/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (window.ns6||window.ie){
if (typeof thewidth!="undefined") window.tipobj.style.width = thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") window.tipobj.style.backgroundColor = thecolor
window.tipobj.innerHTML=thetext
window.enabletip=true
return false
}
}

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

var leftedge=(window.offsetxpoint<0)? window.offsetxpoint*(-1) : -1000

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

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

function hideddrivetip(){
if (window.ns6||window.ie){
window.enabletip=false
window.tipobj.style.visibility="hidden"
window.tipobj.style.left="-1000px"
window.tipobj.style.backgroundColor=''
window.tipobj.style.width=''
}
}


function ddriveBootstrap() {
window.offsetxpoint=-60 //Customize x offset of tooltip
window.offsetypoint=20 //Customize y offset of tooltip
window.ie=document.all;
window.ns6=document.getElementById && !document.all;
window.enabletip=false;
if (window.ie||window.ns6)
window.tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";

document.onmousemove=positiontip;
}
