var IE = document.all?true:false;
document.onmousemove = getMouseXY;
// Temporary variables to hold mouse x-y pos.s
var tempX = 0;
var tempY = 0;

// Main function to retrieve mouse x-y pos.s
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;
	};
	// catch possible negative values in NS4
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}
	// show the position values in the form named Show
	// in the text fields named MouseX and MouseY
	document.getElementById('MouseX').value = tempX;
	document.getElementById('MouseY').value = tempY;
	//return true;
}
function toolTip(oParentId,data) 
{
    var tip;

    this.show = toolTip_show;
    this.hide = toolTip_hide;
    
     
    this.tip = document.createElement("div");
    this.tip.style.position = 'absolute';
    this.tip.style.margin = '15px';
    this.tip.style.zIndex = '20000';
    this.tip.style.top = document.getElementById('MouseY').value;
    this.tip.style.left = document.getElementById('MouseX').value;
    this.tip.className = 'tooltip';
    this.tip.innerHTML = data;
    this.tip.style.display = 'none';
    this.tip.style.width = '200px';
    document.getElementById(oParentId).tooltip = this;
    document.getElementById(oParentId).onmousemove = function() {
        this.tooltip.tip.style.left = document.getElementById('MouseX').value;
        this.tooltip.tip.style.top = document.getElementById('MouseY').value;
    }   
    document.getElementById(oParentId).onmouseover = function() {
        this.tooltip.show(this.tooltip);
    }
    document.getElementById(oParentId).onmouseout = function() {
        this.tooltip.hide(this.tooltip);
    }
    if (document.getElementById('tipsHolder')) {
        document.getElementById('tipsHolder').appendChild(this.tip);
    } else {
        alert('Error ID:TipsHolder Cannot be found, Tooltips wont be deployed');
    }
    function toolTip_show(obj)
    {
       obj.tip.style.display = '';
    }
    function toolTip_hide(obj)
    {
        obj.tip.style.display = 'none';
    }
}
