      REAL FUNCTION xcort(icor)
*
      include 'xcort.inc'
       integer icor
*       icor=1
 
      

        cl=19.*2.6/1000.
        cs=19.*40./1000./1000.
	cc=0.
	if (idch.eq.21 .or. idch.eq.23) cc=cs
	if (idch.eq.22 .or. idch.eq.24) cc=cl

        if (idch.eq.1 .or. idch.eq.3) cc=cs
        if (idch.eq.2 .or. idch.eq.4) cc=cl

        if (idch.eq.5 .or. idch.eq.7) cc=cs
        if (idch.eq.6 .or. idch.eq.8) cc=cl

        if (idch.eq.9 .or. idch.eq.11) cc=cs
        if (idch.eq.10 .or. idch.eq.12) cc=cl


	cg=cc/23.*7.
	cf=cc
	if (icor.eq.-1) then
            xcor=(x+cc*dt)
	elseif (icor.eq.1) then
             xcor=(x+cc*dt)-cc*dt+cg*dtgra
	elseif (icor.eq.2) then
             xcor=(x+cc*dt)+cg*dtgra-cf*dtfra
	else
             xcor=x
	endif
*        xcor=(x+cc*dt)-cc*dt+cg*dtgra
*           xcor=(x+cc*dt)
*         xcor=(x+cc*dt)+cg*dtgra-cf*dtfra
	
	xcort=xcor
      END
