!function(n){"use strict";var r=".ajax-reservation",o="is-invalid",a='[name="email"]',l='[name="name"],[name="email"],[name="guests"],[name="date"],[name="event"]',s=n(".form-messages");function t(){var e=n(r).serialize();(function(){var s,t=!0;(function(e){e=e.split(",");for(var a=0;a<e.length;a++)s=r+" "+e[a],t=n(s).val()?(n(s).removeClass(o),!0):(n(s).addClass(o),!1)})(l),t=n(a).val()&&n(a).val().match(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/)?(n(a).removeClass(o),!0):(n(a).addClass(o),!1);return t})()&&jQuery.ajax({url:n(r).attr("action"),data:e,type:"POST"}).done(function(e){s.removeClass("error"),s.addClass("success"),s.text(e),n(r+' input:not([type="submit"]),'+r+" textarea").val("")}).fail(function(e){s.removeClass("success"),s.addClass("error"),""!==e.responseText?s.html(e.responseText):s.html("Oops! An error occured and your message could not be sent.")})}n(r).on("submit",function(e){e.preventDefault(),t()})}(jQuery);