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

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.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 project = $("select#project").val();
  		
      
	  
	  var comments = $("textarea#comments").val();
  		if (comments == "") {
        $("label#comments_error").show();
        $("textarea#comments").focus();
        return false;
      }
	  var contactby = $("input#contactby").val();
  		if (contactby != "") {
        $("label#contactby_error").show();
        return false;
      }
	
	  var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&comments=' + comments + '&contactby' + contactby + '&project=' + project;
	  //alert (dataString);return false;
	  $.ajax({
      type: "POST",
      url: "bin/process.php",
      data: dataString,
      success: function() {
        $('#contact_form').html("<div id='message'></div>");
        $('#message').html("<img id='checkmark' src='images/check.png' /><h2>Thanks for submitting a quote request, <br />a member of our design team will be in touch shortly . . .</h2>")
        
        .hide()
        .fadeIn(1500, function() {
          
        });
      }
     });
    return false;
	});
});
runOnLoad(function(){
  $("input#name").select().focus();
});
  
  
 
