Nope, no framework involved, looks like clean JS. Either way, as it seems, you are already assigning the class there with .className Now for the more interesting part... finding each element that is currently visible and hiding it:
Code:
<script type="text/javascript">
function display (category) {
var whichcategory = document.getElementById(category);
var showClass = "show";
var all = document.getElementsByTagName('*');
var shown = new Array();
for (var e = 0; e < all.length; e++) {
if (all[e].className == showClass)
shown[shown.length] = all[e];
}
if (whichcategory.className == showClass)
whichcategory.className = "hide";
else {
for (var i = 0; i < shown.length; i++)
shown[i].className = "hide";
whichcategory.className = showClass;
}
}
</script>
Probably _not_ the best way to do it... and I'm not sure exactly how it will play out with nested locations, but I believe it can be modified to ignore elements that are parent elements of the one you're currently trying to show.