﻿(function($) {
	$.fn.StyleCurrentMenu = function(className, startPage) {
		var aAdress = location.href.split("http://demo.cmsoffice.se");
		var sPage = aAdress[aAdress.length - 1];
		
		if (sPage.length == 0) { sPage = startPage }
		$("#" + this.attr("id") + " a").each(function() {
			if ($(this).attr("href") == sPage) {
				return $(this).parent("li").addClass(className);
			}
		});
	}
})(jQuery);


(function($) {
	$.fn.StyleCurrentHeadMenu = function(className, startPage) {
		var aAdress = location.href.split("http://demo.cmsoffice.se");
		var sPage = aAdress[aAdress.length - 1];
		sPage = sPage.substring(1, sPage.length);
		var indexOf = sPage.indexOf('/');
		if (indexOf > 0) {
			var aPage = sPage.split("/");
			sPage = aPage[0];
		}
		if (sPage.length == 0) { sPage = startPage }
		$("#" + this.attr("id") + " a").each(function() {
			var indexHref = $(this).attr("href").indexOf(sPage);
			if (indexHref > 0) {
				return $(this).parent("li").addClass(className);
			}

		});
	}
})(jQuery);