/*
	Tooltip library
	
	Requires: 	Browser >= 4.0
				browser.js
	22.05.2001 v.1.0
	
	$Id: tooltip_v1.00.js,v 1.7 2005/06/29 11:09:31 seberma Exp $

*/

function toolTip_init(){
	//variables
	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;
	
	//interface
	this.add = toolTip_add
	this.xy = toolTip_xy
	this.show = toolTip_show
	this.hide = toolTip_hide
	this.write = toolTip_write
	
	//activate
//	if (oBrowser.isMAC == false){
		document.onmousemove = toolTip_mouseMove
		if (oBrowser.isNN) document.captureEvents(Event.MOUSEMOVE)
//	}
	this.oToolTip = (oBrowser.isNN) ? document.toolTip : document.getElementById('toolTip').style
	this.hide()
}

function toolTip_add(aTooltip){
	this.aTooltips[this.aTooltips.length] = aTooltip
	return this.aTooltips.length-1
}

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
		oToolTip.oToolTip.visibility = (oBrowser.isNN) ? "show" : "visible"
	}
}


function toolTip_xy(iX, iY){
	var iWidth = this.iTtWidth
	var iHeight = this.iTtHeight
	
	if((iX + iWidth) >= (oToolTip.iVisX - 20)) {
		this.oToolTip.left = iX - iWidth - 30
	}
	else {
		this.oToolTip.left = iX
	}
	
	if((iY + iHeight) >= (oToolTip.iVisY - 20)) {
		var iYCentered = iY - (iHeight/2) - 25
		this.oToolTip.top = ((iY + (iHeight/2)) >= oToolTip.iVisY) ? oToolTip.iVisY - iHeight - 5 : ((iYCentered <= 0) ? 5 : iYCentered)
	}
	else {
		this.oToolTip.top = iY
	}
}

function toolTip_write(sHTML){
	if (oBrowser.isNN) {
		var oDoc = document.toolTip.document
		oDoc.write(sHTML)
		oDoc.close()
	}
	else {
		document.getElementById('toolTip').innerHTML = sHTML
	}

}

function toolTip_show(iID, iXOffset, iYOffset){
	window.document.body.style.cursor = 'help';
	this.makeVisible=true
	this.iXOffset = iXOffset
	this.iYOffset = iYOffset
	this.iTtWidth = this.aTooltips[iID][1]
	this.iTtHeight = this.aTooltips[iID][2]

	this.write(this.aTooltips[iID][0])
}

function toolTip_hide(){
	window.document.body.style.cursor = 'auto';
	this.makeVisible=false
	this.isVisible=false
	this.oToolTip.visibility = (oBrowser.isNN) ? this.oToolTip.visibility = 'hide' : 'hidden'
}

if (oBrowser.isNN) {
	document.write('<layer ID="toolTip"></layer>')
} else {
	document.write('<DIV ID="toolTip" STYLE="position:absolute;visibility:hidden;z-index: 10;">&nbsp;</DIV>')
}

document.close()

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



