<!-- Begin
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
// End -->
function validateFormOnSubmit(theForm) {
var reason = "";
reason += validateEmpty1(theForm.fields_fname);
reason += validateEmail(theForm.fields_email);
if (reason != "") {
alert("Please make corrections to the following required field(s):\n\n" + reason);
return false;
}
return true;
}
function validateEmpty1(fld) {
var error = "";
if (fld.value.length == 0) {
fld.style.background = 'Yellow'; error = "Full Name (required)\n"
} else {
fld.style.background = 'White';
}
return error; }
function trim(s)
{
return s.replace(/^\s+|\s+$/, '');
}
function validateEmail(fld) {
var error="";
var tfld = trim(fld.value); // value of field with whitespace trimmed off
var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
var illegalChars= /[\(\)\&lt;\>\,\;\:\\\"\[\]]/ ;
if (fld.value == "") {
fld.style.background = 'Yellow';
error = "Please enter a valid Email Address.\n";
} else if (!emailFilter.test(tfld)) { //test email for illegal characters
fld.style.background = 'Yellow';
error = "Please enter a valid Email Address.\n";
} else if (fld.value.match(illegalChars)) {
//fld.style.background = 'Yellow';
//error = "The Email Address contains illegal characters.\n";
} else {
fld.style.background = 'White';
}
return error;
}
