      SUBROUTINE SHOWCNTRL(ITEM)
!   SHOW CONTROL PAGE    

      USE WINTERACTER

      USE RESID
      
      USE BLKRM10

      integer ilb(6)
      IF(ITEM .NE. 1) GO TO 400
300   CONTINUE  
305   CONTINUE      
      IF(NCYC .GT. 0  .AND.  DATEND .NE.'                ') THEN
        CALL WMessageBox(YesNo,QuestionIcon,CommonYes, &
                 'Do you wish to set set time steps to zero (YES)'//CHAR(13)// &
        'or delete ending date (NO) ?', 'ENDING DATE AND NUMBER OF TIME STEPS DEFINED')
        IF(WInfoDialog(4) .eq. 1) then
          NCYC=0
        ELSE
          DATEND='                '
        ENDIF
      ENDIF
      call wdialogload(IDD_CONTROLS)
      ierr=infoerror(1)

      CALL WDialogSelect(IDD_CONTROLS)
      ierr=infoerror(1)
      
      CALL WGridPutCellInteger(IDF_GRID5,1,1,IOPTZD)
      CALL WGridPutCellInteger(IDF_GRID5,1,2,NCYC)
      CALL WGridPutCellInteger(IDF_GRID5,1,3,NITI)
      CALL WGridPutCellInteger(IDF_GRID5,1,4,NITN)

      CALL WGridPutCellReal(IDF_GRID3,1,1,ELEV)
      CALL WGridPutCellReal(IDF_GRID3,1,2,ELEV1)
      CALL WGridPutCellReal(IDF_GRID3,1,3,OMEGA1)
      CALL WGridPutCellReal(IDF_GRID3,1,4,CONV(1))
      CALL WGridPutCellReal(IDF_GRID3,1,5,CONV(3))
      CALL WGridPutCellReal(IDF_GRID3,1,6,CONV(4))
      CALL WGridPutCellReal(IDF_GRID3,1,7,CONV(5))
      CALL WGridPutCellReal(IDF_GRID3,1,8,CONV(6))
      CALL WGridPutCellReal(IDF_GRID3,1,9,SALI)
      CALL WGridPutCellReal(IDF_GRID3,1,10,TEMPI)
      CALL WGridPutCellReal(IDF_GRID3,1,11,SEDI)

      call wdialogPutcheckbox(IDF_CHECK1,ITRANSIT)           
      IF(ITRANSIT .EQ. 1) THEN
        CALL WDialogPutReal(IDF_REAL1,TRANSIT)        
      ENDIF          
      
      CALL WGridPutCellReal(IDF_GRID6,1,1,ACT1)
      CALL WGridPutCellReal(IDF_GRID6,1,2,ACT2)
      CALL WGridPutCellReal(IDF_GRID6,1,3,ACT3)
      CALL WGridPutCellReal(IDF_GRID6,1,4,ACT4)

      IF (IDNOPT .EQ. 0) THEN
        call wdialogputRadioButton(idf_radio4)
      ELSEIF (IDNOPT .EQ. -1) THEN
        call wdialogputRadioButton(idf_radio4+1)
      ELSE
        call wdialogputRadioButton(idf_radio4+2)
      ENDIF
      
      
!      CALL WDialogPutInteger(IDF_INTEGER4,INTG(6))
!      IF (IEDSW .EQ. 0) THEN
      
      call wdialogputRadioButton(idf_radio7+IEDSW)
      call wdialogputRadioButton(idf_radio13+NLAYTYP)
      IF(NLAYTYP .EQ. 1) THEN
        CALL WGridPutCellInteger(IDF_GRID7,1,1,NDP)
      ENDIF

      IF(NLAYTYP .GT. 0) THEN
        CALL WGridPutCellReal(IDF_GRID8,1,1,DMIX)
      ENDIF
      
!      ELSE
!        call wdialogputRadioButton(idf_radio7+1)
!      ENDIF
      IF (ICPU .EQ. 0) THEN
        call wdialogputRadioButton(idf_radio1)
      ELSE  
        call wdialogputRadioButton(idf_radio1+1)
      ENDIF
      
      call wdialogputRadioButton(idf_radio10+IPRT)
      
!      CALL WDialogPutInteger(IDF_INTEGER14,INTG(26))
      CALL WDialogPutString(IDF_STRING16,DATEST)
      CALL WDialogPutString(IDF_STRING18,DATEND)

      CALL WDialogShow(-1,-1,0,Modal)

      ierr=infoerror(1)
      do
         IF (WInfoDialog(ExitButton) .EQ. IDF_HELP1) THEN
           IHSW=20
           CALL HELP10(IHSW)
           GO TO 305
         ELSEIF (WInfoDialog(ExitButton) .EQ. IDOK  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART2  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART3  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART4) THEN
