        SUBROUTINE GLASSFRESH(J)
!        USE WINTERACTER
        IMPLICIT NONE
        INTEGER J,FNDLIST,CATLIST
        CHARACTER CURNAME*13
        COMMON/NAMECUR/CURNAME
        INCLUDE 'RESOURCE.INC'
        INCLUDE 'DATLEN.INC'
        INCLUDE 'DATMAC.INC'
        INCLUDE 'DATMAI.INC'
!        CALL WDIALOGSELECT(IDD_EDGLASS)
C
!        CALL WDIALOGPUTINTEGER(IDF_SURFNUM,J)
C
        INCLUDE 'NOTMODEL.INC'
        INCLUDE 'NOTMYGLASS.INC'
        INCLUDE 'NOTCAT.INC'
        INCLUDE 'NOTUSER.INC'
C
C       IF CURRENT GLASS IS AIR
        IF(GLANAM(J,1).EQ.'AIR'.OR.GLANAM(J,2).EQ.'AIR') THEN
!        CALL WDIALOGFIELDSTATE(IDF_TYPE1,2)
!        CALL WDIALOGPUTRADIOBUTTON(IDF_TYPE1)
                        ELSE
!        CALL WDIALOGFIELDSTATE(IDF_TYPE1,0)
!        CALL WDIALOGCLEARFIELD(IDF_TYPE1)
                        END IF
C       IF CURRENT GLASS IS REFL
        IF(GLANAM(J,1).EQ.'REFL'.OR.GLANAM(J,2).EQ.'REFL') THEN
!        CALL WDIALOGPUTRADIOBUTTON(IDF_TYPE2)
!        CALL WDIALOGFIELDSTATE(IDF_TYPE2,2)
                        ELSE
!        CALL WDIALOGCLEARFIELD(IDF_TYPE2)
!        CALL WDIALOGFIELDSTATE(IDF_TYPE2,0)
                        END IF
C       IF CURRENT GLASS IS REFLTIRO
        IF(GLANAM(J,1).EQ.'REFLTIRO'.OR.GLANAM(J,2).EQ.'REFLTIRO') THEN
!        CALL WDIALOGPUTRADIOBUTTON(IDF_TYPE3)
!        CALL WDIALOGFIELDSTATE(IDF_TYPE3,2)
                        ELSE
!        CALL WDIALOGCLEARFIELD(IDF_TYPE3)
!        CALL WDIALOGFIELDSTATE(IDF_TYPE3,0)
                        END IF
C       IF CURRENT GLASS IS REFLTIR
        IF(GLANAM(J,1).EQ.'REFLTIR'.OR.GLANAM(J,2).EQ.'REFLTIR') THEN
!        CALL WDIALOGPUTRADIOBUTTON(IDF_TYPE4)
!        CALL WDIALOGFIELDSTATE(IDF_TYPE4,2)
                        ELSE
!        CALL WDIALOGCLEARFIELD(IDF_TYPE4)
!        CALL WDIALOGFIELDSTATE(IDF_TYPE4,0)
                        END IF
C
C       IF CURRENT GLASS IS MODEL, MAKE GLASS DIALOGS ACTIVE
C       AND LOAD VALUES
        IF(GLANAM(J,1).EQ.'MODEL') THEN
!        CALL WDIALOGFIELDSTATE(IDF_MODNAME,1)
!        CALL WDIALOGFIELDSTATE(IDF_ND,1)
!        CALL WDIALOGFIELDSTATE(IDF_VD,1)
!        CALL WDIALOGFIELDSTATE(IDF_DPART,1)
!        CALL WDIALOGPUTSTRING(IDF_MODNAME,CURNAME)
!        CALL WDIALOGPUTDOUBLE(IDF_ND,ALENS(86,J))
!        CALL WDIALOGPUTDOUBLE(IDF_VD,ALENS(87,J))
!        CALL WDIALOGPUTDOUBLE(IDF_DPART,ALENS(89,J))
        CALL FGLASSLOAD(FNDLIST,J)
