var em = document.getElementById("joinEmail")||null;
if(em){
	em.onkeypress = function(e){
		if(!e)e = window.event;
		if(!e)return;
		if(e.keyCode == 13){
			joinEmail();
		}
	}
}
function joinEmail(){
	
	if(!em || !em.value || !isValidEmail(em.value)){
		em.select();
		alert(' invalid email format');
		em.focus();
		return;
	}
	if(!ref){
		var ref = new z1BStream("__xxx__");
		ref.onload = function(){
			var w = this.getWindow();
			if(w){
				if(w.isOk){
<!--					alert("Your email is in our Mailing List.");-->
					em.value="";
					return true;
				}
				else{
					alert("This email is in our Mailing List already, please type an other email.");
					return false;
					document.getElementById("joinEmail").focus();
					em.value="";
				}
			}
			this.destroy();
		}
		ref.setURL("addEmailList.php?email="+em.value);
	}
}
function isValidEmail(strEmail){
		validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	    if (strEmail.search(validRegExp) == -1){
    		return false;
    	}
	    return true;
	}