$(document).ready(function(){
	$('#form').validate({
		 messages: {
			 naam: "Gelieve uw naam in te vullen",
			 bericht: "Gelieve een bericht in te vullen",
			 email: "Gelieve een email adres in te vullen",
		 } 						
	});
});
$(function() {
    $('.error_label').hide();
	$("#message").hide();
    $("#submit").click(function() {
      // validate and process form here

     /*$('.error').hide();*/
  	  var naam = $("input#naam").val();
  		if (naam == "") {
        $("label#name_error").show();
        $("input#naam").focus();
        return false;
      }
  		var email = $("input#email").val();
  		if (email == "") {
        $("label#email_error").show();
        $("input#email").focus();
        return false;
      }
  		var bericht = $("textarea#bericht").val();
  		if (bericht == "") {
        $("label#bericht_error").show();
        $("textarea#bericht").focus();
        return false;
      }
  		var datum = $("input#datum").val();
  		if (datum == "") {
        $("label#bericht_error").show();
        $("textarea#bericht").focus();
        return false;
      }

	  var dataString = 'naam='+ naam + '&email=' + email + '&bericht=' + bericht + '&datum=' + datum;
	  //alert (dataString);return false;
	  $.ajax({
		type: "POST",
		url: "bin/process.php",
		data: dataString,
		success: function() {
			$("#message").fadeIn("fast");
			$('#form #naam').val("");
			$('#form #email').val("");
			$('#form #bericht').val("");
		}
	  });
	  return false;


    });
  });

$(document).ready(function(){
  $("input#ok").click(function () {		
		$("#message").fadeOut("fast");
  });
});


