codice:
var prev = null;

function menuClick() {
	this.parentNode.className = this.parentNode.className === "show" ? "hide" : "show";
   	if (prev) { prev.className = "hide"; }
	prev = this.parentNode;
}

window.onload = function() {
	if (document.getElementsByTagName && document.getElementById) {
		document.getElementById("nav").className = "jsenable";
		var hs = document.getElementById("nav").getElementsByTagName("h3");
		for (var i = 0; i < hs.length; i++) { hs[i].onclick = menuClick; }
	}
};