function validateForm(form) { //This is the name of the function

if (form.name.value == "") { //This checks to make sure the field is not empty
   alert("The \"Name\" field is empty. Please enter your name."); //Informs user of empty field
   form.name.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
}

if (form.email.value == "") { //This checks to make sure the field is not empty
   alert("The \"Email\" field is empty. Please enter your email."); //Informs user of empty field
   form.email.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
}

//function to check valid email address

validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
strEmail = document.forms[0].email.value;

// search email text for regular exp matches
if (strEmail.search(validRegExp) == -1) {
	alert('Sorry, but a valid e-mail address is required.\nPlease amend and retry.');
	return false;
} 

// you may copy the above 5 lines for each form field you wish to validate
// Replace the text "FIELD1" with the name you wish to call the field
}
