$(function() {
  $('.error').hide();
  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  var email = $("input#signup").val();
		if (email == "Enter email for newsletter") {
      $("label#email_error").show();
      //$("input#email").focus();
      return false;
    }
		
		var dataString = '&email=' + email;
		//alert (dataString);return false;
		
	$.ajax({
      type: "POST",
      url: "/js/email.php",
      data: dataString,
      success: function() {
        $('#newsltr').html("<div id='message'></div>");
        $('#message').html("Email Submitted!<br />Thank you for signing up for our newsletter.")
        //.append("<p>We will be in touch soon.</p>")
        .hide()
        .fadeIn(1500, function() {
          $('#message').append("");
        });
      }
     });
    return false;
	});
});
//runOnLoad(function(){
//  $("input#email").select().focus();
//});

