(function($) {
	$.fn.menu = function() {
		$("#nav > li").mouseover(function() {
			$(this).css("background-color", "#9badbf");
			$(this).find("a.main").removeClass("main").addClass("mainOn");
			if (this.$timer) {
				clearTimeout(this.$timer);
			}
		});
		$("#nav > li").mouseout(function() {
/*
			$(this).css("background-color", "");
			$(this).find("a.mainOn").removeClass("mainOn").addClass("main");
*/
			var self = $(this);
			this.$timer = setTimeout(
				function() {
					$(self).css("background-color", "");
					$(self).find("a.mainOn").removeClass("mainOn").addClass("main");
				},
				150
			);
		});

		$("#nav li").mouseover(function() {
			if (this.$sftimer) {
				clearTimeout(this.$sftimer);
			}
			$(this).addClass("sfhover");
		});
		$("#nav li").mouseout(function() {
			/*
			$(this).removeClass("sfhover");
			*/
			var self = $(this);
			this.$sftimer = setTimeout(
				function() {
					$(self).removeClass("sfhover");
				},
				50
			);
		});
		
		$("#nav > li > ul").find("a").mouseover(function() {
			$(this).css("background-color", "#e6eaee");
			$(this).css("color", "#395973");
		});
		$("#nav > li > ul").find("a").mouseout(function() {
			$(this).css("background-color", "");
			$(this).css("color", "#fff");
		});
	}
	
	
	/*
	
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
	*/
})(jQuery);