!        CALL WDialogPutMenu(IDF_FINDGLASS,FNDARRAY,FNDLIST,1)
!        CALL WDIALOGFIELDSTATE(IDF_FINDGLASS,1)
!        CALL WDIALOGFIELDSTATE(IDF_MODTOCAT,1)
!        CALL WDIALOGFIELDSTATE(IDF_MODELOK,1)
                        ELSE
!        CALL WDIALOGFIELDSTATE(IDF_MODNAME,0)
!        CALL WDIALOGFIELDSTATE(IDF_ND,0)
!        CALL WDIALOGFIELDSTATE(IDF_VD,0)
!        CALL WDIALOGFIELDSTATE(IDF_DPART,0)
!        CALL WDIALOGCLEARFIELD(IDF_MODNAME)
!        CALL WDIALOGCLEARFIELD(IDF_ND)
!        CALL WDIALOGCLEARFIELD(IDF_VD)
!        CALL WDIALOGCLEARFIELD(IDF_DPART)
!        CALL WDIALOGCLEARFIELD(IDF_FINDGLASS)
!        CALL WDIALOGFIELDSTATE(IDF_MODELOK,0)
                        END IF
C
C       IF CURRENT GLASS IS SCHOTT,OHARA,HOYA,CORNIN
C       CHANCE,RUSSIAN,HIKARI,MATL,SCH2000
        IF(GLANAM(J,1).EQ.'SCHOTT'.OR.GLANAM(J,1).EQ.'OHARA'
     1  .OR.GLANAM(J,1).EQ.'HOYA'.OR.GLANAM(J,1).EQ.'CHANCE'
     1  .OR.GLANAM(J,1).EQ.'CORNIN'.OR.GLANAM(J,1).EQ.'RUSSIAN'
     1  .OR.GLANAM(J,1).EQ.'HIKARI'.OR.GLANAM(J,1).EQ.'RADHARD'
     1  .OR.GLANAM(J,1).EQ.'MATL'
     1  .OR.GLANAM(J,1).EQ.'SCH2000') THEN
