//used by isValidEmailAddress function
function trim(inputString) {
   return inputString.replace(/^\s+/,'').replace(/\s+$/,'');
}
//Called by html page
function isValidEmailAddress(email, regx) {
	if(email == null)  
	{
		return false;
	} 
	else if((email = trim(email)).length == 0)
	{
		return false;
	} 
	else 
	{
		//Validate emailaddress character set and rules
		if(regx == null || regx == "" || regx == "null")
		{
			regx = /^[A-Za-z0-9]+\w*((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-|_)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
		}
		return regx.test(email);
  	}
}
// called by html page but we will not be using so we can erase.
function isValidDomain(domain, regx) 
{	
	if(domain == null)
	{
		return false;
	} 
	else if((domain = trim(domain)).length == 0)
	{
		return false;
	}
	else if(domain.length > 250)
	{
		return false;
	}
	else 
	{	
		//Validate domain character and rules
		if(regx == null || regx == "" || regx == "null")
		{
			regx = /^[A-Za-z0-9](\.|-|\w)*[A-Za-z0-9]$/;
		}
  		return regx.test(domain);
  	}
}