// Das obere Menue inkl. Menuepunkte

function HorizontalMenu() {
	var elem = new Span();
	elem.className = "horizontal_menu";
	var content = elem.appendChild(new Span());

	elem.getItem = function(label) {
		for (i in content.childNodes) {
			if (content.childNodes[i].label == label) return content.childNodes[i];
		}
		window.io.fail("No menu item of label "+label+" found!");
	}

	elem.addItem = function(label, action, isActive) {
		if (elem.firstChild) elem.appendChild(new Divider());
		var item = elem.appendChild(new Link(label, "javascript:openLink('" + action + "')"));
		item.onclick = function() {
			basemenu.deselect();
			if (label.indexOf("<img") == -1) {
				window.lastCalled = label;
			}
		}

	
	}
	elem.removeItem = function(item) {
		var junk = content.removeChild(item);
		junk = null;
	}
	
	elem.addDividers = function() {
		for (var i in content.childNodes) {
			if (content.childNodes[i].tagName == "DIV") {
				content.childNodes[i].appendChild(document.createElement("hr"));
				if (i == (content.childNodes.length - 1)) {
					content.childNodes[i].lastChild.style.visibility = "hidden";
				}
			}
		}
	}
	return elem;
}
