
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;}
function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;}
function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;}
function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;}
function posRight() {return posLeft()+pageWidth();}
function posBottom() {return posTop()+pageHeight();}

<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007
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;
	}
	winW = document.body.offsetWidth;
	if (document.all) {
		cX += rX;
		cY += rY;
		winW -= 25; // IE includes scrollbar...
	}

	if (winW < cX+10+d.offsetWidth) {
		d.style.left = (winW-d.offsetWidth-rX) + 'px';
	} else {
		d.style.left = (cX+10) + "px";
	}

	//alert('top: ' + cY + 'bottom: ' +posBottom());
	if (cY+10+d.offsetHeight > posBottom()) {
		d.style.top = posBottom()-d.offsetHeight + 'px';
	} else {
		d.style.top = (cY+10) + "px";
	}
	document.body.appendChild(d);
}

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);
	dd.style.display = "block";
	AssignPosition(dd); // moved past display to be able to get size of element
}

function ReverseContentDisplay(d) {
	if (d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if (dd.style.display == "none") { dd.style.display = "block"; }
	else { dd.style.display = "none"; }
}
//-->

