function  isStandardDomain( domainIn )  { 

	/// The value to return, start out assuming invalid domain.
	var  isStandardReturn = false;
	
	/// Holds the last 5 characters of domain name.
	var  last5chars  =  domainIn.substring( domainIn.length-5, domainIn.length );	

	/// 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();
	last5chars = last5chars.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 == ".INT" ) isStandardReturn = true;	
	else if ( last4chars == ".ORG" ) isStandardReturn = true;
	else if ( last4chars == ".BIZ" ) isStandardReturn = true;	
	else if ( last4chars == ".NOM" ) isStandardReturn = true;		
	else if ( last4chars == ".PRO" ) isStandardReturn = true;			
	else if ( last4chars == ".WEB" ) isStandardReturn = true;	
	else if ( last4chars == ".CAT" ) isStandardReturn = true;	
	else if ( last4chars == ".TEL" ) isStandardReturn = true;	
	else if ( last5chars == ".INFO" ) isStandardReturn = true;		
	else if ( last5chars == ".NAME" ) isStandardReturn = true;		
	else if ( last5chars == ".COOP" ) isStandardReturn = true;			
	else if ( last5chars == "STORE" ) isStandardReturn = true;			
	else if ( last5chars == ".FIRM" ) isStandardReturn = true;				
	else if ( last5chars == ".ARPA" ) isStandardReturn = true;		
	else if ( last5chars == "USEUM" ) isStandardReturn = true;			
	else if ( last5chars == ".AERO" ) isStandardReturn = true;				
	else if ( last5chars == ".NATO" ) isStandardReturn = true;	
	else if ( last5chars == ".JOBS" ) isStandardReturn = true;		
	else if ( last5chars == ".MOBI" ) isStandardReturn = true;			
	else if ( last5chars == ".ASIA" ) isStandardReturn = true;				
	else if ( last5chars == "RAVEL" ) 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  validateEmailAddress2( emailIn )  {

	var  isStandardReturn = false;

	/// 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;
	
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	

	alertString += "El contenido del campo Correo Electrónico:  \"" + emailIn + "\" - ";


	if ( emailIn == "" )
		alertString += "is EMPTY.";

	else if ( numAtChars  ==  0 )
		alertString += "no contiene el carácter '@' y por lo tanto no es una dirección válida de Correo Electrónico.";

	else if ( numAtChars  >  1 )
		alertString += "no es una dirección válida de Correo Electrónico.";

	else if ( addressFields[0] == "" )
		alertString += "no es una dirección válida de Correo Electrónico.";

	else if ( addressFields[1] == "" )
		alertString += "no es una dirección válida de Correo Electrónico.";
		

	else
		{
		userNameIn   = addressFields[0];
		domainNameIn = addressFields[1];

		if ( userNameIn.indexOf( " " ) != -1 )
			alertString += "no es una dirección válida de Correo Electrónico.";
		else if ( domainNameIn.indexOf( " " ) != -1 )
			alertString += "no es una dirección válida de Correo Electrónico.";

		else if ( isStandardDomain( domainNameIn ) == false )
			alertString += "no termina con un dominio (como, por ejemplo, '.com') o un dominio de código de dos letras correspondiente a un país, y por lo tanto no es una dirección válida de Correo Electrónico.";

		else if (!filter.test(emailIn)) 	
			alertString += "no es una dirección válida de Correo Electrónico.";

		else
			alertString = "";

	} // Ends else from outer string of if-then-else's.

	// Post the alert box.

	if (alertString == "")
		isStandardReturn = true;
	else
		alert( alertString );		
		
	
	return  isStandardReturn;
	

} // Ends validateEmailAddress2().
   
