function menu() {
	var _d = 0;
	$('#nav').each(function(){
		var _this = this;
		var _li = $('li', _this);
		_li.each(function(){
			if($(this).has('ul')){
				var _el = this;
				_el.ul = $(this).find('ul:eq(0)');
				$(this).mouseenter(function(){
					$(this).addClass('hover');
					_el.ul.css({opacity: 0});
					if(_el.ul.is(':animated')) _el.ul.stop();
					_el.ul.animate({opacity: 1},{duration:_d,queue: false, complete:function(){
						$(this).css('opacity','auto');
					}});
				}).mouseleave(function(){
					_el.ul.animate({opacity: 0},{duration:_d,queue: false, complete:function(){
						$(_el).removeClass('hover');
					}});
				})
			}else{
				$(this).mouseenter(function(){
					$(this).addClass('hover');
				}).mouseleave(function(){
					$(this).removeClass('hover');
				})
			}
		})
	})
}


$(document).ready(function(){
	menu();
});

