/*
The tool tip javascript will allow users to create roll over bubble displays.
For an example of this tooltip go to http://web-graphics.com/mtarchive/001717.php

Function Use
------------
displayTooltip - used for onMouseOver event
removeTolltip - used for onMouseOut event
Locate - used for onMouseMove event

Created: John Kim
Modified: 12/5/2007
*/

/*=======================================================================================
Displays a Bubble Tool Tip
=======================================================================================*/
function displayTooltip(imagePath)
{
	//if the document doesn't support DOM then alert a message and return
	if(!document.getElementById || !document.getElementsByTagName)
	{
		alert('Your browser doesn\'t support DOM');
		return;
	}
	
	//Create container element once if it doesn't exist
	if(document.getElementById('tooltip') == null)
	{
		var container = document.createElement("span");
		container.id = 'tooltip';
		container.className = 'tooltip';
		container.style.display = 'block';
		document.getElementsByTagName("body")[0].appendChild(container);
	}
	
	//create an inner element that will display an image
	var inner = document.createElement("span");
	inner.id = 'inner';
	inner.className = 'inner';
	inner.style.display = 'block';
	document.getElementById('tooltip').appendChild(inner);
	
	//Insert an Image into the inner span
	var image = document.createElement("img");
	image.id = 'picture';
	image.className = 'picture';
	image.src = imagePath;
	document.getElementById('inner').appendChild(image);
	
	return;
	
}




/*=======================================================================================
Remove the tool Tip
=======================================================================================*/
function removeTooltip()
{
	var container = document.getElementById('tooltip');
	container.removeChild(container.firstChild);
	return;
}




/*=======================================================================================
Locates the Mouse, and sets the position of the tool tip
=======================================================================================*/
function Locate(e)
{
	var bubble = document.getElementById('inner');
	
	var posx=0, posy=0;
	if(e==null)
		e = window.event;
	
		
	//Navigator
	if(e.pageX || e.pageY)
	{
		posx=e.pageX;
		posy=e.pageY;
	}
	//Explorer
	else if(e.clientX || e.clientY)
	{
		if(document.documentElement.scrollTop)
		{
			posx=e.clientX+document.documentElement.scrollLeft;
			posy=e.clientY+document.documentElement.scrollTop;
		}
		else
		{
			posx=e.clientX+document.body.scrollLeft;
			posy=e.clientY+document.body.scrollTop;
		}
	}
	
	bubble.style.top=(posy-280)+"px";
	bubble.style.left=(posx-150)+"px";
	
	return;
}