$ (document).ready(function(){//dom load
 $('#nav ul').hide();	//hide #nav child uls
 
 // find first ul and animate open
 $('#nav ul:first').animate({height: 'show'}, 'slow');
 
 $('#nav a').click(function(e){
	 
	 if ($(this).parent().find("ul").length == 0){
		 return;
	 } //end if
	 
	 if($(this).parent().find("ul").css('display') == "none"){
	 
	 
		 // close open ul
		 $('#nav li ul').animate({height: 'hide'});
		 
		 // get parent of clicked object then find ul in that 
		 $(this).parent().find("ul").animate({height: 'show'});
 	
	 }//end if
 
	 // prevent default action
	 e.preventDefault();
 })//end click
 
 
 
 
}); //end dom ready



