/*
	Tooltip library
	
	Requires: 	Browser >= 4.0
				browser.js
	22.05.2001 v.1.0
	
	$Id: tooltip_v1.00.js,v 1.16 2008/04/21 11:18:01 kunzese Exp $

*/

function toolTip()
{
    //variables
	var thisObject   = this;
    this.aTooltips   = new Array();
    this.isVisible   = false;
    this.makeVisible = false;
    this.iXOffset    = 0;
    this.iYOffset    = 0;
    this.iVisX       = 0;
    this.iVisY       = 0;
    this.iTtWidth    = 0;
    this.iTtHeight   = 0;
	//this.oToolTipStyle = /*(oBrowser.isNN) ? document.toolTip :*/ $('toolTip');
	
	document.onmousemove = toolTip_mouseMove;
	if (oBrowser.isNN) document.captureEvents(Event.MOUSEMOVE);
	
    this.add = function(aTooltip)
    {
		thisObject.aTooltips[thisObject.aTooltips.length] = aTooltip;
		return thisObject.aTooltips.length - 1;
    }
    
    this.xy = function(iX, iY)
	{
		if ((iX + thisObject.iTtWidth + thisObject.iXOffset) >= (thisObject.iVisX - 20))
		{
	    	$('toolTip').style.left = (iX - thisObject.iTtWidth - thisObject.iXOffset) + 'px';
		}
		else
		{
	    	$('toolTip').style.left = (iX + thisObject.iXOffset) + 'px';
		}
		if ((iY + thisObject.iTtHeight + thisObject.iYOffset) >= (oToolTip.iVisY - 20))
		{
	    	$('toolTip').style.top = (iY - thisObject.iTtHeight - thisObject.iYOffset) + 'px';
		}
		else
		{
	    	$('toolTip').style.top = (iY + thisObject.iYOffset) + 'px';
		}
    }
    
    this.write = function(sHTML)
    {
		if (oBrowser.isNN)
		{
	    	var oDoc = document.toolTip.document;
	    	oDoc.write(sHTML);
	    	oDoc.close();
		}
		else
		{
	   		$('toolTip').innerHTML = sHTML;

			if (thisObject.iTtWidth == 0)
			{
				thisObject.iTtWidth = Element.getWidth('toolTip');
			}

			if (thisObject.iTtHeight == 0)
			{
				thisObject.iTtHeight = Element.getHeight('toolTip');
			}
		}
    }
    
    this.show = function(iID, iXOffset, iYOffset)
	{
		window.document.body.style.cursor = 'pointer';
		thisObject.makeVisible = true;
		thisObject.iXOffset    = iXOffset;
		thisObject.iYOffset    = iYOffset;
		thisObject.iTtWidth    = thisObject.aTooltips[iID][1];
		thisObject.iTtHeight   = thisObject.aTooltips[iID][2];
		thisObject.write(thisObject.aTooltips[iID][0]);
		
		if (thisObject.aTooltips[iID][3] == true)
		{
			startFlash(thisObject.aTooltips[iID][4]);
		}
    }
    
    this.hide = function()
    {
		if (window.document.body)
		{
			window.document.body.style.cursor = 'auto';
		}
		
		thisObject.makeVisible = false;
		thisObject.isVisible   = false;
		
		if ($('toolTip'))
		{
			$('toolTip').style.visibility = /*(oBrowser.isNN) ? this.visibility = 'hide' : */'hidden';
		}
    }
		
    this.hide();
}

function toolTip_mouseMove(oEvent)
{	
	if (oToolTip.makeVisible)
	{
		if (oBrowser.isIE4 || oBrowser.isIE5)
		{
			x = event.x + document.body.scrollLeft;
			y = event.y + document.body.scrollTop;
			oToolTip.iVisX = document.body.clientWidth;
			oToolTip.iVisY = document.body.clientHeight;
		}
		else if (oBrowser.isNN)
		{	
			x = oEvent.pageX;
			y = oEvent.pageY;
			oToolTip.iVisX = window.innerWidth;
			oToolTip.iVisY = window.innerHeight;
		}
		else
		{
			x = oEvent.pageX;
			y = oEvent.pageY;
			oToolTip.iVisX = document.body.clientWidth;
			oToolTip.iVisY = document.body.clientHeight;
		}
	
		oToolTip.xy(x, y);
	}

	if (oToolTip.makeVisible == true && oToolTip.isVisible == false)
	{
		oToolTip.isVisible = true;
		$('toolTip').style.visibility = /*(oBrowser.isNN) ? "show" :*/"visible";
	}
}
/*if (oBrowser.isNN)
{
    document.write('<layer id="tooltip"></layer>');
}
else
{*/
    document.write('<div id="toolTip" style="position:absolute;visibility:hidden;z-index: 999;">&nbsp;</div>');
//}

document.close();

var oToolTip = new toolTip();
var gbToolTip_init = true;