	var CUSTOM_TOOLTIP_WIDTH = 250; //width of the tool tips
	var oActiveTipStyle = null; //reference to the active tip
	var x; //the current horizontal location of cursor
	var y; //the current vertical location of the cursor
	var windowWidth; //the window width
	var windowHeight  // Current help position and main window size
	
	//wire up the mouse move event
	document.onmousemove = mousemove;
	
	/***************************************************
	* This actually builds the HTML tip
	****************************************************/
	function buildToolTip(toolTipId, toolTipText)
	{
		var customToolTip = '';
		customToolTip += '<div id="' + toolTipId + '" style="position:absolute; visibility:hidden; z-index:999; top:0px;left:0px;">'; //Main container
		customToolTip += '<table width=' + CUSTOM_TOOLTIP_WIDTH + ' border=1 cellpadding=2 cellspacing=0 class="CustomToolTipWidthContainer">'; //container for width of tip
		customToolTip += '<tr><td>';
			if(toolTipText && toolTipText != "")
			{
				customToolTip += toolTipText;				
			}
		customToolTip += '</td></tr>';
		customToolTip += '</table>';
		customToolTip += '</div>' + "\n";
		
		document.write(customToolTip);
	}
	
	/********************************************
	* Handles the mouse move event.  We need 
	* to know where the mouse is on the screen.
	********************************************/
	function mousemove(e)
	{
		if(e) //NON IE
		{
			x = e.pageX ? e.pageX : e.clientX ? e.clientX : 0;
			y = e.pageY ? e.pageY : e.clientY ? e.clientY : 0;
		}
		else if(event) //IE
		{
			x = event.clientX + document.body.scrollLeft; 
			y = event.clientY + document.body.scrollTop;
		}
		else
		{
			x = 0; 
			y = 0;
		}

		if(oActiveTipStyle) 
			showCustomToolTip();
	}
	
	/************************************
	* Support function for showTip()
	************************************/
	function showCustomToolTip()
	{
	
		var heightOfBox = 40;
		
		//if the location of the mouse plus the width of the
		//tool tip, is smaller then the screen
		//show the mouse on the right.
		if( (x  + CUSTOM_TOOLTIP_WIDTH + 10) < windowWidth)
		{
			oActiveTipStyle.left = (x + 12) + "px";
		}
		else //tool tip would be off the screen, move it to the left.
		{
			oActiveTipStyle.left = (x - (CUSTOM_TOOLTIP_WIDTH + 20)) + "px";
		}
		
		if( (y + heightOfBox) < windowHeight)
		{
			oActiveTipStyle.top = (y + 12) + "px";
		}
		else
		{
			oActiveTipStyle.top = (y - heightOfBox) + "px";
		}
		oActiveTipStyle.visibility = "visible";
		//window.status="oActiveTipStyle X:"+(oActiveTipStyle.left?oActiveTipStyle.left:"NAN")+", Y:"+(oActiveTipStyle.top?oActiveTipStyle.top:"NAN")+", x:"+x+", y:"+y +", windowW:"+windowWidth+", windowH:"+ windowHeight;
	}

	/***************************************
	* This should be called from the object 
	* wishing to show the tip.
	***************************************/
	function showTip(name)
	{
		if(oActiveTipStyle) 
			unTip();
		oActiveTipStyle = document.getElementById(name).style;
		if(oActiveTipStyle)
		{
			windowWidth = (window.innerWidth) ? window.innerWidth + window.pageXOffset - 16 : document.body.offsetWidth - 20;
			windowHeight = (window.innerHeight) ? window.innerHeight + window.pageYOffset : document.body.offsetHeight;
		}
		showCustomToolTip();
	}
 
	/***************************************
	* Hides the currently displaying it.
	***************************************/
	function unTip()
	{
		if(oActiveTipStyle) 
			oActiveTipStyle.visibility = "hidden";

		oActiveTipStyle = null;
	}
