// RSPCA Wigan
// function to check form for lost and found

	
function checkFormNow(){
	
// check for lost or found
if(document.contactformLostFound.LostOrFound.value == 0){
	window.alert("Please tell us whether the animal is lost or found.");
	document.contactformLostFound.LostOrFound.focus();
	return (false);
}

// check for animal details
if(document.contactformLostFound.animalDetails.value == ""){
	window.alert("Please provide us with some details about the animal.");
	document.contactformLostFound.animalDetails.focus();
	return (false);
}
	
// check for location of animal 
if(document.contactformLostFound.locationLostOrFound.value == ""){
	window.alert("Please tell us where the animal was lost or found.");
	document.contactformLostFound.locationLostOrFound.focus();
	return (false);
}
	
// check for date and time  
if(document.contactformLostFound.lastSeenOrFound.value == ""){
	window.alert("Please tell us the date and time the animal was last seen or found.");
	document.contactformLostFound.lastSeenOrFound.focus();
	return (false);
}

// check for type of animal  
if(document.contactformLostFound.animalType.value == ""){
	window.alert("Please tell us the type of animal.");
	document.contactformLostFound.animalType.focus();
	return (false);
}

// check for sex
if(document.contactformLostFound.animalSex.value == 0){
	window.alert("Please indicate the sex of the animal.");
	document.contactformLostFound.animalSex.focus();
	return (false);
}

// check for collar worn
if(document.contactformLostFound.collarWorn.value == 0){
	window.alert("Please tell us whether a collar is or was worn.");
	document.contactformLostFound.collarWorn.focus();
	return (false);
}


if(document.contactformLostFound.collarWorn.value == "Yes" && document.contactformLostFound.collarColour.value == ""){
	window.alert("Please tell us the colour of the collar.");
	document.contactformLostFound.collarColour.focus();
	return (false);
}

// check for body size
if(document.contactformLostFound.bodySize.value == 0){
	window.alert("Please tell us the animal\'s body size.");
	document.contactformLostFound.bodySize.focus();
	return (false);
}

// check for main body colour  
if(document.contactformLostFound.mainBodyColour.value == ""){
	window.alert("Please tell us the animal\'s main body colour.");
	document.contactformLostFound.mainBodyColour.focus();
	return (false);
}

// check for neutered or spayed
if(document.contactformLostFound.animalNeuteredOrSpayed.value == 0){
	window.alert("Please indicate whether the animal has been neutered or spayed.");
	document.contactformLostFound.animalNeuteredOrSpayed.focus();
	return (false);
}

// check for name of contact
if(document.contactformLostFound.nameOfContact.value == ""){
	window.alert("Please enter your name.");
	document.contactformLostFound.nameOfContact.focus();
	return (false);
}

// check for address of contact
if(document.contactformLostFound.addressOfContact.value == ""){
	window.alert("Please enter your address.");
	document.contactformLostFound.addressOfContact.focus();
	return (false);
}


// check for valid email address - @ sign and "."
if(document.contactformLostFound.email.value != ""){
	atfound = document.contactformLostFound.email.value.indexOf("@");
	dotfound = document.contactformLostFound.email.value.indexOf(".");
	if (atfound < 1 || dotfound < 2) {
			alert("Invalid email address: please re-enter correct address");
document.contactformLostFound.email.focus();
	return (false);}
}

// check for preferred contact number
if(document.contactformLostFound.preferredContactNo.value == ""){
	window.alert("Please enter your preferred contact number.");
	document.contactformLostFound.preferredContactNo.focus();
	return (false);
}

// closing curly bracket for function
}


