var msie = false, nn4 = false, w3c = false; // browser identifiers
var incompatible = false;                   // non-compatible browser identifier

function getBrowser()
{
	// identify the viewer's browser
	if (document.all)
		msie = true;
	else if (document.layers)
		nn4 = true;
	else if (document.getElementById)
		w3c = true;
	else
		incompatible = true;
}

getBrowser();       // get the viewer's browser
var currTip = null; // current visible tip layer

// set up event handling
if (nn4 || w3c)
	document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = moveToolTip;

function showToolTip(what, evt)
{
	// initialize the active tooltip
	if (msie || w3c)
	{
		if (msie)
		{
			what = document.all[what].style;
			evt = event;
		}
		else
			what = document.getElementById(what).style;

		what.left = evt.clientX + 10 + document.body.scrollLeft;
		what.top = evt.clientY + document.body.scrollTop;
		what.visibility = "visible";
		currTip = what;
	}
	else if (nn4)
	{
		what = document.layers[what];
		what.left = evt.pageX + window.pageXOffset;
		what.top = evt.pageY + window.pageYOffset;
		what.visibility = "visible";
		currTip = what;
	}
	else
	{
		// don't do anything in a non-compliant browser
		alert("Your browser can't run this script.");
		return;
	}
}

function moveToolTip(evt)
{
	if (currTip)
	{
		// update the tooltip's position
		if (msie || w3c)
		{
			if (msie) evt = event;
			currTip.left = evt.clientX + 10 + document.body.scrollLeft;
			currTip.top = evt.clientY + document.body.scrollTop;
		}
		else if (nn4)
		{
			currTip.left = evt.pageX + 10 + window.pageXOffset;
			currTip.top = evt.pageY + window.pageYOffset;
		}
	}
}

function hideToolTip()
{
	// don't do anything in a non-compliant browser
	if (incompatible)
	{
		alert("Your browser can't run this script.");
		return;
	}

	// "deactivate" the active tooltip
	currTip.visibility = "hidden";
	currTip = null;
}