/*************************************************************
 * Cursor script by QuanMongMo (http://www.quanmongmo.net)
 * This script can be used and modified absolutely free
 * untill this statement presents unchanged in all copies
 * and derivatives.
 *************************************************************/

var borderW=10;
function vmaxonmousemoved(x,y)
{getPageSizes();
 
 if(x<pageX)                   x=pageX;
 if(x>pageX+pageW)             x=pageX+pageW;
 if(y<pageY)                   y=pageY;
 if(y>pageY+pageH)             y=pageY+pageH;

 if(document.layers)
   {document['CVTLINE'].left=x;
    document['CVTLINE'].top=y-document['CVTLINE'].clip.height-10;

    document['CHLLINE'].left=x-document['CHLLINE'].clip.width-10;
    document['CHLLINE'].top=y;
    
    document['CVBLINE'].left=x;
    document['CVBLINE'].top=y+10;
    document['CVBLINE'].clip.bottom=(pageY+pageH)-10;
    
    document['CHRLINE'].left=x+10;
    document['CHRLINE'].top=y;
    document['CHRLINE'].clip.right=(pageX+pageW)-10;

    document['CLCENTER'].top=y-10;
    document['CLCENTER'].left=x-10;
    document['CRCENTER'].top=y-10;
    document['CRCENTER'].left=x+2;


   }

 if(document.all)
   {x-=2;
    y-=2;
    document.all['CVTLINE'].style.pixelLeft=x;
    document.all['CVTLINE'].style.height=pageH-5;
    document.all['CVTLINE'].style.pixelTop=y-pageH;

    document.all['CVBLINE'].style.pixelLeft=x;
    document.all['CVBLINE'].style.pixelTop=Math.min(y+5,pageH+pageY);
    hh=pageY+pageH-y-20; 
    if(hh<0) hh=0;
    document.all['CVBLINE'].style.height=hh;


    document.all['CHLLINE'].style.pixelTop=y;
    document.all['CHLLINE'].style.width=pageW-5;
    document.all['CHLLINE'].style.pixelLeft=x-pageW;

    document.all['CHRLINE'].style.pixelTop=y;
    document.all['CHRLINE'].style.pixelLeft=Math.min(x+5,pageW+pageX);
    ww=pageX+pageW-x-20; 
    if(ww<0) ww=0;
    document.all['CHRLINE'].style.width=ww;

    document.all['CLCENTER'].style.pixelTop=y-10;
    document.all['CLCENTER'].style.pixelLeft=x-10;
    document.all['CRCENTER'].style.pixelTop=y-10;
    document.all['CRCENTER'].style.pixelLeft=x+2;

   }
}


//---------- window size detecting ------------

var pageX=0;
var pageY=0;
var pageW=600;
var pageH=400;


function getPageSizes()

{if(document.layers)
    {pageX=window.pageXOffset;
     pageW=window.innerWidth;
     pageY=window.pageYOffset;
     pageH=window.innerHeight;
    }
 if(document.all)
    {pageX=window.document.body.scrollLeft;
     pageW=window.document.body.offsetWidth-12;
     pageY=window.document.body.scrollTop;
     pageH=window.document.body.offsetHeight-12;
    } 
} 
//--------------------------------------------

function NNbugFix()
{// To fix NN layer document width problems on resize
 history.go(0);
}

//---------- mouse move handlers --------------
function mymousehandler(e)
{if(document.all)
   {ex=event.x;
    ey=event.y;
    vmaxonmousemoved(ex,ey);
    return true;
   }
 if(document.layers)
   {ex=e.pageX; 
    ey=e.pageY;
    vmaxonmousemoved(ex,ey);
    return routeEvent(e);
   }
 if(oldhandler) oldhandler();
}

function setOnMouseMoveHandlers()
{ if(document.layers)
   {window.captureEvents(Event.MOUSEMOVE);
    window.onMouseMove=mymousehandler;
    window.onresize=NNbugFix;
   }
  if(document.all)
   {document.onmousemove=mymousehandler;
   }
}
//----------------------------------------
function setCursor()
 {var ok;
  if(document.layers) {ok=true; tag='div';}
  if(document.all)    {ok=true; tag='div';}
  if(!ok) return;
  getPageSizes()

  s='<style type="text/css">\n';
  s+='#CVTLINE {position:absolute; top:11; left:11; height:100%; width:1px; }';
  s+='#CVBLINE {position:absolute; top:11; left:11; height:100%; width:1px; }';
  s+='#CHLLINE {position:absolute; top:11; left:11; height:1px; width:100%; }';
  s+='#CHRLINE {position:absolute; top:11; left:11; height:1px; width:100%; }';
  s+='#CLCENTER{position:absolute; top:0;  left:0;  height:21px; width:9px; }';
  s+='#CRCENTER{position:absolute; top:0;  left:12; height:21px; width:9px; }';
  s+='</style>\n';
  document.writeln(s);

  s ='<'+tag+' ID="CHLLINE"  ><img  src="chlinepix.gif" border=0 width="100%" height=1></'+tag+'>';
  s+='<'+tag+' ID="CHRLINE"  ><img  src="chlinepix.gif" border=0 width="100%" height=1></'+tag+'>';
  s+='<'+tag+' ID="CVTLINE"  ><img  src="chlinepix.gif" border=0 width=1 height="100%"></'+tag+'>';
  s+='<'+tag+' ID="CVBLINE"  ><img  src="chlinepix.gif" border=0 width=1 height="100%"></'+tag+'>';
  s+='<'+tag+' ID="CLCENTER" ><img  src="clcenter.gif"  border=0 width=9 height=21></'+tag+'>';
  s+='<'+tag+' ID="CRCENTER" ><img  src="crcenter.gif"  border=0 width=9 height=21></'+tag+'>';
  document.writeln(s);
  setOnMouseMoveHandlers();  
 }




