
// Validate Enquiry form
function validate_enquiry_form(f) {
	if (isFilled(f.contact_name)==false) {
		alert("Contact Name field cannot be blank");
		f.contact_name.focus();
		return false;
	}
	if (isFilled(f.email)==false) {
		alert("Email field cannot be blank!");
		f.email.focus();
		return false;
  	}
	if (isFilled(f.company_name)==false) {
		alert("Company Name field cannot be blank");
		f.company_name.focus();
		return false;
	}
	if (isFilled(f.address)==false) {
		alert("Address field cannot be blank");
		f.address.focus();
		return false;
	}
	if ((!f.contact_me.checked) && (isFilled(f.contact_method)==true)) {
		alert("If you would like us to contact you please check the contact me checkbox!");
		f.contact_me.focus();
		return false;
	}
	if ((f.contact_me.checked) && (isFilled(f.contact_method)==false)) {
		alert("Please enter your preferred way of being contacted!");
		f.contact_method.focus();
		return false;
	}
	if (isFilled(f.enquiry)==false) {
		alert("Your Enquiry field cannot be blank");
		f.enquiry.focus();
		return false;
	}
  	if (validEmail(f.email.value)==false) {  // check e-mail address is valid
		alert("Invalid email address!");
		f.email.focus();
		f.email.select();
		return false;
  	}
	return true;
}

// Validate 'Tell a Friend' form
function validate_tell_a_friend_form(f) {
	if (isFilled(f.to_first_name)==false) {
		alert("TO First Name field cannot be blank");
		f.to_first_name.focus();
		return false;
	}
	if (isFilled(f.to_last_name)==false) {
		alert("TO Last Name field cannot be blank");
		f.to_last_name.focus();
		return false;
	}
	if (isFilled(f.to_email)==false) {
		alert("TO Email Address field cannot be blank");
		f.to_email.focus();
		return false;
	}
  	if (validEmail(f.to_email.value)==false) {
		alert("Invalid TO Email Address!");
		f.to_email.focus();
		f.to_email.select();
		return false;
  	}
	if (isFilled(f.from_first_name)==false) {
		alert("FROM First Name field cannot be blank");
		f.from_first_name.focus();
		return false;
	}
	if (isFilled(f.from_last_name)==false) {
		alert("FROM Last Name field cannot be blank");
		f.from_last_name.focus();
		return false;
	}
	if (isFilled(f.from_email)==false) {
		alert("FROM Email Address field cannot be blank");
		f.from_email.focus();
		return false;
	}
  	if (validEmail(f.from_email.value)==false) {
		alert("Invalid FROM Email Address!");
		f.from_email.focus();
		f.from_email.select();
		return false;
  	}
	return true;
}