//=======================================================================================================
//-------------------------------------------------------------------------------------------------------
//	Custom Javascript functions
//-------------------------------------------------------------------------------------------------------
//=======================================================================================================
function IsEmail()
	{
		form = document.newslettersignup;
		control = form["fields[Email]"].value;
		if ( !control.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi) )
		{
			alert('Please enter a valid email address');
			return false;
		}
		
		return true;
	}

function validateSignup()
{
	form = document.newslettersignup;

	control = form["fields[Email]"];
	
	if ( !NLIsEmail( control.value ) )
	{
		alert("Invalid email address.");
		return false;
	}
	
	return true;
}

//---------------------------------------------------------------------------------------------------------
//	Email validation
//---------------------------------------------------------------------------------------------------------
function NLIsEmail( fieldvalue )
{
// Note: The next expression must be all on one line...
//       allow no spaces, linefeeds, or carriage returns!
	return fieldvalue.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
}