// Fields
var o_dhtt=null;
var o_minWidth;
var o_maxWidth;
var o_offsetX=10;
var o_offsetY=20;
var ie=document.all;
var ns6=(document.getElementById && !document.all);
// Functions
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function glib_dhtmltooltipshow(id,html,minW,maxW){
if(html.length == 0) return false;
if(html.replace(/^\s+|\s+$/g,'') == '') return false;
if(ns6||ie){
o_dhtt=document.all? document.all['odhtt_'+id] : document.getElementById? document.getElementById('odhtt_'+id) : ''
if(typeof minW != "undefined"){
o_minWidth = minW;
}else{
o_minWidth = 10;
}
if(typeof maxW != "undefined"){
o_maxWidth = maxW;
}else{
o_maxWidth = 500;
}
if(o_dhtt != null){
o_dhtt.innerHTML=html;
}
}
return false;
}
function glib_dhtmltooltiphide(){
if((ns6||ie) && (o_dhtt != null)){
o_dhtt.style.visibility="hidden"
o_dhtt.style.left="-1000px"
o_dhtt.style.backgroundColor=''
o_dhtt.style.width=''
o_dhtt=null;
}
}
function positiontip(e){
if(o_dhtt != null){
if((o_dhtt.offsetWidth-10) > o_maxWidth){
o_dhtt.style.width = o_maxWidth+"px";
}
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) - o_offsetX) : ((window.innerWidth - e.clientX) - (o_offsetX - 20))
var bottomedge= (ie && !window.opera)? ((ietruebody().clientHeight - event.clientY) - o_offsetY) : ((window.innerHeight - e.clientY) - (o_offsetY - 20))
var leftedge=(o_offsetX < 0)? (o_offsetX*(-1)) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if(rightedge < o_dhtt.offsetWidth){
//move the horizontal position of the menu to the left by it's width
o_dhtt.style.left=ie? (((ietruebody().scrollLeft + event.clientX) - o_dhtt.offsetWidth) + "px") : (((window.pageXOffset+e.clientX) - o_dhtt.offsetWidth) + "px")
}else if(curX < leftedge){
o_dhtt.style.left="5px"
}else{
//position the horizontal position of the menu where the mouse is positioned
o_dhtt.style.left=((curX + o_offsetX) + "px");
}
//same concept with the vertical position
if(bottomedge < o_dhtt.offsetHeight){
o_dhtt.style.top=ie? (((ietruebody().scrollTop + event.clientY) - (o_dhtt.offsetHeight - o_offsetY)) + "px") : (((window.pageYOffset + e.clientY) - (o_dhtt.offsetHeight - o_offsetY)) + "px")
}else{
o_dhtt.style.top=((curY + o_offsetY)+"px");
}
if(o_dhtt.offsetWidth < o_minWidth) o_dhtt.style.width = (o_minWidth+'px');
o_dhtt.style.visibility="visible";
}
}
// Document
document.onmousemove=positiontip;