!           ITYP=0
!           ORT=0
           
      CALL WGridGetCellInteger(IDF_GRID5,1,1,IOPTZD)
      CALL WGridGetCellInteger(IDF_GRID5,1,2,NCYC)
      CALL WGridGetCellInteger(IDF_GRID5,1,3,NITI)
      CALL WGridGetCellInteger(IDF_GRID5,1,4,NITN)

      CALL WGridGetCellReal(IDF_GRID3,1,1,ELEV)
      CALL WGridGetCellReal(IDF_GRID3,1,2,ELEV1)
      CALL WGridGetCellReal(IDF_GRID3,1,3,OMEGA1)
      CALL WGridGetCellReal(IDF_GRID3,1,4,CONV(1))
      CALL WGridGetCellReal(IDF_GRID3,1,5,CONV(3))
      CALL WGridGetCellReal(IDF_GRID3,1,6,CONV(4))
      CALL WGridGetCellReal(IDF_GRID3,1,7,CONV(5))
      CALL WGridGetCellReal(IDF_GRID3,1,8,CONV(6))
      CALL WGridGetCellReal(IDF_GRID3,1,9,SALI)
      CALL WGridGetCellReal(IDF_GRID3,1,10,TEMPI)
      CALL WGridGetCellReal(IDF_GRID3,1,11,SEDI)

      call wdialogGetcheckbox(IDF_CHECK1,ITRANSIT)           
      IF(ITRANSIT .EQ. 1) THEN
        CALL WDialogGetReal(IDF_REAL1,TRANSIT)        
      ENDIF          

      CALL WGridGetCellReal(IDF_GRID6,1,1,ACT1)
      CALL WGridGetCellReal(IDF_GRID6,1,2,ACT2)
      CALL WGridGetCellReal(IDF_GRID6,1,3,ACT3)
      CALL WGridGetCellReal(IDF_GRID6,1,4,ACT4)
           
           call wdialogGetRadioButton(idf_radio4,IDNOPT)
           IF(IDNOPT .EQ. 1) THEN
             IDNOPT=0     
           ELSEIF(IDNOPT .EQ. 2) THEN
             IDNOPT=-1
           ELSE
             IDNOPT=-2

           ENDIF
           
           call wdialogGetRadioButton(idf_radio7,IEDSW)
           IF(IEDSW .EQ. 1) THEN
             IEDSW=0     
           ELSEIF(IEDSW .EQ. 2) THEN
             IEDSW=1
           ELSE
             IEDSW=2
           ENDIF

           call wdialogGetRadioButton(idf_radio10,IPRT)
           IPRT=IPRT-1
!           CALL WDialogGetInteger(IDF_INTEGER10,INTG(17))
           call wdialogGetRadioButton(idf_radio1,ICPU)
           IF(ICPU .EQ. 1) THEN
             ICPU= 0
           ELSE
             ICPU=5
           ENDIF

           call wdialogGetRadioButton(idf_radio13,NLAYTYP)
           NLAYTYP=NLAYTYP-1
           IF(NLAYTYP .EQ. 1) THEN
             CALL WGridGetCellInteger(IDF_GRID7,1,1,NDP)
           ENDIF

           IF(NLAYTYP .GT. 0) THEN
             CALL WGridGetCellReal(IDF_GRID8,1,1,DMIX)
           ENDIF
           IF(NLAYTYP .EQ. 4) L3DTYP=3
           IF(NLAYTYP .EQ. 3) L3DTYP=2
           IF(NLAYTYP .EQ. 2) L3DTYP=1
           
!           CALL WDialogGetInteger(IDF_INTEGER14,INTG(26))

           CALL WDialogGetString(IDF_STRING16,DATEST)
           CALL WDialogGetString(IDF_STRING18,DATEND)
                
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART2) GO TO 405
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART3) GO TO 505
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART4) GO TO 705
             
           RETURN
         ELSEIF (WInfoDialog(ExitButton) .EQ. IDCANCEL) THEN
           return
         ENDIF
      enddo
      
      RETURN
      
!  *******************************************************************************      
      
400   CONTINUE  
      IF(ITEM .NE. 2) GO TO 500
