function checkIt(theForm) {
	// Make sure they fill in the first name
	if (isFieldBlank(document.sendemail.fName)) return false;

	// Make sure they fill in the last name
	else if (isFieldBlank(document.sendemail.lName)) return false;

	// Make sure they fill in the email_from address
	else if (document.sendemail.email_from.value == ""){
		document.sendemail.email_from.select();
		document.sendemail.email_from.focus();
		alert('Please enter an email address');	
		return false;
	}
		
	else if (emailCheck(document.sendemail.email_from.value) == false) {
		document.sendemail.email_from.select();
		document.sendemail.email_from.focus();
		alert('The email address you entered is not valid.  Please enter a valid email address');
		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 "fName": { var fName = "a First Name"; break }
		case "lName": { var fName = "a Last Name"; break }
	}
	if (theField.value == '' || theField.value == null) {
		alert('\nPlease enter ' + fName + '.');
		theField.focus();
		theField.select();
		return true;
	} else
		return false;
}
//-->


