function checkEmails (theform)
{
	var eMailElement;
	var eMailValid;

	if (theform.TO_EMAIL.value.length == 0) {
		alert("You did not enter a valid TO: email address, please try again.");
		theform.TO_EMAIL.select();
		return;
    } else {
		eMailElement = theform.TO_EMAIL;
		eMailElement.value = trim(eMailElement.value);
		eMailValid = checkEmail(eMailElement.value);
		if (eMailValid != 0) 
		{
			alert ('The TO: e-mail address ' + eMailElement.value + ' is not valid.  Please try again.');
			theform.TO_EMAIL.select();
			return;
		}
	}

	if (theform.FROM_EMAIL.value.length == 0) {
		alert("You did not enter a valid FROM: email address, please try again.");
		theform.FROM_EMAIL.select();
		return;
    } else {
		eMailElement = theform.FROM_EMAIL;
		eMailElement.value = trim(eMailElement.value);
		eMailValid = checkEmail(eMailElement.value);
		if (eMailValid != 0) 
		{
			alert ('The FROM: e-mail address ' + eMailElement.value + ' is not valid.  Please try again.');
			theform.FROM_EMAIL.select();
			return;
		}
	}

    theform.submit();
}


