/*
Section: email validation
*/
	function email_VA(str){		
	
		// regular expression configuration	
		var dots_double = new RegExp("\\.\\.");
		var dots_begin = new RegExp("^\\.");
		var dots_end = new RegExp("\\.$");
		var ats_begin = new RegExp("^@");
		var ats_end = new RegExp("@$");
		var white_space = new RegExp("\\s");
		
		// boolean evaluations
		var at_exists = (str.search(/\@/) != -1);
		var at_only_one = false;
		var dot_one_after_at = false;
		
		if(at_exists){	// if no 'at' symbol exists, the following are obsolete
			var at_only_one = (Number((str.split("@").length)-1) == 1);
			var dot_one_after_at = (Number(str.split("@")[1].search(/\./)) != -1);
		}
		
		// regular expression evaluations
		var e_dots_double = dots_double.test(str);
		var e_dots_begin_end = (dots_begin.test(str) || dots_end.test(str));
		var e_ats_begin_end = (ats_begin.test(str) || ats_end.test(str));
		var e_at_only_one = at_only_one;
		var e_white_space = white_space.test(str);
		var e_dot_one_after_at = dot_one_after_at;

		// final evaluation
		var valid_email = Boolean((!e_dots_double) && (!e_dots_begin_end) && (!e_ats_begin_end)
			&& (e_at_only_one) && (!e_white_space) && (e_dot_one_after_at));		
		
		if(valid_email){		
				return true;	// email successfully validated
			//else
				//return false;
		}
		else{
			// capture and handle errors in the provided email structure
			var error_msg = "";
			if(e_dots_double){
				error_msg = "Periods (.) must be separated by non-whitespace characters";
			}
			else if(e_dots_begin_end){
				error_msg = "A valid email address cannot begin with a period (.) or end with a period";
			}
			else if(e_ats_begin_end){
				error_msg = "A valid email address cannot begin with an '@' symbol or end with an '@' symbol";
			}
			else if(!at_exists){
				error_msg = "An '@' symbol is required in a valid email address";
			}
			else if(!e_at_only_one){
				error_msg = "Only one '@' symbol is allowed in a valid email address";
			}
			else if(e_white_space){
				error_msg = "No white space (space, tab, newline, carriage return, bell, etc) " + 
					"is allowed in a valid email address";
			}
			else if(!e_dot_one_after_at){
				error_msg = "A valid email address's domain must have at least one period (.)";
			}
			var email_example = "joe.smith@email.somewhere.com";
			var email_explain = "A valid email consists of a username, an '@' symbol, " +
				"and a domain address.  For example...\n -  " + email_example;
				
			alert(error_msg + "\n -  " + str + "\n\n" + email_explain);
			
			return false;			
		}
	}
// end section

/*
 Section: compatibility functions for Netscape and IE
*/
	function isDefined(variable){
		if(navigator.appName == "Netscape"){
			return (!(variable == undefined));
		}
		else{ // (navigator.appName == "Microsoft Internet Explorer"){
			return (!(variable == null));
		}
	}

	function isEmpty(variable){
		if(	(!isDefined(variable)) ||
			(variable == "") ||
			(variable == null) )
		{	
			return true;
		}

		return false;
	}
// end section

<!-- Hide
function newWindow() 
{ 
secondWindow = window.open('startpage.html', 'newWin', 'width=450,height=300,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable'); 
}
// Unhide -->

function confirmEA(email)
{
	return confirm("Please verify your email address: " + "\n\n" + email +  "\n\n" + "Click OK to continue and Cancel to change." );	
}

