$(function() {
  //$('.error').hide();
  $('.text-input').css({backgroundColor:"transparent"});
  $('.text-input').focus(function(){
    $(this).css({borderColor:"#666"});
  });
  $('.text-input').blur(function(){
      $("#email").css({backgroundColor:"transparent"});
    $(this).css({borderColor:"#aaa"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
  //  $('.error').hide();
		
		var email = $("#email").val();
	
	if ((email == "")||(email =="mailinglist@byamfi.nl")||(email =="email address")||(email =="undefined")||(email ==" ")||(email =="  ")||(email =="   ")||(email =="&nbsp;")) {

//      $("label#email_error").show();
      $("#email").focus();
      $("#email").css({backgroundColor:"#fffee8"});
    $("#email").css({borderColor:"#666"});

	 return false;

    }
		
		var dataString = '&email=' + email;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "/assets/processnews.php",
      data: dataString,
      success: function() {
        $('#newsletter_form').html("<div id='thankyoun'></div>");
        $('#thankyoun').html("<p>Welcome to the By AMFI mailinglist!</p>")
      }
     });
    return false;
	});
});
/*
runOnLoad(function(){
  $("input#name").select().focus();
});
*/
