// Check the fields in the FORM
function checkFields(thisForm){



// Check for 'empty' fields
for (var i=0; i < thisForm.length; ++i){
var theField = thisForm.elements[i];
if ( theField.type == "text" ||
theField.type == "textarea" ||
theField.type == "password" ||
theField.type == "select-one" ){
if ( theField.value == "" || theField.value == null ){
msg = "The "+theField.name+" field can not be left empty";
alert(msg);
thisForm[theField.name].focus();
return false;
if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
}
}
}



// Check if a Special Offers Radio Button was selected
var Applied = false;
for (var i=0; i< thisForm.Applied.length; ++i) {
if (thisForm.Applied[i].checked == true) {
Applied = true;
break;
}
}
if (Applied != true) {
window.alert("You must answer if you have previously applied.");
return false;
}
return true;
}




// Check that a number has been entered
function checkForNumber(Value) {
var numberCheck = isNaN(Value);
if (numberCheck == true) {
window.alert("You must enter a numeric value!");
return false;
}
return true;
}


<!-- email --->
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}

<!-- email end --->



// Verify they really want to reset the form
function confirmReset() {
var resetForm = window.confirm("Are you sure you want to reset the form?");
if (resetForm == true)
return true;
return false;
}



<!-- submit --->
function confirmSubmit() {
var submitForm = window.confirm("Are you sure you want to submit the form?");
if (submitForm == true)
return true;
return false;
}





// JavaScript Document
