function isValidEmail(emailAddressStr)
{
	// A valid email addresses must be of form ---@---.---	
	// The position of "@" must not be 0, and must be more than 1 position to the left of the "."
	// Additional "." characters may also be located anywhere in the address.
	
	var index1 = 0;
	var index2 = 0;
	var index3 = -1;
	var lastDot = 0;
	
	// check first to see that address does not end with a '.'
	lastDot = emailAddressStr.indexOf('.',(emailAddressStr.length -1));
	if (lastDot != -1) 
	{
		return false;
	}
	// check for existence of @
	index1 = emailAddressStr.indexOf('@',0);
	if ((index1 == -1) || (index1 == 0))
	{
		return false;
	}
	else
	{
		// check for illegal 2nd occurrence of '@'
		index3 = emailAddressStr.indexOf('@',(index1 +1));
		if (index3 != -1)
		{
			return false;
		}
	}
	
	// check for existence of at least one "." following the "@" by at least 1 character
	index2 = emailAddressStr.indexOf('.',index1);		
	if(index2 == -1)		// no "." at all
	{
		return false;
	}
	else					// see if there is 1 "." that is following the "@" appropriately
	{			  
		do
		{
			if((index1+1) < index2)
			{
				
				return true;
			}		
				
			index2 = emailAddressStr.indexOf('.',index2 +1);
			if(index2 == -1)
			{
				return false;
			}	
		}
	
		while(!(index2 == -1))		
	}
	return true;
}

