startToolTip = false;
displayToolTip = false;
ToolTipID = "";

function showToolTip(tooltipdiv)
	{
	ToolTipID = tooltipdiv; 
	displayToolTip = true; 
	document.getElementById(ToolTipID).style.display = "block";
	}

function hideToolTip()
	{
	document.getElementById(ToolTipID).style.display = "none";
	displayToolTip = false; 
	ToolTipID = ""; 
	}

function processToolTipID(PosX, PosY)
	{
	ToolTipIDHeight = parseInt(document.getElementById(ToolTipID).offsetHeight, 0);
	ToolTipIDWidth = parseInt(document.getElementById(ToolTipID).offsetWidth, 0);

	if (window.innerHeight)
		{
		WindowInnerWidth = window.innerWidth; 
		WindowInnerHeight = window.innerHeight;
		}
	else if (document.documentElement && document.documentElement.clientHeight)
		{
		WindowInnerWidth = document.documentElement.clientWidth;
		WindowInnerHeight = document.documentElement.clientHeight;
		}
	else if (document.body)
		{
		WindowInnerWidth = document.body.clientWidth; 
		WindowInnerHeight = document.body.clientHeight;
		}

	ToolTipPosX = PosX;
	ToolTipPosY = PosY + 23; 

	if( (ToolTipPosY + ToolTipIDHeight) > WindowInnerHeight )
		{
		if( (PosY - 5 - ToolTipIDHeight) > 0 ) 
			{ ToolTipPosY = PosY - 5 - ToolTipIDHeight; }
		}

	if( (ToolTipPosX + ToolTipIDWidth) > WindowInnerWidth )
		{
		if ( (PosX  - ToolTipIDWidth) > 0)
			{ ToolTipPosX = PosX  - ToolTipIDWidth; }
		}

	document.getElementById(ToolTipID).style.top = ToolTipPosY + "px";
	document.getElementById(ToolTipID).style.left = ToolTipPosX + "px";
	}


function processMouseEvent(MSE)
	{
	if(window.event) { MSE = window.event; }

	if(displayToolTip && startToolTip)
		{
		MsX = MSE.clientX;
		MsY = MSE.clientY;
		if(ToolTipID != "") 
			{ processToolTipID(MsX, MsY) }
		}
	}

document.onmousemove = processMouseEvent;

