$(document).ready(function(){	
						   
			$(".nav > li").hover(	
					function(){		  
					
									
					$(this).css({backgroundImage:"url(http://www.aidforaids.org/themes/cp_themes/afa/images/menu_bg_on.gif)"}); 
					
					$(".subnav").css("visibility", "hidden"); // hides all subnavs
					$(this).children(".subnav").css("visibility", "visible");	//shows child subnav	  	 
					$(this).children(".subnav").hover( 
						function(){},						
						function(){//on hover out subnav:
									if( $(this).attr("id") != "subnav_active") { // if the child subnav is not the current one it hides it
									$(this).css("visibility", "hidden")
									}
							;}			 
					)		  	
					},
					
					function(){ //on hover out li in nav:
					// checks if its not the active one and if its not, go back to normal bg
					if ( $(this).attr("id") != "active" ) {
		  			   $(this).css({backgroundImage:"url(http://www.aidforaids.org/themes/cp_themes/afa/images/menu_bg.gif)"}); 
					}
					
					$(".subnav").css("visibility", "hidden"); // hides all subnavs again
					$("#subnav_active").css("visibility","visible"); // keeps the active subnav visible
					}
			);
	
	
});


