	$(document).ready(function(){
	
		// 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)
		// we also want to only remove the image on non-selected nav items, so this is a bit more complicated
		$(".nav3").children("li").each(function() {
			var current = "nav3 current-" + ($(this).attr("class"));
			var parentClass = $(".nav3").attr("class");
			if (parentClass != current) {
				$(this).children("a").css({backgroundImage:"none"});
			}
		});	


		// create events for each nav item
	attachNavEvents(".nav3", "careershr");
		attachNavEvents(".nav3", "gallery");
		attachNavEvents(".nav3", "ourstory");
		attachNavEvents(".nav3", "offersignup");
		attachNavEvents(".nav3", "press");
		attachNavEvents(".nav3", "contact");
		attachNavEvents(".nav3", "location");

		function attachNavEvents(parent, myClass) {
			$(parent + " ." + myClass).mouseover(function() {
				$(this).append('<div class="nav3-' + myClass + '"></div>');
				$("div.nav3-" + myClass).css({display:"none"}).fadeIn(200);
			}).mouseout(function() {
				$("div.nav3-" + myClass).fadeOut(200, function() {
					$(this).remove();
				});
			}).mousedown(function() {
				$("div.nav3-" + myClass).attr("class", "nav3-" + myClass + "-click");
			}).mouseup(function() {
				$("div.nav3-" + myClass + "-click").attr("class", "nav3-" + myClass);
			});
		}



	});
