  //początek kodu z listingu 11.6
  function closeAllDown(el)
  {
    if(!el) return;
    var uls = el.getElementsByTagName('ul');
    for(var i = 0; i < uls.length; i++)
      uls[i].style.display = 'none';
  }
  function closeAllExcept(menu)
  {
    if(!menu || !menu.parentNode) return;
    var nodes = menu.parentNode.childNodes;
    for(var i = 0; i < nodes.length; i++){
      if(nodes[i].nodeName.toLowerCase() == 'li' && nodes[i] != menu){
        closeAllDown(nodes[i]);
      }
    }
  }
</script>