// Verifies that a form element contains a valid e-mail address
// Prompts for a default domain if necessary
// Returns TRUE|FALSE
// Verifies that a string is a valid e-mail address
// Returns TRUE|FALSE
function verify_email(strEmail)
{
	// look for an @ sign in the right place
	var iAtSign = strEmail.indexOf('@')
	if ((iAtSign == 0) || (iAtSign == -1) || (iAtSign == (strEmail.length - 1))) return false;

	// ensure there's only one at sign
	var iSecondAtSign = strEmail.indexOf('@', iAtSign + 1)
	if (iSecondAtSign > iAtSign) return false;

	// ensure that the last character in the address is not a period
	if (strEmail.charAt(strEmail.length - 1) == '.') return false;

	// ensure there's at least one period after the at sign
	var iPeriod = strEmail.indexOf('.', iAtSign)
	if ((iPeriod == 0) || (iPeriod == -1)) return false;

	// ensure that the period is not the character directly following the at sign
	if (iPeriod == iAtSign + 1) return false;
	
	// Disallow all these characters
	if (strEmail.indexOf(',') != -1) return false;
	if (strEmail.indexOf(' ') != -1) return false;
	if (strEmail.indexOf('*') != -1) return false;
	if (strEmail.indexOf('(') != -1) return false;
	if (strEmail.indexOf(')') != -1) return false;
	if (strEmail.indexOf('>') != -1) return false;
	if (strEmail.indexOf('<') != -1) return false;
	if (strEmail.indexOf(':') != -1) return false;
	if (strEmail.indexOf(';') != -1) return false;
	if (strEmail.indexOf('"') != -1) return false;

	// Otherwise, fall through to here and declare the e-mail address valid
	return true;
}