// JavaScript Document
addLoadEvent(toggleBody);
addLoadEvent(toggleNav);
					 
function toggleNav(){
	var nav=document.getElementById("navigation");
	var url=location.pathname;
	var i;
	var elms=nav.getElementsByTagName("a");
	if(url){
		if(url.match("/about/") || url.match("/depts/")){
			elms[3].className="nav4_selected";
		}
		else if(url.match("/books/")){
			elms[0].className="nav1_selected";
		}
		else if(url.match("/articles/")){
			elms[1].className="nav2_selected";
		}
		else if(url.match("/services/")){
			elms[2].className="nav3_selected";
		}
		
	}
}

function toggleBody(){
	var url=location.pathname;
	var elmBody=document.getElementsByTagName("body");
	if(url){
		if(url.match("/about/")){
			elmBody[0].className="about";
		}
		else if(url.match("/books/")){
			elmBody[0].className="books";
		}
		else if(url.match("/articles/")){
			elmBody[0].className="articles";
		}
		else if(url.match("/services/")){
			elmBody[0].className="services";
		}
		
	}
}

function showMap(){
	var elm=document.getElementById("map");
	elm.className="show";
}

/*
	Add Load Event
*/
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
