<!--

var _bIE55 = false;
var _bIE6 = false;
var _timerMenu = true;
var _timerID = null;
var _aHiders = null;

sfHover = function() {
	var sfEl = document.getElementById("meny");
	if (sfEl != null) {
		var sfEls = sfEl.childNodes;
		_Setup();
		for (var i = 0; i < sfEls.length; i++) if (sfEls[i].getElementsByTagName != null) {
			sfEls[i].submenu = sfEls[i].getElementsByTagName("UL")[0];
			sfEls[i].id = i;
			if (sfEls[i].submenu != null) {
				sfEls[i].onmouseover = function() {
					_Apply(this);
				}
				sfEls[i].onmouseout = function() {
					_timerMenu = this;
					_timerID = setTimeout("_Timeout()", 400);
				}
			}
		}
	}
}
if (document.all&&document.getElementById) {
	if (window.attachEvent) window.attachEvent("onload", sfHover);
	else {
		var old = window.onload; 
		window.onload = function() { if (old) old(); sfHover(); } 
	}
}

function _Setup() {
	_bIE55 = (typeof(document.body.contentEditable) != "undefined");
	_bIE6 = (typeof(document.compatMode) != "undefined");

	_bIE55 = false;
	_bIE6 = false;

	if (!_bIE55) _aHiders = _GetElementsByClassName("WCHhider", document, "DIV");
}

function _Apply(oContainer) {
	if (_timerMenu != null && _timerMenu.id == oContainer.id) {
		clearTimeout(_timerID);
		_timerMenu = null;
		_timerID = null;
	} else {
		if (_timerMenu != null) {
			clearTimeout(_timerID);
			_Discard(_timerMenu);
			_timerMenu = null;
			_timerID = null;
		}
		oContainer.className = "sfhover";
		if (_bIE55 && (oIframe = _Hider(oContainer, true))) {
			oIframe.style.visibility = "visible";
		} else if (_aHiders != null) {
			for (var i = 0; i < _aHiders.length; ++i) _aHiders[i].style.visibility = "hidden";
		}
	}
}

function _Discard(oContainer) {
	oContainer.className = "";
	if (_bIE55 && (oIframe = _Hider(oContainer, false))) {
		oIframe.style.visibility = "hidden";
	} else if (_aHiders != null) {
		for (var i = 0; i < _aHiders.length; ++i) _aHiders[i].style.visibility = "visible";
	}
}

function _Hider(oContainer, bResize) {
	var sHiderID = "WCHhider" + oContainer.id;
	var oIframe = document.getElementById(sHiderID);
	if (!oIframe) {
		//	IE 6 has this property, IE 5 not. IE 5.5(even SP2) crashes when filter is applied, hence the check
		var sFilter = (_bIE6) ? "filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);" : "";
		//	get z-index of the object. must be at least 2!
		zIndex = parseInt(oContainer.submenu.currentStyle.zIndex);
		if (isNaN(zIndex)) return null;
		oContainer.insertAdjacentHTML("afterBegin", '<iframe class="WCHiframe" src="javascript:void(0)" id="' + sHiderID + '" scroll="no" frameborder="0" style="position:absolute;visibility:hidden;' + sFilter + 'border:0;top:0;left;0;width:0;height:0;background-color:transparent;z-index:' + (zIndex--) + ';"></iframe>');
		oIframe = document.getElementById(sHiderID);
		_SetPos(oIframe, oContainer.submenu);
	} else if (bResize) {
		_SetPos(oIframe, oContainer.submenu);
	}
	return oIframe;
}

function _SetPos(oIframe, oLayer) {
	oIframe.style.width = oLayer.offsetWidth + "px";
	oIframe.style.height = oLayer.offsetHeight + "px";
	oIframe.style.left = oLayer.offsetLeft + "px";
	oIframe.style.top = oLayer.offsetTop + "px";
}

function _Timeout() {
	if (_timerMenu != null) {
		_Discard(_timerMenu);
		_timerMenu = null;
		_timerID = null;
	}
}

function _GetElementsByClassName(clsName, parentEle, tagName) {
	var found = new Array();
	var re = new RegExp('\\b'+clsName+'\\b', 'i');
	var list = parentEle.getElementsByTagName(tagName);
	for (var i = 0; i < list.length; ++i) if (list[i].className.search(re) != -1) found[found.length] = list[i];
	return found;
}

//-->
