﻿function validateForm()
{
	valid = true;
	if (document.photoData.firstname.value == "") {
		alert ("Please fill in the 'First Name' box.");
		document.photoData.firstname.focus();
		valid = false;
	} else if (document.photoData.lastname.value == "") {
		alert ("Please fill in the 'Last Name' box.");
		document.photoData.lastname.focus();
		valid = false;
	} else if (document.photoData.age.value == "") {
		alert ("Please fill in the 'Age' box.");
		document.photoData.age.focus();
		valid = false;
	} else if (document.photoData.grade.value == "") {
		alert ("Please fill in the 'Grade' box.");
		document.photoData.grade.focus();
		valid = false;
	} else if (document.photoData.street.value == "") {
		alert ("Please fill in the 'Street Verify' box.");
		document.photoData.street.focus();
		valid = false;
	} else if (document.photoData.school.value == "") {
		alert ("Please fill in the 'School' box.");
		document.photoData.school.focus();
		valid = false;
	} else if (document.photoData.email.value == "") {
		alert ("Please fill in the 'Email' box.");
		document.photoData.email.focus();
		valid = false;
	} else if (document.photoData.city.value == "") {
		alert ("Please fill in the 'City' box.");
		document.photoData.city.focus();
		valid = false;
	} else if (document.photoData.state.value == "") {
		alert ("Please fill in the 'State' box.");
		document.photoData.state.focus();
		valid = false;
	} else if (document.photoData.zip.value == "") {
		alert ("Please fill in the 'Zip Code' box.");
		document.photoData.zip.focus();
		valid = false;
	} else if (document.photoData.phone.value == "") {
		alert ("Please fill in the 'Phone' box.");
		document.photoData.phone.focus();
		valid = false;
	} else if (document.photoData.photo.value != "") {
		if (!(/(.png|.jpg|.gif)$/.test(document.getElementById("photo").value))) {
		    alert ("Please upload an image file only.");
			document.photoData.photo.value = "";
			document.photoData.photo.focus();
		    valid = false;
		}
	}
	return valid;
}