405   CONTINUE
      call wdialogload(IDD_CONTROLS2A)
      ierr=infoerror(1)

      CALL WDialogSelect(IDD_CONTROL2SA)
      ierr=infoerror(1)

      NN=0
      do k=1,1000
         IF(ITYP(K) .GT. 0) THEN 
!        IF(ORT(K,1) .NE. 0.  .AND.  ORT(K,1) .GT. -900.) THEN
          NN=NN+1
          CALL WGridPutCellInteger(IDF_GRID1,1,NN,ITYP(K))
          CALL WGridPutCellReal(IDF_GRID1,2,NN,ORT(K,1))
          CALL WGridPutCellReal(IDF_GRID1,3,NN,ORT(K,6))
          CALL WGridPutCellReal(IDF_GRID1,4,NN,ORT(K,8))
          CALL WGridPutCellReal(IDF_GRID1,5,NN,ORT(K,10))
          CALL WGridPutCellReal(IDF_GRID1,6,NN,ORT(K,5))
          CALL WGridPutCellReal(IDF_GRID1,7,NN,ORT(K,12))
          CALL WGridPutCellReal(IDF_GRID1,8,NN,ORT(K,11))
          CALL WGridPutCellReal(IDF_GRID1,9,NN,ORT(K,13))
        ENDIF
      ENDDO

      DO K=1,L3DCNT
        CALL WGridPutCellInteger(IDF_GRID6,1,K,JND(K))
        CALL WGridPutCellInteger(IDF_GRID6,2,K,KKLAY(K))
        DO KK=1,KKLAY(K)
          CALL WGridPutCellReal(IDF_GRID6,KK+2,K,L3DDAT(K,KK))
        ENDDO
      ENDDO
        
      CALL WDialogShow(-1,-1,0,Modal)

      ierr=infoerror(1)
      do
         IF (WInfoDialog(ExitButton) .EQ. IDF_HELP1) THEN
           IHSW=21
           CALL HELP10(IHSW)
           GO TO 300
         ELSEIF (WInfoDialog(ExitButton) .EQ. IDOK  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART1  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART3  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART4) THEN
           NMAT=0
           NN=0
           DO K=1,1000
            CALL WGridGetCellInteger(IDF_GRID1,1,K,ITYP(K))
              
            IF(ITYP(K) .LE. 0) THEN
              CYCLE
            ELSE 
              IF(ITYP(K) .GT. NMAT) NMAT=ITYP(K)
            ENDIF
            CALL WGridGetCellReal(IDF_GRID1,2,K,ORT(K,1))
            CALL WGridGetCellReal(IDF_GRID1,3,K,ORT(K,6))
            CALL WGridGetCellReal(IDF_GRID1,4,K,ORT(K,8))
            CALL WGridGetCellReal(IDF_GRID1,5,K,ORT(K,10))
            CALL WGridGetCellReal(IDF_GRID1,6,K,ORT(K,5))
            CALL WGridGetCellReal(IDF_GRID1,7,K,ORT(K,12))
            CALL WGridGetCellReal(IDF_GRID1,8,K,ORT(K,11))
            CALL WGridGetCellReal(IDF_GRID1,9,K,ORT(K,13))
          ENDDO   
             
          DO K=1,1000
            CALL WGridGetCellInteger(IDF_GRID6,1,K,JND(K))
            IF(JND(K) .LT. 0) THEN
              L3DCNT=K-1
              EXIT
            ENDIF
            CALL WGridGetCellInteger(IDF_GRID6,2,K,KKLAY(K))
            DO KK=1,KKLAY(K)
              CALL WGridGetCellReal(IDF_GRID6,KK+2,K,L3DDAT(K,KK))
            ENDDO
          ENDDO
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART1) GO TO 305
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART3) GO TO 505
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART4) GO TO 705
             
           RETURN
         ELSEIF (WInfoDialog(ExitButton) .EQ. IDCANCEL) THEN
           return
         ENDIF
      enddo
      
      RETURN
      
!   ************************************************************************************      
      
