sfHover = function() {
	var sfEls = document.getElementById("mainmenu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// JavaScript Document
window.onload = function initPage(){
	//openmenu();
	//highlightMainMenuLink();
	//highlightSubPage();
}
window.afterpageload

function openmenu(){
	var bodyID = document.body.id;

	if(bodyID.indexOf("-") != -1){
		index = bodyID.indexOf("-");
		bodyID = bodyID.substring(0, index);
	}

	if (document.getElementById("mm" + bodyID)){
		mmlink = document.getElementById("mm" + bodyID);
		mmlink.parentNode.className = 'active';
		mmlink.title = 'The Section you are Currently Browsing';
	}

	
	if(document.getElementById(bodyID + "Menu")){
		menu = document.getElementById(bodyID + "Menu");
		menu.className = "sidenav";
		menu.id = "its";
	}
}

function highlightMainMenuLink(){
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	
	if (document.getElementById && document.getElementById("mainmenu")) {
		navRoot = document.getElementById("mainmenu");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				if (node.childNodes[0].href){
					href = node.childNodes[0].href;
					subpage = href.substring(href.lastIndexOf('/') + 1);
					if(subpage == sPage && node.className != 'snh'){
						node.className = 'active';
						node.childNodes[0].title = 'The Section you are Currently Browsing';
					}
				}
	   		}
		}
	}
}

function highlightSubPage(){
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	
	if (document.getElementById && document.getElementById("its")) {
		navRoot = document.getElementById("its");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				if (node.childNodes[0].href){
					href = node.childNodes[0].href;
					subpage = href.substring(href.lastIndexOf('/') + 1);
					if(subpage == sPage && node.className != 'snh'){
						node.className = 'highlite';
						node.childNodes[0].title = 'The Page you are Currently Viewing';
					}
				}
	   		}
		}
	}
}

function date(){
	CurrentDate = new Date();
	
	var months=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	var month=months[CurrentDate.getMonth()];
	var days= new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
	var day=days[CurrentDate.getDay()];
	
	//display date as Friday, April 21, 2000
	document.write(day + " " + month + " " + CurrentDate.getDate() + ", " + CurrentDate.getFullYear());
	//document.write(month + " " + CurrentDate.getDate() + ", " + CurrentDate.getFullYear());
}

function togglesidebar(){
	if (document.getElementById) {
		wrap = document.getElementById("wrapper");
		tslink = document.getElementById("inToggleSidebar");
		if (wrap.className == ""){
			wrap.className = 'sidebarhidden';
			tslink.title = "Collapse the Content Area (showing the Side Bar)"
		}
		else{
			wrap.className = "";
			tslink.title = "Expand the Content Area (removing the Side Bar)"
		}
	}
}