function ValidateSearch(theForm) { if (theForm.s.value == "") { theForm.s.focus(); return (false); } if (theForm.s.value.length < 3 ) { alert("Please enter at least 3 characters in the \"Search\" field."); theForm.s.focus(); return (false); } if (theForm.s.value != "" ) { var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+' "; var checkStr = theForm.s.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } theForm.s.value = checkStr; if (!allValid) { alert("Please enter only letters and numbers in the \"Search\" field."); theForm.s.focus(); return (false); } } return (true); }