$(function(){
/***************************/
// set current location class for nav highlighting
function markLocation(){
	$('#nav a')
		.each(function(){
			if(this.href == location){
				$(this)
					.parents("li")
					.not ($("#nav").parents())
					.addClass("selected")
					.add()
					.children("a")
					.addClass("selected")
					;
			}
		});
};
markLocation();

// two part mouseover mouseout functionality for removing current location to allow a:hover styles
// and then returning the nav item for the current page back to a selected state
$('#nav a')
	.mouseover(function(){
		$('#nav *').removeClass("selected");
	});
$('#nav a')
	.mouseout(function(){
		markLocation();
	});
/***************************/
});
