"use strict";function iframeBusterNativeHome(){if(document.querySelector('div[id*="promo1"]')){const e=document.querySelector('div[id*="promo1"]');if(e.classList.contains("ad-loaded")){document.querySelector('.ad div[id*="promo1"] div iframe').setAttribute("class","iframe-buster-native-home");const t=document.querySelectorAll(".iframe-buster-native-home")[0],n=t.contentDocument||t.contentWindow.document;0==n.body.innerHTML.length&&(e.parentElement.style.display="none"),e.insertAdjacentHTML("beforeend",n.body.innerHTML)}}}function iframeBusterNativeArticle(){if(document.querySelector('div[id*="underarticlenative1"]')){const e=document.querySelector('div[id*="underarticlenative1"]');if(e.classList.contains("ad-loaded")){document.querySelector('.ad div[id*="underarticlenative1"] div iframe').setAttribute("class","iframe-buster-native-article");const t=document.querySelectorAll(".iframe-buster-native-article")[0],n=t.contentDocument||t.contentWindow.document;0==n.body.innerHTML.length&&(e.style.display="none"),e.insertAdjacentHTML("beforeend",n.body.innerHTML)}}}function iframeBusterAdhesionBanner(){if(document.querySelector('div[id*="boot_desktop"]')){const e=document.querySelector('div[id*="boot_desktop"]');if(e.classList.contains("ad-loaded")){document.querySelector('.footer div[id*="boot_desktop"] div iframe').setAttribute("class","iframe-buster-adhesionBanner");const t=document.querySelectorAll(".iframe-buster-adhesionBanner")[0],n=t.contentDocument||t.contentWindow.document;0==n.body.innerHTML.length&&(e.style.display="none"),e.insertAdjacentHTML("beforeend",n.body.innerHTML)}}}function iframeBusterAdhesionBannerMobile(){if(document.querySelector('div[id*="boot_mobile"]')){const e=document.querySelector('div[id*="boot_mobile"]');if(e.classList.contains("ad-loaded")){document.querySelector('.footer div[id*="boot_mobile"] div iframe').setAttribute("class","iframe-buster-adhesionBannerMobile");const t=document.querySelectorAll(".iframe-buster-adhesionBannerMobile")[0],n=t.contentDocument||t.contentWindow.document;0==n.body.innerHTML.length&&(e.style.display="none"),e.insertAdjacentHTML("beforeend",n.body.innerHTML)}}}function resizeVids(){var e=document.body.querySelectorAll("iframe[src*='//www.youtube.com/embed'],iframe[src*='//player.vimeo.com/video'],iframe[src*='//www.kickstarter.com/projects'],iframe[src*='//players.brightcove.net/'],iframe[src*='//www.hulu.com/embed'],object[data*='//www.flickr.com/apps/video'],iframe[src*='//vine.co/v/'],iframe[src*='//videopress.com/embed'],iframe[src*='//www.dailymotion.com/embed'],iframe[src*='//vid.me/e/'],iframe[src*='//player.twitch.tv/'],.superembed-force");[].forEach.call(e,(function(e){if(!e.classList.contains("superembed-ignore")){e.hasAttribute("data-width")||(e.classList.contains("superembed-square")?(e.setAttribute("data-width","1"),e.setAttribute("data-height","1")):e.hasAttribute("width")&&e.hasAttribute("height")?(e.setAttribute("data-width",e.offsetWidth),e.setAttribute("data-height",e.offsetHeight)):(e.setAttribute("data-width","16"),e.setAttribute("data-height","9")));var t=e.parentElement.offsetWidth,n=document.body.clientHeight,o=0,i=e.getAttribute("data-width"),r=e.getAttribute("data-height");i!=t&&(o=t/i,e.setAttribute("width",t),e.setAttribute("height",r*o),r*=o,i*=o),r>n&&(o=n/r,e.setAttribute("height",n),e.setAttribute("width",i*o),i*=o,r*=o)}}))}window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),window.HTMLCollection&&!HTMLCollection.prototype.forEach&&(HTMLCollection.prototype.forEach=Array.prototype.forEach),document.addEventListener("DOMContentLoaded",(()=>{if(document.querySelector(".hometop")){let n=["headerbg1.jpg","headerbg2.jpg","headerbg3.jpg"];document.querySelector(".hometop").style.backgroundImage="url(//rcpmag.com/~/media/ECG/rcpmag/design/2019/"+n[Math.floor(Math.random()*n.length)]+")"}if(document.querySelector(".search")){document.querySelector(".search input[type='text']").setAttribute("placeholder","Search"),document.querySelector(".search input").setAttribute("autocomplete","off");const o=document.querySelector(".search"),i=document.querySelector(".social-top");document.querySelector(".search-icon").addEventListener("click",(function(){i.classList.toggle("active-search"),o.style.display="block"})),document.querySelector(".search-icon-close").addEventListener("click",(function(){i.classList.toggle("active-search"),o.style.display="none"}))}if(document.querySelector(".mobile-flyout")){const r=document.querySelector(".flyout-list"),c=document.querySelector(".flyout-mask");[document.querySelector(".mobile-flyout-button"),document.querySelector(".flyout-mask"),document.querySelector(".flyout-close")].forEach((e=>{e.addEventListener("click",(()=>{r.classList.toggle("active"),c.classList.toggle("active")}))}))}if(document.querySelector("#main > .ad")){const a=document.querySelector("#main"),s=document.querySelectorAll("#main > .ad","#main > .ad:nth-child(2)"),d=a.offsetTop;window.onscroll=function(){window.pageYOffset>d+100?(a.classList.add("inview"),s.forEach((function(e){e.classList.add("special--fixed")}))):(a.classList.remove("inview"),s.forEach((function(e){e.classList.remove("special--fixed")})))}}if(document.querySelector("#sitemap")&&document.querySelector("#sitemap a[href*=javascript]").parentElement.remove(),document.querySelector(".whatsnew li[id*='300Ad'] div[id*='google_ads_iframe']")&&document.querySelector(".whatsnew li[id*='300Ad'] div[id*='google_ads_iframe']").length<1&&(document.querySelector("li[id*='300Ad']").style.display="none"),document.querySelector("#rssFeed")){document.querySelector("#level1 .intro").classList.add("rssFeedPage");let l=document.querySelectorAll("#rssFeed td a"),u=document.querySelectorAll("#rssFeed tr"),m=u.length,f='<ul class="rssFeed">';for(let h=1;h<m;h++){const y=Array.from(u[h].querySelectorAll("td:first-of-type"));f+='<li><a href=" '.concat(l[h-1].getAttribute("href"),' "> ').concat(y[0].innerText," </a></li>")}f+="</ul>",document.querySelector("#rssFeed").insertAdjacentHTML("beforeend",f)}if(document.querySelector(".sharePage")){document.querySelectorAll(".shareTrigger").forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault(),this.parentElement.parentElement.classList.toggle("active")}))}))}if(document.querySelector(".trialdownloads")){const p=document.querySelectorAll(".productlongdesclink"),b=document.querySelectorAll(".productlongdesclinkhide");p.forEach((function(e){e.addEventListener("click",(function(){this.nextElementSibling.style.display="block",this.style.display="none"}))})),b.forEach((function(e){e.addEventListener("click",(function(){this.closest("span").style.display="none",this.parentElement.previousElementSibling.style.display="block"}))}))}if(document.querySelector(".standard")&&document.querySelector(".standard").length>0&&(document.querySelector("#comments").style.display="block"),document.querySelector("#article .associatedFiles")){const v=document.querySelector("#article .associatedFiles");document.querySelector("#article .byline").insertAdjacentElement("afterend",v)}if(document.querySelector("p.sponsor")){document.querySelector('#level0 img[src*="XXX.ashx"]')&&(document.querySelector("p.sponsor").style.display="none")}if(document.querySelector("body").insertAdjacentHTML("beforeend","<script>(function() {var d=document,h=d.getElementsByTagName('head')[0],s=d.createElement('script'),sc = 'https:' == document.location.protocol ? 'https://' : 'http://';s.type='text/javascript';s.async=true;s.src=sc+'s.dpmsrv.com/dpm_a93c168323147d1135503939396cac628dc194c5.min.js';h.appendChild(s);})();<\/script>"),document.querySelector("#level0 #article")||document.querySelector("#level0 #blogPost")){const S=document.querySelector("#level0 #article"),g=document.querySelector("#level0 #blogPost .names + div"),q='<div class="socialshare__wrapper">\n                          <ul class="share__list">\n                            <li class="share__item"><button class="share__link  share__link--facebook" aria-label="Share the Article on Facebook"></button></li>\n                            <li class="share__item"><button class="share__link share__link--linkedin" aria-label="Share the Article on LinkedIn"></button></li>\n                            <li class="share__item"><button class="share__link share__link--twitter" aria-label="Share the Article on Twitter / X"></button></li>\n                          </ul>\n                         </div>';S?S.insertAdjacentHTML("afterbegin",q):g&&g.insertAdjacentHTML("beforeend",q);var e=encodeURIComponent(document.URL),t=encodeURIComponent(document.title);function L(e,t,n){var o=(screen.width-t)/2,i="menubar=no,toolbar=no,status=no,width="+t+",height="+n+",top="+(screen.height-n)/2+",left="+o;window.open(e,"",i),event.preventDefault()}document.addEventListener("click",(function(n){let o=null;n.target.classList.contains("share__link--facebook")&&(o="https://www.facebook.com/sharer.php?u="+e,L(o,570,570)),n.target.classList.contains("share__link--linkedin")&&(o="https://www.linkedin.com/shareArticle?mini=true&url="+e,L(o,570,570)),n.target.classList.contains("share__link--twitter")&&(o="https://twitter.com/intent/tweet?url="+e+"&text="+t,L(o,570,570))}),!1)}})),window.addEventListener("load",(function(){setTimeout((function(){iframeBusterNativeHome(),iframeBusterNativeArticle(),iframeBusterAdhesionBanner(),iframeBusterAdhesionBannerMobile()}),500)})),window.addEventListener("load",(function(){setTimeout((function(){document.querySelector('div[id*="promo1"]')&&document.querySelector('div[id*="promo1"]').classList.contains("ad-loaded")&&document.querySelector(".native1").parentElement.classList.add("show-native"),document.querySelector('div[id*="promo2"]')&&document.querySelector('div[id*="promo2"]').classList.contains("ad-loaded")&&document.querySelector(".native2").parentElement.classList.add("show-native"),document.querySelector('div[id*="underarticlenative1"]')&&document.querySelector('div[id*="underarticlenative1"]').classList.contains("ad-loaded")&&document.querySelector(".native3").parentElement.classList.add("show-native"),document.querySelector('div[id*="underarticlenative2"]')&&document.querySelector('div[id*="underarticlenative2"]').classList.contains("ad-loaded")&&document.querySelector(".native4").parentElement.classList.add("show-native")}),700)})),window.jQuery||(window.addEventListener("DOMContentLoaded",resizeVids),window.addEventListener("resize",resizeVids)),document.addEventListener("DOMContentLoaded",(()=>{document.querySelector(".topnav")&&(document.querySelector(".topnav").id="topnav"),document.querySelector(".menu-toggle")&&document.querySelector(".menu-toggle").addEventListener("click",(function(e){e.preventDefault();const t=document.querySelector(".topnav");this.classList.toggle("act"),this.classList.contains("act")?t.classList.add("nav-open"):t.classList.remove("nav-open")}))})),function(){const e=function(e){let t,n,o,i=e.parentElement;function r(e){const n=e.currentTarget;e.preventDefault(),t&&n!==t&&c(t),c(n)}function c(e){const n=document.getElementById(e.getAttribute("aria-controls"));"true"===e.getAttribute("aria-expanded")?(e.setAttribute("aria-expanded",!1),n.setAttribute("aria-hidden",!0),t=!1):(e.setAttribute("aria-expanded",!0),n.setAttribute("aria-hidden",!1),function(e){const t=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=e.offsetParent,o=n.getBoundingClientRect().left+e.offsetWidth;o+32>t&&e.classList.add("sub-menu--right")}(n),t=e)}function a(e){27===e.keyCode&&(null!==e.target.closest('ul[aria-hidden="false"]')?(t.focus(),c(t)):"true"===e.target.getAttribute("aria-expanded")&&c(t))}function s(e){t&&!e.target.closest("#"+i.id)&&c(t)}this.init=function(){document.querySelector(".topnav").classList.remove("no-js"),e.querySelectorAll("ul").forEach((t=>{const i=t.parentElement;if(void 0!==t){let c=function(e){const t=e.getElementsByTagName("a")[0],i=t.innerHTML,r=t.attributes,c=document.createElement("button");if(null!==t){for(c.innerHTML=i.trim(),n=0,o=r.length;n<o;n++){let e=r[n];"href"!==e.name&&c.setAttribute(e.name,e.value)}e.replaceChild(c,t)}return c}(i);!function(e,t){const n=e.getAttribute("id");let o;o=null===n?t.textContent.trim().replace(/\s+/g,"-").toLowerCase()+"-submenu":menuItemId+"-submenu",t.setAttribute("aria-controls",o),t.setAttribute("aria-expanded",!1),e.setAttribute("id",o),e.setAttribute("aria-hidden",!0)}(t,c),c.addEventListener("click",r),e.addEventListener("keyup",a)}})),document.addEventListener("click",s)}};document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".topnavlist").forEach((t=>{new e(t).init()}))}))}();