// JavaScript Document


/* Scrips for popup information boxes */

function showSummary(linkObj, sbID){
  showSummaryCore(linkObj, sbID, "rollover");
}

function showSummarySmall(linkObj, sbID){
  showSummaryCore(linkObj, sbID, "rollover_small");
}

function showSummaryCore(linkObj, sbID, className){
  var so = document.getElementById("summary_"+sbID);
  if (typeof linkObj == "string")
		linkObj = document.getElementById(linkObj);  
  var l = getDist(linkObj,false);
  var t = getDist(linkObj,true);
  if(so){
    so.className=className;
    so.style.top= (t+linkObj.offsetHeight)+"px";
    so.style.left= l +"px";
	
/*	
    so.style.top= (((t+so.offsetHeight)>document.body.offsetHeight)?(t-so.offsetHeight):(t+linkObj.offsetHeight))+"px";
    so.style.left= (((l+so.offsetWidth)>document.body.offsetWidth)?(document.body.offsetWidth-so.offsetWidth):(l))+"px";
*/
  }
}

function hideSummary(sbID){
  var so = document.getElementById("summary_"+sbID);
  if(so){
    so.className="hidden";
  }
}

function getDist(obj,isTop){
  var acum=0;
  while(obj){
    acum+=isTop?obj.offsetTop:obj.offsetLeft;
    obj=obj.offsetParent;
  }
  return acum
}

function color(so,n){
	if (typeof so == "string")
		so = document.getElementById(so);
	if(so){
		if(n==1){
			so.className = "orange";
		}
		else{
			so.className = "lightblue";
		}
	}
}

function visible(so){
	if (typeof so == "string")
		so = document.getElementById(so);
	if(so)
	{
		so.className = "visible";
	}
}

function invisible(so){
	if (typeof so == "string")
		so = document.getElementById(so);
	if(so)
	{
		so.className = "invisible";
	}
}

function hide(so){
	if (typeof so == "string")
		so = document.getElementById(so);
	if(so)
		so.style.display = "none";
}

function showInline(so){
	if (typeof so == "string")
		so = document.getElementById(so);
	if(so)
		so.style.display = "inline";
}

function showBlock(so){
	if (typeof so == "string")
		so = document.getElementById(so);
	if(so)
		so.style.display = "block";
}


/* Highlight background */

function highlight(elementID, bool) { /* bool = true clears background */
	
	var e = document.getElementById(elementID);
	
	if (e) {
		
		if(bool) {
			e.style.backgroundColor = "orange";
		}
		else {
			e.style.backgroundColor = "white"; /* assumes body background is white */
		}
	}
}


/* Additional scripts */

function SymError()
{
  return true;
}

