var tooltip = null;
var toolTipVisible = false;
var timerId = null;
var delayToolTip = 500;
var offset = +20;

if (browserDetector.isOpera)
{
	offset = -20;
}

function get_ToolTip()
{
	if (tooltip==null)
	{
		tooltip = DHTML.getElement('tooltip');
	}
}


document.onmousemove=OnMouseMove;
document.onmouseup=OnMouseDown;

function OnMouseDown()
{
		return false;
}

function OnMouseMove(event)
{
	if (event==null)
	{
		event = window.event;
	}
	
	if (!toolTipVisible && tooltip!=null)
	{
		x = event.clientX;
		y = event.clientY;
		
		sy= document.body.scrollTop;
		sx = document.body.scrollLeft;
		
		x = x + sx;
		y = y + sy;
		
		
		get_ToolTip();

		dom_showInlineObjectByPos(x, y, tooltip, true, offset, offset);
    }
}

function ShowToolTip(obj, text)
{
	 get_ToolTip();
	 if (tooltip==null) return;

	 tooltip.innerHTML=" " + text + " ";

	 destroyTimer();	 
   	 timerId = setTimeout("_showToolTip()", delayToolTip);
}

function _showToolTip()
{
	if (tooltip==null) return;
	
	if (DHTML.getX(tooltip)==0 && DHTML.getY(tooltip)==0) return;
	
	 DHTML.showObj(tooltip);
	 toolTipVisible = true;
}


function destroyTimer()
{
	 if (timerId!=null)
	 {
	 	  clearTimeout(timerId);
	 	  timerId = null;
	 }
}

function HideToolTip()
{
	toolTipVisible = false;	 
	if (tooltip==null) return;
    DHTML.hideObj(tooltip);
	 destroyTimer();
}

