
$.extend($.fn, {
	  autoID : function () {
			return this.each(function () {
				 $(this).attr("autoID", "jQuery_autoID_" + $.data(this));
			});
	  }
 }); 

jQuery(document).ready(function() {
	
	var menu = jQuery('#menu');
	var menuActionInProgress = false;
	var toShow = menu.find('[href='+window.location.pathname+']');
	
	menu.find('ul li ul').hide();
	
	if (toShow.size() == 1)
	{
		var toShowCur = toShow;
		while (toShowCur[0] != menu[0])
		{
			toShowCur = toShowCur.parent();
			toShowCur.find('> ul').show();
			//alert('aa');
		}
		menu.show();
	}
	else
		menu.show('slow');

	menu.find('ul > li').click(function() {
			var menuItemClicked = jQuery(this);
			
			menuItemClicked.siblings().find('> ul').slideUp('slow', function () {
				menuItemClicked.find('> ul').slideDown('slow');
			});
	});
	
});