$(document).ready(function() {
	
	//determine page URL
	pageURL = document.location.pathname;
	
	$("#topNav a").each(function() {
		linkURL = $(this).attr("href");
		/* strip 'index.php' from path checking */
		pageURL = pageURL.split("index.")[0];
		linkURL = linkURL.split("index.")[0];

		//compare page URL to left nav URLs (bolding current page)
		if(linkURL == pageURL) {
			$(this).addClass("selected");
			$(this).parents("td").addClass("selected");
			
			//end iteration
			return false;
		}
		
		
	});

});


// the following block of code hooks up the top nav flyouts
var flyoutIsOut = false;

$(document).ready(function() {
	
	$('.topNavCell').find('a.topNavLink').mouseover(function(){
		$('.flyout').css("display","none");
		$(this.parentNode).find('.flyout').css("display","block");
	});
	
	$('.flyout').mouseover(function(){
		$(this).stop().css("display","block");
		flyoutIsOut = true;
	});
	
	$('.flyout').mouseout(function(){
		$(this).css("display","none");
	});
	
	$('.topNavCell').find('a.topNavLink').mouseout(function(){
		$(this.parentNode).find('.flyout').css("display","none");
	});

});
