var _id = 'menu';
var _slideEl = 'ul';
var _duration = 300;
var _hide = true;

jQuery.noConflict();
jQuery(document).ready(function() { 
	jQuery('#'+_id+' li ul li').each(function() {
            jQuery(_slideEl, this).hide(_duration)
	});
	jQuery('#'+_id+' li ul li a').hover(function () {
		if (_hide) hideLevels(this);
		jQuery(this).next(_slideEl).toggle(_duration);
	});
});

function hideLevels(_this){
	jQuery('#'+_id+' li ul li').each(function() {
		var _f = false;
		var _a = jQuery('a', this).each(function(i, _el) {
			if (_el == _this) _f = true;
		});
		if (!_f) jQuery(_slideEl, this).hide(_duration)
	});
}
