$(document).ready(function(){
	$("#nav li a").mouseover(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
			var bb=$(this).attr("id");
			if (bb=="nav-who") {
				$(this).addClass("selecte_who");
			}
			else if(bb=="nav-what") {
				$(this).addClass("selecte_what");
			}
			else if(bb=="nav-how") {
				$(this).addClass("selecte_how");
			}
			else if(bb=="nav-resources") {
				$(this).addClass("selecte_resources");
			}
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
			var bb=$(this).attr("id");
			if (bb=="nav-who"){
				$(this).removeClass("selecte_who");
			} else if(bb=="nav-what") {
				$(this).removeClass("selecte_what");
			}
			else if(bb=="nav-how") {
				$(this).removeClass("selecte_how");
			}
			else if(bb=="nav-resources") {
				$(this).removeClass("selecte_resources");
			}
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

});