var tooltipwidth=250;
var tooltipheight=50;

function highlight(ob)
{
	ob.style.background='#FFFFFF';
}

function unhighlight(ob)
{
	ob.style.background='#FFFFFF';;
}

function addshadow(text,div)
{
	
	result='<table width='+tooltipwidth+' cellspacing=0 cellpading=0>';
	result=result+'<tr><td width="10" height="15" style="font-size: 1px; border-bottom: 1px solid #000000;">&nbsp;</td><td width="11" height="15" style="font-size: 1px;">&nbsp;</td><td width="'+(tooltipwidth-25)+'" height="15" style="font-size: 1px; border-bottom: 1px solid #000000;">&nbsp;</td></tr>';
	result=result+'<tr><td class="tool_tip_shadow" colspan="3">'+text+'</td></tr></table>';

	document.getElementById(div+'_shadow').innerHTML=result;
	document.getElementById(div+'_shadow').style.visibility='visible';	
	document.getElementById(div+'_shadow').style.top=parseInt(document.getElementById(div).style.top)+3;
	document.getElementById(div+'_shadow').style.left=parseInt(document.getElementById(div).style.left)+3;	
}


function addshadow2(text,div)
{
	
	result='<table width='+tooltipwidth+' cellspacing=0 cellpading=0>';
	result=result+'<tr><td class="tool_tip_shadow" colspan="3">'+text+'</td></tr>';
	result=result+'<tr><td width="10" height="15" style="font-size: 1px; border-top: 1px solid #000000;">&nbsp;</td><td width="11" height="15" style="font-size: 1px; background: url(img/tool_tip/left_ear_bottom_shadow.gif);">&nbsp;</td><td width="'+(tooltipwidth-25)+'" height="15" style="font-size: 1px; border-top: 1px solid #000000;">&nbsp;</td></tr></table>';	

	document.getElementById(div+'_shadow').innerHTML=result;
	document.getElementById(div+'_shadow').style.visibility='visible';	
	document.getElementById(div+'_shadow').style.top=parseInt(document.getElementById(div).style.top)+3;
	document.getElementById(div+'_shadow').style.left=parseInt(document.getElementById(div).style.left)+3;	
}

function moveshadow(div)
{
	document.getElementById(div+'_shadow').style.top=parseInt(document.getElementById(div).style.top)+3;
	document.getElementById(div+'_shadow').style.left=parseInt(document.getElementById(div).style.left)+3;	
}

function hideshadow(div)
{
	document.getElementById(div+'_shadow').innerHTML='';
	document.getElementById(div+'_shadow').style.visibility='hidden';	
	document.getElementById(div+'_shadow').style.top=-1000;
	document.getElementById(div+'_shadow').style.left=-1000;	
}

function showtooltip(evt,ob,text,div)
{
	var result;
	var x=MousePos(evt,'x');
	var y=MousePos(evt,'y');	

  	var xCurrScreenPos = (window.pageXOffset) ? window.pageXOffset : document.body.scrollLeft;  
  	var yCurrScreenPos = (window.pageYOffset) ? window.pageYOffset : document.body.scrollTop;
	
  	var x2=x-xCurrScreenPos;
	var y2=y-yCurrScreenPos;	
  	if (document.body.clientHeight-y2<tooltipheight)
  	{
		result='<table width='+tooltipwidth+' cellspacing=0 cellpading=0>';		
		result=result+'<tr><td class="tool_tip_top" colspan="3">'+text+'</td></tr>';  		  		
		result=result+'<tr><td width="10" height="15" style="font-size: 1px; border-top: 1px solid #000000;">&nbsp;</td><td width="11" height="15" style="font-size: 1px; background: url(img/tool_tip/left_ear_bottom.gif);">&nbsp;</td><td width="'+(tooltipwidth-25)+'" height="15" style="font-size: 1px; border-top: 1px solid #000000;">&nbsp;</td></tr></table>';		
		
		document.getElementById(div).innerHTML=result;
		document.getElementById(div).style.visibility='visible';	
		document.getElementById(div).style.top=y-58;
		document.getElementById(div).style.left=x;			
		addshadow2(text,div);
  	} 
  	else
  	{
		result='<table width='+tooltipwidth+' cellspacing=0 cellpading=0>';
		result=result+'<tr><td width="10" height="15" style="font-size: 1px; border-bottom: 1px solid #000000;">&nbsp;</td><td width="11" height="15" style="font-size: 1px; background: url(img/tool_tip/left_ear.gif);">&nbsp;</td><td width="'+(tooltipwidth-25)+'" height="15" style="font-size: 1px; border-bottom: 1px solid #000000;">&nbsp;</td></tr>';
		result=result+'<tr><td class="tool_tip" colspan="3">'+text+'</td></tr></table>';  		

		document.getElementById(div).innerHTML=result;
		document.getElementById(div).style.visibility='visible';	
		document.getElementById(div).style.top=y+8;
		document.getElementById(div).style.left=x;		
		addshadow(text,div);		
  	}
}

function movetooltip(evt,ob,text,div)
{
	showtooltip(evt,ob,text,div);
}

function hidetooltip(evt,ob,div)
{
	document.getElementById(div).innerHTML='';
	document.getElementById(div).style.visibility='hidden';	
	document.getElementById(div).style.top=-1000;
	document.getElementById(div).style.left=-1000;
	hideshadow(div);
}

/*
function MousePos(evt,coord)
{		
  var e = (window.event) ? window.event : evt;
  var xMousePosMax = (window.pageXOffset) ? window.pageXOffset : document.body.scrollLeft;  
  var yMousePosMax = (window.pageYOffset) ? window.pageYOffset : document.body.scrollTop;
  x=xMousePosMax+e.clientX;
  y=yMousePosMax+e.clientY;

  if (coord=='x')
	  return x;
  if (coord=='y')
	  return y;
}
*/