/* Java Script to show a tooltip
**
** To use this add the js file to the bottom of the document
** Next, in the link you want the tool tip add a mouse over to call
** fnShowInfo function and pass it a string you want to show eg
** 		onMouseOver="fnShowInfo('<?php print $row[name] ?>');"
**
** Next, add a mouse out to kill the tooltip eg
**		onMouseOut="fnKillInfo();"
**
** The string sent can contain any HTML
*/

<!--
// Puts the div that we will move to the page
document.write ("<DIV id='toolTipLayer' style='position:absolute; top:0; left:0; z-index:200; display:none;'>This is a tooltip</DIV>");

// Will be the test in the div later
theText = "This is a NEW tooltip";

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
function fnKillInfo()
{
	document.getElementById("toolTipLayer").style.display = "none";		
}
// Function to show the div "toolTipLayer" and move test browser
function fnShowInfo(strNewText)
{
	// Show the div "toolTipLayer"
	document.getElementById("toolTipLayer").style.display = "block";
	
	// What ever is sent the function is the new text
	theText = strNewText;
	// If NS -- that is, !IE -- then set up for mouse capture
	if (!IE) document.captureEvents(Event.MOUSEMOVE)
	
	// Set-up to use getMouseXY function onMouseMove
	document.onmousemove = getMouseXY;
	
	//change the text held in the div to whatever is hed in "theText"
	if(IE)
	{
		document.getElementById("toolTipLayer").innerHTML = theText;
	}
	else
	{
		document.getElementById("toolTipLayer").innerHTML = theText;
		
		var lyr = document.layers["toolTipLayer"].document;
		lyr.open();
		lyr.write(theText);
		lyr.close();	
	}
}
// Main function to retrieve mouse x-y pos.s

function getMouseXY(pos)
{
	if (IE)
	{
		// Get the x-y pos if browser is IE
		tempX = event.clientX + document.body.scrollLeft
		tempY = event.clientY + document.body.scrollTop
	}
	else
	{ 
		// Get the x-y pos if browser isn't IE
		tempX = pos.pageX
		tempY = pos.pageY
	}  
	// catch possible negative values in NS4
	if (tempX < 0){tempX = 0}
	if (tempY < 0){tempY = 0}  

	// Moves the div "toolTipLayer" to the x and y of the mouse
	if (IE)
	{
		document.getElementById("toolTipLayer").style.top = (tempY)+10;
		document.getElementById("toolTipLayer").style.left = (tempX)+10;
	}
	else
	{
		document.getElementById("toolTipLayer").style.top = (tempY)+10;
		document.getElementById("toolTipLayer").style.left = (tempX)+10;
	}
	
	return true
}

//-->