500 IF(ITEM .NE. 3) GO TO 705
505 CONTINUE    

      call wdialogload(IDD_CONTROLS2)
      ierr=infoerror(1)

      CALL WDialogSelect(IDD_CONTROLS2)
      ierr=infoerror(1)

      CALL WGridPutCellReal(IDF_GRID3,1,1,TBFACT)
      CALL WGridPutCellReal(IDF_GRID3,1,2,TBMIN)
      CALL WGridPutCellReal(IDF_GRID3,1,3,UNOM)
      CALL WGridPutCellReal(IDF_GRID3,1,4,UDIR)
      CALL WGridPutCellReal(IDF_GRID3,1,5,UINP)
      CALL WGridPutCellReal(IDF_GRID3,1,6,VINP)
      
      CALL WGridPutCellReal(IDF_GRID7,1,1,VMIN)
      CALL WGridPutCellReal(IDF_GRID7,1,2,POWER)
      CALL WGridPutCellReal(IDF_GRID7,1,3,UMIN)
      CALL WGridPutCellReal(IDF_GRID7,1,4,PWERIN)
      CALL WGridPutCellReal(IDF_GRID7,1,5,CMIN)
      CALL WGridPutCellReal(IDF_GRID7,1,6,CPR)
      CALL WGridPutCellReal(IDF_GRID7,1,7,PRCNT)
      
      CALL WGridPutCellInteger(IDF_GRID6,1,1,IPROJ)
      CALL WGridPutCellInteger(IDF_GRID6,1,2,ID1DND)
      CALL WGridPutCellInteger(IDF_GRID6,1,3,NPRTF)
      CALL WGridPutCellInteger(IDF_GRID6,1,4,NPRTI)
      CALL WGridPutCellInteger(IDF_GRID6,1,5,IRSAV)
     
      CALL WGridPutCellInteger(IDF_GRID6,1,6,IOUTFREQ)
      CALL WGridPutCellInteger(IDF_GRID6,1,7,IOUTRST)
      CALL WGridPutCellInteger(IDF_GRID6,1,8,IREWMES)
      CALL WGridPutCellInteger(IDF_GRID6,1,9,IREWOUT)
      CALL WGridPutCellInteger(IDF_GRID6,1,10,IDSWT)
      CALL WGridPutCellInteger(IDF_GRID6,1,11,ISAVITR)
      CALL WGridPutCellInteger(IDF_GRID6,1,12,IVERTDEN)
      CALL WGridPutCellInteger(IDF_GRID6,1,13,IFXBC)
      
      IF(IEQSWT .EQ. 0) IEQSWT=20000
      CALL WGridPutCellInteger(IDF_GRID6,1,14,IEQSWT)

      IF(JSPLPT .GT. 0) THEN
        DO KK=1,5    
          IF(JSPLPT .LT. KK) EXIT  
          CALL WGridPutCellInteger(IDF_GRID4,1,KK,NSPLPT(KK))
          IF(JSPLPT .GT. 5  .AND.  KK+5 .LE. JSPLPT) THEN
            CALL WGridPutCellInteger(IDF_GRID4,2,KK,NSPLPT(KK+5))
          ENDIF  
        ENDDO
      ENDIF  
      call wdialogPutcheckbox(IDF_CHECK1,IGRV)           
      call wdialogPutcheckbox(IDF_CHECK2,IOV)           
      call wdialogPutcheckbox(IDF_CHECK3,INTG(16))           
      call wdialogPutcheckbox(IDF_CHECK12,IOOC)    
      
      call wdialogPutcheckbox(IDF_CHECK7,IZB)           
      call wdialogPutcheckbox(IDF_CHECK11,IZERS)           
      call wdialogPutcheckbox(IDF_CHECK8,IPASS1)           
      call wdialogPutcheckbox(IDF_CHECK9,IPASS2)    
      call wdialogPutcheckbox(IDF_CHECK10,IPASS3)           
      
      do kk=1,6
        if(iccomp(kk) .eq.  1) THEN
          call wdialogPutcheckbox(IDF_CHECK4,1)  
        endif
        if(iccomp(kk) .eq. 2) THEN
          call wdialogPutcheckbox(IDF_CHECK5,1)           
        endif
        if(iccomp(kk) .eq. 3) THEN
          call wdialogPutcheckbox(IDF_CHECK6,1)           
        endif
        if(iccomp(kk) .eq. 4) THEN
          call wdialogPutcheckbox(IDF_CHECK13,1)  
        endif
        if(iccomp(kk) .eq. 5) THEN
          call wdialogPutcheckbox(IDF_CHECK14,1)           
        endif
        if(iccomp(kk) .eq. 6) THEN
          call wdialogPutcheckbox(IDF_CHECK15,1)           
        endif
      enddo

      DO KK=1,ICTOTC
        CALL WGridPutCellInteger(IDF_CCLINE,1,KK,NCSPLPT(KK))
      ENDDO      
      
      CALL WDialogShow(-1,-1,0,Modal)

      ierr=infoerror(1)
      do
      
         IF (WInfoDialog(ExitButton) .EQ. IDF_HELP1) THEN
           IHSW=22
           CALL HELP10(IHSW)
           GO TO 505
         ELSEIF (WInfoDialog(ExitButton) .EQ. IDOK  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART1  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART2  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART4) THEN


           CALL WGridGetCellReal(IDF_GRID3,1,1,TBFACT)
           CALL WGridGetCellReal(IDF_GRID3,1,2,TBMIN)
           CALL WGridGetCellReal(IDF_GRID3,1,3,UNOM)
           CALL WGridGetCellReal(IDF_GRID3,1,4,UDIR)
           CALL WGridGetCellReal(IDF_GRID3,1,5,UINP)
           CALL WGridGetCellReal(IDF_GRID3,1,6,VINP)
      
      
           CALL WGridGetCellReal(IDF_GRID7,1,1,VMIN)
           CALL WGridGetCellReal(IDF_GRID7,1,2,POWER)
           CALL WGridGetCellReal(IDF_GRID7,1,3,UMIN)
           CALL WGridGetCellReal(IDF_GRID7,1,4,PWERIN)
           CALL WGridGetCellReal(IDF_GRID7,1,5,CMIN)
           CALL WGridGetCellReal(IDF_GRID7,1,6,CPR)
           CALL WGridGetCellReal(IDF_GRID7,1,7,PRCNT)
      
           CALL WGridGetCellInteger(IDF_GRID6,1,1,IPROJ)
           CALL WGridGetCellInteger(IDF_GRID6,1,2,ID1DND)
           CALL WGridGetCellInteger(IDF_GRID6,1,3,NPRTF)
           CALL WGridGetCellInteger(IDF_GRID6,1,4,NPRTI)
           CALL WGridGetCellInteger(IDF_GRID6,1,5,IRSAV)
     
           CALL WGridGetCellInteger(IDF_GRID6,1,6,IOUTFREQ)
           CALL WGridGetCellInteger(IDF_GRID6,1,7,IOUTRST)
           CALL WGridGetCellInteger(IDF_GRID6,1,8,IREWMES)
           CALL WGridGetCellInteger(IDF_GRID6,1,9,IREWOUT)
           CALL WGridGetCellInteger(IDF_GRID6,1,10,IDSWT)
           CALL WGridGetCellInteger(IDF_GRID6,1,11,ISAVITR)
           CALL WGridGetCellInteger(IDF_GRID6,1,12,IVERTDEN)
           CALL WGridGetCellInteger(IDF_GRID6,1,13,IFXBC)
           CALL WGridGetCellInteger(IDF_GRID6,1,14,IEQSWT)
           IF(IEQSWT .EQ. 0) IEQSWT=20000

           DO KK=1,10
             LL=1  
             KL=KK
             IF(KK .GT. 5) THEN
               KL=KK-5
               LL=2  
             ENDIF  
             CALL WGridGetCellInteger(IDF_GRID4,LL,KL,NSPLPT(KK)) 
             IF(NSPLPT(KK) .LE. 0) THEN
               JSPLPT=KK-1
               EXIT
             ENDIF  
           ENDDO

           
           call wdialogGetcheckbox(IDF_CHECK1,IGRV)           
           call wdialogGetcheckbox(IDF_CHECK2,IOV)           
           call wdialogGetcheckbox(IDF_CHECK3,INTG(16))           
           call wdialogGetcheckbox(IDF_CHECK12,IOOC)           
           
           call wdialogGetcheckbox(IDF_CHECK7,IZB)           
           call wdialogGetcheckbox(IDF_CHECK11,IZERS)           
           call wdialogGetcheckbox(IDF_CHECK8,IPASS1)           
           call wdialogGetcheckbox(IDF_CHECK9,IPASS2)    
           call wdialogGetcheckbox(IDF_CHECK10,IPASS3)           
           
          call wdialogGetcheckbox(IDF_CHECK4,ILB(1))           
          call wdialogGetcheckbox(IDF_CHECK5,ILB(2))           
          call wdialogGetcheckbox(IDF_CHECK6,ILB(3))
          call wdialogGetcheckbox(IDF_CHECK13,ILB(4))           
          call wdialogGetcheckbox(IDF_CHECK14,ILB(5))           
          call wdialogGetcheckbox(IDF_CHECK15,ILB(6))
          if(ilb(1) .eq. 1) then
            iccomp(1) =1
          else
            iccomp(1) =0
          endif
          if(ilb(2) .eq. 1) then
            iccomp(2) =2
          else
            iccomp(2) =0
          endif
          if(ilb(3) .eq. 1) then
            iccomp(3) =3
          else
            iccomp(3) =0
          endif
          if(ilb(4) .eq. 1) then
            iccomp(4) =4
          else
            iccomp(4) =0
          endif
          if(ilb(5) .eq. 1) then
            iccomp(5) =5
          else
            iccomp(5) =0
          endif
          if(ilb(6) .eq. 1) then
            iccomp(6) =6
          else
            iccomp(6) =0
          endif
        

          DO KK=1,30
            CALL WGridGetCellInteger(IDF_CCLINE,1,KK,NCSPLPT(KK))
            IF(NCSPLPT(KK) .LE. 0) THEN
              ICTOTC=KK-1
              EXIT
            ENDIF
          ENDDO

           IF (WInfoDialog(ExitButton) .EQ. IDF_PART1) GO TO 305
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART2) GO TO 405
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART4) GO TO 705
          RETURN
        ELSE
          RETURN
        ENDIF
      ENDDO
      RETURN

