module OW_image_areal
!
! Imaging Condition -- crosscorrelation
!

use OW_type
use OW_parms_areal

implicit none

contains
!----------------------------------------------------------
subroutine owimage(ws,wr,GG) 

integer					:: ish, ihso, ixw,iw
complex					:: GG(:,:),wr(:),ws(:)

do ish=1,img%sh%n
write(0,*) "IMG01"
   ihso=nint(((ish-1)*img%sh%d+img%sh%o)/(img%xm%d))
   do ixw=1,img%xm%n
      if (ixw-ihso >= 1 .and. ixw-ihso <= img%xm%n .and. ixw+ihso >= 1 .and. ixw+ihso <= img%xm%n) then
write(0,*) "IMG02"
   write(0,*) ihso,ish,ixw
          GG(ish,ixw)=GG(ish,ixw)+conjg(ws(ixw-ihso))*(wr(ixw+ihso))
write(0,*) "IMG03"
      end if
   end do
end do

end subroutine

end module
