// validate_email.js		

function validate_email() {
	
	var emailForm = document.getElementById("EmailSignup");
	
	if(!validate_email_input(emailForm.a11.value)) {
		alert("You have entered an invalid email.");
		emailForm.a11.focus(); 
		if(document.all || document.getElementByID){
			emailForm.a11.style.background = "yellow";
		}
		return false;
	}
}

function validate_email_input(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0) { 
			return (false);
		}
	}
	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
			return (-1);		
		}
	}
}

