//add dhtmltip
if(!document.getElementById('dhtmltooltip')){
newdiv = document.createElement("div");
newdiv.id = 'dhtmltooltip';
document.body.appendChild(newdiv);
}


var msie = ((navigator.userAgent.indexOf("MSIE")!= -1))? true : false; 
var firefox = ((navigator.userAgent.indexOf("Firefox")!= -1))? true : false; 
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=30 //Customize y offset of tooltip
var tippointerpos = 70;
var tippos = false;
var dtippointerclass = 'notset';
var tipshadow = false;
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
var enabletippointer = false;
var tippointermove = false;

if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
var dtippointer;

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px";
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
tipobj.innerHTML=thetext+'<span id="tipshadow" style="display:none; position:absolute; overflow:hidden"></span><span id="dtippointer" style="display:none; position:absolute"></span>';
dtippointerclass = 'notset';
dtippointer=document.all? document.all["dtippointer"] : document.getElementById? document.getElementById("dtippointer") : ""
tipshadow=document.all? document.all["tipshadow"] : document.getElementById? document.getElementById("tipshadow") : false
enabletippointer = true;
enabletip = true
return false
}
}

function dt(thetext){ ddrivetip(thetext);} 
function ht(){ hideddrivetip(); }

function positiontip(e){
if (enabletip){
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-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
tippointermove = false;
var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -3000

//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=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
tippointermove = 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+offsetxpoint+"px"
}

	//same concept with the vertical position
	if (bottomedge<tipobj.offsetHeight){
	tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";	
	tippos = 'bottom';
	}else{
	tipobj.style.top=curY+offsetypoint+"px";
	//tipobj.style.visibility="visible";	
	tippos = 'top';
	}
			
		if(enabletippointer==true){ 
				
			if(tippos=="top"){
			dtippointer.style.top = parseInt((dtippointer.offsetHeight)*-1)+'px';
				if(parseInt(dtippointer.style.top)==0){
				dtippointer.style.top = ((18)*-1)+'px';
				}
			} else {
			dtippointer.style.top = parseInt((tipobj.offsetHeight) - 2 )+'px';
			}
			dtippointer.style.display = ""; 				
		if(tippointermove==true){
			//tip moved to left
			newclass = dtippointerclass;
			if(tippos=='top'){ newclass = 'pointertopleft'; }else if(tippos=="bottom"){ newclass = 'pointerbottomleft'; }
			dtippointer.style.left = parseInt(tipobj.offsetWidth) - parseInt(dtippointer.offsetWidth) - 20 +'px';			
			}else{			
			if(tippos=='top'){ newclass = 'pointertop'; }else if(tippos=="bottom"){ newclass = 'pointerbottom'; }
			dtippointer.style.left = parseInt(tippointerpos)+'px';
			}
			
			
			if(newclass!=dtippointerclass){			
		 	dtippointer.className = newclass;
			dtippointerclass = newclass;		
				if(tippos=="top" && tipshadow!=false){
				tipshadow.style.display = "";
				tipshadow.style.left = '0px';
				tipshadow.style.top = (parseInt(tipobj.offsetHeight) - 1 )+'px';
				tipshadow.style.width = (parseInt(tipobj.offsetWidth) - 1)+'px';
				tipshadow.innerHTML = '';
				}
			}			
		}	
		
		tipobj.style.visibility="visible";	
		
	}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

function DoSearch(frmname){
	getE(frmname).submit();
}
document.onmousemove=positiontip;