
// BOI followed by one or more whitespace characters followed by EOI
var whitespace = /^\s+$/

// BOI followed by one or more characters excluding whitespace and @
// followed by a @ followed by one or more characters excluding
// whitespace and @ followed by a . followed by one or more characters
// excluding whitespace and @ followed by EOI
var email = /^[^\s@]+@[^\s@]+\.[^\s@]+$/

// BOI followed by a digit or space zero or more times
var phone_number = /^[\d ]*$/

// returns true if string s is empty
function isEmpty(s)
{
	if ((s == null) || (s.length == 0))
		return true;
}

// returns true if string s contains only whitespace
// i.e. tabs, carriage returns or newline characters
function isWhitespace(s)
{   
	if (isEmpty(s)) 
		return true;
	else
	{
		return whitespace.test(s);
	}
}

function isEmail(s)
{   
	if (isWhitespace(s)) 
		return false;
	else 
	{
		return email.test(s);
	}
}

function isPhoneNumber(s)
{
		return phone_number.test(s);
}