﻿
cursorcoords = [0,0];
tip = "";
pageLoaded = false;
function cursorCoordinates(e) {
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) {
		cursorcoords[0] = e.pageX;
		cursorcoords[1] = e.pageY;
	}
	else if (e.clientX || e.clientY) {
		cursorcoords[0] = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		cursorcoords[1] = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
}


function initMouseTracking() {
	if (document.layers) {
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = cursorCoordinates;
	} else if (document.all) {
		document.onmousemove = cursorCoordinates;
	} else if (document.getElementById) {
		document.onmousemove = cursorCoordinates;
	}
	tip = getObj("tiplayer");
}


function floatingToolTipShow(body,allowUpdates) {
	if(pageLoaded === true){
		tip.innerHTML = body;
		tip.style.left = cursorcoords[0]+"px";
		tip.style.visibility = "visible";

		var divHeight = 220;
		if(tip.offsetHeight){
			divHeight=tip.offsetHeight;
		}
		else if(tip.style.pixelHeight){
			divHeight=tip.style.pixelHeight;
		}

		tip.style.top = (cursorcoords[1]-divHeight-10)+"px";
		if(allowUpdates == true) {
			tiprefresh = setInterval('updateToolTip()',50);
		}
	}
}


function updateToolTip() {
	var divHeight = 220;
	if(tip.offsetHeight){
		divHeight=tip.offsetHeight;
	}
	else if(tip.style.pixelHeight){
		divHeight=tip.style.pixelHeight;
	}

	tip.style.top = (cursorcoords[1]-divHeight-10)+"px";
	tip.style.left = cursorcoords[0]+"px";
}


function floatingToolTipHide() {
	try{clearInterval(tiprefresh);}catch(err){}
	tip.style.visibility = "hidden";
	tip.style.top = "0px";
	tip.innerHTML = "";
}


function getObj(objID) {
    if(document.getElementById){
        return document.getElementById(objID);
    } else if (document.all){
        return document.all[objID];
    } else if (document.layers){
        return document.layers[objID];
    }
}
