$(function() {
  $('.error').hide();
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#e1e1e1"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  var first_name = $("input#first_name").val();
		if (first_name == "") {
      $("#first_name_error").show();
      $("#first_name").focus();
      return false;
    }
	  var last_name = $("input#last_name").val();
		if (last_name == "") {
      $("#last_name_error").show();
      $("#last_name").focus();
      return false;
    }
	  var company = $("input#company").val();
		if (company == "") {
      $("#company_error").show();
      $("#company").focus();
      return false;
    }
	  var city = $("input#city").val();
		if (city == "") {
      $("#city_error").show();
      $("#city").focus();
      return false;
    }
	  var state = $("input#state").val();
		if (state == "") {
      $("#state_error").show();
      $("#state").focus();
      return false;
    }
	  var email = $("input#email").val();
		if (email == "") {
      $("#email_error").show();
      $("#email").focus();
      return false;
    }
	  var phone = $("input#phone").val();
		if (phone == "") {
      $("#phone_error").show();
      $("#phone").focus();
      return false;
    }

		var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone;
		//alert (dataString);return false;

		$.ajax({
      type: "POST",
     });
    return false;
	});
});

runOnLoad(function(){
  $("input#name").select().focus();
});
