// JavaScript Document
//
// TOOLTIPS ON (?) FIELDS...
//
// tooltip(this,'Here goes <b>layouted</b> tooltip text...')

function balloontooltip(obj,txt,ancTxt,ancURL)
{
  myPosition = findPos(obj);
  
  txt = (typeof txt == 'undefined') ? obj.alt : txt;
  document.getElementById('balloonTooltipParagraph').innerHTML = txt;
  
  ancURL = (typeof ancURL == 'undefined') ? '' : ancURL;
  if (document.getElementById('balloonTooltipAnchor') != null) 
  	document.getElementById('balloonTooltipAnchor').href = ancURL;
  
  ancTxt = (typeof ancTxt == 'undefined') ? '' : ancTxt;
  ancURLResourcebundle = (typeof ancURLResourcebundle == 'undefined') ? '' : ancURLResourcebundle;

  if (document.getElementById('balloonTooltipAnchor') != null) 
  	document.getElementById('balloonTooltipAnchor').innerHTML =ancTxt;
    
  myTooltip = document.getElementById('balloonTooltip');
  myTooltip.style.left = (myPosition[0] - 38 + 3)+"px";
  myTooltip.style.top = (myPosition[1] - myTooltip.offsetHeight + 2)+"px";
  myTooltip.style.visibility = "visible";
  
}

function balloontooltipHide()
{
  document.getElementById("balloonTooltip").style.visibility = "hidden";
}

function ttpKeepAlive(obj)
{
  document.getElementById(obj.id).style.visibility = "visible";
}

function ttpHide(obj)
{
  document.getElementById(obj.id).style.visibility = "hidden";
}

//
// THIS IS TAKEN FROM 
// http://www.quirksmode.org/js/findpos.html
//

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


