function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function ShowPopup(hoveritem, hovertext)
{
	hp = document.getElementById("hoverpopup");
	ht = document.getElementById("hovertext");
	ht.innerHTML= hovertext

	// get screen size
	screenY = window.outerHeight
	screenX = window.outerWidth

	// Set position of hover-over popup
	lt = findPos(hoveritem);

	hp.style.top = lt[1] - 18;

	// Decide if left or right
	if( lt[0] + 400 > screenX )
		hp.style.left = lt[0] - 300
	else
		hp.style.left = lt[0] + 20;

	// Set popup to visible
	hp.style.visibility = "Visible";
}

function HidePopup()
{
	hp = document.getElementById("hoverpopup");
	hp.style.visibility = "Hidden";
}

