// -------------------------------------------------------------
//	Script for running the main index/navigation bar at the top
//  of the pages. 
//	Language = JQUERY 1.3.2 NOT Javascript standard!
// -------------------------------------------------------------

// get current URL and look for $_GET variables in the URL
var url = location.href;
if(url.indexOf("navID=") >= 0) {
	// split the value of ?navID=## if present in URL
	var navID = url.split("navID=")[1].split("&")[0];
} else {
	// else default to highlight HOME link as selected
	var navID = 0;
}

// set class of selected li element to selected
$("#linkArea ul li:eq("+navID+")").addClass("selected");

// add event listener to stop browser reloading an already selected link
$("#linkArea ul li a").click(lookupLink);

function lookupLink() {
	if(this.parentNode.className == "selected") 
		return false;
}

// fix style problem for mobile safari on iPhone
if(navigator.userAgent.toLowerCase().indexOf("iphone")>=0 && navigator.userAgent.toLowerCase().indexOf("safari")>=0) {
	$("div#linkArea ul li").css("margin", "0px 30px");
}
