function resetForm (f) {
  for ( i=0; i < f.length; i++) {
    field=f.elements[i];
    switch (field.type) {
      case "text" :
        field.value="";
        break;
      case "textarea" :
        field.value="";
        break;
      case "radio" :
        /** Assume that the first one is the one to mark as checked.  I tried
                field[0], but that didn't work, so I had to check to see if
                it is same as the last one. This will break if for some wierd
                reason the radio buttons are out of order...
        **/
        if ( lastRadioName != field.name) {
          // This must be the first one
          field.checked=true;
        } else {
          field.checked=false;
        }
        var lastRadioName=field.name;
        break;
      case "select-one" :
        field.selectedIndex=0;
        break;
      case "select-multiple" :
        field.selectedIndex=-1;
        break;
      case "checkbox" :
        field.checked=false;
        break;
    }
  }
}
