function check_email(theFormName)
{
	if (eval("document." + theFormName + ".updateEmail.value==''"))
	{
		alert('Please enter your email address.');
		eval("document." + theFormName + ".updateEmail.select()")
	 	return false;
	}
	
	// Check the email syntax
	if (eval('validate_email(document.' + theFormName + '.updateEmail) != 0'))
	{
		eval("document." + theFormName + ".updateEmail.select()")
		return false;
	}
	
	return true;
}

// A two dimensional array to hold error messages
function CreateArray(length)
{
	this.size=(length+3);
	for(var i = 1; i <= length+3; i++)
		this[i] = "Unacceptable character\nOnly alpha-numerics, underscores, hyphens and periods are allowed.";
}
	
// Validate the email address
function validate_email(email)
{
	address = new String(email.value);
	if(address.length == 0) return 0; 
	invalidchars = new Array(' ', ',', '[', ']', '/', '=', ';', '`', '+', '!', '#', '$', '%', '^', '&', '*', '(', ')', '~', ':', '\"', '\'', '\b', '<', '>', '?', '|', '{', '}');
	var numchars = invalidchars.length;
	error_messages = new CreateArray(numchars);  
	error_messages[0] = "Valid";
	error_messages[1] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[2] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[3] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[4] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[5] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[6] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[7] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[8] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[9] = "#sp_qryFormLabels.frm_email_error#";
	error_messages[10] = "#sp_qryFormLabels.frm_email_error#";

	var atloc=address.indexOf('@');
	var dotloc=address.lastIndexOf('.');
	var strOpt="\n\nYou also may simply leave this field blank";
         
	// Tests For one '.' and one '@' in correct order
	// And makes sure first substring isn't null
	if(atloc<1||dotloc==-1||dotloc<atloc)
	{
	alert("Please enter a valid Email Address.");           
	return 1;
	}
               
	// Tests second and third substrings for nullness
	else if(dotloc < atloc+2 || address.length < dotloc+2)
	{
	alert("Please enter a valid Email Address.");     
	return 2;
	}             
       
	// Tests for individual syntax errors
	// Only common keystroke errors included!        
	for(var ct=0;ct<numchars;ct++)
	{
		status=invalidchars[ct];
		if(address.indexOf(invalidchars[ct])!=-1)
		{
			alert("Please enter a valid Email Address.");
			return (ct+3);
		}
	}
	return 0;
}
// -->
