function checkIt(theForm) {
	// Make sure they fill in the from address
	if (emailCheck(document.sendemail.FROM.value) == false) {
		sfrm.FROM.select();
		sfrm.FROM.focus();
		alert('The email address you entered is not valid.  Please enter a valid email address');
		return false;
	}

	// Make sure they fill in the to first name
	else if (isFieldBlank(document.sendemail.firstName)) return false;

	// Make sure they fill in the to last name
	else if (isFieldBlank(document.sendemail.lastName)) return false;

	// Make sure they fill in the to address1
	else if (isFieldBlank(document.sendemail.address1)) return false;

	// Make sure they fill in the to city
	else if (isFieldBlank(document.sendemail.city)) return false;

	// Make sure they fill in the to State
	else if (isFieldBlank(document.sendemail.state)) return false;

	// Make sure they fill in the to zip
	else if (isFieldBlank(document.sendemail.zip)) return false;

	// Make sure they fill in the to country
	else if (isFieldBlank(document.sendemail.country)) return false;

	// Make sure they fill in the to phone
	else if (isFieldBlank(document.sendemail.phone)) return false;

	// Make sure they fill in the to Exam Type
	exam=document.sendemail.exam1.options['0'].selected;
	if (exam == true){
		alert("Please select an exam type from the list.")
	}
	
	// Make sure they fill in the Date
	else if (isFieldBlank(document.sendemail.date1)) return false;

	else document.sendemail.submit()
}

//  This method checks the email address they entered to make sure it's valid.
//  It will return true if everything works right and false if it doesn't.
function emailCheck (emailStr) {
	var emailPat = /^(.+)@(.+)$/
	var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars = "\[^\\s" + specialChars + "\]"
	var quotedUser = "(\"[^\"]*\")"
	var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom = validChars + '+'
	var word = "(" + atom + "|" + quotedUser + ")"
	var userPat = new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat = new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray = emailStr.match(emailPat)
	if (matchArray == null) {
		return false
	}

	var user = matchArray[1]
	var domain = matchArray[2]

	if (user.match(userPat) == null) {
		return false
	}

	var IPArray = domain.match(ipDomainPat)
	if (IPArray != null) {
		for (var i = 1; i <= 4; i++) {
			if (IPArray[i] > 255) {
				return false
			}
		}
		return true
	}

	var domainArray = domain.match(domainPat)
	if (domainArray == null) {
		return false
	}

	var atomPat = new RegExp(atom,"g")
	var domArr = domain.match(atomPat)
	var len = domArr.length
	if (domArr[domArr.length-1].length < 2 || domArr[domArr.length-1].length > 3) {
		return false
	}

	if (len < 2) {
		//alert(errStr)
		return false
	}

	// If we've gotten this far, everything's valid!
	return true;
}

function isFieldBlank(theField) {
	var fName = theField.name;
	switch (fName) {
		case "FROM": { var fName = "a valid email address"; break }
		case "firstName": { var fName = "a First Name"; break }
		case "lastName": { var fName = "a Last Name"; break }
		case "address1": { var fName = "an Address"; break }
		case "city": { var fName = "a City"; break }
		case "state": { var fName = "a State"; break }
		case "zip": { var fName = "a Zip or Postal Code"; break }
		case "country": { var fName = "a Country"; break }
		case "testLocation": { var fName = "an Exam Location"; break }
		case "date1": { var fName = "a Date"; break }
	}
	if (theField.value == '' || theField.value == null) {
		alert('\nPlease enter ' + fName + '.');
		theField.focus();
		theField.select();
		return true;
	} else
		return false;
}
//-->


