c
c @(#)cross.f	1.4
c
      subroutine crossbg

      include'mladv.inc'

      common/parm/kz,m,mm1,mm2,mp1,msq,tim,tmax,tstart,hy,rea,dt,
     +   xbasin,yy(mx0),icalc,kzp1,kzm1,iftop,ifbot,iftvv,ifrel,theta,
     +   ifsbl,ifeva

      do 85 ip=1,msq

        hnew = hdpth(ip,mlcur) - qgts * wbgml(ip)

        if (hnew .gt. maxh) hnew = maxh

        call findkml(hdpth(ip,mlcur),zml,l,k1)
        call findkml(hnew,zml,l,k2)

        if (abs(k1-k2) .gt. 1) then
           write(*,*)'CFL VIOLATION**********'
           write(*,*)ip,k1,k2,mltime,hnew,hdpth(ip,mlcur)
c          stop
          endif

        if (k2.lt.k1) then
           zcross(ip,1) = 1.0
           zcross(ip,2) = k1
         else if (k2.gt.k1) then
           zcross(ip,1) = -1.0
           zcross(ip,2) = k1
         else
           zcross(ip,1) = 0.0
        endif

   85 continue

      return
      end
