//-------------------------------------------------------------------------------------------------------

function ValidEmail(str) {
	Valid = false;
	// If string is greater than 0
	if (str.length > 0) {
		// If a space exists OR a comma exists OR a semi colon exists
		if (str.indexOf(' ') != -1 || str.indexOf(',') != -1 || str.indexOf(';') != -1) {
			return false;
		}
				
		at = str.indexOf('@');

		// If @ is not in 1st position
		if (at > 0) {
			// dot is the index of . starting at @
			dot = str.indexOf('.',at);
			
			// If 1 char between @ and . AND at least 2 char after . AND no more than 3 char after .
			if (dot > (at + 1) && dot < (str.length - 2) && dot >= (str.length - 4)) {
				Valid = true;
			}
		}			
	}
	return Valid;
}

function check()
{
	var o=document.getElementById('newsletter'); 

	if (!ValidEmail(o.email.value)) 
	{
			alert('Please enter a valid email address.');
			o.email.focus();
			return false;	
	}
}

function check_secondary()
{
	var o=document.getElementById('newsletter_secondary'); 

	if (!ValidEmail(o.email.value)) 
	{
			alert('Please enter a valid email address.');
			o.email.focus();
			return false;	
	}
}