/* array of menu DIV-Container (if more then one menu) */
menuContainers = Array('menuContainer','headMenu');

sfHover = function() {
	for (var k=0; k<menuContainers.length; k++) {
		var sfEls = document.getElementById(menuContainers[k]).getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				// my vers. this.className=this.className.replace(/ sfhover\b/, "");
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function cleanHREF(url){
	pos=url.lastIndexOf("/");
	return url.substring(pos+1,url.length);
}

var site = cleanHREF(document.location.href);

makeActiveLink = function() {
	for (var i=0; i<menuContainers.length; i++) {
		var allMenuLI = document.getElementById(menuContainers[i]).getElementsByTagName("A");
		for (k=0; k<allMenuLI.length; k++){
			if (cleanHREF(allMenuLI[k].href) == site){
			   //allMenuLI[k].href="javascript: void(0)"; This doesn't work in IE 7 with sfHover; sigh ... 
			   allMenuLI[k].removeAttribute("href"); //sfHover works until first click on this item; double sigh
			   allMenuLI[k].className+=" active";
			   allMenuLI[k].title="Dies ist die aktuelle Seite";
			   allMenuLI[k].parentNode.className+=" active";
			   parentChecker (allMenuLI[k].parentNode);
		   }
		}
	}
}

function parentChecker(node){
	if (node.parentNode && node.parentNode.nodeName != "DIV") {
		if (node.parentNode.nodeName == "LI") node.parentNode.className+=" active";
		parentChecker(node.parentNode);
	}
}