$(function(){
	
		var emailReg = /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;
		var data;
		var e_btn = $('#e_btn');
		
		$("#email").focus(function(){
			  if($(this).val() == this.defaultValue){
					 $(this).val("");           
			  } 
		}).blur(function(){
			  if ($(this).val() == '') {
					 $(this).val(this.defaultValue);
             }
		});
		//Press "Enter" Key to realize auto submit in "Forgot Password"
		$("#email").keypress(function (e) {
			if (e.keyCode == 13) {
				e_btn.trigger("click");
                return false;
            }
        });
		e_btn.click(function(){
					if( $('#email').val() =="" || ( !emailReg.test($('#email').val()) ) )
					 {
						 alert ("Please enter a valid email address!");
						 return false;
					   }
					   else{ 
					 };
					data = $('#form').serialize();
					//var index = this.rel;
					//表单提交
					$.ajax({
					   type: "POST",
					   url: "enewsletter.php",
					   data: data,
					   success: function(result){
						   (result=="OK") ? alert ("Submit Successfully!") : '';
						   (result=="Been") ? alert ("We already have this email in our list.") : '';
						   (result=="Wrong") ? alert ("Please enter a valid email address!") : '';
						   $("#email").val('your email address');
					   }
					});
			});
			
});

