
	/////////////////////////////////////
	//                                 //
	// jQuery Fading Menu Items Script //
	//                                 //
	// Ben Avery                       //
	// www.averywebdesign.com          //
	//                                 //
	/////////////////////////////////////

$(document).ready(function(){

	// control hover in/out fade speed
	var hoverSpeed = 300;
	var navigationDiv = "#nav";

	// remove link background images since we're re-doing the hover interaction below 
	// (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
	$(navigationDiv + " li").children("a.navlink").css({backgroundImage:"none"});
	
	
	// toggle colour bar shift on hover of nav items
	attachNavEvents("home");
	attachNavEvents("assessments");
	attachNavEvents("builds");
	attachNavEvents("contact");

	function attachNavEvents(id) {
		$(navigationDiv + " ." + id).mouseover(function() {
			// create pseudo-link and fade it in
			$(this).before('<div class="nav-' + id + '"></div>');
			$("div.nav-" + id).css({display:"none"}).fadeIn(hoverSpeed);
		}).mouseout(function() {
			// fade out & destroy pseudo-link
			$("div.nav-" + id).fadeOut(hoverSpeed, function() {
				$(this).remove();
			});
		});
	}
});