!        CALL WDIALOGFIELDSTATE(IDF_CURGLASS,2)
!        CALL WDIALOGPUTSTRING(IDF_CURGLASS,GLANAM(J,1)//' '
!     1  //GLANAM(J,2))
        CALL GCATLOAD(CATLIST)
!        CALL WDialogPutMenu(IDF_CATMENU,CATARRAY,CATLIST,1)
!        CALL WDIALOGFIELDSTATE(IDF_CATMENU,1)
!        CALL WDIALOGFIELDSTATE(IDF_CATTOMOD,1)
!        CALL WDIALOGFIELDSTATE(IDF_CHGGLASS,1)
                        ELSE
!        CALL WDIALOGFIELDSTATE(IDF_CURGLASS,0)
!        CALL WDIALOGFIELDSTATE(IDF_CHGGLASS,0)
!        CALL WDIALOGFIELDSTATE(IDF_CATMENU,0)
!        CALL WDIALOGCLEARFIELD(IDF_CURGLASS)
!        CALL WDIALOGCLEARFIELD(IDF_CATMENU)
                        END IF
C
C       IF CURRENT GLASS IS GLASS, MAKE GLASS DIALOGS ACTIVE
C       AND LOAD VALUES
        IF(GLANAM(J,1).EQ.'GLA') THEN
!        CALL WDIALOGFIELDSTATE(IDF_MYNAME,1)
!        CALL WDIALOGFIELDSTATE(IDF_N1,0)
!        CALL WDIALOGFIELDSTATE(IDF_N2,0)
!        CALL WDIALOGFIELDSTATE(IDF_N3,0)
!        CALL WDIALOGFIELDSTATE(IDF_N4,0)
!        CALL WDIALOGFIELDSTATE(IDF_N5,0)
!        CALL WDIALOGFIELDSTATE(IDF_N6,0)
!        CALL WDIALOGFIELDSTATE(IDF_N7,0)
!        CALL WDIALOGFIELDSTATE(IDF_N8,0)
!        CALL WDIALOGFIELDSTATE(IDF_N9,0)
!        CALL WDIALOGFIELDSTATE(IDF_N10,0)
!        CALL WDIALOGPUTSTRING(IDF_MYNAME,GLANAM(J,2))
!        CALL WDIALOGPUTDOUBLE(IDF_N1,ALENS(46,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N2,ALENS(47,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N3,ALENS(48,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N4,ALENS(49,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N5,ALENS(50,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N6,ALENS(71,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N7,ALENS(72,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N8,ALENS(73,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N9,ALENS(74,J))
!        CALL WDIALOGPUTDOUBLE(IDF_N10,ALENS(75,J))
!        IF(SYSTEM1(1).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N1,1)
!        IF(SYSTEM1(2).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N2,1)
!        IF(SYSTEM1(3).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N3,1)
!        IF(SYSTEM1(4).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N4,1)
!        IF(SYSTEM1(5).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N5,1)
!        IF(SYSTEM1(71).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N6,1)
!        IF(SYSTEM1(72).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N7,1)
!        IF(SYSTEM1(73).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N8,1)
!        IF(SYSTEM1(73).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N9,1)
!        IF(SYSTEM1(75).NE.0.0D0)
!     1  CALL WDIALOGFIELDSTATE(IDF_N10,1)
!        CALL WDIALOGFIELDSTATE(IDF_MYGLASSOK,2)
                        ELSE
!        CALL WDIALOGCLEARFIELD(IDF_N1)
!        CALL WDIALOGCLEARFIELD(IDF_N2)
!        CALL WDIALOGCLEARFIELD(IDF_N3)
!        CALL WDIALOGCLEARFIELD(IDF_N4)
!        CALL WDIALOGCLEARFIELD(IDF_N5)
!        CALL WDIALOGCLEARFIELD(IDF_N6)
!        CALL WDIALOGCLEARFIELD(IDF_N7)
!        CALL WDIALOGCLEARFIELD(IDF_N8)
!        CALL WDIALOGCLEARFIELD(IDF_N9)
!        CALL WDIALOGCLEARFIELD(IDF_N10)
!        CALL WDIALOGFIELDSTATE(IDF_N1,0)
!        CALL WDIALOGFIELDSTATE(IDF_N2,0)
!        CALL WDIALOGFIELDSTATE(IDF_N3,0)
!        CALL WDIALOGFIELDSTATE(IDF_N4,0)
!        CALL WDIALOGFIELDSTATE(IDF_N5,0)
!        CALL WDIALOGFIELDSTATE(IDF_N6,0)
!        CALL WDIALOGFIELDSTATE(IDF_N7,0)
!        CALL WDIALOGFIELDSTATE(IDF_N8,0)
!        CALL WDIALOGFIELDSTATE(IDF_N9,0)
!        CALL WDIALOGFIELDSTATE(IDF_N10,0)
!        CALL WDIALOGFIELDSTATE(IDF_MYNAME,0)
!        CALL WDIALOGFIELDSTATE(IDF_MYGLASSOK,0)
                        END IF
        IF(GLANAM(J,1).EQ.'USER') THEN
!        CALL WDIALOGFIELDSTATE(IDF_USER,1)
!        CALL WDIALOGPUTCHECKBOX(IDF_USER,1)
!        CALL WDIALOGFIELDSTATE(IDF_USERNAME,1)
!        CALL WDIALOGPUTSTRING(IDF_USERNAME,GLANAM(J,2))
!        CALL WDIALOGFIELDSTATE(IDF_USEROK,1)
                        ELSE
!        CALL WDIALOGFIELDSTATE(IDF_USER,0)
!        CALL WDIALOGPUTCHECKBOX(IDF_USER,0)
!        CALL WDIALOGFIELDSTATE(IDF_USERNAME,0)
!        CALL WDIALOGCLEARFIELD(IDF_USERNAME)
!        CALL WDIALOGFIELDSTATE(IDF_USEROK,0)
                        END IF
C
!!        CALL WDialogShow(-1,-1,0,Modeless)
                        RETURN
                        END
