function fillSearchCategories(){ // this function is used to fill the category list on load addOption(document.searchform.SearchCategory, '1', 'Condo for Rent');addOption(document.searchform.SearchCategory, '2', 'Condo for Sale');addOption(document.searchform.SearchCategory, '3', 'House for Rent');addOption(document.searchform.SearchCategory, '4', 'House for Sale');addOption(document.searchform.SearchCategory, '5', 'Land for Sale');} // end of JS function function SelectSearchPriceRange(){ // ON or after selection of category this function will work removeAllOptions(document.searchform.SearchPriceRange); addOption(document.searchform.SearchPriceRange, "", "-- Price Range --", ""); // Collect all element of subcategory for various cat_id if(document.searchform.SearchCategory.value == '1'){ addOption(document.searchform.SearchPriceRange,"ItemPrice > 0", "No Min or Max"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 0 AND ItemPrice < 20001", "0 - 20,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 19999 AND ItemPrice < 30001", "20,000 - 30,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 29999 AND ItemPrice < 50001", "30,000 - 50,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 50000", "Over 50,000"); } if(document.searchform.SearchCategory.value == '2'){ addOption(document.searchform.SearchPriceRange,"ItemPrice > 0", "No Min or Max"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 0 AND ItemPrice < 1000001", "0 - 1,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 999999 AND ItemPrice < 3000001", "1,000,000 - 3,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 2999999 AND ItemPrice < 6000001", "3,000,000 - 6,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 6000000", "Over 6,000,000"); } if(document.searchform.SearchCategory.value == '3'){ addOption(document.searchform.SearchPriceRange,"ItemPrice > 0", "No Min or Max"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 0 AND ItemPrice < 20001", "0 - 20,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 19999 AND ItemPrice < 30001", "20,000 - 30,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 29999 AND ItemPrice < 50001", "30,000 - 50,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 50000", "Over 50,000"); } if(document.searchform.SearchCategory.value == '4'){ addOption(document.searchform.SearchPriceRange,"ItemPrice > 0", "No Min or Max"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 0 AND ItemPrice < 1000001", "0 - 1,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 999999 AND ItemPrice < 3000001", "1,000,000 - 3,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 2999999 AND ItemPrice < 6000001", "3,000,000 - 6,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 6000000", "Over 6,000,000"); } if(document.searchform.SearchCategory.value == '5'){ addOption(document.searchform.SearchPriceRange,"ItemPrice > 0", "No Min or Max"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 0 AND ItemPrice < 1000001", "0 - 1,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 999999 AND ItemPrice < 3000001", "1,000,000 - 3,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 2999999 AND ItemPrice < 6000001", "3,000,000 - 6,000,000"); addOption(document.searchform.SearchPriceRange,"ItemPrice > 6000000", "Over 6,000,000"); } } ////////////////// function removeAllOptions(selectbox) { var i; for(i=selectbox.options.length-1;i>=0;i--) { //selectbox.options.remove(i); selectbox.remove(i); } } function addOption(selectbox, value, text ) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selectbox.options.add(optn); }