
function validate(email) {

	
	if (email.value != "") {
	
		var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		
		if (!re.test(email.value)) {
		
		window.alert("You entered an invalid Email Address.");
		email.value = "";
		
		// setTimout is used to make blinking cursor appear with focus
		//    and also to make focus work in Firefox.
		// I found this solution in a search for focus problems in JS.
		
		setTimeout(function(){email.focus()}, 10);
		return false;
		}
	}

}