function pre(formdata) {
   $("#info").html("<img src='images/spinner.gif' border='0' /> <p class='alert'>Please wait while this form is sent...</p>")
}
function post(response) {
   if( response.indexOf('error') >= 0) {
       //Output error message from response.
       $("#info").html(response)
   } else {
       $("#info").html("<p class='alert'>Thank you, your enquiry was successfully sent.</p>");
   }
}
var options = {
   beforeSubmit:  pre,
   success:       post,
   target: "#info",
   resetForm: false
};
$().ready(function() {
   $("#contact").validate({
             submitHandler: function(form) {
                 $(form).ajaxSubmit(options)
              }
         });
});

