<!--

var _top=0
var _left=0
var _eventopen=false

var distancecursorX=0 //Customize x offset of tooltip
var distancecursorY=0 //Customize y offset of tooltip

var offsetdivfrompointerX=5 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=5 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).


var ie=document.all
var ns6=document.getElementById && !document.all

function _show(_object) {

if (document.getElementById){
subobj=document.getElementById(_object)
_eventopen=true
//subobj.style.width = 200
//subobj.style.height = 100

subobj.style.left=_left
subobj.style.top=_top

subobj.style.display="block"
return false
}
else { return true }

}

function _close(subobj){
document.getElementById(subobj).style.display="none"
_eventopen=false
}
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function mousepos(e) {

if (_eventopen){
var nondefaultpos=false
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 winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-distancecursorX : winwidth-e.clientX-distancecursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-distancecursorY : winheight-e.clientY-distancecursorY

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

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<subobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
subobj.style.left=curX-subobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
subobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
subobj.style.left=curX+distancecursorX-offsetdivfrompointerX+"px"

}

//same concept with the vertical position
if (bottomedge<subobj.offsetHeight){
subobj.style.top=curY-subobj.offsetHeight-distancecursorY+"px"
nondefaultpos=true
}
else{
subobj.style.top=curY+distancecursorY+offsetdivfrompointerY+"px"
}
subobj.style.visibility="visible"
}
// when _eventopen is false
else {

var nondefaultpos=false
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 winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-distancecursorX : winwidth-e.clientX-distancecursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-distancecursorY : winheight-e.clientY-distancecursorY

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

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<200){
//move the horizontal position of the menu to the left by it's width
_left=curX+"px"
nondefaultpos=true
}
else if (curX<leftedge)
_left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
_left=curX+distancecursorX-offsetdivfrompointerX+"px"

}

//same concept with the vertical position
if (bottomedge<100){
_top=curY-distancecursorY+"px"
nondefaultpos=true
}
else{
_top=curY+distancecursorY+offsetdivfrompointerY+"px"
}


// end of _eventopen == false
}


}
document.onmousemove=mousepos
//-->
