jQuery.fn.initMenu = function() {  
	return this.each(function(){
	
		var theMenu = jQuery(this).get(0);
		isRunning = false;
		jQuery('.acitem', this).hide();
		jQuery('.expand', this).show();
		jQuery('.expand', this).addClass('active');
		jQuery('.expand', this).removeClass('expand');
		jQuery('li.expand > .acitem', this).show();
		jQuery('li.expand > .acitem', this).prev().addClass('active');
		
		jQuery('li a', this).mouseover(function() {
			
			if (isRunning) 
				return;

			isRunning = true;
			var theElement = jQuery(this).next();
			var parent = this.parentNode.parentNode;

			if(theElement.hasClass('acitem') && !theElement.is(':visible')) {                        					
				jQuery('.acitem:visible', parent).first().slideUp('normal', function() {
					jQuery(this).prev().removeClass('active');
					isRunning = false;
				});					
				theElement.slideDown('normal', function() {
					jQuery(this).prev().addClass('active');
					isRunning = false;
				});					
				return false;
			} 
			else 
				isRunning = false;

		});
	});
};

jQuery(document).ready(function() {
	jQuery('.menu').initMenu();
});