// Se till att menyn vet vilken länk som är aktiv (funkar ej på Produkter och Press eftersom de är drop-downs utan riktiga länkar) //
function scriptInit() {
if (!document.getElementById) {
	return;
	}
}

function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
	elm.addEventListener(evType, fn, useCapture);
	return true;
	} else if (elm.attachEvent) {
	var r = elm.attachEvent('on' + evType, fn);
	return r;
	} else {
	elm['on' + evType] = fn;
	}
}

function checkActive() {
	var a = document.getElementsByTagName("a");
	if (window.location.href.substr(location.href.length - 1, 1) == '/') {
		var loc = window.location.href + 'index.php'; 
	}
	else {
		var loc = window.location.href;
	}

	for(var i=0; i < a.length; i++) {
		if (a[i].href == loc) {
			a[i].setAttribute("class", "active");
			a[i].setAttribute("className", "active");
		}
	}
}

addEvent(window, 'load', checkActive, false);

// SLUT: Se till att menyn vet vilken länk som är aktiv //

// Extra hover-stöd för IE //
/*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);*/
// SLUT: Extra hover-stöd för IE //

// visa/göm drop-down //
function functionLayer(stringValue) {
   var stringStyle = document.getElementById(stringValue).style;
   stringStyle.display='block';
}
function functionLayerHide(stringValue) {
   var stringStyle = document.getElementById(stringValue).style;
   stringStyle.display='none';
}
// SLUT: visa/göm drop-down //