// prototype for categories
function category(id,name){
        this.id = id;
        this.name=name;
}



function resetCategories(subCatHeader){
        //set the name to the actual form name.
        var theForm=document.forms["theForm"];

        // this is the selected category
        //var selectedCategory = theForm.main_category[theForm.main_category.selectedIndex].value;

        // Reset category to "All Categories" if category is on dashed line
        //      if ( theForm.main_category[theForm.main_category.selectedIndex].value == -1) {
        //  theForm.main_catesgory.selectedIndex=0;
        //}

        var selectedCategory = theForm.member_type[theForm.member_type.selectedIndex].value;

        // this is the drop-down for classes
        var subCategorySelect=theForm.category_1;
	var subCategorySelect2=theForm.category_2;

        // get the selected value
        var selectedValue  = subCategorySelect.value;
	var selectedValue2  = subCategorySelect2.value;

        subCategorySelect.options.length = 0;
	subCategorySelect2.options.length = 0;

        subCategorySelect.options[0] = new Option(subCatHeader,"0");  
	subCategorySelect2.options[0] = new Option(subCatHeader,"0");
        //subCategorySelect.options[1] = new Option("------------------------------","0");

        if (categories[selectedCategory] != null){
          // there is a category that correlates with selection

          for(var i = 0; i < categories[selectedCategory].length; i++) {
            subCategorySelect.options[i+1] = new Option(categories[selectedCategory][i].name, categories[selectedCategory][i].id);
	    subCategorySelect2.options[i+1] = new Option(categories[selectedCategory][i].name, categories[selectedCategory][i].id);

          }
        }
    // set to last selected class
    subCategorySelect.value=selectedValue; 
    subCategorySelect2.value=selectedValue;

    // make sure the class still exists in new category.  If not, make it "Any Class"
    if (! ( subCategorySelect.selectedIndex >= 0) ) {
      subCategorySelect.selectedIndex=0;
    }

    // make sure the class still exists in new category.  If not, make it "Any Class"
    if (! ( subCategorySelect2.selectedIndex >= 0) ) {
      subCategorySelect2.selectedIndex=0;
    }

}

