var map,lastOpenedInfoWindow,static_url=document.body.getAttribute("data-static"),media_url=document.body.getAttribute("data-media"),maps_api_key=document.getElementById("body-content").getAttribute("data-maps"),map_markers=[];function google_maps_lazyload(t){if(document.getElementById("map")){var e=document.getElementById("map");new IntersectionObserver((function(o,a){"boolean"==typeof o[0].isIntersecting?o[0].isIntersecting:o[0].intersectionRatio;o[0].isIntersecting&&(loadJS("https://maps.googleapis.com/maps/api/js?key="+t+"&callback=initMap"),a.unobserve(e))})).observe(e)}}function initMap(){if(document.getElementById("map")){var t=parseInt(document.getElementById("map").dataset.zoom);map=new google.maps.Map(document.getElementById("map"),{center:{lat:40.458833,lng:-79.924796},zoom:t||9}),$(".list-group-item[data-location]").each((function(e,o){var a=$(o).attr("data-location").split("~"),n=parseFloat(a[0]),r=parseFloat(a[1]),i=a[2],s=a[3],l=($(o).attr("data-practice-url"),$(o).attr("data-appointment-url")),c=$(o).attr("data-external-url");if(null!=n){var d=new google.maps.Marker({position:{lat:n,lng:r},marker_name:i,map:map,title:i}),m='<div class="mb-1 mt-2" style="font-weight: 500; font-size: 1.1em;">'+i+'</div><div class="mb-1">'+s+'</div><a class="btn tertiary-color map-marker-btn mb-2 mr-2 direction-btn" href="https://www.google.com/maps/dir/?api=1&destination='+s+'" target="_blank" rel="nofollow"> DIRECTIONS </a>';m+=c?'<a class="btn primary-color map-marker-btn mb-2 app-btn" href="'+l+'" target="_blank" rel="nofollow"> REQUEST APPOINTMENT </a>':'<a class="btn primary-color map-marker-btn mb-2 app-btn" href="'+l+'"> REQUEST APPOINTMENT </a>';var u=new google.maps.InfoWindow({content:m,maxWidth:240});d.addListener("click",(function(){lastOpenedInfoWindow&&lastOpenedInfoWindow.close(),u.open(map,d),lastOpenedInfoWindow=u})),map_markers.push(d),0==e&&(map.setCenter({lat:n,lng:r}),e===$(".list-group-item[data-location]").length-1&&(map.setZoom(t||16),u.open(map,d),lastOpenedInfoWindow=u))}}))}}function jumpToLocation(t,e,o){for(var a in map.panTo({lat:parseFloat(t),lng:parseFloat(e)}),map_markers)if(map_markers[a].marker_name==o){var n=map_markers[a];google.maps.event.trigger(n,"click")}}function google_maps_lazyload_2(t){if(document.getElementById("map2")){var e=document.getElementById("map2");new IntersectionObserver((function(o,a){"boolean"==typeof o[0].isIntersecting?o[0].isIntersecting:o[0].intersectionRatio;o[0].isIntersecting&&(loadJS("https://maps.googleapis.com/maps/api/js?key="+t+"&callback=initMapTwo"),a.unobserve(e))})).observe(e)}}function initMapTwo(){if(document.getElementById("map2")){var t=parseInt(document.getElementById("map2").dataset.zoom);map=new google.maps.Map(document.getElementById("map2"),{center:{lat:40.458833,lng:-79.924796},zoom:t||9}),$(".hidden-location[data-location]").each((function(e,o){var a=$(o).attr("data-location").split("~"),n=parseFloat(a[0]),r=parseFloat(a[1]),i=a[2],s=a[3],l=a[4],c=a[5],d=a[6],m="No Phone Listed",u="",p="No Fax Listed";if("<br>"!==c&&""!==c){var f=c.split("<br>");f[0]&&(m=f[0]),f[1]&&(p=f[1])}"null"!=l?u=format_office_hours_string(JSON.parse(l),JSON.parse(d)):u="No Hours Listed";if(null!=n){var b=new google.maps.Marker({position:{lat:n,lng:r},marker_name:i,map:map,officeName:i,officeAddress:s,officeHours:u,officeNumber:m,officeFax:p,title:i});b.addListener("click",(function(){show_location_info(b.officeName,b.officeAddress,b.officeHours,b.officeNumber,b.officeFax)})),map_markers.push(b),0==e&&(map.setCenter({lat:n,lng:r}),e===$(".hidden-location[data-location]").length-1&&map.setZoom(t||16),show_location_info(i,s,u,m,p))}}))}}function google_maps_iframe_lazyload(){if(document.querySelector(".location-maps-block")){var t=[].slice.call(document.querySelectorAll(".location-maps-block iframe"));if("loading"in HTMLIFrameElement.prototype||!("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype&&"isIntersecting"in window.IntersectionObserverEntry.prototype))t.forEach((function(t){t.src=t.dataset.src}));else{var e=new IntersectionObserver((function(t,e){var o=t[0].target;"boolean"==typeof t[0].isIntersecting?t[0].isIntersecting:t[0].intersectionRatio;t[0].isIntersecting&&(o.src=o.dataset.src,e.unobserve(o))}));t.forEach((function(t){e.observe(t)}))}}}function convert_office_hours(t){var e,o=t[0],a=t[1];return o&&a?(parseInt(o.substring(0,2))>12?o=("0"+parseInt(o.substring(0,2)-12).toString()).slice(-2)+o.substring(2)+" pm":12==parseInt(o.substring(0,2))?o+=" pm":o+=" am",parseInt(a.substring(0,2))>12?a=("0"+parseInt(a.substring(0,2)-12).toString()).slice(-2)+a.substring(2)+" pm":12==parseInt(a.substring(0,2))?a+=" pm":a+=" am",e=o.toString()+" - "+a.toString()):e="Closed",e}function format_office_hours_string(t,e){var o="";return t.forEach((function(t,a){var n,r=convert_office_hours(t),i=get_day_abbr(a);o+='<span style="width: 50px; display: inline-block;">'+i+"</span>&nbsp;<span>"+r+"</span><br>",null!==e&&(n=e[a]),n&&(o+="<span>"+n+"</span><br>")})),o}function get_day_abbr(t){switch(t){case 0:return"Mon";case 1:return"Tue";case 2:return"Wed";case 3:return"Thu";case 4:return"Fri";case 5:return"Sat";case 6:return"Sun"}}function show_location_info(t,e,o,a,n){$(".location-block-two .location-name").text(t),$(".location-block-two .location-address").text(e),$(".location-block-two .location-hours").html(o),$(".location-block-two .direction-btn").attr("href","https://www.google.com/maps/dir/?api=1&destination="+e),"No Phone Listed"==a&&"No Fax Listed"==n?$(".location-block-two .location-get-in-touch").hide():$(".location-block-two .location-get-in-touch").show(),"No Phone Listed"==a?($(".location-block-two .call-btn").hide(),$(".location-block-two .call-btn").text(a),$(".location-block-two .call-btn").attr("href","")):($(".location-block-two .call-btn").show(),$(".location-block-two .call-btn").text("CALL: "+formatPhoneNumber(a)),$(".location-block-two .call-btn").attr("href","tel:"+a)),"No Fax Listed"==n?($(".location-block-two .location-fax").text(n),$(".location-block-two .location-fax").hide()):($(".location-block-two .location-fax").show(),$(".location-block-two .location-fax").text("FAX: "+formatPhoneNumber(n)))}function footerSubscribe(){var t=$("#footerSubForm"),e=t.attr("data-id"),o=t.attr("data-type"),a=t.find("input[type='email']");if(a.removeClass("is-invalid"),a.attr("aria-invalid","false"),!validateEmail(a.val()))return a.addClass("is-invalid"),a.attr("aria-invalid","true"),void a.prev(".input-group-prepend").addClass("is-invalid");subscribe(a.val(),o,e)}function serviceCarousel(){var t=document.querySelector(".carousel-serv");function e(e){var o=320*e;t.scrollLeft>t.dataset.scrollstop?t.scrollLeft=0:Element.prototype.scrollBy?t.scrollBy({left:o,behavior:"smooth"}):t.scrollLeft+=o}window.setInterval((function(){e(1)}),1e3*t.dataset.delay),document.getElementById("sc-right").addEventListener("click",(function(){e(1)})),document.getElementById("sc-left").addEventListener("click",(function(){e(-1)}))}$(document).ready((function(){var t=$(".testimonial-ratings-row").attr("data-avg"),e=Math.floor(t),o=t%1,a="";for(s=0;s<e;s++)a+='<i class="fas fa-star fa-2x"></i>';o>0&&(a+='<i class="fas fa-star-half-alt fa-2x"></i>');var n=(Math.floor(100*t)/100).toFixed(2);$(".avg_stars_footer").html(a),$("#avg_rating_footer").text(n),$(".avg_stars").html(a),$("#avg_rating").text(n),$("#avg_rating_overview_lg").text(n),$("#avg_rating_overview_sm").text(n),$(".dropdown-menu a.dropdown-toggle").on("click",(function(t){return $(this).next().hasClass("show")||$(this).parents(".dropdown-menu").first().find(".show").removeClass("show"),$(this).next(".dropdown-menu").toggleClass("show"),$(this).parents("li.nav-item.dropdown.show").on("hidden.bs.dropdown",(function(t){$(".dropdown-submenu .show").removeClass("show")})),!1}));var r=document.querySelectorAll(".youtube");[].slice.call(r).forEach((function(t){if(null==t.querySelector("img")){let e="https://img.youtube.com/vi/"+t.dataset.embed+"/hqdefault.jpg",o="https://img.youtube.com/vi_webp/"+t.dataset.embed+"/hqdefault.webp";const a=new Image;a.classList.add("lazy"),a.setAttribute("data-src",o),a.alt="Youtube thumbnail",a.onerror=function(){this.onerror=null,this.src=e},t.appendChild(a);const n=new IntersectionObserver((function(t,e){if(t[0].isIntersecting){var o=t[0].target;o.src=o.dataset.src,o.classList.remove("lazy"),n.unobserve(o)}}));n.observe(a)}t.addEventListener("click",(function(){var t=document.createElement("iframe");t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen",""),t.setAttribute("src","https://www.youtube.com/embed/"+this.dataset.embed+"?rel=0&showinfo=0&autoplay=1"),this.innerHTML="",this.appendChild(t)}))}));for(var i=document.querySelectorAll(".vimeo"),s=0;s<i.length;s++)i[s].addEventListener("click",(function(){var t=document.createElement("iframe");t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen",""),t.setAttribute("src","https://player.vimeo.com/video/"+this.dataset.embed+"?autoplay=1"),t.setAttribute("title","Vimeo video"),this.innerHTML="",this.appendChild(t)}));google_maps_lazyload(maps_api_key),google_maps_lazyload_2(maps_api_key),google_maps_iframe_lazyload(),$(".testimonials-by-site-block").length>0&&initBySiteBlock(),window.location.href.indexOf("pulse")>-1&&autolinkPulses(),$(".carousel-serv").length>0&&serviceCarousel(),$("#announcement-modal").length>0&&window.setTimeout((function(){$("#announcement-modal").modal("show")}),500),$("#announcement-exit-modal").length>0&&document.body.addEventListener("mouseleave",(function(){"true"!=localStorage.getItem("exit-modal")&&($("#announcement-exit-modal").modal("show"),localStorage.setItem("exit-modal",!0))}))})),document.addEventListener("DOMContentLoaded",(function(){var t=[].slice.call(document.querySelectorAll("img.lazy")),e=[].slice.call(document.querySelectorAll(".lazy-background"));if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype&&"isIntersecting"in window.IntersectionObserverEntry.prototype){var o=new IntersectionObserver((function(t,e){t.forEach((function(t){if(t.isIntersecting){var e=t.target;e.src=e.dataset.src,e.classList.remove("lazy"),o.unobserve(e)}}))})),a=new IntersectionObserver((function(t,e){t.forEach((function(t){t.isIntersecting&&(t.target.classList.add("visible"),a.unobserve(t.target))}))}));t.forEach((function(t){o.observe(t)})),e.forEach((function(t){a.observe(t)}))}else t.forEach((function(t){t.src=t.dataset.src,t.classList.remove("lazy")})),e.forEach((function(t){t.classList.add("visible")}))}));