function showSubmenu(obj) { obj = obj.parentNode; // The link is on the A-tag, so the LI is the parent var sub = obj.getElementsByTagName('UL'); // Get the UL of the submenu var overlay = document.getElementById('overlay'); // Get the overlay var body = document.getElementsByTagName('BODY')[0]; // Get the body // Get al LI's on the same level as "obj" var parent = obj.parentNode; var children = parent.childNodes; for(var i = 0; i < children.length; i++) { var child = children[i]; if(child.nodeName == 'LI') { var menu = child.getElementsByTagName('UL') if(menu.length) { menu[0].style.display = 'none'; } } } if(sub.length) { sub[0].style.display = 'block'; } overlay.style.display = 'block'; overlay.style.height = body.clientHeight + 'px'; } function closeOverlay(obj) { // Hide the overlay obj.style.display = 'none'; // Close the submenu var udm = document.getElementById('udm'); var uls = udm.getElementsByTagName('UL'); for(var i = 0; i < uls.length; i++) { uls[i].style.display = 'none'; } }