/*For Mac with layout manager issues where css is loaded AFTER javascript load, this should resolve the
js css style change event*/

/*
 *	This is the function for adjusting the right and left navigation bar so the color will extend to the bottom
 *  of the page.
 *
 *	Author: Huming Tang
 */
function adjustNavigation()
{
	var staticHeight = document.getElementById("CENTER_SECTION").clientHeight;
	if (staticHeight<550)
		staticHeight=550;
	try{
		document.getElementById("left_nav").style.height = staticHeight + "px";
	}
	catch(e)
	{
		//do nothing case for pages with no left nav
	}
	document.getElementById("right_nav").style.height = (staticHeight+10) + "px";
	
	//adjust the search result page
	try
	{
		document.getElementById("content_nav_tc_white_left").style.height = staticHeight + "px";
		document.getElementById("content_nav_tc_white").style.height = staticHeight + "px";
	}
	catch(e2)
	{
	}
	
}

/*
 *	This is the function for loading the table css to have a uniformed look and feel for the tables
 *
 *	Author: Huming Tang
 */
function updateTable()
{
	var table = document.getElementsByTagName("table");  

	//exit if table doesn't exist
	if (table==null)
	{
		return;
	}
	
	for (index=0;index<table.length;index++)
	{
		
		if (table[index].getAttribute("name")=="content_table")
			var rows = table[index].getElementsByTagName("tr");   
			//exit if there is no row in table
			if (rows == null)
				return;
			for(i = 0; i < rows.length; i++){      
				if (i%2==0)
					rows[i].className="blue";
			}
	}

}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(adjustNavigation);
addLoadEvent(updateTable);
addLoadEvent(function() {
  /* more code to run on page load */ 
});





