$.validator.setDefaults({
    submitHandler: function() {
        //alert("submitted!");
        var generator = Math.random()*100000;
    	var arg= $("input[@type=text]").serialize();
		arg+='&'+$("textarea").serialize();


		//alert(arg);
		 $.ajax({
		  url: "../ajax_contact.php",
		  type: "GET",
		  dataType: 'html',
		  data: arg,
		  timeout: 2000,
		  cache: false,
		  success: function(html){
		    //alert(html);
           //alert(data);
          if(html == "notsent")
        	{
              document.location.href="contact-failed.html";
        	}
        	else if(html == "sentsuccess")
        	{
        	  document.location.href="contact-success.html";
        	}
         }
		});
  }
});

function form_clear(){
  	$("#feed_name").val('');
    $("#feed_email").val('');
    $("#feed_msg").val('');
	$("#feed_telephone").val('');
}



$().ready(function() {

	// validate signup form on keyup and submit
	$("#feedbackfrm").validate({
		rules: {
		feed_name: {
			  required: true
			},
        feed_telephone:{
          required:true,
          telephone:true
        },


        feed_msg:{
         required: true
        },
        feed_email: {
        required: true,
        emailnew: true
        }
		},
		messages: {
		   feed_name: {
             required: "\nVul uw naam in"
			},

           feed_email: {
             required: "\nVul uw E-mail adres in",
             emailnew: "\nVul een correct E-mail adres in"
			},
            feed_msg:{
             required: "\nVul uw Bericht in"
            },
            feed_telephone:{
              required: "\nVul uw Telefoonnummer in",
              telephone: "\nVul een correct Telefoonnummer in"
            }
		}
	});

	// propose username by combining first- and lastname
});
