/********************************************************************************************
Author:		B06GUY/B06JDN
Create Date:	06/06/03
Description:	pass-in parameter is a string. 
		Return true if it is valid email, otherwise false
				
		Valid email criteria checked:
		1. The sections preceding and following the @ symbol may not include 
		   the following characters:  @,:;{}()[]<> ",. and space
		2. . is not allowed preceding and following @ symbol
		3. No leading or ending or repeating .
		4. The section following the @ sign must contain a period (.)
		5. The @ and only one @ symbol must be included in the string
		6. The section following the last period following the @ sign must be 
		   one of the following:  biz,com,net,org,edu,gov,int,tv,info,cc,ws	
		   or any two charaters for country code.  Well, you are right, bi is valid
		   domain. But who knows?
		7. It is case insensitive. 
				
Limitation:	1. It does not check the IP address format such as 15.25.108.9	
		2. It considers any two characters as valid country code because we do not 
		   know where/how to collect the list of real valid country codes
		3. This may drive somebody crazy:  a.a.a.a@b.c.d.e.f.g.h.biz. 
		   But it is also considered as valid
		4. Maybe more......
*********************************************************************************************/				
				   		
function isValidEmail(strEmail)
{
	strEmail = strEmail.replace(/^\s+\s+$/, "");
	strEmail = strEmail.toUpperCase();
	
	if(strEmail.length == 0)	
		return false;
	
	var emailPat=/^(([^@,:;{}()\[\]<> ."]+)[.])*([^@,:;{}()\[\]<> ."])+@(([^@,:;{}()\[\]<> ."]+)[.])+([^@,:;{}()\[\]<> .'"]+)$/;
	var arrResult = emailPat.exec(strEmail);
	
	if (arrResult == null) 
		return false;
	
	var intIndex = strEmail.lastIndexOf(".");
	var strDomain = strEmail.substring(intIndex+1, strEmail.length);
	
	var domainPat = /^(BIZ|COM|NET|ORG|EDU|GOV|INT|TV|INFO|CC|WS|[^\d\W]{2})$/;
	
	var arrResult = domainPat.exec(strDomain);
	
	if (arrResult == null) 
		return false;
	
	return true;
}
