// JavaScript Document


var tooltipobj = document.all ? document.all["tooltip"] : document.getElementById ? document.getElementById("tooltip") : "";

var tooltiptextobj = document.all ? document.all["tooltip_text"] : document.getElementById ? document.getElementById("tooltip_text") : "";

var tooltipimgobj = document.all ? document.all["tooltip_img"] : document.getElementById ? document.getElementById("tooltip_img") : "";

var tooltipcontainerobj = document.all ? document.all["tooltip_container"] : document.getElementById ? document.getElementById("tooltip_container") : "";

var tooltipshadowobj = document.all ? document.all["tooltip_shadow"] : document.getElementById ? document.getElementById("tooltip_shadow") : "";


var offsetxpoint = 36 //Customize x offset of tooltip
var offsetypoint = -30 //Customize y offset of tooltip
var ie = document.all;
var ns6 = document.getElementById && !document.all;
var enabletip = false;


function showtooltip(tiptext,tipimg,tipwidth) {
	
	if (show_tooltips) {

		if (tiptext.length > 60 && !tipwidth)
		tooltipobj.style.width = '360px';
		else if (tipwidth == 'wide')
		tooltipobj.style.width = '426px';
		else if (tipwidth == 'xwide')
		tooltipobj.style.width = '476px';
		else
		tooltipobj.style.width = '240px';
		
		if (tiptext.length < 30)
		tooltiptextobj.style.whiteSpace = 'nowrap';
		else
		tooltiptextobj.style.whiteSpace = 'normal';


		tooltipimgobj.src = '../img/x.gif';
		tooltipimgobj.style.margin = '0';
		
		if (tipimg) {
		tooltipimgobj.src = tipimg;
		tooltipimgobj.style.margin = '20px 0 0 0';
		}

	tooltiptextobj.innerHTML = tiptext;
	
	document.getElementById("tooltip").style.display = 'block';
	enabletip = true;
	
	div_width = tooltipcontainerobj.offsetWidth;
	div_height = tooltipcontainerobj.offsetHeight;
	tooltipshadowobj.style.width = div_width+'px';
	tooltipshadowobj.style.height = div_height+'px';

	}
}

function hidetooltip() {
document.getElementById("tooltip").style.display = 'none';
}




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




function positiontooltip(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
	
	var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
	
	//if the horizontal distance isn't enough to accomodate the width of the context menu
	//move the horizontal position of the menu to the left by it's width
	if (rightedge<tooltipobj.offsetWidth)
	tooltipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tooltipobj.offsetWidth-20+"px" : window.pageXOffset+e.clientX-tooltipobj.offsetWidth-20+"px"
	else if (curX<leftedge)
	tooltipobj.style.left="5px"
	//position the horizontal position of the menu where the mouse is positioned
	else
	tooltipobj.style.left=curX+offsetxpoint+"px"
	
	//same concept with the vertical position
	if (bottomedge<tooltipobj.offsetHeight)
	tooltipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tooltipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tooltipobj.offsetHeight-offsetypoint+"px"
	else
	tooltipobj.style.top=curY+offsetypoint+"px"
	tooltipobj.style.diplay="block";
	}
}



document.onmousemove=positiontooltip;


