      COMPLEX FUNCTION WINT*16(HW,ALPHA1,ALPHA2,MX,DEP,GRAD,FINT,
     1                         NP,AVG,LH)
C
C     THE FOLLOWING FUNCTION COMPUTES THE INTERGAL OVER THE WATER 
C     COLUMN OF THE PRODUCT OF TWO COMPLEX DEPTH FUNCTIONS AND THE 
C     DIFFERENCE BETWEEN THE SQUARE OF THE INDEX OF REFRACTION AND 
C     ITS AVG. THIS INTEGRAL IS USED IN THE GALERKIN METHOD IN 
C     SUBROUTINE AMAT. 
C
      IMPLICIT REAL*8 (A-H,O-Z)
      DIMENSION DEP(MX),GRAD(MX),FINT(MX)
      COMPLEX*16 ZCISP,CISP,U,V,W
      COMPLEX*16 ALPHA1,ALPHA2
C
      COMMON /BLKEVN/ HB,CW,CB,FKW,FKB,ROHW,ROHB,ATEN
C
      WINT=DCMPLX(0.0,0.0)
      U=FKB**4/(ALPHA1*ALPHA2*ROHW)
      IF(LH .EQ. 1) GO TO 200
C
      LHM1=LH-1
      DO 100 K=1,LHM1
      V=ZCISP(ALPHA1,ALPHA2,DEP(K+1))      
      W=ZCISP(ALPHA1,ALPHA2,DEP(K))      
      WINT=WINT-GRAD(K)*(V-W)*U
      V=CISP(ALPHA1,DEP(K+1),ALPHA2,DEP(K+1))      
      W=CISP(ALPHA1,DEP(K),ALPHA2,DEP(K))      
      WINT=WINT+(AVG-FINT(K))*(V-W)*U
  100 CONTINUE
C
  200 CONTINUE
      V=ZCISP(ALPHA1,ALPHA2,HW)      
      W=ZCISP(ALPHA1,ALPHA2,DEP(LH))      
      WINT=WINT-GRAD(LH)*(V-W)*U
      V=CISP(ALPHA1,HW,ALPHA2,HW)      
      W=CISP(ALPHA1,DEP(LH),ALPHA2,DEP(LH))      
      WINT=WINT+(AVG-FINT(LH))*(V-W)*U
C
      RETURN
      END
