/***********************************************
* Cool DHTML tooltip script II- © 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
***********************************************/
/*
How to use:
<a href="#" onMouseover="tooltip_show('This is multiline tooltip.<br>You can use HTML <b>tags</b>')"; onMouseout="tooltip_hide()"><img src="/images/help.gif" alt="" border="0"></a>
*/

var position = position||'bottom';

if (position=='bottom') {
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip
var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=12 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
} else { // position=top
var offsetfromcursorX=0 //Customize x offset of tooltip
var offsetfromcursorY=-10 //Customize y offset of tooltip
var offsetdivfrompointerX=-10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=-10//Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
}

var style=style||'gray';
var imagePath = imagePath||'/js/tooltip/'

var arrowimage=arrowimage||'arrow2.gif';

document.write('<div id="dhtmltooltip" class="'+style+'"></div>') //write out tooltip DIV
//document.write('<img id="dhtmlpointer" src="'+imagePath+'arrow_'+style+'_'+position+'.gif'+'">') //write out pointer image
document.write('<div id="dhtmlpointer"></div>') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

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

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

function positiontip(e){
if (enabletip){
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-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

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

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

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

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

function stm(t,s){
// Print error message if tipa and/or style unavailable
if(!t) t = ['Error!','No tip message available for this item!']
if (!s) s = ["white","red","","","",12,"white","black","","","",10,,,,"",5,,,,,"",,,,]
var ab="";var ap=""
var titCol=s[0]?"COLOR='"+s[0]+"'":""
var titBgCol=s[1]&&!s[2]?"BGCOLOR='"+s[1]+"'":""
var titBgImg=s[2]?"BACKGROUND='"+s[2]+"'":""
var titTxtAli=s[3]?"ALIGN='"+s[3]+"'":""
var txtCol=s[6]?"COLOR:'"+s[6]+"'":""
var txtBgCol=s[7]&&!s[8]?"BGCOLOR='"+s[7]+"'":""
var txtBgImg=s[8]?"BACKGROUND='"+s[8]+"'":""
var txtTxtAli=s[9]?"ALIGN='"+s[9]+"'":""
var tipHeight=s[13]? "HEIGHT='"+s[13]+"'":""
var brdCol=s[15]? "BGCOLOR='"+s[15]+"'":""
if(!s[4])s[4]="Verdana,Arial,Helvetica" 
if(!s[5])s[5]=1 
if(!s[10])s[10]="Verdana,Arial,Helvetica" 
if(!s[11])s[11]=1
if(!s[12])s[12]=200
if(!s[14])s[14]=0
if(!s[16])s[16]=0
if(!s[24])s[24]=10
if(!s[25])s[25]=10
hs=s[22]

var closeLink=hs==3?"<TD ALIGN=\'right\' style=\'font-size:"+s[5]+"px;font-family:"+s[4]+"\'><A HREF=\'javascript:void(0)\' ONCLICK=\'mig_hide(0)\' STYLE=\'text-decoration:none;color:"+s[0]+"\'><B>Close</B></A></TD>":""
var title=t[0]||hs==3?"<TABLE WIDTH=\'100%\' BORDER=\'0\' CELLPADDING=\'0\' CELLPADDING=\'"+s[16]+"\' "+titBgCol+" "+titBgImg+"><TR><TD "+titTxtAli+" style=\'font-size:"+s[5]+"px;font-family:"+s[4]+";color:"+s[0]+"\'><B>"+t[0]+"</B></TD>"+closeLink+"</TR></TABLE>":"";
var txt="<TABLE "+ab+" WIDTH=\'"+s[12]+"\' BORDER=\'0\' CELLSPACING=\'0\' CELLPADDING=\'"+s[14]+"\' "+brdCol+"><TR><TD>"+title+"<TABLE WIDTH=\'100%\' "+tipHeight+" BORDER=\'0\' CELLPADDING=\'"+s[16]+"\' CELLSPACING=\'0\' "+txtBgCol+" "+txtBgImg+"><TR><TD "+txtTxtAli+" "+ap+" VALIGN=\'top\' style=\'font-size:"+s[11]+"px;font-family:"+s[10]+";color:"+s[6]+"\'><ul style=\'margin:0 0 0 15px; padding:0;\'>"+t[1]+"</ul></TD></TR></TABLE></TD></TR></TABLE>"
tooltip_show(txt);
}

function htm() {
tooltip_hide();
}

document.onmousemove=positiontip

