      SUBROUTINE GETLAYDAT(NLAY,ipos,rlay)

      use winteracter

      implicit none

      include 'D.inc'

!
! Declare window-type and message variables
!
      TYPE(WIN_STYLE)    :: WINDOW

      TYPE(WIN_MESSAGE) :: MESSAGE
      INTEGER           :: IPOS,NLAY,I
      INTEGER           :: JNK,ierr
      REAL              :: rlay(9)

      call wdialogload(IDD_LAY)
      ierr=infoerror(1)


      IF(IPOS .EQ. 1) THEN
        call wdialogputRadioButton(idf_radio1)
	  ELSE
        call wdialogputRadioButton(idf_radio2)
      ENDIF
      CALL WDialogPutINTEGER(IDF_INTEGER1,NLAY)
       do i=1,7
         CALL WGridPutCellReal(IDF_GRID1,i,1,rlay(i))
       enddo


      CALL WDialogSelect(IDD_LAY)
      ierr=infoerror(1)
 
      CALL WDialogShow(-1,-1,0,Modal)
      ierr=infoerror(1)
      

      do
         IF (WInfoDialog(ExitButton) .EQ. IDOK) THEN

           call wdialoggetradiobutton(idf_radio1,ipos)

           CALL WDialogGetINTEGER(IDF_INTEGER1,NLAY)
           do i=1,7
             CALL WGridGetCellReal(IDF_GRID1,i,1,rlay(i))
           enddo
           return
         ELSEIF (WInfoDialog(ExitButton) .EQ. IDCANCEL) THEN
		   RETURN
         endif
!IPK SEP02
  	     return
      enddo
      RETURN
      END                                           
