/// This checks the string passed in as a domain name and requires that it
///   either end in one of the '.com' style endings or ends with '.cc' where the
///   'cc' represents two alphabetic characters of a country code domain.
///   I don't actually check for a valid country code, only for the proper form.
/// This function needs JS1.2 and does not work in Opera3.5.
function  isStandardDomain( domainIn )  {

	/// The value to return, start out assuming invalid domain.
	var  isStandardReturn = false;

	/// Holds the last 4 characters of domain name.
	var  last4chars  =  domainIn.substring( domainIn.length-4, domainIn.length );

	/// Holds the last 3 characters of domain name.
	var  last3chars  =  domainIn.substring( domainIn.length-3, domainIn.length );

	/// Uppercase it for comparison purposes.
	last4chars = last4chars.toUpperCase();

	/// A regular expression pattern to match country code domains.
	///  In otherwords a Dot character followed by two alphabetic characters.
	/// NOTE:  This line doesn't work at all in Opera3.5 and prevents the
	///  entire script from running!!!  BUMMER!!!
	///  It also seems to not work in Opera4.02 but only prevents
	///  the 2 letter codes from working but doesn't crash the script.
	var  countryCodePattern = /\.[a-zA-Z][a-zA-Z]/;


	if      ( last4chars == ".COM" ) isStandardReturn = true;
	else if ( last4chars == ".EDU" ) isStandardReturn = true;
	else if ( last4chars == ".GOV" ) isStandardReturn = true;
	else if ( last4chars == ".NET" ) isStandardReturn = true;
	else if ( last4chars == ".MIL" ) isStandardReturn = true;
	else if ( last4chars == ".ORG" ) isStandardReturn = true;

	else if ( last3chars.search( countryCodePattern )   !=  -1 )
		isStandardReturn = true;

	return  isStandardReturn;

} // Ends isStandardDomain( domainIn ).


/// Checks basic validity of an email address that's passed in.
///  Requires proper configuration of the '@' character lack of Spaces
///  and calls function "isStandardDomain()" to check on the form of the
///  domain name part.
/// Used an alert box to display it's answer.
/// This function needs JS1.2 [because isStandardDomain() does] and does not work in Opera3.5.
function  validateEmailAddress( emailIn )  {

	/// Number of '@' chars present in input string.
	var  numAtChars;

	/// The part of input address before the '@' character.
	var  userNameIn;

	/// The part of input address after the '@' character.
	var  domainNameIn;

	/// Holds the fields of the entered address, delimitted by '@' chars.
	var  addressFields = new Array();

	// Concatenate all alert output to here.
	var  alertString = "";


	/// Divide the input email address into fields.
	///  Note that the array "addressFields" will have one more element
	///  than the number of '@' signs in the input string.
	/// IE4 handles this OK with '@' as last character but NS4,4.5 and Opera 3.5 don't.
	addressFields = emailIn.split( '@' );

	numAtChars = addressFields.length - 1;

	alertString += "You have entered an invalid email address.\n\n";


	if ( emailIn == "" || numAtChars  ==  0 || numAtChars  >  1 || addressFields[0] == "" || addressFields[1] == "" )
		alert( alertString );
		
	else
		{
		userNameIn   = addressFields[0];
		domainNameIn = addressFields[1];

		if ( userNameIn.indexOf( " " ) != -1 || domainNameIn.indexOf( " " ) != -1 || isStandardDomain( domainNameIn ) == false )
			alert( alertString );
			
	} // Ends else from outer string of if-then-else's.

} // Ends validateEmailAddress().

function confirmPasswd (passwd, c_passwd){
	if (passwd != c_passwd)
		alert ("The passwords provided do not match. Please make sure you are entering the same password in both boxes.");
}


