C
C *** EIGEN VALUE EQUATION OF LOVE WAVE
C
      REAL FUNCTION FUNCFL*8 (CC)
C
C INPUT DATA
C OM     : CIRCULAR FREQUENCY ( OMEGA ) FROM COMMON
C CC     : PHASE VELOCITY OF LOVE WAVE
C OUTPUT DATA
C FUNCFL : EIGEN VALUE EQUATION OF LOVE WAVE
C
      IMPLICIT REAL*8(A-H,O-Z)
      COMMON / LAYER / NL,VS(35),DEP(35),SM(35) / OMEGA /OM
      COMPLEX*16 R11,R12,R21,R22,SA11,SA12,SA21,SA22
     *          ,SB11,SB12,SB21,SB22
C
      WN=OM/CC
C
      R11=(1.0D0,0.0D0)
      R12=(0.0D0,0.0D0)
      R21=(0.0D0,0.0D0)
      R22=(1.0D0,0.0D0)
C
      DO 100 ML=1,NL-1
C
        SA11=R11
        SA12=R12
        SA21=R21
        SA22=R22
C
        BM=VS(ML)
        CB2=CC*CC/(BM*BM)
        IF(BM-CC)10,20,30
C
   10     RBM=DSQRT(CB2-1.0D0)
          QM=WN*RBM*DEP(ML)
          CQ=DCOS(QM)
          SQ=DSIN(QM)
          STQ=RBM*SQ
          SDQ=SQ/RBM
          GOTO 40
C
   20     CQ=1.0D0
          STQ=0.0D0
          SDQ=WN*DEP(ML)
          GOTO 40
C
   30     RBM=DSQRT(1.0D0-CB2)
          QM=WN*RBM*DEP(ML)
          EX1=DEXP(QM)
          EX2=DEXP(-QM)
          CQ=(EX1+EX2)/2.0D0
          EX12=(EX1-EX2)/2.0D0
          STQ=-RBM*EX12
          SDQ=EX12/RBM
C
   40   SB11=DCMPLX(CQ,0.0D0)
        SB12=DCMPLX(0.0D0,SDQ/SM(ML))
        SB21=DCMPLX(0.0D0,STQ*SM(ML))
        SB22=DCMPLX(CQ,0.0D0)
C
        R11=SB11*SA11+SB12*SA21
        R12=SB11*SA12+SB12*SA22
        R21=SB21*SA11+SB22*SA21
        R22=SB21*SA12+SB22*SA22
C
  100 CONTINUE
C
      RBN=-DSQRT(1.0D0-CC*CC/(VS(NL)*VS(NL)))
      FUNCFL=IMAG(R21)+SM(NL)*RBN*REAL(R11)
C
      RETURN
      END
