/*
	Tooltip library
	
	Requires: 	Browser >= 4.0
				browser.js
	22.05.2001 v.1.0
	
	$Id: tooltip_v1.00.js,v 1.12 2008/01/15 16:03:02 blankse 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 :*/ document.getElementById('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)
	{
		var iWidth  = thisObject.iTtWidth;
		var iHeight = thisObject.iTtHeight;
	
		if ((iX + iWidth) >= (thisObject.iVisX - 20))
		{
	    	document.getElementById('toolTip').style.left = iX - iWidth - 30 + 'px';
		}
		else
		{
	    	document.getElementById('toolTip').style.left = iX + 'px';
		}
	
		if ((iY + iHeight) >= (oToolTip.iVisY - 20))
		{
	   		var iYCentered = iY - (iHeight/2) - 25;
	    	document.getElementById('toolTip').style.top = ((iY + (iHeight/2)) >= thisObject.iVisY) ? thisObject.iVisY - iHeight - 5 + 'px' : ((iYCentered <= 0) ? 5 + 'px' : iYCentered + 'px')
		}
		else
		{
	    	document.getElementById('toolTip').style.top = iY + 'px';
		}
    }
    
    this.write = function(sHTML)
    {
		if (oBrowser.isNN)
		{
	    	var oDoc = document.toolTip.document;
	    	oDoc.write(sHTML);
	    	oDoc.close();
		}
		else
		{
	   		document.getElementById('toolTip').innerHTML = sHTML;
		}
    }
    
    this.show = function(iID, iXOffset, iYOffset)
	{
		window.document.body.style.cursor = 'help';
		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 (document.getElementById('toolTip'))
		{
			document.getElementById('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 + oToolTip.iXOffset, y + oToolTip.iYOffset);
	}

	if (oToolTip.makeVisible == true && oToolTip.isVisible == false)
	{
		oToolTip.isVisible = true;
		document.getElementById('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;