!function(){if("undefined"==typeof loadPowr){window.addEventListener?window.addEventListener("message",t):window.attachEvent("onmessage",t);var j=0;POWR_RECEIVERS=[];var n=document.createEvent("Event");n.initEvent("powrPingListener",!0,!0),loadPowr=function e(){for(var t=null,n=null,o=null,r=!1,i=document.querySelectorAll("script"),a=0;a<i.length;a++){var l=i[a],d=l.getAttribute("src");if(null!=d){var s=l.getAttribute("powr-token"),c=l.getAttribute("external-type"),u=l.getAttribute("template-powr-token"),p=l.getAttribute("powr-load");if(null==p&&(p="async"),X()&&X()<=9&&(p="sync"),r=l.getAttribute("demo-mode"),null!=s?t=s:-1<d.search("powr-token")&&void 0!==(o=G(d))["powr-token"]&&0<o["powr-token"].length&&(t=o["powr-token"]),null!=c?n=c:-1<d.search("external-type")&&null!=(o=G(d))["external-type"]&&0<o["external-type"].length&&(n=o["external-type"]),null!=t||null!=n)break}}if(null==t||0==t.length)try{t=window.top.location.host}catch(e){t=""}var E=/\[powr-[^\]]*\]/gi,w=/\[powr-[^\s\]]*/gi,g=document.querySelectorAll("a");for(a=0;a<g.length;a++){if(!F(R=g[a])){var m=R.previousSibling,v=R.nextSibling;if(m&&v&&R.getAttribute("href")&&-1<R.getAttribute("href").search("tel")&&3==m.nodeType&&3==v.nodeType&&m.nodeValue.match(w)&&-1<v.nodeValue.search("]")){var f=R.innerHTML,h=m.nodeValue.match(/powr-[^\s\]]*/gi)[0];(C=document.createElement("div")).innerHTML='<div class="'+h+'" label="'+f+'"></div>',m.parentNode.removeChild(m),v.parentNode.removeChild(v),R.parentNode.replaceChild(C,R)}}}for(g=document.querySelectorAll("body, body *"),a=0;a<g.length;a++){var R,y=(R=g[a]).childNodes;if(!F(R))for(var _=0;_<y.length;_++){var S=y[_];if(3==S.nodeType){var C,b=S.nodeValue,O=b.replace(E,z);if(O!=b)(C=document.createElement("div")).innerHTML=O,R.replaceChild(C,S)}}}if(0==document.querySelectorAll("#powrIframeLoader").length){var P=document.createElement("div"),I=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0];P.id="powrIframeLoader",P.innerHTML="&shy;<style> .powrLoaded iframe { visibility: hidden; } </style>",I.parentNode.insertBefore(P,I)}var W=document.querySelectorAll("[class*=powr-]"),V=!1,A=!1;for(a=0;a<W.length;a++){var L=W[a];if(!F(L)&&!(L instanceof SVGElement||-1<L.className.search("powrLoaded"))){var T=L.className.split(/\s+/);for(_=0;_<T.length;_++)if(0===T[_].toLowerCase().search("powr-")){var x=T[_].toLowerCase().replace("powr-","");break}if(void 0!==x){"popup"==x&&(V=!0),"scroll-to-top"==x&&(A=!0);var k=L.getAttribute("label");if(null==k&&(k=""),"weebly_"!=k){L.className+=" powrLoaded",null==u&&(u="");var N=L.getAttribute("id");null==N&&(N="");var M=L.getAttribute("view-mode"),H="true"==r||"true"==L.getAttribute("demo-mode"),q="https://www.powr.io/plugins/"+x+"/cached_view?load="+p+"&index="+j+"&unique_label="+N+"&powr_token="+t+"&user_label="+encodeURIComponent(k)+"&demo_mode="+H,J="https://www.powr.io/plugins/"+x+"/view.json?unique_label="+N+"&powr_token="+t+"&user_label="+encodeURIComponent(k)+"&demo_mode="+H;if(null!=n&&(J+="&external_type="+n,q+="&external_type="+n),null!=u&&(J+="&template_powr_token="+u,q+="&template_powr_token="+u),null!=M&&(J+="&view_mode="+M,q+="&view_mode="+M),K(),K()&&(J+="&url="+encodeURIComponent(K())),document.location.host)var B=document.location.protocol+"//"+document.location.host;else try{B=document.location.ancestorOrigins[0]}catch(e){if(window.top&&window.top.location&&window.top.location.host)B=window.top.location.protocol+"//"+window.top.location.host;else B=""}J+="&request_url="+encodeURIComponent(B),q+="&request_url="+encodeURIComponent(document.location.href);var U=document.createElement("iframe");U.src=q,U.setAttribute("powrindex",j),U.width="100%",U.height="0px",U.style.transition="height 0.3s",U.style.webkitTransition="height 0.3s",U.style.height="0px",U.style.display="block",U.frameBorder="0",U.style.visibility="visible",U.setAttribute("webkitallowfullscreen",""),U.setAttribute("mozallowfullscreen",""),U.setAttribute("allowfullscreen",""),"ecwid"==n&&(L.style.minWidth="280px");try{/iPhone|iPod|iPad/.test(navigator.userAgent)&&(U.style.minWidth="100%",U.style.width="1px",U.setAttribute("scrolling","no"))}catch(e){console.log("Err: "+e)}Q(U,j,q),L.appendChild(U);var D=U.contentWindow;POWR_RECEIVERS.push({receiver:D,url:q,data_url:J}),"async"==p&&($(j),Z(j,U)),j++}}}}V&&(Y(document,"click",function(e){var t=(e=e||window.event).relatedTarget||e.toElement||e.target;if(t&&t.classList.contains("trigger-popup"))for(var n=0;n<POWR_RECEIVERS.length;n++)POWR_RECEIVERS[n].receiver.postMessage(JSON.stringify({message:"triggerPowrPopupClick"}),POWR_RECEIVERS[n].url)}),Y(document,"mouseout",function(e){if((e=e||window.event).clientY<5)for(var t=0;t<POWR_RECEIVERS.length;t++)POWR_RECEIVERS[t].receiver.postMessage(JSON.stringify({message:"exitDocument"}),POWR_RECEIVERS[t].url)})),A&&Y(document,"scroll",function(e){for(var t=(document.documentElement.scrollHeight||document.body.scrollHeight)-window.innerHeight,n=100*(document.documentElement.scrollTop||document.body.scrollTop)/t,o=0;o<POWR_RECEIVERS.length;o++)POWR_RECEIVERS[o].receiver.postMessage(JSON.stringify({message:"scrollPosition",scrollPercentage:n}),POWR_RECEIVERS[o].url)}),"ecwid"==n&&(window.powrAutoLoad&&clearTimeout(window.powrAutoLoad),window.powrAutoLoad=setTimeout(function(){e()},500))};for(var e=0;e<10;e++)setTimeout(function(){loadPowr()},2e3*e);Y(window,"load",loadPowr);var o=!1;Y(window,"keydown",function(e){if(80==e.keyCode&&(o=!0,setTimeout(function(){o=!1},2e3)),38==e.keyCode&&o){for(var t=0;t<POWR_RECEIVERS.length;t++)POWR_RECEIVERS[t].receiver.postMessage(JSON.stringify({message:"showEdit"}),POWR_RECEIVERS[t].url);return e.preventDefault(),!1}if(40==e.keyCode&&o){for(t=0;t<POWR_RECEIVERS.length;t++)POWR_RECEIVERS[t].receiver.postMessage(JSON.stringify({message:"hideEdit"}),POWR_RECEIVERS[t].url);return e.preventDefault(),!1}})}function Y(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}function z(e,t,n,o,r,i){var a=e,l=a.match(/powr-[^\s\]]*/i),d=a.match(/id="[^"]*"/i);null==d&&(d=a.match(/id='[^']*'/i)),null==d&&null!=(d=a.match(/id=[^\]]*/i))&&(d=d[0].replace("id=",'id="')+'"'),null==d&&(d=a.match(/label="[^"]*"/i)),null==d&&(d=a.match(/label='[^']*'/i)),null==d&&(d="");var s='<div class="'+l+'" '+d+"></div>";return s}function G(e){for(var t={},n=e.search("\\?"),o=(e=e.substr(n+1)).split("&"),r=0;r<o.length;r++){var i=o[r].split("=");if(void 0===t[i[0]])t[i[0]]=i[1];else if("string"==typeof t[i[0]]){var a=[t[i[0]],i[1]];t[i[0]]=a}else t[i[0]].push(i[1])}return t}function X(){var e=navigator.userAgent.toLowerCase();return-1!=e.indexOf("msie")&&parseInt(e.split("msie")[1])}function F(e){for(var t=!1,n=e;n&&n!==document;n=n.parentNode)if(null!=n.classList&&n.classList.contains("powr-ignore")){t=!0;break}return t}function K(){try{return window.top.location.href}catch(e){return""}}function Q(t,n,o){function e(){var e={message:"loaded",data:{iframe_index:n,parent_window_width:window.innerWidth||document.documentElement.clientWidth||document.getElementsByTagName("body")[0].clientWidth,parent_window_height:window.innerHeight||document.documentElement.clientHeight||document.getElementsByTagName("body")[0].clientHeight}};t.contentWindow.postMessage(JSON.stringify(e),o)}t.addEventListener?t.addEventListener("load",e):t.attachEvent("onload",e)}function Z(t,e){e.addEventListener&&(e.addEventListener("powrPingListener",function(){return POWR_RECEIVERS[t].listenerConnected=!0},!1),POWR_RECEIVERS[t].ping_interval=setInterval(function(){var e=document.querySelectorAll('[powrindex="'+t+'"]')[0];e&&(POWR_RECEIVERS[t].listenerConnected=!1,e.dispatchEvent(n),!1===POWR_RECEIVERS[t].listenerConnected&&(console.log("POWr Lost connection. Reconnecting"),clearInterval(POWR_RECEIVERS[t].ping_interval),POWR_RECEIVERS[t].receiver=e.contentWindow,$(t),Z(t,e)))},2e3))}function $(n){var o=new XMLHttpRequest;o.open("GET",POWR_RECEIVERS[n].data_url,!0),o.withCredentials=!0,o.onreadystatechange=function(){if((o.readyState==XMLHttpRequest.DONE||4==o.readyState)&&200==o.status){var e=JSON.parse(o.responseText);e.iframe_index=n,POWR_RECEIVERS[n].data=e;var t=setInterval(function(){POWR_RECEIVERS[n].loaded&&(POWR_RECEIVERS[n].receiver.postMessage(JSON.stringify({message:"loadView",data:e}),POWR_RECEIVERS[n].url),clearInterval(t))},10)}},o.send()}function i(e){switch(e.scrollTo){case"top":r(0,e.scrollSpeed);break;case"bottom":t=e.scrollSpeed,r((document.documentElement.scrollHeight||document.body.scrollHeight)-window.innerHeight+50,t);break;case"text":!function(e,t){var n=function(e){for(var t=document.querySelectorAll("body, body *"),n=0;n<t.length;n++)for(var o=t[n],r=o.childNodes,i=0;i<r.length;i++){var a=r[i];if(3==a.nodeType){var l=a.nodeValue;if(-1<l.search(e))return o}}return!1}(e);if(!n)return;r(n.getBoundingClientRect().top+window.scrollY-150,t)}(e.scrollToText,e.scrollSpeed);break;case"anchor":!function(e,t){var n=document.getElementById(e);if(!n)return;r(n.getBoundingClientRect().top+window.scrollY-150,t)}(e.scrollToAnchor,e.scrollSpeed)}var t}function r(e,t,n){var o=document.documentElement.scrollTop||document.body.scrollTop;o!==n&&(window.requestAnimationFrame(function(){r(e,t,o)}),o<e?window.scrollTo(0,o+(e-o)/t):window.scrollTo(0,o-(o-e)/t))}function t(e){try{var t=JSON.parse(e.data);if("viewLoaded"==t.message){var n=t.data.iframe_index;POWR_RECEIVERS[n].loaded=!0}else if("updateSize"==t.message){"undefined"!=typeof gadgets&&void 0!==gadgets.window&&void 0!==gadgets.window.adjustHeight&&gadgets.window.adjustHeight(t.data.height);n=t.data.iframe_index;var o=document.querySelectorAll('[powrindex="'+n+'"]')[0];if(o&&(o.height=t.data.height+"px",o.style.height=t.data.height+"px",o.style.display="inline",null!=t.data.postCss))for(var r in t.data.postCss)o.style[r]=t.data.postCss[r];t.data.postMessage&&"scrollTo"==t.data.postMessage.messageType&&i(t.data.postMessage)}else if("loadMe"==t.message){n=t.data.iframe_index;null!=POWR_RECEIVERS[n]&&null!=POWR_RECEIVERS[n].data&&POWR_RECEIVERS[n].receiver.postMessage(JSON.stringify({message:"loadView",data:POWR_RECEIVERS[n].data}),POWR_RECEIVERS[n].url)}}catch(e){}}}();
