const headerElement=document.getElementById("Header");const mainElement=document.getElementById("Main");const footerElement=document.getElementById("Footer");function prepWYSIWYGImages(){var images=document.querySelectorAll(".rteCopy img");images.forEach((image)=>{image.removeAttribute("width");image.removeAttribute("height");image.classList.add("dynamicResize");})}
function backToTop(){window.scrollTo({top:0,left:0,behavior:"smooth",})}
function padBodyByHeader(){mainElement.style.paddingTop=(headerElement.offsetHeight+50)+'px';}
function padBodyByFooter(){mainElement.style.paddingBottom=footerElement.offsetHeight+'px';}
$('ul').not(':has(li)').remove();function dynamicImageResize(){var images=document.querySelectorAll(".dynamicResize");images.forEach((img)=>{var imageWidth=0;var parentWidth=0;var imgShouldFloat=false;var parentElement;for(var p=img.parentElement;p;p=p.parentElement){var style=window.getComputedStyle(p,null);if(style){var displaystyle=style.getPropertyValue('display');if(displaystyle=='block'){parentElement=p;break;}}}
img.style.width="100%";parentWidth=parentElement.clientWidth+10;img.style.width="auto";var imgStyle=window.getComputedStyle(img,null);if(imgStyle){img.dataset.float=imgStyle.getPropertyValue("float");}
imgShouldFloat=img.dataset.float=="none"?false:true;imageWidth=imgStyle.getPropertyValue("width").replace("px","");img.dataset.width=imageWidth;if(imageWidth>=parentWidth){img.style.width="100%";}
else{img.style.width=imageWidth+"px";}
if(imgShouldFloat){if(imageWidth>=(parentWidth-300)){img.style.cssText="display: block; float: none; padding-top: 7px; padding-right: 0px; padding-left: 0px; padding-bottom: 15px;";}
else if(img.dataset.float=="left"){img.style.cssText="display: inline; float: left; padding-top: 7px; padding-right: 25px; padding-left: 0px; padding-bottom: 15px;";}
else if(img.dataset.float=="right"){img.style.cssText="display: inline; float: right; padding-top: 7px; padding-right: 0px; padding-left: 25px; padding-bottom: 15px;";}}})}
function setStickyOnScroll(){var wHeight=window.innerWidth;var stickyElements=document.querySelectorAll(".stickyOnScroll");stickyElements.forEach((element)=>{if(element.outerHeight(true)>wHeight){img.classList.remove("sticky");}
else{img.classList.add("sticky");}})}
function setImgScaleOnHover(){var images=document.querySelectorAll(".imgScaleOnHover");images.forEach((image)=>{image.style.overflow="hidden";})}
function lazyLoadImages(){var images=document.querySelectorAll(".lazyLoad");images.forEach((image)=>{var imgSrc=image.dataset.src;image.src=imgSrc;})}
function setBTCValues(){setTimeout(()=>{var btcInputs=document.querySelectorAll('.btc3243');btcInputs.forEach((input)=>{input.value='f37e69cd-24f8-4129-befe-f7031797a6cb';});},2000);}
function setCookie(cname,cvalue,exdays){const d=new Date();d.setTime(d.getTime()+(exdays*24*60*60*1000));let expires="expires="+d.toUTCString();document.cookie=cname+"="+cvalue+";"+expires+";path=/";}
function getCookie(cname){var cvalue=document.cookie.split("; ").find((row)=>row.startsWith(cname+"="))?.split("=")[1];return cvalue;}
function deleteCookie(cname){setCookie(cname,0,-30);}
function setupModals(){var modalTriggers=document.querySelectorAll(".modalTrigger");modalTriggers.forEach((trigger)=>{trigger.addEventListener("click",(event)=>{event.preventDefault();var modalId=trigger.dataset.modalId;openModal(modalId);})})
var modalCloseBtns=document.querySelectorAll(".modalClose");modalCloseBtns.forEach((btn)=>{btn.addEventListener("click",(event)=>{event.preventDefault();var wrapper=btn.closest(".modalWrapper");if(wrapper!=null){closeModal(wrapper.id);}})})}
function openModal(modalId){var modal=document.getElementById(modalId);var body=document.querySelector("body");if(body!=null&&modal!=null){body.classList.add("bodyModalOpen");modal.style.display="flex";setTimeout(()=>{modal.classList.add("modalActive");},25);}}
function closeModal(modalId){var modal=document.getElementById(modalId);var body=document.querySelector("body");modal.classList.remove("modalActive");setTimeout(()=>{modal.style.display="none";body.classList.remove("bodyModalOpen");},200);}
function post(url,data,token){return new Promise((resolve,reject)=>{let xhr=new XMLHttpRequest();xhr.open('POST',url);xhr.setRequestHeader('Content-Type','application/json; charset=UTF-8');xhr.setRequestHeader('RequestVerificationToken',token);xhr.addEventListener('load',()=>{let{response,status}=xhr;let res=JSON.parse(response);if(status>=200&&status<400){resolve({response:res,status});}else{reject({response:res,status});}});console.log(JSON.stringify(data));xhr.send(JSON.stringify(data));});}
function xhr(method,url,data){return new Promise((resolve,reject)=>{let xhr=new XMLHttpRequest();xhr.open(method,url);xhr.setRequestHeader('Content-Type','application/json; charset=UTF-8');xhr.addEventListener('load',()=>{let{response,status}=xhr;let res=JSON.parse(response);if(status>=200&&status<400){resolve({response:res,status});}else{reject({response:res,status});}});if(data){xhr.send(JSON.stringify(data));}else{xhr.send();}});}
function isGALoaded(){return typeof gtag==typeof Function;}
function gaLinkTrackingToOutboundLinks(){var externalPattern=/^(\w+:)?\/\//;if(isGALoaded()){var links=document.querySelectorAll("a");links.forEach((a)=>{console.log(a.nodeName);if(a.href!==undefined&&a.href.indexOf('sms')==-1&&a.href.indexOf('tel')==-1&&a.href.search(externalPattern)!==-1){a.addEventListener("click",()=>{gaTrackOutBoundLink(a);})}})}}
function gaTrackOutBoundLink(e){if(a!=null&&a.nodeName==="A"){gaSendEvent('Outbound Link','Click',a.href,false);}}
function gaBindCallEmailEvents(){var gaEmailLinks=document.querySelectorAll(".gaEmail");gaEmailLinks.forEach((link)=>{link.addEventListener("click",()=>{gaSendEvent('Click-To-Email','Click',$(this).text(),true);})})
var gaPhoneLinks=document.querySelectorAll(".gaPhone");gaPhoneLinks.forEach((link)=>{link.addEventListener("click",()=>{gaSendEvent('Click-To-Call','Click',$(this).text(),true);})})}
function gaSendEvent(category,action,label,countAsInteration,value){if(isGALoaded()){if(isNaN(value)){gtag('event',action,{'event_category':category,'event_label':label,'non_interaction':!countAsInteration});}else{gtag('event',action,{'event_category':category,'event_label':label,'value':value,'non_interaction':!countAsInteration});}}}
function bingIsTrackingLoaded(){if(typeof uetq!='undefined'&&uetq!=null){return true;}
return false;}
function bingLinkTrackingToOutboundLinks(){var externalPattern=/^(\w+:)?\/\//;if(bingIsTrackingLoaded()){var links=document.querySelectorAll("a");links.forEach((a)=>{console.log(a.nodeName);if(a.href!==undefined&&a.href.indexOf('sms')==-1&&a.href.indexOf('tel')==-1&&a.href.search(externalPattern)!==-1){a.addEventListener("click",()=>{bingTrackOutBoundLink(this);})}})}}
function bingTrackOutBoundLink(e){if(a!=null&&a.nodeName==="A"){bingSendEvent('Outbound Link','Click',a.href);}}
function bingSendEvent(category,action,label,value){if(bingIsTrackingLoaded()){if(isNaN(value)){uetq.push({'ec':category,'ea':action,'el':label});}else{uetq.push({'ec':category,'ea':action,'el':label,'ev':value});}}}
var mobileToggleClosedText='+';var mobileToggleOpenText='-';var mainNavWrap=document.getElementById('MainNavWrap');var mobileMenu=document.getElementById('MobileMenu');var mobileMenuButton=document.getElementById('MobileMenuButton');function toggleMobileNav(forceClose){if(forceClose){closeMobileMenu();}else{mobileMenu.classList.contains("open")?closeMobileMenu():openMobileMenu();}}
function openMobileMenu(){mobileMenu.classList.add("open");mobileMenu.style.display="block";mobileMenu.style.visibility="visible";mobileMenuButton.classList.add("mobileMenuButtonOpen");}
function closeMobileMenu(){if(mobileMenu.classList.contains("open")){mobileMenu.classList.remove("open");mobileMenu.style.visibility="hidden";mobileMenu.style.display="none";mobileMenuButton.classList.remove("mobileMenuButtonOpen");}}
function openMobileMenuSection(e){var par=e.parentElement;var childList=e.parentElement.querySelectorAll("UL");if(e.classList.contains("toggleClosed")){if(childList!=null&&childList.tagName=="UL"){childList.style.display="block";}
e.classList.remove("toggleClosed");e.classList.add("toggleOpen");e.textContent=mobileToggleOpenText;}else{if(childList!=null&&childList.tagName=="UL"){childList.style.display="none";}
e.classList.remove("toggleOpen");e.classList.add("toggleClosed");e.textContent=mobileToggleClosedText;}
par.parentElement.classList.toggle("openThis");}
function buildMobileMenu(){var extraButtons=headerElement.querySelector(".topNav").innerHTML;if(mainNavWrap!=null&&mobileMenu!=null){mobileMenu.addEventListener('click',(event)=>{event.stopPropagation();})
mobileMenu.innerHTML=mainNavWrap.innerHTML;mobileMenu.querySelector(".mainNav").innerHTML+=extraButtons;var subNavElements=mobileMenu.querySelectorAll(".subNav");subNavElements.forEach((subNav)=>{var parent=subNav.parentNode;while(subNav.firstChild)parent.insertBefore(subNav.firstChild,subNav);parent.removeChild(subNav);})
var linkList=mobileMenu.querySelectorAll('a');linkList.forEach((link)=>{var nextSibling=link.nextElementSibling;if(nextSibling!=null&&nextSibling.tagName=="UL"){var toggleLink=document.createElement('div');toggleLink.classList.add('mobileToggle');if(link.parentElement.classList.contains("mobileMenuOpen")){toggleLink.classList.add("toggleOpen");toggleLink.textContent=mobileToggleOpenText;}
else{toggleLink.classList.add("toggleClosed");toggleLink.textContent=mobileToggleClosedText;}
toggleLink.addEventListener('click',(event)=>{event.preventDefault();openMobileMenuSection(toggleLink);})
link.append(toggleLink);}})}}
window.addEventListener("load",()=>{buildMobileMenu();var mobileToggleBtn=headerElement.querySelector(".mobileMenuButton");if(mobileToggleBtn!=null){mobileToggleBtn.addEventListener("click",(event)=>{event.preventDefault();event.stopPropagation();toggleMobileNav();})}})
document.addEventListener("click",()=>{toggleMobileNav(true);})
window.addEventListener("load",function(){padBodyByFooter();prepWYSIWYGImages();dynamicImageResize();setupModals();setImgScaleOnHover();setStickyOnScroll();setBTCValues();gaLinkTrackingToOutboundLinks();gaBindCallEmailEvents();bingLinkTrackingToOutboundLinks();})
var widthInitial=window.outerWidth;window.addEventListener('resize',function(){padBodyByFooter();dynamicImageResize();setStickyOnScroll();if(window.outerWidth!=widthInitial){toggleMobileNav(true);widthInitial=window.outerWidth;}})
window.addEventListener('scroll',function(){let scroll=window.scrollY;if(scroll>50){headerElement.classList.add('sticky');}else{headerElement.classList.remove('sticky');}})
var highest=0;function sortNumber(a,b){return a-b;}
function maxHeight(eleClass){var heights=new Array();$('.'+eleClass).each(function(){$(this).css('height','auto');heights.push($(this).outerHeight(false));heights=heights.sort(sortNumber).reverse();});highest=heights[0];$('.'+eleClass).each(function(){$(this).css('height',highest);});};;
