$(document).ready(function(){

	//$("ul.subnav").parent().append("<span>a</span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("#nav li div.parent").hover(function() { //When trigger is clicked...
		$("#nav li ul li:last-child").addClass("no-border");
		$("#nav li ul li:first-child").addClass("border-top");
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").show(); //Drop down the subnav on click

		$(this).parent().hover(function() {			
		}, function(){			
			$(this).parent().find("ul.subnav").hide(); //When the mouse hovers out of the subnav, move it back up			
			//$(this).removeClass('selected-hover');
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
			//$(this).parent().addClass('selected-hover');
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"			
	});
	
	$("#zone-bar li em").click(function() {
		   		var hidden = $(this).parents("li").children("ul").is(":hidden");
		   		
				$("#zone-bar>ul>li>ul").hide()        
			   	$("#zone-bar>ul>li>a").removeClass();
			   		
			   	if (hidden) {
			   		$(this)
				   		.parents("li").children("ul").toggle()
				   		.parents("li").children("a").addClass("zoneCur");
				   	} 
			   });
	
	$("#zone-bar2 li em").click(function() {
		   		var hidden = $(this).parents("li").children("ul").is(":hidden");
		   		
				$("#zone-bar2>ul>li>ul").hide()        
			   	$("#zone-bar2>ul>li>a").removeClass();
			   		
			   	if (hidden) {
			   		$(this)
				   		.parents("li").children("ul").toggle()
				   		.parents("li").children("a").addClass("zoneCur");
				   	} 
			   });
	
	/*$("ul#topnav li").hover(function() { //Hover over event on list item
		$(this).css({ 'background-color' : '#8D8D8D'}); //Add background color and image on hovered list item
		$(this).find("span").show(); //Show the subnav
	} , function() { //on hover out...
		$(this).css({ 'background' : 'none'}); //Ditch the background
		$(this).find("span").hide(); //Hide the subnav
	});*/

});


/*sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);*/




