function toggleSearchOptions(strVisibility) { $("searchOptions").setStyle('visibility', strVisibility); } function validateSearchInput() { var userInput = (document.forms['frmSearch'].elements['txtKeyword'].value).clean(); for (rb = 0; rb < document.forms['frmSearch'].elements['rdoSearchType'].length; rb++) { if (document.forms['frmSearch'].elements['rdoSearchType'][rb].checked) var srchType = document.forms['frmSearch'].elements['rdoSearchType'][rb].value; } var strAlert = ""; switch (srchType) { case "product": if (userInput == "") strAlert += "Enter at least one keyword to perform a product search."; break; case "store": if (userInput == "") strAlert += "Enter at least one keyword to perform a store search."; break; case "local": //make sure input is a zip code if (isNaN(userInput) || userInput.length != 5) strAlert += "Enter a 5-digit zip code to perform a local search."; break; case "review": if (userInput == "") strAlert += "Enter at least one keyword to perform a review search."; break; case "people": if (userInput == "") strAlert += "Enter at least one keyword to perform a people search."; break; } if (strAlert != "") { alert(strAlert); return false; } else return true; }