// function to check form

function enterAddress(){
	if(document.contactform.postalAddress.value == "Click here to enter your postal address, including postcode. (We must have this if you want us to carry out a home visit.)") {
	document.contactform.postalAddress.value = "";
	}
}

	
function checkEnquiryNow(){
	
// check for name
if(document.contactform.name.value == ""){
	window.alert("Please enter your name.");
	document.contactform.name.focus();
	return (false);
}
	
// check for drop down selection
if(document.contactform.howToContact.value == 0){
	window.alert("Please tell us how you would like to be contacted.");
	document.contactform.howToContact.focus();
	return (false);
}
	
	// check for contact number
if(document.contactform.howToContact.value == "Phone only" && document.contactform.contactNo.value == ""){
	window.alert("Please enter your telephone or mobile no.");
	document.contactform.contactNo.focus();
	return (false);
}
	
	// check for email address 
if(document.contactform.howToContact.value == "Email only" && document.contactform.email.value == ""){
	window.alert("Please enter your email address.");
	document.contactform.email.focus();
	return (false);
}
	
	// check for contact number if either way is selected  
if(document.contactform.howToContact.value == "Phone or email" && document.contactform.contactNo.value == ""){
	window.alert("Please enter your telephone or mobile no.");
	document.contactform.contactNo.focus();
	return (false);
}
	
	// check for email address if either way is selected
if(document.contactform.howToContact.value == "Phone or email" && document.contactform.email.value == ""){
	window.alert("Please enter your email address.");
	document.contactform.email.focus();
	return (false);
}

	// check that at least one enquiry type is checked
if(document.contactform.rehomingCats.checked == false && document.contactform.rehomingDogs.checked == false && document.contactform.volunteering.checked == false && document.contactform.homeVisiting.checked == false&& document.contactform.workInShops.checked == false && document.contactform.payrollGiving.checked == false && document.contactform.makeDonation.checked == false && document.contactform.other.checked == false){
	window.alert("Please tell us the type of your enquiry.");
		return (false);
}
	
	// check for postal address if home visiting is requested
	if((document.contactform.homeVisiting.checked == true && document.contactform.postalAddress.value == "Click here to enter your postal address, including postcode. (We must have this if you want us to carry out a home visit.)") || (document.contactform.homeVisiting.checked == true && document.contactform.postalAddress.value == "")){
	window.alert("To carry out home visits, we will need your postal address.");
	document.contactform.postalAddress.focus();
		return (false);
}
		
	
	// check for enquiry details
if(document.contactform.details.value == ""){
	window.alert("Please tell us about your enquiry.");
	document.contactform.details.focus();
	return (false);
}


	// check for contact details if newsletter requested
if(document.contactform.newsletterByEmail.checked == true && document.contactform.email.value == ""){
	window.alert("Please enter your email address so \nwe can send you our newsletter.");
	document.contactform.email.focus();
	return (false);
}

if(document.contactform.newsletterByPost.checked == true && (document.contactform.postalAddress.value == "" || document.contactform.postalAddress.value == "Click here to enter your postal address, including postcode. (We must have this if you want us to carry out a home visit.)")){
	window.alert("Please enter your postal address so \nwe can send you our newsletter.");
	document.contactform.postalAddress.focus();
	return (false);
}




}

