// 	Initialise variables to hold the mouse coordinates
var msX =0;
var msY =0;

// Initialise variable to hold browser type (NB: only distinguishes between
// IE and other types.  Same statement also in positioning functions script
var IE = document.all?true:false;

// Function to get the current mouse coordinates
function getMouseXY(e) 
{
	if (IE) 
	{ 
		// The IE way 
		msX = event.clientX + document.body.scrollLeft;
		msY = event.clientY + document.body.scrollTop;
	}else{ 
		// The Mozilla way
		msX = e.pageX;
		msY = e.pageY;
	}  

	// Sanity check the coordinates
	if (msX < 0)
	{
		msX = 0;
	}
	
	if (msY < 0)
	{
		msY = 0;
	}
			
	// Uncomment to display current mouse coordinates in display area
	//	 ords = msX + ":" + msY;
	// 	 disp('msgDisplay', ords);

	// Uncomment to display mouse coordinates in status bar
	ords = msX + ":" + msY;
	
	if (IE)
	{
		self.status = ords;
	}else{
		// Note that this only works if scripts have been allowed to change
		// status bar text in Firefox
		// FF 1.0 Tools > Options > Web Features > Enable JavaScript / Advanced > Allow scripts to change status bar text
		// FF 1.5 Tools > Options > Content > Enable JavaScript / Advanced > Allow scripts to change status bar text
		window.status = ords;
	}
	// This function should be placed in the page that calls this
	// function as the menu positioning will vary from page to page
	// Comment out if the page has no menus to avoid errors
//	adjustMenus();
}

// Set the mouse listener going in Mozilla based browsers
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// When the mouse is moved, call the function to record the coordinates
// and trigger other functions 
document.onmousemove = getMouseXY;
