function setUp() { var animalList=document.getElementById('animal_type'); var breedList=document.getElementById('breeds'); var weightList=document.getElementById('weights'); var colourList=document.getElementById('colours'); // Clear out the list of Ranges ClearOptions(breedList); AddToOptionList(breedList, "all", "All Available"); ClearOptions(weightList); AddToOptionList(weightList, "all", "All Available"); AddToOptionList(weightList, "1", "Under 5Kg"); AddToOptionList(weightList, "2", "5-10Kg"); AddToOptionList(weightList, "3", "10-20Kg"); AddToOptionList(weightList, "4", "20+Kg"); ClearOptions(colourList); AddToOptionList(colourList, "all", "All Available"); } function ClearOptions(OptionList) { // Always clear an option list from the last entry to the first for (x = OptionList.length; x >= 0; x = x - 1) { OptionList[x] = null; } } function AddToOptionList(OptionList, OptionValue, OptionText) { // Add option to the bottom of the list OptionList[OptionList.length] = new Option(OptionText, OptionValue); }