  $(function() {
  
  	$('.error').hide();
	$('input.text-input').css({backgroundColor:"#FFFFFF"});
	$('input.text-input').focus(function(){
	  $(this).css({backgroundColor:"#D6EEFF"});
	});
	$('input.text-input').blur(function(){
	$(this).css({backgroundColor:"#FFFFFF"});
	  });
	  
	$('textarea.text-input').css({backgroundColor:"#FFFFFF"});
	$('textarea.text-input').focus(function(){
	  $(this).css({backgroundColor:"#D6EEFF"});
	});
	$('textarea.text-input').blur(function(){
	$(this).css({backgroundColor:"#FFFFFF"});
	  });

    $(".button").click(function() {
      // validate and process form here
      
      $('.error').hide();
  	  var name = $("input#name").val();
  		if (name == "") {
        $("label#name_error").show();
        $("input#name").focus();
        return false;
      }
  		var email = $("input#email").val();
  		if (email == "") {
        $("label#email_error").show();
        $("input#email").focus();
        return false;
      }
  		var phone = $("input#phone").val();
  		if (phone == "") {
        $("label#phone_error").show();
        $("input#phone").focus();
        return false;
      }
      
      var note = $("textarea#note").val();
  		if (note == "") {
        $("label#note_error").show();
        $("input#note").focus();
        return false;
      }
      
      var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&note=' + note;
	  //alert (dataString);return false;
	  $.ajax({
	    type: "POST",
	    url: "bin/process.php",
	    data: dataString,
	    success: function() {
	      $('#contact-form').html("<div id='message'></div>");
	      $('#message').html("<li>Thanks, compadre!</li>")
	      .append("<li>I'll be sure to get back to you soon.</li>")
	      .hide()
	      .fadeIn(1500, function() {
	        $('#message');
	      });
	    }
	  });
	  return false;

      
    });
  });
  
  
    