! ******************************************************************* 
705   call wdialogload(IDD_MISC)

      ierr=infoerror(1)

      CALL WDialogSelect(IDD_MISC)
      ierr=infoerror(1)
      
      CALL WDialogPutInteger(IDF_INTEGER1,INTG(18))
      CALL WDialogPutInteger(IDF_INTEGER2,INTG(19))
      CALL WDialogPutInteger(IDF_INTEGER3,INTG(20))

      call wdialogPutcheckbox(IDF_CHECK1,INTG(21))           
      
      CALL WDialogPutReal(IDF_REAL1,RLDAT(12))
      CALL WDialogPutReal(IDF_REAL2,RLDAT(13))
      CALL WDialogPutReal(IDF_REAL3,RLDAT(14))
      CALL WDialogPutReal(IDF_REAL4,RLDAT(15))
      CALL WDialogPutReal(IDF_REAL5,RLDAT(16))
      CALL WDialogPutReal(IDF_REAL7,RLDAT(18))


          DO KK=1,20
            IF(MARSTYP(KK) .EQ. 0) CYCLE
            CALL WGridPutCellInteger(IDF_GRID2,1,KK,MARSTYP(KK))
            CALL WGridPutCellReal(IDF_GRID2,2,KK,RMARSTYP(KK,1))
            CALL WGridPutCellReal(IDF_GRID2,3,KK,RMARSTYP(KK,2))
            CALL WGridPutCellReal(IDF_GRID2,4,KK,RMARSTYP(KK,3))
            CALL WGridPutCellReal(IDF_GRID2,5,KK,RMARSTYP(KK,4))
          ENDDO          
      
      
      CALL WDialogShow(-1,-1,0,Modal)

      ierr=infoerror(1)
      do
         IF (WInfoDialog(ExitButton) .EQ. IDF_HELP1) THEN
           IHSW=23
           CALL HELP10(IHSW)
           GO TO 705
         ELSEIF (WInfoDialog(ExitButton) .EQ. IDOK  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART1  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART2  .OR.  WInfoDialog(ExitButton) .EQ. IDF_PART3) THEN

          CALL WDialogGetInteger(IDF_INTEGER1,INTG(18))
          CALL WDialogGetInteger(IDF_INTEGER2,INTG(19))
          CALL WDialogGetInteger(IDF_INTEGER3,INTG(20))

          call wdialogGetcheckbox(IDF_CHECK1,INTG(21))           
      
          CALL WDialogGetReal(IDF_REAL1,RLDAT(12))
          CALL WDialogGetReal(IDF_REAL2,RLDAT(13))
          CALL WDialogGetReal(IDF_REAL3,RLDAT(14))
          CALL WDialogGetReal(IDF_REAL4,RLDAT(15))
          CALL WDialogGetReal(IDF_REAL5,RLDAT(16))
          CALL WDialogGetReal(IDF_REAL7,RLDAT(18))


          DO KK=1,20
            CALL WGridGetCellInteger(IDF_GRID2,1,KK,MARSTYP(KK))
            IF(MARSTYP(KK) .LE. 0) CYCLE
            CALL WGridGetCellReal(IDF_GRID2,2,KK,RMARSTYP(KK,1))
            CALL WGridGetCellReal(IDF_GRID2,3,KK,RMARSTYP(KK,2))
            CALL WGridGetCellReal(IDF_GRID2,4,KK,RMARSTYP(KK,3))
            CALL WGridGetCellReal(IDF_GRID2,5,KK,RMARSTYP(KK,4))
            NMARSTYP=KK
          ENDDO          
          
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART1) GO TO 305
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART2) GO TO 405
           IF (WInfoDialog(ExitButton) .EQ. IDF_PART3) GO TO 505
          RETURN
        ELSE
          RETURN
        ENDIF
      ENDDO
      RETURN
      END 
    
      SUBROUTINE DEFAULTCN
      USE BLKRM10
      
      
      DO L=1,72
        TITLEHEAD(L:L)=' '
        DO K=1,43
          FNAME(K)(L:L)=' '
        ENDDO
        
      ENDDO
      FNAME(1)='MESH.GEO'
      FNAME(12)='RESULTS.OUT'
      FNAME(13)='BRESULTS.RMA'
      DATEST='01/01/2019 00.00'
	  DATEND='                '
	  DATENDST='31/01/2019 12.00'
      
