var msd = function() {
	var
	oddList,
	evenList,
	
	handleOddMouseOver = function() {
		$(this).css("background-color", "#edf4f8");
	},
	
	handleEvenMouseOver = function() {
		$(this).css("background-color", "#f2f3f4");
	},
	
	handleEvenMouseOut = function() {
		$(this).css("background-color", "#ffffff");
	},
	
	handleOddMouseOut = function() {
		$(this).css("background-color", "#f5fafd");
	},
	
	checkCurrent = function() {
		var that = $(this);
		
		that.find("a").each(function() {
			if($(this).attr("href") == window.location.pathname.toString() || $(this).attr("href").indexOf(topmenupoint) != -1) {
				that.addClass("current");
			}
		});
	},
	
	init = function() {
		oddList = $("a.sporsmaal:odd");
		evenList = $("a.sporsmaal:even");
		
		oddList.each(handleOddMouseOut);
		
		oddList.bind("mouseover", handleOddMouseOver);
		oddList.bind("mouseout", handleOddMouseOut);
		evenList.bind("mouseover", handleEvenMouseOver);
		evenList.bind("mouseout", handleEvenMouseOut);
		
		$("#sok").bind("focus", function() { $(this).val(""); } );
		$("#sporsmaal-form input[type='text'], #sporsmaal-form textarea").bind("focus", 
			function() { 
				if($(this).val() == "Overskrift" || $(this).val() == "Fyll inn spørsmål") {
					$(this).val("");
				}
			} 
		);
		
		$("#mainMenu li").each(function() {
			var that = $(this);
			
			if(typeof topmenupoint == "undefined") {
				topmenupoint = "-1";
			}
			
			that.find("a").each(function() {
				if($(this).attr("href") == window.location.pathname.toString() || $(this).attr("href").indexOf(topmenupoint) != -1) {
					that.addClass("current");
				}
			});
		});
	}
	;
	
	return {
		init:init
	};
}();


$(document).ready(function() {
		msd.init();
});

