$(document).ready(function(){
	//$('.error').hide(); 

   $('.submit_field').click(function(){ //submit button is triggered
	
			var formId = this.form;
			var email = formId.getElementsByTagName("input");
			email = email[0].value;
			
			if (email == "Enter email address..." || email == "") {
				  //$("span.email_error").show();
				  //$("input.email").focus();
				  
				  alert("Please enter a valid email address in order to subscribe to our blog updates.")
				  return false;
			} else {
				atposition=email.indexOf("@")
				dotposition=email.lastIndexOf(".")

				if (atposition<1||dotposition-atposition<2)
					{alert("Not a valid email address.");return false;}

			}
				
			
	  var dataString = 'email=' + email;
	  //alert (dataString);
	  
	  $.ajax({
		 type: "POST",
		 url: "../bin/process_blog_form.php",
		 data: dataString,
		 success: function() {
			//$('#contact_form').html("<div id='message'></div>");
			//$('#message').html("<h2 style='margin-top:0;'>Your Info Submitted!</h2>")
			//	.append("<p style='line-height:18px;'>Thank you for your interest in BookingEntertainment. We will be in touch soon.</p>")
			//	.hide()	
			//disablePopup();
			//alert('sent!');
		 }
	  });
	  alert("Thank you, you have successfully subscribed to our SEO Blog for updates.");
	  return false;
    });
/*  });*/
});


//$(document).ready(function() {
//    // bind form using ajaxForm
//	 var myId = this.id;
//	 var formId = this.form.id;
//    $('#'+myID).ajaxForm({
//        // target identifies the element(s) to update with the serverresponse
//        target: '#htmlExampleTarget',
//
//        // success identifies the function to invoke when the server response
//        // has been received; here we apply a fade-in effect to thenew content
//        success: function() {
//           alert('hoho');
//        }
//    });
//});



