function VM_BusinessLeads_onContactFormSubmit(){VM.BusinessLeads.$form.submit()}var VM=VM||{};VM.Business={endorsed:!1,init:function(){this.initLocations();this.initGallery();this.checkEndorsement();$(".hours-toggle").on("click",this.onHoursToggle);VM.Me.getUser(function(n){if(n.id!==0)$(".endorsementform").on("submit",VM.Business.endorse)})},initGallery:function(){var n=$("#biz-photos").on("click","img",this.onPhotoClick);n.length&&(VM.PhotoViewer.onPopupGalleryClosed=function(){VM.PhotoViewer.$galleryContainer.addClass("hidden")},VM.PhotoViewer.photos.length===2&&(VM.PhotoViewer.preload(0),VM.PhotoViewer.$imgContainer.find("li").eq(2).html(VM.PhotoViewer.$imgContainer.find("li").first().html())))},initLocations:function(){var n=$("#business-map"),i=$("#business-addresses").children(),t;i.length>0&&(t=[],i.each(function(){var r=$(this),i=r.find(".feature-address"),n;i.data("lat")&&(n={},n.title=r.find(".feature-address-name").text(),n.description=i.text(),n.lat=parseFloat(i.data("lat")),n.lng=parseFloat(i.data("lng")),t.push(n))}),n.data("data",t),n.data("data-loaded",!0),this.initMap(n))},initMap:function(n){VM.Mapping.loadMapApi(function(){n.removeClass("hidden");var t=VM.Mapping.initializeMap(n);VM.Mapping.loadData(n,t)})},onLazyLoaded:function(){VM.setup();var n=$(this),i=n.prev(),r=$(n.data("count-target")),u=n.find(".paging-meta"),t=u.data("count"),f=u.data("pages");t>0&&(r.removeClass("hidden").find("b").text(t),t===1&&r.find("[data-single]").each(function(){var n=$(this);n.text(n.data("single"))}),f>1&&n.find(".nav-section-more").removeClass("hidden"));i.is("hr")&&i.removeClass("hidden")},onPhotoClick:function(){var n=$(this).parent().index();VM.PhotoViewer.preload(n);VM.PhotoViewer.$galleryContainer.removeClass("hidden");VM.PhotoViewer.onExpandClick();VM.PhotoViewer.photos.length>1&&VM.PhotoViewer.swipe.slide(n)},checkEndorsement:function(){var t;if(VM.Storage.hasStorage()){var i=VM.Storage.getEndorsementsKey(),n=VM.Storage.getObj(i)||[],r=VM.$body.find(".btn-endorse");(window.location.href.indexOf("endorsed")!==-1||this.endorsed)&&(t=parseInt(r.first().data("id"),10),n.indexOf(t)===-1&&(n.push(t),VM.Storage.setObj(i,n)));n.length>0&&r.each(function(){var t=$(this),r=parseInt(t.data("id"),10),i;n.indexOf(r)!==-1&&(i=t.data("endorsed"),t.hasClass("btn-primary")?t.replaceWith('<\/i> '+i+"<\/a>"):t.replaceWith('<\/i> '+i+"<\/a>"))})}},onHoursToggle:function(){var n=$(this),t=$("#"+n.attr("aria-controls")),i;n.find("span").toggleClass("opened");t.toggleClass("hidden");i=!t.hasClass("hidden");n.attr("aria-expanded",i);t.attr("aria-expanded",i)},endorse:function(n){n.preventDefault();var t=$(this).find(".btn-endorse").addClass("loading");$.ajax($(this).attr("action"),{method:"POST",data:$(this).serialize()}).done(function(){VM.Business.endorsed=!0;VM.Business.checkEndorsement()}).always(function(){t.removeClass("loading")})}};$(function(){VM.Business.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()});VM=VM||{};VM.Category={$catList:null,init:function(){VM.$body.find(".toggle").removeClass("hidden").click(this.onToggle);var n=$("#advs-form");n.length&&(n.hasClass("nocollapse")?$("[aria-controls='advs-form']").find(".caret").addClass("opened"):n.addClass("hidden"))},onToggle:function(n){var t,i,r;n.preventDefault();t=$(this);t.hasClass("caret")&&(t=t.closest(".toggle"));window.setTimeout(function(){t.addClass("ga-off")},100);i=$("#"+t.attr("aria-controls"));$(".toggle .opened").length>0&&(t.addClass("clicked"),$(".toggle .caret.opened").each(function(){var n=$(this).closest(".toggle"),t,i;n.hasClass("clicked")||(t=$(this),i=$("#"+n.attr("aria-controls")),t.removeClass("opened"),n.attr("aria-expanded","false"),i.addClass("hidden").removeClass("hidden-mobile"))}),t.removeClass("clicked"));i.length&&(r=t.find(".caret"),i.css("display")==="none"?(i.removeClass("hidden").removeClass("hidden-mobile"),r.addClass("opened"),t.attr("aria-expanded","true")):(i.addClass("hidden").removeClass("hidden-mobile"),r.removeClass("opened"),t.attr("aria-expanded","false")),i.hasClass("nowoc")||i.toggleClass("woc"))}};$(function(){VM.Category.init();window.onclick=function(n){var t=$(n.target);t.hasClass("toggle")||t.parent().hasClass("toggle")||$(".woc").addClass("hidden").removeClass("woc").each(function(){$("[aria-controls='"+this.id+"']").find(".caret").removeClass("opened")})}})