// Copyright 2002-2005 ExpoCharger International, Inc. 
// All rights reserverd. 

//modeled after macromedia boilerplate tooltip
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
var ns7 = (ns6==true) && (typeof (document.body.clientWidth) != "undefined");
offsetX = 5;
offsetY = 20;
var toolTipSTYLE="";
var CssClassName="tooTip";
var freezePosition=false;
function initToolTips(cssClassName)
{
  if(ns4||ns6||ie4)
  {
	if(cssClassName) CssClassName=cssClassName;
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
		//already hidden
    else 
		toolTipSTYLE.display = "none";
    freezePosition=false;
  }
  else // show
  {
	//freezePosition=true;
    var content = '<table border="0" cellspacing="0" cellpadding="1" >' + 
	'<td align="left"  class="' + CssClassName + '" NOWRAP>' + msg +  '&nbsp\;</td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'	
    }
  }
}
function moveToMouseLoc(e)
{
	if(ns4||ns6)
	{
		x = e.pageX;
		y = e.pageY;
	}
	else 
	{
		x = event.x + document.body.scrollLeft;
		y = event.y + document.body.scrollTop;
	}
	var saveX = x;
	var saveY = y;
	if (ie4 || ns7)
	{
		var div = document.getElementById("toolTipLayer");
		var flyWidth = div.scrollWidth + offsetX;
		var flyHeight = div.scrollHeight + offsetY;
		
		if (x+flyWidth>document.body.clientWidth + document.body.scrollLeft)
		{
			x=x-flyWidth-offsetX/2;
		}
		if (y+flyHeight-10>document.body.clientHeight + document.body.scrollTop)
		{
			y=y-flyHeight-offsetY/2;
		}
		if (x+10<document.body.scrollLeft)
			x=document.body.scrollLeft-offsetX;
		if (y+10<document.body.scrollTop)
			y=document.body.scrollTop-offsetY;		
		//don't cover up the cursor (prevents clicking on the booth)
		if(x<saveX && (x+flyWidth)>saveX && y<saveY && (y+flyHeight)>saveY)
		{
			x = saveX + offsetX;
		}
			
	}
	  
	if (freezePosition==false)
	{
		toolTipSTYLE.left = x + offsetX;
		toolTipSTYLE.top = y + offsetY;

		
	}
  return true;
}