
window.onload = function()
{

	highlightGlobalNav('header');
	highlightGlobalNav('topnav'); 
	highlightLocalNav('sidenav');

}


function highlightGlobalNav(navdiv)
{
	var thissection = window.location.toString().split('/')[3];
	var navul = document.getElementById(navdiv);
	if (navul) {
		var navanchors = navul.getElementsByTagName('a');
		if (navanchors) {
			for(var i = 0; i <= navanchors.length-1; i++) {
				if (navanchors[i].href.toString().split('/')[3] == thissection) {
					navanchors[i].className = 'here';
					break;
				} else {
					navanchors[i].className = 'nothere';
				}
			}
		}
	}
}


function highlightLocalNav(navdiv)
{
	var thispath = window.location.toString().split('#')[0].split('?')[0];
	var navwrap = document.getElementById(navdiv);
	
	if (navwrap) {
		var navanchors = navwrap.getElementsByTagName('a');
		if (navanchors) {
			for(var i = 0; i <= navanchors.length-1; i++) {
				if (navanchors[i].href == thispath) {
					navanchors[i].className = 'here';
					break;
				} else {
					navanchors[i].className = 'nothere';
				}
			}
		}
	}
}


//function to grab the value of our select box
function moveOn()
{
	var pageID = document.navigationForm.attorney.value;
	var page = window.location.href;
	//strip out page back to the /people/ directory
	var peopleDir = page.indexOf('/people/');
	var endString = page.indexOf('.html');
	if(endString==-1){
		//get the name of the current page
		var curPageStr = "index.html";
	}else{
		//get the name of the current page
		var curPageStr = page.substring(peopleDir+8,endString+5);
	}
	
	var urlStr = page.substring(0,peopleDir);
	
	urlStr+="/people/"+curPageStr+"?pageID="+pageID;
	
	
	document.location.href = urlStr;
	
}

