 var J = jQuery.noConflict();
J(function() {
  /*$('.error').hide();
  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#FFDDAA"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });*/

  J(".button").click(function() {
		// validate and process form
		// first hide any error messages
    J('.error').hide();
		
	  var name = J("textarea#name").val();
		if (name == "") {
      J("label#name_error").show();
      J("textarea#name").focus();
      return false;
    }
		var email = J("input#email").val();
		if (email == "") {
      J("label#email_error").show();
      J("input#email").focus();
      return false;
    }
		var phone = J("input#phone").val();
		if (phone == "") {
      J("label#phone_error").show();
      J("input#phone").focus();
      return false;
    }
		
		var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone;
		//alert (dataString);return false;
		
		J.ajax({
      type: "POST",
      url: "bin/process.php",
      data: dataString,
      success: function() {
        J('#contact_form').html("<div id='message'></div>");
        J('#message').html("")
        .append("")
        .hide()
        .fadeIn(1500, function() {
          //J('#message').append("<img id='checkmark' src='images/check.png' />");
        });
      }
     });
    return false;
	});
});
runOnLoad(function(){
  J("input#name").select().focus();
});

