/*  !!!!!!! this file will only work with tiara !!!
--edited by cher 10.OCT.2006
too use with another site please read all comments under the NETSCAPE if statment
****/

function calc_nav_height()
{
  var browser = '';
  
  browser = navigator.appName;
  // test line alert ("before if stmt - browser: " + browser);
  //checks IF browser is IE 
  if(browser == "Microsoft Internet Explorer")
  {
    //set page height into variable
   	var pageHeight = document.body.scrollHeight; 
	var headerHeight = document.getElementById("headerTable").offsetHeight; 
	var navHeight = document.getElementById("TableNav").offsetHeight; 
	var bottomHeight = document.getElementById("TDbottom").offsetHeight 
	var srchHeight =  document.getElementById("searchBoxes").offsetHeight; 
	var minusHeight = headerHeight + navHeight + bottomHeight + srchHeight;
	var finalHeight = pageHeight - minusHeight; 
	var tdbelowNav = document.getElementById("TDbelowNav"); 
	tdbelowNav.style.height = finalHeight;
	
 //if not IE then "else if" browser Netscape/FF?  both will return Netscape
 }else if(browser == "Netscape")
  {
    //total page height
    var pageHeight = document.body.offsetHeight;
	//header in pageID 30 and in default page with does not use header
	var headerHeight = document.getElementById("headerTable").offsetHeight; 
	//height of total deptlinks table
	var navHeight = document.getElementById("TableNav").offsetHeight; 
	//height of footer since it has 300px spacer at bottom
	var bottomHeight = document.getElementById("TDbottom").offsetHeight; 
	//height of both search boxes in deptlinks
	var srchHeight =  document.getElementById("searchBoxes").offsetHeight; 
	//total amount needed to subtract from total height of page
	var minusHeight = headerHeight + navHeight + bottomHeight + srchHeight;
	//find amount side deptlinks needs to grow if any
	var finalHeight = pageHeight - minusHeight; 
	//set table TD element into a variable
	var tdbelowNav = document.getElementById("TDbelowNav"); 
	//set that TD's height via a style tag
	tdbelowNav.style.height = finalHeight+"px"; 
  }
   
 /**
  1) either cut and past this code into bottom of the footer
  or include this file with the lines below
  <script src="assets/images/includes/calc_nav_height_commented.js"></script>
   
   2) add this to the both BODY tag in STYLES section of the manager
   onLoad="calc_nav_height();"   ex.<body onLoad="calc_nav_height();">  
   **/
  //TEST LINE if having problems uncomment this line 
  //TEST    alert( "totalHeight: " + pageHeight + "- minus " + minusHeight +"\n \tgrow side nav by : "+ finalHeight + "pxs"); 
	
} // end function	