// Objekt-Referenz holen
function getObject(id) { 
	if (document.all) {
		if (typeof document.all[id] != "undefined" && document.all[id] != null)
			return document.all[id];
	}
	else if (document.getElementById) { 
		if (typeof document.getElementById(id) != "undefined" && document.getElementById(id) != null)
			return document.getElementById(id);
	}
	return false;
}

function schreiben(name, second, top) {
	var theaddy = name + "@" + second + "." + top;
	var thetext = (schreiben.arguments.length > 3) ? schreiben.arguments[3] : theaddy;
	document.write("<a href=\"mailto:" + theaddy + "\">" + thetext + "</a>");
}

var refID = "navi43";
var navipunkt;
var refEinblend;
var currentRef = -1;
var isStopped = false;

function handleNavi() {
	if (!document.getElementsByTagName) {
		return;
	}
	var listItems = document.getElementById("navigation").childNodes;
	for (var i = 0; i < listItems.length; i++) {
		if (listItems[i].nodeName.toLowerCase() == "li") {
			var clName = listItems[i].firstChild.className;
			if (clName != "hier" && clName != "elternrubrik") {
				toggleSubnavi("hide", listItems[i]);
				// Mouseover auf Navigationspunkt legen
				listItems[i].onmouseover = function() { toggleSubnavi("show", this) };
				listItems[i].onmouseout = function() { toggleSubnavi("hide", this) };
			}
		}
	}
	// Referenzen: Einblendung aktivieren
	navipunkt = getObject(refID);
	if (typeof refClaims == "object" && navipunkt != false) {
		refEinblend = document.createElement("ul");
		refEinblend.style.zIndex = 1;
		refEinblend.style.display = "block";
		navipunkt.appendChild(refEinblend);
		showRef();
		if (typeof navipunkt.onmouseover != "function") {
			navipunkt.onmouseover = function() { isStopped = refID; };
			navipunkt.onmouseout = function() { isStopped = false; };
		}
	}
}

function toggleSubnavi(mode, listItem) {
	var subLists = listItem.getElementsByTagName("ul");
	if (subLists.length > 0) {
		if (mode == "show") {
			isStopped = listItem.id;
			subLists[0].style.display = "block";
		}
		else {
			isStopped = false;
			if (listItem.id != refID) {
				subLists[0].style.display = "none";
			}
		}
	}
}

function showRef() {
	currentRef++;
	if (currentRef >= refClaims.length) {
		currentRef = 0;
	}
	var newLi = document.createElement("li");
	var newA  = document.createElement("a");
	newA.setAttribute("href", refClaims[currentRef][0]);
	newA.appendChild(document.createTextNode(refClaims[currentRef][1]));
	newLi.appendChild(newA);
	refEinblend.appendChild(newLi);
	window.setTimeout("hideRef()", 5000);
}

function hideRef() {
	if (isStopped != refID) {
		var eingeblendet = refEinblend.getElementsByTagName("li");
		for (var i = 0; i < eingeblendet.length; i++) {
			refEinblend.removeChild(eingeblendet[i]);
		}
		window.setTimeout("showRef()", 500);
	}
	else {
		window.setTimeout("hideRef()", 5000);
	}
}

function referenz(claim) {
	getObject("referenzClaim").innerHTML = claim;
}

