function getObjectRef(n, d) {

  //based off MM_findObj v4.01
  //n: String
  //d: Document (for netscape4 recursion)

  var p,i,x;  
  
  if(!d) 
  	d=document; 
  
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; 
	n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) 
  	x=d.all[n]; 
  
  for (i=0;!x&&i<d.forms.length;i++) 
  	x=d.forms[i][n];
	
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
  	x=getObjectRef(n,d.layers[i].document);
	
  if(!x && d.getElementById) 
  	x=d.getElementById(n); 
	
  return x;
}

function dump(obj, area) {
    strMessage = "";
    for(a in obj)
        if(typeof(area) == "undefined")
            strMessage += a + ': ' + obj[a] + '\n';
        else
            strMessage += '<b>' + a + '</b>' + ': ' + obj[a] + '<br>';
    if(typeof(area) != "undefined"){
        aobj = getObjectRef(area);
        aobj.innerHTML = strMessage;
    } else
        alert(strMessage);
}

function highlight(area) {
    obj = getObjectRef(area).style;
    if(obj) {
        obj.backgroundColor = highlightColor;
        obj.fontWeight = "bold";
    }
}

function unhighlight(area) {
    obj = getObjectRef(area).style;
    if(obj) {
        obj.backgroundColor = "";
        obj.fontWeight = "normal";
    }
}

function printSection() {

    if(section == 0) {
        //parent.frames[contentFrame].location = entireURL.replace("Content","Print");
        parent.frames[contentFrame].location = entireURL + "&print=1";
    } else 
        parent.frames[contentFrame].location = getObjectRef("section" + section).href.replace("Content","Print");

}

function changeSection(newSection) {

    // highlight.
    if(newSection != 0) highlight("lsection" + newSection);
    if(section != 0) unhighlight("lsection" + section);
    
    obj = getObjectRef("prevLink").style;
    if(newSection > 1) 
        obj.display = "";
    else
        obj.display = "none";
    
    obj = getObjectRef("nextLink").style;
    if(newSection < totalSections && newSection != 0) 
        obj.display = "";
    else
        obj.display = "none";
    
    section = newSection;
    
    // redirect frame
    if(section == 0) 
        parent.frames[contentFrame].location = entireURL;
    else 
        parent.frames[contentFrame].location = getObjectRef("section" + section).href;

}