!      MFWW=1000
      LIMITVAL(1)=1000
      LIMITDFT(1)=1000
!     NBSS=5000000
      LIMITVAL(2)=5000000
      LIMITDFT(2)=5000000
!     MAXLAY=10
      LIMITVAL(3)=10
      LIMITDFT(3)=10
!     MCRS=1000
      LIMITVAL(4)=1000
      LIMITDFT(4)=1000
!     MPTS=50
      LIMITVAL(5)=50
      LIMITDFT(5)=50
!     NQLDS=20
      LIMITVAL(6)=20
      LIMITDFT(6)=20
!     NHDS=20
      LIMITVAL(7)=20
      LIMITDFT(7)=20
!     NELDS=50
      LIMITVAL(8)=50
      LIMITDFT(8)=50

!   IPRT
      IDEFLT(3)=1
      INTG(3)=1
!   NITI
	  IDEFLT(4)=10
      INTG(4)=10
!   NITN      
	  IDEFLT(5)=10
      INTG(5)=10
!   IDNOPT
      IDEFLT(6)=0
      INTG(6)=0
!   IPROJ
      IDEFLT(7)=1
      INTG(7)=1
!   ITSI
      IDEFLT(8)=-12
      INTG(8)=-12
!   ID1DND
      IDEFLT(9)=1
      INTG(9)=1
