// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

function gotoURL(u)
{
	document.location = u;
}

function turnon(i)
{
	if (document.getElementById || (document.all && !document.GetElementById))
	{
		i.style.backgroundColor = "#96A5C3";
		i.style.cursor = "hand";
	}
}
	
function turnoff(i)
{
	if (document.getElementById || (document.all && !document.GetElementById))
	{
		i.style.backgroundColor = "#425C92";
		i.style.cursor = "";
	}
}

function openNewWindow(url, width, height, name)
{
  width  = width  ? width  : 600;
  height = height ? height : 500;
  name   = name   ? name : "popup";
  var left = (screen.width - width) / 2;
  var top  = (screen.height - height) / 2;
  window.open(url,name,"width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=yes");
}

/*
 * Link Tabs - common way to show and hide tables
 */
window.LAST_TAB_NAME = '';
function setActiveLinkTab(tab_name)
{
  window.LAST_TAB_NAME = tab_name;
  switchTab(tab_name);
}

function switchTab(tab_name)
{
	var last_tab = document.getElementById(window.LAST_TAB_NAME);
	var last_tab_label = document.getElementById(window.LAST_TAB_NAME + '_label');
	var this_tab = document.getElementById(tab_name);
	var this_tab_label = document.getElementById(tab_name + '_label');
	if (last_tab != null)
	{
		last_tab.style.display = 'none';
		last_tab_label.className = '';
	}
	if (this_tab != null)
	{
		this_tab.style.display = 'block';
		this_tab_label.className = 'selected';
	}
	window.LAST_TAB_NAME = tab_name;
}

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if (IEmac && IE4)  // IE 4.5 blows out on testing window.onload
	{
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	}
	else if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}

function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
  {
		gSafeOnload[i]();
  }
}

startList = function() 
{
  if (document.all && document.getElementById) 
  {
    navRoots = document.getElementsByName("nav");
    for (navCount=0; navCount < navRoots.length; navCount++)
    {
      navRoot = navRoots[navCount];
      for (i=0; i<navRoot.childNodes.length; i++) 
      {
        node = navRoot.childNodes[i];
        if (node.nodeName=="LI") 
        {
          node.onmouseover=function() 
          {
            this.className+=" over";
          }
          node.onmouseout=function() 
          {
            this.className=this.className.replace(" over", "");
          }
        }
      }
    }
  }
}
SafeAddOnload(startList);

