t.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()})