$(document).ready(function () {
	
	$('#nav li').click(function () {

		if ($(this).children('ul').css("display") == "none") {
		
		//slideup or hide all the Submenu
		$('#nav li').children('ul').slideUp('fast');	
		
		//show the selected submenu
		$(this).children('ul').slideDown('fast');
		
		}

	});

});