// functions to validate form entry by JCNetworks


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

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

if(myform.contact_address1.value == "") { //check for empty field
   alert("You must enter an address"); //is empty
   myform.contact_address1.focus( ); //jump to empty field
   return false; //stops submission
   }
if(myform.contact_city.value == "") { //check for empty field
   alert("You must enter the name of your city."); //is empty
   myform.contact_city.focus( ); //jump to empty field
   return false; //stops submission
   }

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

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

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

// -- validate checkbox at bottom of form
if (!document.myform.age.checked) {
   // box is not checked
   alert("Pursuant to the COPPA Act (2001) and our Privacy Policy you must verify that you are exactly 13 years of age or older to submit this form."); //is empty
   return false;
}

if(myform.code.value == "") { //check for empty field
   alert("You must enter the code at the bottom. If you're unable to read it then hit refresh image."); //is empty
   myform.code.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.contact_email.value)){
return true;
}
alert ('This email address does not appear to be in a valid format.')
myform.contact_email.focus( );
return false;
}


