// JavaScript Document
//sets on state
    function setNav() {
        var navitems = document.getElementById('nav').getElementsByTagName('a'); //all anchor elements
        var host = "http://"+location.host; //host name
        var path = location.href.substring(host.length,location.href.lastIndexOf("/")+1); // path name
        //loop through all anchors in the nav and if it's the current page or within the current
        //path, add the "on" class to it
        for ( var i = 0; i<navitems.length; i++ ) {
			//highlight nav for index pages
            if ( navitems[i].href.toLowerCase() == location.href.toLowerCase()) {
                navitems[i].className += " on";
            }
            
			//highlight nav for sub pages
			if ( navitems[i].href.toLowerCase().match(path.toLowerCase()) && path !== "/") { 
				navitems[i].className += " on";
			}
        }
		buildBreadcrumb();
    }
	
	window.onload = setNav;