var bPrivacyFlag = false;

		function IsValidEmail(email) 
		{
			var fEmailOK = true;
			var num = 0;
		
			for (var i = 0; i < email.length; ++i) {
				var ch = email.charAt(i);
				if (ch == "@") {
					num = num + 1;
					}
				}
			if (num != "1") 
				return false;
				
			var num2 = 0;
			for (var i = 0; i<email.length; ++i) {
				var ch = email.substring(i,i+2);
				if ((ch == "..")||(ch == ".@")||(ch == "@.")) {
					return false;
					}
				}
	
			if (email.length < 4)
				return false;
			else if (email.lastIndexOf(' ') != -1)
				return false;
			else if ((email.substring(0,1) == ".")||(email.substring(0,1) == "@")){
				return false;
				}
			else if (email.lastIndexOf('\'') != -1)
				return false;
			else if ((i = email.lastIndexOf('@')) == -1)
				return false;
			else { // Get substring
				var tail = email.substring(i+1, email.length);
				if (tail.length < 3)
					return false;
				else if ((i = tail.lastIndexOf('.')) == -1)
					return false;
				else {
					var tailend = tail.substring(i+1, tail.length);
					if (tailend.length == 0)
						return false;
				}
			}
			return true;
		} 

	function checkForm(frm) {
	var errMsg = '';
	
	// Validate email address.
	if (isBlank(frm.EmailAddress)) errMsg += '\n\nEmail address is required.\n';

	if (!IsValidEmail(frm.EmailAddress.value)) {
		errMsg = "The email address you entered was not complete.";
		errMsg += "\nType your complete e-mail address, including the @ symbol";
		errMsg += "\nand the domain. (i.e., myname@sounddogs.com)";
		}

	if (isBlank(frm.Password)) errMsg += '\n\nPassword Field is Required';	

	if (isBlank(frm.ConfirmPassword)) errMsg += '\n\nConfirm Password Field is Required';	

	if (isBlank(frm.FirstName)) errMsg += '\n\n First Name Field is Required';	

	if (isBlank(frm.LastName)) errMsg += '\n\n Last Name Field is Required';	

	if ((frm.Password.value) != (frm.ConfirmPassword.value)) errMsg += '\n\n Password and Confirm Password Fields must match';	

	if (!isBlank(frm.EmailAddress2)) {
		if (!IsValidEmail(frm.EmailAddress2.value)) {
			errMsg += "\n\nThe Additional email address you entered was not complete.";
			errMsg += "\nType your complete Additional e-mail address, including the @ symbol";
			errMsg += "\nand the domain. (i.e., myname2@sounddogs.com)";
			}
		}


		if (errMsg != '') {
			alert('Errors Encountered:\n\n' + errMsg);
			return false;
		}
		else {
			return true;
		}
	}	
			
		
	function isBlank(tf) {
		var tfVal = tf.value;
		var space = ' ';
		var c;
		
	if (tfVal == null || tfVal.length == 0) 
	return true;

    for (var i = 0; i < tfVal.length; i++) {   
        c = tfVal.charAt(i);
        if (space.indexOf(c) == -1) 
	return false;
	}
    return true;
}
