function DOMGetElement(xx) 
{
  // This function returns document's elemtnt acording it's name
  // Using Document Object Model
 if (document.getElementById) return document.getElementById(xx); 
 return nul;
}

function showmenu(name) 
{
// This is the main function that hide all the layers but the only one, 
// which name was delivered to the function as a parametr

var ii;  // cicle variable
var m=2; // variable that shows maximum nomber in layers' names 
var qq;  // here we store the name of a layer that we must show
var nen; // here we store the names of all layers (in a cicle)

NeMenu =  new Array(m+1); // an array to store the objects -  all the layers that should be hidden
nename = new Array(m+1);  // an array to store the names of all the layers  that should be hidden

// cicle to store the names of all the layers that should be hidden an array
for (ii=0; ii<=m; ii++) {
  nen="menu" + ii;
  nename[ii]=nen;
   if (name) { // this
    if (nen==name) qq=ii; // flag on - if it's a name of a layer hat should be shown
   }
}
  if (document.getElementById) { 
  // Type 1: IE5,6; NN6; Mozilla
  // if our brouser supports DOM and we can get an object according to it's name
    if (name) { // if there was a parametr
     var Menu = DOMGetElement(name); // get an object 
     Menu.style.visibility='visible'; // and show it, changing the style
    }
    for (ii=0; ii<=m; ii++) { // for all the layers
     if (ii!=qq) { // but one that should be shown
      NeMenu[ii] = DOMGetElement(nename[ii]); // get an object that we do NOT show
      NeMenu[ii].style.visibility='hidden';  // and hide it, changing the style
     }
    }
    return true; // exit function
  } // that's all for the first type of brousers

 if(document.all) { 
  // Type 2: For document.all stands IE4-6 and Opera5, but IE5,6 were gone as the 1-st type 
   if (name) document.all[name].style.visibility= 'visible'; //if there was a parametr, show that layer using style
  for (ii=0; ii<=m; ii++) { 
   // hide all the layers but one that should be shown  - using style
   if (ii!=qq) document.all[nename[ii]].style.visibility= 'hidden'; 
  }
    return true; // exit function
 } // that's all for the second type of brousers

 if (document.layers) { 
   //Type 2: NN4
   if (name) document.layers[name].visibility='show'; // if there was a parametr, show that layer using layer
    for (ii=0; ii<=m; ii++) {
    // hide all the layers but one that should be shown  - using layer
     if (ii!=qq) document.layers[nename[ii]].visibility='hide';
    }
    return true; // exit function
  } // that's all for the second type of brousers (NN4)
} // JavaScript Document