$(function() {
	$(".level1").hover(
		function() {
			$(this).addClass("liover");
			var ul = $(this).children("ul");
			if (ul.length) {
				ul.width(900).show();
				var li = ul.children("li");
				var w = 0;
				li.each(function() {
					w += $(this).outerWidth(true);
				});
				ul.width(w);
				ul.css("margin-left", -0.45*w);
			}
		},
		function() {
			$(this).removeClass("liover");
			$(this).children("ul").hide();
		}
	);
});
