var Toolsoffsetxpoint=-30 //Customize x offset of tooltip
var Toolsoffsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
if (ie||ns6)
var Toolstipobj=document.getElementById('toolTip');

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function Toolspositiontip(e){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-Toolsoffsetxpoint : window.innerWidth-e.clientX-Toolsoffsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-Toolsoffsetypoint : window.innerHeight-e.clientY-Toolsoffsetypoint-20

var leftedge=(Toolsoffsetxpoint<0)? Toolsoffsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<Toolstipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
Toolstipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-Toolstipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-Toolstipobj.offsetWidth+"px"
else if (curX<leftedge)
Toolstipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
Toolstipobj.style.left=curX+Toolsoffsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<Toolstipobj.offsetHeight)
Toolstipobj.style.top=ie? ietruebody().scrollTop+event.clientY-Toolstipobj.offsetHeight-Toolsoffsetypoint+"px" : window.pageYOffset+e.clientY-Toolstipobj.offsetHeight-Toolsoffsetypoint+"px"
else
Toolstipobj.style.top=curY+Toolsoffsetypoint+"px"

}