!   IRSTMES
      IDEFLT(10)=0
      INTG(10)=0
!   NCYC
      IDEFLT(11)=0
      INTG(11)=0
!   JRED
      IDEFLT(12)=0
      INTG(12)=0
!   JHOLD
      IDEFLT(13)=4
      INTG(13)=4
!   IGRAV
      IDEFLT(14)=1
      INTG(14)=1
!   IOV
      IDEFLT(15)=0
      INTG(15)=0
!   IINIT
      IDEFLT(16)=0
      INTG(16)=0
!   EDDYTYPE   IEDSW
      IDEFLT(17)=1
      INTG(17)=1
!   LI   DRY NODE FREQUENCY
      IDEFLT(18)=0
      INTG(18)=0
!   IHOE   HIGHER ORDER INTEGRATION
      IDEFLT(19)=0
      INTG(19)=0
!   I9NOD   9 NODE ELEMENTS
      IDEFLT(20)=0
      INTG(20)=0
!   ISTDRST   RESTART FILE PER STEP
      IDEFLT(21)=0
      INTG(21)=0
!   ISAVSTRT  START BINARY FILE
      IDEFLT(22)=1
      INTG(22)=1
!   ISAVFRQ   FREQUENCY OF BINRAY FILE
      IDEFLT(23)=1
      INTG(23)=1
!   IRSTFRQ   FREQUENCY OF RESTART FILE
      IDEFLT(24)=1
      INTG(24)=1
!   NUMRST   NUMBER OF RESTART FILES
      IDEFLT(25)=0
      INTG(25)=0
!   ICPU      SOLVER TYPE          
      IDEFLT(26)=5
      INTG(26)=5
!   IDAYINTP   Day interval for saving of binary results
      IDEFLT(27)=0
      INTG(27)=0
      
      
	  NMAT=1
      
!	  ELEV=0.
      RDEFLT(1)=0.
      RLDAT(1)=0
      
!	  OMEGA=0.
      RDEFLT(2)=0.
      RLDAT(2)=0
      
!	  CONVX=0.01
      RDEFLT(3)=0.01
      RLDAT(3)=0.01
      
