/* --- Note: modifications to this file are discouraged. Check the documentation before making any changes to this file. --- */
function onloadFunctions(){ 
//apply a minimum height to the 'main' div when it is shorter then the 'sidebar' div
	var columnMain=document.getElementById('main')
	var columnSidebar=document.getElementById('sidebar')
		
		if (columnSidebar.offsetHeight >= columnMain.offsetHeight) {
			//IE 6 and less does not reconize min-height, therefore adjust height
			if (navigator.userAgent.indexOf('MSIE 6.0')!=-1 || navigator.userAgent.indexOf('MSIE 5.5')!=-1 && navigator.userAgent.indexOf('Opera')==-1) {
				columnMain.style.height=(columnSidebar.offsetHeight +5) + 'px';
			}else{
				columnMain.style.minHeight=(columnSidebar.offsetHeight +5) + 'px';
			}
		}


		//adjust widths for Opera
	if(navigator.userAgent.indexOf('Opera')!=-1) {
		document.getElementById('header_container').style.width=58.5 + 'em';
		document.getElementById('banner_graphic').style.width=58.5 + 'em';
		document.getElementById('wrapper').style.width=58.5 + 'em';
		document.getElementById('columns').style.width=58.5 + 'em';
		document.getElementById('sidebar').style.width=16+ 'em';
				if (document.getElementById('one_column')) {
					document.getElementById('main').style.width=55.5 + 'em';
				}else{
					document.getElementById('main').style.width=39.5 + 'em';
				}
		document.getElementById('footer').style.width=58.5 + 'em';	
		} 
}


// Global navigation script
// Inspired by http://www.alistapart.com/articles/whereami
// Modified February 6, 2007, granroth@msu.edu
//
// Show where you are.
//  Provide a custom id, #active, on the global link for the section you are in.
// 
// The first argument is the id of the global navigation container element.
// The second argument is the depth of the directory that contains the sections.
// i.e., if <ul id="nav"> and the main sections are the first level directories, 
//   use globalNav("nav",1)

function globalNav(id,categoryDepth) 
{    
    // Get the category from the URL
    var currentCat = getCategory(window.location.pathname, categoryDepth);
  
    // Collect the anchors in the global navigation as an array.
    var navNode = document.getElementById(id);
    var navLinks = navNode.getElementsByTagName("a");    
    
    // Compare category from URL to categories in the anchors
    if (currentCat.length > 0) { 
        for (var i=0; i<navLinks.length; i++){
            var navLink = navLinks[i].pathname;
            var navCat = getCategory(navLink, categoryDepth);
			
            // If the categories match, tag the anchor with id="active"
            if (navCat == currentCat){
                navLinks[i].setAttribute("id","active");
                return true;
            }
        }
    } else {
        // There is no category, so assume root level of the site.
        // Set the "Home" link, first in the array, as a match.
        navLinks[0].setAttribute("id","active");
        return true;
    }
    return false;
}


function getCategory(path,depth)
{

    // IE does not start some paths with a slash, while other browsers do. 
    // Make sure there is a slash at the beginning of the file path.
    if (path.substr(0,1) !== "/"){
        path = "/"+path;
    }
    var splitPath = path.split("/");
    var category = splitPath[depth];
    
    return category;
}



// Fire up functions using the adddomloadevent.js function
addDOMLoadEvent(function() {
    onloadFunctions()
});
//Change categoryDepth parameter (the number) here if your site is not in the root of the domain
addDOMLoadEvent(function () {
	globalNav('navGlobal',1);
});




	