// JavaScript Document
function hideAll() {
var navList = document.getElementById("nav");
for (var i=0; i<navList.childNodes.length; i++) {
var node = navList.childNodes[i];
if (node.tagName == "LI") {
node.className = node.className.replace(new RegExp("\s?active", "i"), "");
}
}
}
window.onload = function () { var navList = document.getElementById("nav");
for (var i=0; i<navList.childNodes.length; i++) {
var node = navList.childNodes[i];
if (node.tagName == "LI") {
node.onclick = function() { // Check to see if the item is already active
var alreadyActive = false;
if (this.className.indexOf("active") >= 0) {
alreadyActive = true;
}
// Hide everything
hideAll();
// If the item was already active - don't reshow
if (!alreadyActive) {
this.className += " active";
}
}
}
}
}