function rootActiveInMenu() {
	if(document.location.pathname.length <= 1 && document.getElementById("menu")) {
		var elmMenu = document.getElementById("menu");
		var elmMenuItems = elmMenu.getElementsByTagName("li");
		if (elmMenuItems.length > 0 && document.location.pathname.length <= 1) {
			elmMenuItems[0].className = "first active";
		}
	}
}
function gotoTVpage() {
	window.location = document.strTVurl;
}

function linkToCalendar() {
	if (document.getElementById && document.getElementById('calendarAnchor') && document.getElementById('menu')) {
		var elmMenu = document.getElementById('menu');
		var anchors = elmMenu.getElementsByTagName('a');
		if (anchors.length) {
			for (var i = 0; i < anchors.length; i=i+1) {
				if(anchors[i].href.search(/kalender/) != -1) {
					var elmCalAnchor = document.getElementById('calendarAnchor');
					var newElm = document.createElement('A');
					newElm.setAttribute('href', anchors[i].href);
					newElm.setAttribute('title','Lęs mere i kalenderen for ' + document.title);
					newElm.appendChild(document.createTextNode("Lęs mere her..."));
					elmCalAnchor.appendChild(newElm,elmCalAnchor);
					return true;
				}
			}
		}
	}
}

// Suckerfish dropdown workaround for MSIE < 7
var menuHover = function() {
	var sfEls = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0, len = sfEls.length; i < len; i = i + 1) {
		sfEls[i].onmouseover = function() {
			this.className += " hover";
		}
		sfEls[i].onmouseout = function() {
			this.className = this.className.replace(new RegExp(" hover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", menuHover);

(function ($) {
    $(function () {
        rootActiveInMenu();
        linkToCalendar();
    
    
        $("div#menu ul.L1 li.first").hover(
        function () {
            // on mouse enter
            $("div#content").addClass("menuhover");
        },
        function () {
            // on mouse leave
            $("div#content").removeClass("menuhover");
        });
    });
    
})(jQuery);
