var aTimeout = 0;
var x = 0;
var y = 0;
var aText = '';
var aID = 'linkPopupText';


function absLeft(el) {
	return (el.offsetParent)? 
	el.offsetLeft+absLeft(el.offsetParent) : el.offsetLeft;
}

function absTop(el) {
	return (el.offsetParent)? 
	el.offsetTop+absTop(el.offsetParent) : el.offsetTop;
}

function absWidth(el) {
	return (el.offsetParent)? 
		absWidth(el.offsetParent) : el.offsetWidth;
}

function getPopupObject(myId)
{
   if (document.getElementById(myId))
   {
     return document.getElementById(myId);
   }
   else
   {
     return window.document[myId]; 
	}     
}

function doSetPopupTimeout(sender, text)
{
	x=absLeft(sender);
	aWidth=absWidth(sender);
	if (x+130>absWidth(sender))
		x=x-130+sender.offsetWidth;
	y=absTop(sender);
	aText=text;
	aTimeout = setTimeout('showPopupNew()',800);
}

function showPopupNew()
{
	if (aText!='')
	{
		var popup=getPopupObject(aID);
		if (popup)
		{	
			var popupText=getPopupObject(aID);
			popupText.innerHTML=aText;

			popup.style.left=x;
			popup.style.top=y+25;

			popup.style.visibility='visible';
		}
		aTimeout = setTimeout('hidePopup(\'linkPopupText\')',8000);
	}
	else
		clearTimeout(aTimeout);
}

function showPopup(x, y, id, text)
{
	if (text!='')
	{
		var popup=getPopupObject(id);
		if (popup)
		{	
			var popupText=getPopupObject(id);
			popupText.innerHTML=text;

			// popup.style.left=x+20;
			// popup.style.top=y;
			popup.style.left=x;
			popup.style.top=y+20;

			popup.style.visibility='visible';
		}
		aTimeout = setTimeout('hidePopup(\'linkPopupText\')',8000);
	}
	else
		clearTimeout(aTimeout);
}

function hidePopup(id)
{
	clearTimeout(aTimeout);
	var popup=getPopupObject(id);
	popup.style.visibility='hidden';
}
