function initMenu() {
	$('#menu ul').hide();
	//$('#menu ul:first').show();
	$('#menu a.active').next().next().show();
	$('#menu a.active').parent().addClass('active');
	$('#menu li a').click(
	function() {
	var checkElement = $(this).next().next();
	if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
		var tmpObj = $(this).parent().find("ul li a:first");
		//window.location.href=tmpObj.attr('href');
		//return false;
	}
	if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
		//$('#menu ul:visible').slideUp('normal');
		$('#menu ul:visible').parent().removeClass('active');
		//$(this).parent().addClass('active');
		//$(this).addClass('active');
		//checkElement.slideDown('normal');
		var tmpObj = $(this).parent().find("ul li a:first");
		if(tmpObj.parent().parent().parent().find("a:first").attr("href") == "/konsument/recept.aspx") {
			tmpObj.attr("href", tmpObj.parent().find("ul li a:first").attr("href"));
		}
		else if(tmpObj.parent().parent().parent().find("a:first").attr("href") == "/press/nyheter.aspx") {
			tmpObj.attr("href", "/press/nyheter.aspx");	
		}/*else if(tmpObj.parent().parent().parent().find('a:first[href^="/konsument/recept/"]')) {
			//tmpObj.attr("href", tmpObj.parent().find("ul li a:first").attr("href"));
			alert(tmpObj.attr("href"));
			//window.location.href=tmpObj.attr('href');
			return false;
		}*/
		window.location.href=tmpObj.attr('href');
		//alert(tmpObj.attr('href'));
		//return false;
	}
	});
	
	
}


function initSitemapMenu() {
	$('ul#sitemap li ul li ul').hide();
	$('ul#sitemap li a').click(
	function() {
	var checkElement = $(this).next();
	if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
		//$('#menu ul:visible').slideUp('normal');
		//$('#menu ul:visible').parent().removeClass('active');
		//$(this).parent().addClass('active');
		//$(this).addClass('active');
		//checkElement.slideDown('normal');
		var tmpObj = $(this).parent().find("ul li a:first");
		if(tmpObj.parent().parent().parent().find("a:first").attr("href") == "/konsument/recept.aspx") {
			tmpObj.attr("href", tmpObj.parent().find("ul li a:first").attr("href"));
		}
		else if(tmpObj.parent().parent().parent().find("a:first").attr("href") == "/press/nyheter.aspx") {
			tmpObj.attr("href", "/press/nyheter.aspx");
			
		}
		window.location.href=tmpObj.attr('href');
		//return false;
	}
	});
	
	
}

