﻿// JavaScript Document

function setMenu(menu, p_submenutag) {
	
	var aNodes = document.getElementById(menu).getElementsByTagName("a");
	
	for (i = 0; i < aNodes.length; i++) {
		//alert(aNodes[i].className);
		if (aNodes[i].className !== "") {
			//alert("linke!");
			aNodes[i].parentNode.onmouseover = function() {
				show(this);
			};
			aNodes[i].parentNode.onmouseout = function() {
				hide(this);
			};
		}
	}
	
	function show(node) {
		//alert(node.parentNode.tagName);
		for (i = 0; i < node.childNodes.length; i++) {
			//alert(node.parentNode.childNodes[i].tagName);
			if (node.childNodes[i].tagName == p_submenutag.toUpperCase()) {
				//alert(node.childNodes[i].tagName);
				node.childNodes[i].style.display = "block";
			}
		}
	}
	
	function hide(node) {
		for (i = 0; i < node.childNodes.length; i++) {
			if (node.childNodes[i].tagName == p_submenutag.toUpperCase()) {
				node.childNodes[i].style.display = "none";
			}
		}
	}

}
