// Controls Main Navigation Tab ON State

function initNav(){
	if (document.getElementById){
			var nav = document.getElementById('nav');  	//finds nav element
			var navas = nav.getElementsByTagName('a'); 	//finds all anchors within nav
			for (var a=0; a<navas.length; a++){		//cycles through each link
				var currenthref=String(navas[a].href);	//assigns current link href to a string
				var currentloc=String(document.location);	//assigns current document url to a string
			
				//if the current link href matches the document url the anchor parent node is given an id
				if (unescape(currenthref)==unescape(currentloc)){
					navas[a].parentNode.id ="current";
				}
			}
	  	}
		//This work around looks for unique ID on the blog pages to set the blog tab to the id 'current'
	if(document.getElementById('bodyblog')){
		var tab = document.getElementById('blog-tab');
		tab.id = "current";
	}
}

window.onload = initNav;
		