$(function() {
    $('.error').hide();
    $(".button").click(function() {
      

  	  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 bericht = $("textarea#bericht").val();
  		if (bericht == "") {
        $("label#bericht_error").show();
        $("textarea#bericht").focus();
        return false;
      }
	  
	  var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&bericht=' + bericht;

	  $.ajax({
		type: "POST",
		url: "process.php",
		data: dataString,
		success: function() {
		  $('#contact_form').html("<div id='message'></div>");
		  $('#message').html("<h3>Contact formulier verzonden!</h3>")
		  .append("<p>We behandelen je bericht zo snel mogelijk.</p>")
		  .hide()
		  .fadeIn(1500, function() {
			$('#message').append("<img id='checkmark' src='images/check.png' />");
		  });
		}
	  });
	  return false;

    });
  });

