function VM_BusinessLeads_onContactFormSubmit(){VM.BusinessLeads.$form.submit()}var VM=VM||{};VM.Businesses={data:[],$map:null,init:function(){if(this.setupSort(),this.$map=$("#businesses-map"),this.$map.length!==0){var t=this.getLocationData(),n=this.$map.data("toggler");if(t.length>0)if(this.$map.data("data-loaded",!0),this.$map.data("data",t),n!==undefined)$(n).on("click",this.onMapToggle);else this.mapToggle();else n!==undefined&&$(n).remove()}},getLocationData:function(){var n=[];return VM.$body.find(".map-item").each(function(){var r=$(this),t=r.data("locations"),o=r.find(".map-title").text(),f=r.data("logo"),e,i,u;if(e=r.is("a")?r.attr("href"):r.find("a").last().attr("href"),t&&t.length>0)for(i=0;it.getAttribute("data-ga-label")?1:-1});t.detach().appendTo(n)}};$(function(){VM.Businesses.init()});VM=VM||{};VM.BusinessLeads={$form:null,init:function(){this.$form=$("#directory-contactform");this.$form.length&&this.$form.submit(this.onContactFormSubmit)},onContactFormSubmit:function(n){if(n.preventDefault(),VM.BusinessLeads.$form.valid()){VM.BusinessLeads.$form.find(".alert").remove();var t=VM.BusinessLeads.$form.find("button").addClass("loading").prop("disabled",!0);$.ajax(VM.BusinessLeads.$form.attr("action"),{method:"POST",data:VM.BusinessLeads.$form.serialize()}).done(function(){VM.BusinessLeads.track();VM.BusinessLeads.$form.find(".field-clear").val("");VM.BusinessLeads.$form.find(".checkbox-clear").prop("checked",!1);VM.BusinessLeads.$form.append('

Thank you for your inquiry.<\/p>')}).fail(function(n,t,i){VM.BusinessLeads.$form.append('

'+(n.responseText||i)+"<\/p>")}).always(function(){t.removeClass("loading").prop("disabled",!1)})}},track:function(){var n={category:this.$form.data("event-category"),label:this.$form.data("event-label")},i=VM.BusinessLeads.$form.find(".field-track"),r=this.$form.data("event-action"),t;i.length&&(n.label=i.find("option:selected").text());n.label?VM.Track.trackEvent(r,n):(t=VM.BusinessLeads.$form.find(".checkbox-track:checked"),t.length&&t.each(function(){n.label=$(this).parent().text();VM.Track.trackEvent(r,n)}))}};$(function(){VM.BusinessLeads.init()})