var ie = false;

if ((navigator.appName=="Microsoft Internet Explorer")&&
	(parseInt(navigator.appVersion)>=4)){
	ie = true;
}


var instatus = false;			//determines if tooltip will also be displayed
								//in the status bar
var ttname = "tooltip"; 		//name of the tooltip div tag (used on next line)
var bcolor = "lightblue";		//background color of tooltip
var fcolor = "#000000";			//color of tooltip text
var opacity = 85;				//translucency of tooltip
var borderstyle = "solid";		//tooltip border style
var borderwidth = 1;			//tooltip border width
var bordercolor = "#000000";	//tooltip border color
//var bordercolor = "#0099FF";	//tooltip border color
var font = "Verdana";			//font family
var fontsize = 10;				//font size

//mouse coordinates
var tempX = 0;
var tempY = 0;

//this is the div tag that holds the tooltip
document.write('<div style="color: '+fcolor+'; z-index: 2000; position: absolute; filter: alpha(opacity='+opacity+'); background-color: '+bcolor+'; border-style: '+borderstyle+'; border-width: '+borderwidth+'; border-color: '+bordercolor+'; font-family: '+font+'; font-size: '+fontsize+'; visibility: hidden;" id="'+ttname+'">');
document.write('Just an empty link!');
document.write('</div>');

var evnt;

// Author: Igor Savic
// Date: 15.03.2005
// Build for: Firefox 1.0.1

function GetAttributeValue(obj, attributename){	
	var i;
	var res;
	if (obj != "[object HTMLDivElement]"){
		for (i=0;i<obj.attributes.length;i++){
			if (obj.attributes[i].name == attributename){
				try{
					res = obj.attributes[i].value;
					break;
				} catch (Exception){
				}
			}
		}
	}
	return res;
} 

function ToolTip(evn) {
	var es;
	var tip="";
	if (ie){
		evnt = event;
		es = evnt.srcElement;	//event source
		if (es.tooltip != "" && es.tooltip != null) {
			tip = es.tooltip;
		}
	} else {
		evnt = evn;		
		es = evnt.originalTarget;
		tip=GetAttributeValue(es,"tooltip");		
	}
	if (tip != null && tip != "undefined" && tip != "") {
		getMouseXY(evnt);
		if (document.getElementById(ttname) != null) {		
			document.getElementById(ttname).style.visibility = "visible";
			document.getElementById(ttname).style.left = tempX+10;
			document.getElementById(ttname).style.top = tempY;
			document.getElementById(ttname).style.position = "absolute";
			document.getElementById(ttname).innerHTML = htmlFormat(tip);
		}
		if (instatus) {
			window.status = tip;
		}
	}
}

function hideToolTip() {
	//hide tooltip
	if (document.getElementById(ttname) != null) {
		document.getElementById(ttname).style.visibility = "hidden";
	}
	if (instatus) {
		window.status = "";
	}
}

function htmlFormat(text)
{
	//puts the text in table for better formatting
 	result = "<table><tr><td>" + text + "</td></tr></table>";
 	return result;
}

document.onmousemove = ToolTip;
document.onmouseout = hideToolTip;

function getMouseXY(e) {
	if (ie) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	} else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX;
		tempY = e.pageY;
	}  
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;} 
	return true;
}

