var cursoroffsetX=12; 
var cursoroffsetY=10; 

var offsetdivfrompointerX=110; 
var offsetdivfrompointerY=14; 

var showImg = true;

document.write('<div id="dtooltip" align=right dir=rtl></div>'); 
document.write('<img id="dpointer" src="imgr/home/arrowtooltip.gif">');

var ie=document.all;
var enabletip=false;

var tipobj=document.all? document.all["dtooltip"] : document.getElementById? document.getElementById("dtooltip") : "";

var pointerobj=document.all? document.all["dpointer"] : document.getElementById? document.getElementById("dpointer") : "";

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function disTip(thetext, thewidth, thecolor){
if (typeof(thewidth)!="undefined") tipobj.style.width=thewidth+"px";
if (typeof(thewidth)!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;

tipobj.innerHTML=thetext;

enabletip=true;

return false;

}

function tipPos(e){

if (enabletip){

var curX;
var curY;
var bFirefox = document.all ? 1 : 0;
curX = (!bFirefox) ? e.pageX : event.x;
curY = (!bFirefox) ? e.pageY-ietruebody().scrollTop-20 : event.y;

var nondefaultpos=false
curX=curX+ietruebody().scrollLeft;
curY=curY+ietruebody().scrollTop;

var winWidth=ietruebody().clientWidth; 
var winHeight=ietruebody().clientHeight;

var rightedge=winWidth-((!bFirefox) ? e.clientX : event.clientX)-cursoroffsetX;
var bottomedge=winHeight-((!bFirefox) ? e.clientY : event.clientY)-cursoroffsetY;

var leftedge=(cursoroffsetX<0)? cursoroffsetX*(-1) : -1000;

if (rightedge<tipobj.offsetWidth){
tipobj.style.left=curX-tipobj.offsetWidth+"px";
nondefaultpos=true;
}
else if (curX<leftedge)
tipobj.style.left="5px";
else{
tipobj.style.left=curX+cursoroffsetX-offsetdivfrompointerX+"px";
pointerobj.style.left=curX+cursoroffsetX+"px";
}
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-cursoroffsetY+"px";
nondefaultpos=true;
}
else{
tipobj.style.top=curY+cursoroffsetY+offsetdivfrompointerY+"px";
pointerobj.style.top=curY+cursoroffsetY+"px";
}
tipobj.style.visibility="visible";
if (!nondefaultpos && showImg == true)
pointerobj.style.visibility="visible";
else
pointerobj.style.visibility="hidden";
}
}

function unDisTip(){
enabletip=false;
tipobj.style.visibility="hidden";
pointerobj.style.visibility="hidden";
tipobj.style.left="-1000px";
tipobj.style.backgroundColor='';
tipobj.style.width='';

}

