function getElementbyClass(classname){
 var inc=0;
 var customcollection = new Array();
 var alltags=document.all? document.all : document.getElementsByTagName("*");
 for (i=0; i<alltags.length; i++){
   if (alltags[i].className==classname)
     customcollection[inc++]=alltags[i];
 }
 return (customcollection);
}

function mmenu(ID) {
var menu = document.getElementById(ID);
var display = menu.style.display;
var oth = getElementbyClass('submenu');
for (j=0; j< oth.length; j++) {
	if (oth[j].id != ID) oth[j].style.display = "none"; 
}	

menu.style.display = (display == "block") ? "none" : "block";
/*menu.parentNode.style.listStyleImage = (display == "block") ? "url(cartellachiusa.gif)" : "url(cartellaaperta.gif)";*/
}

/* inizializzazione del menu */
window.onload = function() {
var uls = document.getElementsByTagName("ul");
for (i=0;i<uls.length;i++) {
if(uls[i].getAttribute("class")=="submenu")uls[i].style.display = "none";
if(uls[i].getAttribute("id") && uls[i].getAttribute("id").search("submenu-")!= -1) uls[i].style.display = "none";
if(opn) mmenu(opn);
}
}