$(function() {
  $('.error').hide();

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	 
		var email = $("input#email").val();
		if (email == "")  {
      $("label#info").hide();
	  $("label#email_error").show();	  
	  $('input.text-input').css('background-image','url(images/bg-input-error.jpg)');	  
      $("input#email").focus();
      return false;    }		
		
		var dataString = 'email=' + email;
		//alert (dataString);return false;		
		
	$.ajax({
      type: "GET",
      url: "/bin/process.php",
      data: dataString,
      success: function() {
        $('#contact_form').html("<div id='message'></div>");
        $('#message').html("<h2>Email Submitted!</h2>")
        .append("<p>Thank you for registering your interest, we will notify you prior to the launch of 'Thinkcreative'.</p>")
        .hide()
        .fadeIn(1500, function() {
          $('#message');
        });
      }
     });
    return false;
	});
});
runOnLoad(function(){
  $("input#email").select().focus();
});
