// with help from RobG, comp.lang.javascript

// use document.all if getElementById is missing
if( (!document.getElementById) && document.all){
    document.getElementById = function(id){
      return  document.all[id];
    };
  }

function showCat(catString){
  // show all elements w/ class attribute matching catString
  var stuff = document.getElementById("stuff").getElementsByTagName("li"),
      matchTest = new RegExp("\\b" + catString + "\\b"),
      i = stuff.length,
      li;
  while (i--){
    li = stuff[i];
    if (li.className){
      // if catString matches OR if show "everything" then
      if (matchTest.test(li.className) || catString == "everything"){
        // show this block
        stuff[i].style.display = "";
      }
      else {
        // hide this block
        stuff[i].style.display = "none";
      }// className exists?
    }// className matches?
  }// end loop
}// end function

function showCatFromSelected(){ // call showCat using the selected OPTION's value
  showCat(this.options[this.selectedIndex].value);
  }

function handleSelect(){
  document.getElementById("show-me").onchange = showCatFromSelected; // handle the onchange event
}

window.onload = handleSelect;
  
