/******************************************************************* 
* 
* File    : xMouse.js 
* 
* Created : 2000/07/15 
* 
* Author  : Roy Whittle  (Roy@Whittle.com) www.Roy.Whittle.com 
* 
* Purpose : To create a cross browser "Mouse" object.
*		This library will allow scripts to query the current x,y
*		coordinates of the browser
* 
* History 
* Date         Version        Description 
* 2000-06-08	1.0		Initial version
* 2000-07-31	1.1		Some fixing up.
* 2000-10-14	1.2		Now works in IE 5.0+
* 2001-09-03	1.3		Now works in IE 6.0
***********************************************************************/
/*** Create an object able to hold the x,y coordinates ***/
function xMouse() 
{ 	
	this.X = 0;
	this.Y = 0;
	this.scrollLeft = 0;
	this.scrollTop = 0;
	this.eX = 0;
	this.eY = 0;
	
	if(navigator.appName.indexOf("Netscape") != -1)
	{
		this.getMouseXY = function (evnt) 
		{
			document.ml.X=evnt.pageX;
			document.ml.Y=evnt.pageY;
		}

		window.captureEvents(Event.MOUSEMOVE);
		window.onmousemove = this.getMouseXY;

		document.ml = this;
	}
	else if(document.all)
	{
		if(document.getElementById)
		{
			this.getMouseXY = function ()
			{
				var xy = getScrollXY();
				document.ml.X = event.x + xy[0];
				document.ml.Y = event.y + xy[1];
			}
		}
		else
		{
			this.getMouseXY = function ()
			{
				document.ml.X = event.x;
				document.ml.Y = event.y;
			}
		}
		document.ml = this;
		document.onmousemove = this.getMouseXY;
	} 
	return(this);
 
}
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}
/*** End  - xMouse a cross browser "Mouse" object by www.Roy.Whittle.com ***/ 