// functions to validate form entry by JCNetworks


function validateForm(myform) { // -- function to check entire form --


if(myform.firstname.value == "") { //check for empty field
   alert("You must enter your First Name"); //is empty
   myform.firstname.focus( ); //jump to empty field
   return false; //stops submission
   }

if(myform.lastname.value == "") { //check for empty field
   alert("You must enter your Last Name"); //is empty
   myform.lastname.focus( ); //jump to empty field
   return false; //stops submission
   }

if(myform.businessname.value == "") { //check for empty field
   alert("You must enter your Business Name"); //is empty
   myform.businessname.focus( ); //jump to empty field
   return false; //stops submission
   }

if(myform.address.value == "") { //check for empty field
   alert("You must enter your postal address"); //is empty
   myform.address.focus( ); //jump to empty field
   return false; //stops submission
   }

if(myform.city.value == "") { //check for empty field
   alert("You must enter your City."); //is empty
   myform.city.focus( ); //jump to empty field
   return false; //stops submission
   }

if(myform.state.value == "") { //check for empty field
   alert("You must enter your State or Province."); //is empty
   myform.state.focus( ); //jump to empty field
   return false; //stops submission
   }
if(myform.phone.value == "") { //check for empty field
   alert("You must enter your contact phone number."); //is empty
   myform.phone.focus( ); //jump to empty field
   return false; //stops submission
   }

if(myform.contactEmail.value == "") { //check for empty field
   alert("You must enter a valid contact email address."); //is empty
   myform.contactEmail.focus( ); //jump to empty field
   return false; //stops submission
   }

if(myform.comments.value == "") { //check for empty field
   alert("You must enter something in the Message Area."); //is empty
   myform.comments.focus( ); //jump to empty field
   return false; //stops submission
   }


} // end validateForm function


// -- addtional function to check email compostition
function isValid() {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myform.contactEmail.value)){
return true;
}
alert ('This email address does not appear to be in a valid format.')
myform.contactEmail.focus( );
return false;
}


