var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}

if(document.all) 
{ 
	document.onmousemove = UpdateCursorPositionDocAll; 
}
else 
{ 
	document.onmousemove = UpdateCursorPosition; 
}

function AssignPosition(d)
{
	if(self.pageYOffset)
	{
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	}
	else if(document.documentElement && document.documentElement.scrollTop)
	{
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	}
	else if(document.body) 
	{
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}
	if(document.all)
	{
		cX += rX; 
		cY += rY;
	}
	d.style.left = (cX-260) + "px";
	//Stuart Starrs
	//Initially set the top to be the same as the current cursor location
	//we will get the height of the div element once the div is displayes
	//as the DOM doesnt know the height whilst the element is invisible (display=none;)
	//Once we know the height we can subtract it from the top value so the element
	//displays just above the current cursor position
	d.style.top = (cY) + "px";
}

function HideContent(d) 
{
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function ShowContent(d) 
{
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";dd.style.top = (parseInt(dd.style.top,10)-dd.offsetHeight) + "px";
}

function ReverseContentDisplay(d) 
{
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if(dd.style.display == "none") 
	{ 
		dd.style.display = "block";dd.style.top = (parseInt(dd.style.top,10)-dd.offsetHeight) + "px"; }
	else 
	{ 
		dd.style.display = "none"; 
	}
}
