function animateMenus() {
	var currentMenu = null;
	MenuAnimator = function(element) {
		var dropDown = $("ul", element);
		this.timer = null;
		this.hide = function() {
			$(dropDown).stop(false, true).hide();
		};
		var self = this;
		$("img", element).mouseenter(function() {
			if (currentMenu != null && currentMenu != self) {
				clearTimeout(currentMenu.timer);
				currentMenu.hide();
			}
			currentMenu = self;
			clearTimeout(self.timer);
			$(dropDown).slideDown();
		});
		$("img, ul", element).mouseleave(function() {
			self.timer = setTimeout(function() {
				$(dropDown).fadeOut("slow");
			}, 1000);
		});
		$("ul", element).mouseenter(function() {
			clearTimeout(self.timer);
		});
	};
	$(".menu").each(function() {
		new MenuAnimator(this);
	});
	$(".dropdown a").hover(function() {
		$(this).stop().animate({width: "120%"}, 400);
	}, function() {
		$(this).stop().animate({width: "100%"}, 400);
	});
}
$(function() {
	animateMenus();
});