!	  CONVH=0.001
      RDEFLT(4)=0.001
      RLDAT(4)=0.001

!      ACT1=2.
      RDEFLT(5)=2.
      RLDAT(5)=2.

!      ACT2=0.25
      RDEFLT(6)=0.25
      RLDAT(6)=0.25
      
!	  ACT3=0.01
      RDEFLT(7)=0.01
      RLDAT(7)=0.01
      
!	  ACT4=0.0
      RDEFLT(8)=0.0
      RLDAT(8)=0.0

!	  tbfact=0.2
      RDEFLT(9)=0.2
      RLDAT(9)=0.2

!	  tbmin-1.0
      RDEFLT(10)=1.0
      RLDAT(10)=1.0

!	  TOLERAN=10.
      RDEFLT(11)=10.0
      RLDAT(11)=10.0

!	  X-SCALE=0.
      RDEFLT(12)=1.0
      RLDAT(12)=1.0

!	  Y-SCALE=0.
      RDEFLT(13)=1.0
      RLDAT(13)=1.0

!	  Z-SCALE=0.
      RDEFLT(14)=1.0
      RLDAT(14)=1.0

!	  DSET=0.
      RDEFLT(15)=0.0
      RLDAT(15)=0.0

!	  DSETD=0.
      RDEFLT(16)=0.0
      RLDAT(16)=0.0

!	  UNOM=0.25
      RDEFLT(17)=0.25
      RLDAT(17)=0.25

!	  HMIN=0.
      RDEFLT(18)=0.0
      RLDAT(18)=0.0
      
!	  FHOURINTP=0.
      RDEFLT(19)=0.0
      RLDAT(19)=0.0
      
!	  DPCUTOF1=0.
      RDEFLT(20)=0.0
      RLDAT(20)=0.0
      
!	  DPCUTOF2=0.
      RDEFLT(21)=0.0
      RLDAT(21)=0.0
      
      
      
      ITYP=0
      ORT=0.
      !DO K=1,1000
      !  ITYP(K)=0
      !  ORT(K,1)=-0.2
      !  ORT(K,5)=0.02
      !  ORT(K,7)=10.
      !  ORTDFLT(K,1)=-0.2
      !  ORTDFLT(K,5)=0.02
      !  ORTDFLT(K,7)=10.
      !ENDDO
      !ITYP(1)=1

      DELTM=0.
      DELTH=0.
      DELTM(2)=15.
      JT=2
      IQLIN=0
      IQLIN(1,1)=1
      IQLIN(1,2)=1
      QLIN=0.
      QLIN(1,1)=50.
      QLIN(1,2)=50.
      iqlin1=0
      IQLIN1(1,1)=1
      IQLIN1(1,2)=1
      QDLIN=-9999.
      QDLIN(1,1)=0.00
      QDLIN(1,2)=0.00
      IHLIN=0
      IHLIN(1,1)=2
      IHLIN(1,2)=2
      HLIN=-9999.
      HLIN(1,1)=0.
      HLIN(1,2)=0.
      HLIN1=-9999.
      IELIN=0
      NQLIN=0
      NQLIN(1)=1
      NQLIN(2)=1
      NHLIN=0
      NHLIN(1)=1
      NHLIN(2)=1
      NELIN=0
      ELIN=0.
      ELIN(1,1)=6.
      ELIN(1,2)=6.
      QCKLIN=0
      HCKLIN=0
      ECKLIN=0
      ECKLIN1=0
      ECKLIN1(1,1)=1
      ECKLIN1(1,2)=1
      ECKLIN2=0
      IETP=0
      IETP(1,1)=1
      IETP(1,2)=1
      IELIN=0
      IELIN(1,1)=5
      IELIN(1,2)=5
      ISFLIN=0
      NSFLIN=0
      SFLIN=0
      SFLIN1=0.
      SFLIN2=0.
      SFLIN3=0.
      SFLIN4=0.
      IFCLIN=-999
      IFCLIN1=0
      NFCLIN=0
      FCLIN1=0.
      FCLIN2=0.
      FCLIN3=0.
      FCLIN4=0.
      FCLIN5=0.
      FCLIN6=0.

      WVEL=0.
      WDIR=0.
      IWIND=0
      IWUNITS=0

      ICFLOWS=0
      ICELEV=0
      ICDEP=0
      
      WDT=0.
      IWTYP=0
      NWR=0
      ICTOTC=0
      ICPLIN=0
      
      IGATE=0
      JGATE=0
      RETURN
      END
    
