var app={};(function($,console) {const model={contact:{lglid:null,fullname:null,email:null,phone:null,shipping:{fullname:null,address:null,address2:null,city:null,state:null,zipcode:null,country:null,},billing:{address:null,address2:null,city:null,state:null,zipcode:null,country:null,},ebookemailed:!1,},};app=new flexapp({config:{apiurl:'/?c=api',enagicURL:'https://www.enagic.com/',sidebarMinHeight:800,flexid:'',products:{},productcodes:[],productsenabled:[],shopurl:'',searchurl:'/affsites/eco/search.php',pageurl:'',currentProductCode:'',motd:'',ctoken:'',c:'',lc:'',locale:'',country:'',country_detected:'',stat:{trackurls:['gclid','fblid'],tags:{id:null},ads:{id:null,addToCart:null,beginCheckout:null,purchase:null}},storage:{storage_key:'website',},},data:{firstInit:!1,notifyme:($.cookie('notifyme')==='1'),products:{},scroll:{previous:0,threshold:25,thresholdStart:0,headerOffset:100,},},lang:{},dict:{},debug:function(msg,context,type) {if(!window.isDarryl||context==='prefillData')return;type=type||'log';console[type](msg,context)},init:function(config) {var app=this;if($.isPlainObject(config)) $.extend(!0,app.config,config);app.stat.init(app.config.stat);if(!app.store.contact) app.store.contact=model.contact;if($.isArray(app.config.productsenabled)) {var $checks=$('.checkbox.pcheck');$checks.each(function(){let $chk=$(this),pcode=$chk.attr('id').replace('lgli_77_','');if(app.config.productsenabled.indexOf(pcode)<0) {$chk.parents('li').remove()}})} $('.pchecks').removeClass('is-invisible');$('img[data-lazy-src]:not(.lazyloaded)').each(function(x,el) {var $el=$(el),newsrc=$el.data('lazy-src');if(!newsrc||newsrc==="0"||newsrc==='none')return;$el.attr('src',newsrc).addClass('lazyloaded')});$('.sharetab').toggleClass('is-info is-bold is-primary');if(!app.store.contact||!app.store.contact.shipping||app.store.contact.shipping.country!==app.config.country) {app.debug('changed country! clear address!');app.store.contact.shipping={}} $('body').data('smoothanchor-padding',70+10);if($.xhrtoken)app.getLang();else $(window).one('csrfready',app.getLang.bind(app));$.each(app,function(key,func) {if(key&&key!=='init'&&key.substr(0,4)==='init'&&typeof func==='function') {func.call(app)}});app.prefillData();$('.em2').each(function() {var $this=$(this),$a=$this.parent('a');if(!$a.length)return;$a.attr('href','mailto:'+$this.text())});$header=$('.header-style-1');app.data.scroll.headerOffset=$header.outerHeight();$(window).on('scroll',function(e) {var currentY=$(this).scrollTop();if(currentY>=app.data.scroll.headerOffset) {$header.removeClass('video-playing');if(currentY<=app.data.scroll.previous) {if(!$header.hasClass('sticky')) {if(!app.data.scroll.thresholdStart) app.data.scroll.thresholdStart=app.data.scroll.previous;if(Math.abs(currentY-app.data.scroll.thresholdStart)>app.data.scroll.threshold) {$header.addClass('sticky');app.data.scroll.previous=currentY;app.data.scroll.thresholdStart=0}}else if($header.hasClass('slideup')) $header.removeClass('slideup')}else{$header.addClass('slideup');app.data.scroll.thresholdStart=0}}else if(currentY<=app.data.scroll.headerOffset) $header.removeClass('sticky slideup');const $player=window.videos[0].$player;if(currentY<=10&&$player.hasClass('viewportfix')&&$player.hasClass('is-playing')) $header.addClass('video-playing');app.data.scroll.previous=currentY});if(window.innerWidth>950) {function inViewport(el){var rect=el.getBoundingClientRect();var innerHeight=window.innerHeight||document.documentElement.clientHeight;var innerWidth=window.innerWidth||document.documentElement.clientWidth;return rect.top>=0&&rect.left>=0&&rect.bottom<=innerHeight&&rect.right<=innerWidth};const video=window.videos[0];if(!inViewport(video.$player[0])){video.$player.addClass('viewportfix');$(window).on('video_played',(e,data)=>{if($.isPlainObject(data)&&data.videoid) {if(app.config.c==='opportunity'&&data.videoid==="GqY5ozeP") {$header.addClass('video-playing')}}});$(window).on('video_ended video_paused',(e,data)=>{if($.isPlainObject(data)&&data.videoid) {if(app.config.c==='opportunity'&&data.videoid==="GqY5ozeP") {$header.removeClass('video-playing')}}})}else app.debug('video GOOD in viewport')} if(app.config.flexid==='demo') {setTimeout(function(){Lobibox.alert('info',{title:'DEMO PURPOSES ONLY',msg:'This website is not fully functional it is ONLY for demonstrating the website that you can subscribe to through your account with www.EnagicWebSystem.com.'})},7000)} $(window).off('popstate.tabs').on('popstate.tabs',app.initTabs.bind(app));$('.mm-navbar__title').attr('name','mm-navbar');app.bindEvents();$('[data-tooltip]').each(()=>{var $el=$(this),tip=$el.data('tooltip');$el.data('tooltip',app._(tip))});app.data.firstInit=!0},initOptinModal:function(){if(window.doOptinModal) {var $optinModal=$('#optinModal');if($optinModal.length>0) {$('#optinModal form.ebook').on('submit',function(){$optinModal.removeClass('is-active').data('hidePerm',!0);$.cookie('optinModal','hide',{expires:3650})});$optinModal.on('modal-close',function(){if($optinModal.data('hidePerm')!==!0) $.cookie('optinModal','hide',{expires:3})});$(document).on('mouseleave',function(){if($.cookie('optinModal')!=='hide')$optinModal.addClass('is-active')});setTimeout(function(){if($.cookie('optinModal')!=='hide')$optinModal.addClass('is-active')},7*1000)}}},initModals:function() {let app=this,$modalButtons=$('[data-toggle="modal"]');$(document).off('click.togglemodal');$modalButtons.off('click.modal').on('click.modal',function(){let $but=$(this),$modal=$($but.data('target')),onOpen=$modal.data('bind-open');$modal.toggleClass('is-active');if(onOpen&&app[onOpen]) app[onOpen]()});$('.modal button[aria-label="close"]').off('click.modal').on('click.modal',function(){$(this).parents('.modal').removeClass('is-active').trigger('modal-close')})},checkoutAccordionOpen:function() {app.cart.accCheckout[0].expand()},countryWarning:function(callback) {let app=this;app.messenger.confirm(`Country Mismatch`,`

We've detected a mismatch between your selected country and the country you are in.

Detected: ${app.config.country_detected}
Selected: ${app.config.country}

Do you want to continue shopping in ${app.config.country} ?

`,callback)},orderoptin:function(e) {let app=this,$form=$(e.currentTarget),product=app.config.products[app.config.currentProductCode],data=$form.serializeObject();e.preventDefault();data.do='optinorder';data.lglid=app.store.contact.lglid;if(window.timezone)data.timezone=window.timezone;app.debug(data,'orderoptin submit');$.postJSON('/?c=api',data,function(response) {app.waiter.off();if($.isPlainObject(response)&&response.status===1) {if(response.lglid)app.store.contact.lglid=response.lglid;if(data.email)app.store.contact.email=data.email;if(response.phone)app.store.contact.phone=response.phone;app.history.updateReplace({success:'cart-checkout-begin'});app.stat.optin('beginCheckout');app.buynowAction()}}).fail(function(response){app.waiter.off();app.buynowAction()})},buynowAction:function() {let app=this,product=app.config.products[app.config.currentProductCode];if(product.buylink) {window.location.href=product.buylink}else{app.cart.addItem(app.config.currentProductCode,1);setTimeout(function(){window.location.href=app.config.carturl},150)}},buynow:function(e) {let app=this,$button=$(e.currentTarget),product=app.config.products[app.config.currentProductCode],msg=app.getHTMLTemplate('buyoptin');function buyOptin() {if(app.config.optinBeforeBuy&&product.buylink) {app.messenger.delay(255).modal(`${app._('Purchase')} ${product.name} - ${app._('Step 1')}`,msg,(lobi,action)=>{if(action==='yes') {let $form=lobi.$el.find('form').trigger('submit')}},{shown:()=>{app.initForms();app.bindEvents()},})}else app.buynowAction()} if(app.config.country_detected&&app.config.country_detected!==app.config.country) {app.countryWarning((lobi,action)=>{if(action==='yes') {buyOptin()}else{let $toggle=$('.tabcontent li.is-active .buyline');$toggle.addClass('showhelp');setTimeout(()=>{$toggle.removeClass('showhelp')},7000)}})}else buyOptin()},buyTeamSelect:function(e){const app=this;const $modal=$('#modalSelectSponsor');const sponsorHTML=app.getHTMLTemplate('selectsponsor',app.config.team);$modal.find('.modal-card-body').html(sponsorHTML);$modal.addClass('is-active');app.bindEvents()},selectSponsor:function(e){const app=this;const $button=$(e.currentTarget);const sponsorid=$button.data('sponsorid');const data={do:'buylink',product:app.config.currentProductCode,sponsorid:sponsorid,country:app.config.country,};$.postJSON(app.config.apiurl,data).done((response)=>{if($.isPlainObject(response)&&response.status&&response.buylink){app.debug(response.buylink,'buylink');app.config.products[app.config.currentProductCode].buylink=response.buylink;app.buynowAction()}else app.messenger.error('Error','Unknown server error has occurred please try again in a moment.')}).fail(()=>{app.messenger.error('Error','Unknown server error has occurred please try again in a moment.')})},btnGroup:function(e) {let app=this,$clicked=$(e.target),$button=($clicked.hasClass('.button'))?$clicked:$clicked.parents('.button'),$group=$button.parents('.field.has-addons');$group.find('.button.is-active').removeClass('is-active');$button.toggleClass('is-active')},dropdown:function(e) {var app=this,$button=$(e.currentTarget).parents('.dropdown');if(e.type&&e.type==='blur') {setTimeout(()=>{let $search=$button.find('.dropdown-region input.regionsearch:focus, .dropdown-region .dropdown-item > a:focus');if($search.length){return!0} $button.removeClass('is-active')},175);return!0} $button.toggleClass('is-active')},regionChange:function(e) {let app=this;app.waiter.on();app.cart.empty()},regionsearch:function(e) {let app=this,$field=$(e.currentTarget);var value=$field.val();var $items=$field.parents('.dropdown-region').find('> ul > li:not(:first-of-type)');if(value===''){$items.show()} else{$items.not(':icontains('+value+')').hide();$items.filter(':icontains('+value+')').show()}},megaoptinXXX:function(formElement) {var $form=$(formElement),$submit=$form.find('button[type=submit]'),app=this,$comments=$form.find('textarea[name=comments]'),$campaign=$form.find('input[name=campaign]'),fullname=$form.find('input[name=fullname]').val(),$fname=$form.find('input[name=lgl_fname]'),$lname=$form.find('input[name=lgl_lname]');app.debug(data);$submit.prop('disabled',!0);app.spinner.show();if(!$comments.val()) $campaign.prop('disabled',!0);else $campaign.prop('disabled',!1);if(fullname) {var split=fullname.split(' ');$fname.val(split[0]);$lname.val(split.splice(1).join(' '))} var data=$form.serialize()+'&jsonapi=1';$.ajax({url:'/index.php',type:"POST",dataType:'json',data:data,success:function(result) {app.spinner.hide();$submit.prop('disabled',!1);app.debug(result,'optin post result');if(typeof result==='object'&&result.status===!0) {app.store.contact=$form.serializeObject();if($form.parent().attr('id')==='videoOptin') {app.data.videoOpted=!0;jwplayer().play()}else $.messenger.success('Message Received!','We have received your message and will get back to you soon!')}else if(typeof result==='object'&&result.error) {$.messenger.alert('Form Validation Failed',result.error)}else{$.messenger.tell('Unknown Error','An unknown error has occurred, please try again later.

[result not object]')}},error:function(xhr,resp,text){app.spinner.hide();$submit.prop('disabled',!1);app.debug(xhr,resp,text);$.messenger.alert('Error','An unknown error has occurred, please try again later.

[server 503]')}});return!1},nav:function(e) {let app=this,$el=$(e.currentTarget),url=$el.data('url');if(url) window.location.href=url},tabResize:function($tabcontent) {let app=this;app.debug('tabResize');$tabcontent=$tabcontent||$('.tabcontent > ul > li.is-active');if(!$tabcontent.length)return;let $tabcontainer=$tabcontent.parents('.tabcontent');if(!$tabcontainer.length)return;$tabcontainer.css('height',$tabcontent.outerHeight()+20+'px')},initTabs:function(e){let app=this,event=($.type(e)==='object'&&e.type)?e.type:!1;$('.tabcontent > ul > li.is-active').addClass('pb-5');let tabName='';if(window.location.hash.substr(0,4)==='#tab') {tabName=window.location.hash.replace('#','')}else if($get('tab')) {tabName=$get('tab');scrollToHash('#tabkangen')}else if(event==='popstate') {tabName='tabk8'} if(tabName) app.tab({currentTarget:$(`a[name="${tabName}"]`),autonav:1});app.loadProductDetails(app.config.currentProductCode,app.tabResize.bind(app).delay(500))},tab:function(e) {let app=this,$a=$(e.currentTarget),$tab=$a.parent(),productcode=$a.data('code'),tabName=$a.attr('name'),$allTabs=$a.parents('.tabs').find('li');if(!$a.length)return;$allTabs.removeClass('is-active');$tab.addClass('is-active');let tabid=0;$allTabs.each(function(i){if(this===$tab[0])tabid=i});let $allTabContent=$('.tabcontent > ul > li');let $tabcontent=$allTabContent.eq(tabid);$allTabContent.removeClass('is-active pb-5');if(!e.autonav) {let title1=$tabcontent.find('.tab-title1').text();let title2=$tabcontent.find('.tab-title2').text();let titleuser=window.document.title.substr(window.document.title.indexOf(' | ')+3);let title=(title1)?`${title1} ยป ${title2} | ${titleuser}`:undefined;app.history.push(`${app.config.pageurl}#${tabName}`,title)} setTimeout(function(){$tabcontent.addClass('is-active pb-5');app.config.currentProductCode=productcode;app.loadProductDetails(productcode,app.tabResize.bind(app).delay(500));app.tabResize()},175)},getLang:function() {},loadProductDetails:function(code,callback) {let app=this;if($.type(code)==='object') {var $productDetails=code;code=app.config.currentProductCode}else{var $productDetails=$(`#tabcontent-${code}`).find('.product-details')} if(!$productDetails.length||$productDetails.data('loaded'))return;if($productDetails.hasClass('page-server-load')) {$productDetails.data('loaded',!0);app.onBeforeInjectEnagic($productDetails);$productDetails.find('td:first-of-type').each(function(){$(this).replaceWith(''+this.innerHTML+'')});return} $productDetails.loadElement(`https://www.enagic.com/?c=product-${code}&lc=${app.config.lc}`,'.info-container table.half tbody > tr',($newElements)=>{$productDetails.data('loaded',!0);app.onBeforeInjectEnagic($newElements);$newElements.find('td:first-of-type').each(function(){$(this).replaceWith(''+this.innerHTML+'')})},function($newElements) {if($.type(callback)==='function') setTimeout(callback,50)})},initShopProduct:function() {var app=this,$productDetails=$('#product-details');if(!$productDetails.length)return;app.loadProductDetails($productDetails)},initProductPageEco:function() {var app=this,$productPage=$('#productPage'),$prodlogo=$('#prodlogo');if(!$productPage.length||!app.config.productcodes)return;function GetCodeFromURL(url) {url=url||window.location.href;var code=url.split('/');code=code[code.length-1];app.debug([code,$get('p',url),url.substr(url.indexOf('/products/')+10)],'GetCodeFromURL');return $get('p',url)||code||''} function GetCurrentCode() {var code=GetCodeFromURL();if(!code)code='k8';return code} function GetNextCode(from) {if(from===undefined)from=GetCurrentCode();var index=app.config.productcodes.indexOf(from)+1;if(!app.config.productcodes[index])index=0;return app.config.productcodes[index]} function GetPrevCode(from) {if(from===undefined)from=GetCurrentCode();var index=app.config.productcodes.indexOf(from)-1;if(!app.config.productcodes[index])index=app.config.productcodes.length-1;return app.config.productcodes[index]} function LoadProduct(code) {if($productPage.find('#page-server-load').length) {$productPage.find('#page-server-load').remove();onBeforeInject($productPage);onAfterInject($productPage)}else{$productPage.loadElement('/?c=-econtent&qs='+encodeURIComponent('c=product-'+code),'#main',onBeforeInject,onAfterInject)}} var onBeforeInject=function($newElements) {app.onBeforeInjectEnagic($newElements);$('.banner .btn.btn-warning',$newElements).prop('href',app.config.shopurl+'/'+GetCurrentCode());$('.certification-area a',$newElements).remove();$('.certification-list li',$newElements).wrapInner($(''))};var onAfterInject=function($newElements) {$('.bg-stretch',$newElements).retinaCover();$.initLightbox($newElements)};$('.prodnav').off('click.prodnav').on('click.prodnav',function(e) {e.preventDefault();window.stop();var $this=$(this),$anext=$('#aNext'),$aprev=$('#aPrev'),gotocode=$this.data('code');$prodlogo.prop('src',app.config.enagicURL+'images/product_logos/'+gotocode+'.png');LoadProduct(gotocode);history.pushState(null,gotocode,$this.attr('href'));document.title=app.config.products[gotocode].name+' - '+app.config.products[gotocode].tagline;$aprev.prop('href',$aprev.attr('href').replace(GetCodeFromURL($aprev.attr('href')),GetPrevCode(gotocode))).data('code',GetPrevCode(gotocode));$anext.prop('href',$anext.attr('href').replace(GetCodeFromURL($anext.attr('href')),GetNextCode(gotocode))).data('code',GetNextCode(gotocode))});LoadProduct(app.config.currentProductCode);$(window).off('popstate.products').on('popstate.products',function(event){var gotocode=GetCodeFromURL();LoadProduct(gotocode);$prodlogo.prop('src',app.config.enagicURL+'images/product_logos/'+gotocode+'.png')})},initProductPage:function() {let app=this,$certs=$('.certificates-additional'),$newElements=$certs.find('.partners-section');$(window).on('resize',app.tabResize.bind(app));$(window).on('timezoneData',function() {if(app.config.country&&app.config.country!==window.timezoneData.countryCode) {var $li=$('li.region_'+window.timezoneData.countryCode);if($li.length>0) $('.dropdown-region > ul > li').eq(0).after($li.addClass('recommend'))}});if($certs.hasClass('page-server-load')) {$certs.data('loaded',!0);app.onBeforeInjectEnagic($newElements);$newElements.find('.col:last-of-type').remove();$newElements.find('.text-wrap').toggleClass('text-wrap columns is-multiline has-text-centered');$newElements.find('.col').toggleClass('col column').each(function(){let $this=$(this),$img=$this.find('img'),$picture=$this.find('picture');$picture.replaceWith($img)}).find('p').remove();$newElements.find('.column').find('.link-holder').each(function(){let $aparent=$(this),$a=$aparent.find('a'),$img=$a.parents('.column').find('.img-holder').eq(0);$a.empty();$img.wrapInner($a);$a.remove()});return} $certs.loadElement('https://www.enagic.com/?c=product-certified','.partners-section',($newElements)=>{app.onBeforeInjectEnagic($newElements);$newElements.find('.col:last-of-type').remove();$newElements.find('.text-wrap').toggleClass('text-wrap columns is-multiline has-text-centered');$newElements.find('.col').toggleClass('col column').each(function(){let $this=$(this),$img=$this.find('img'),$picture=$this.find('picture');$picture.replaceWith($img)}).find('p').remove();$newElements.find('.column').find('.link-holder').each(function(){let $aparent=$(this),$a=$aparent.find('a'),$img=$a.parents('.column').find('.img-holder').eq(0);$a.empty();$img.wrapInner($a);$a.remove()})},$.initLightbox)},onBeforeInjectEnagic:function($newElements) {const app=this;$('[srcset]',$newElements).prop('srcset',function(i,origsrc){origsrc=origsrc.split(',');$.each(origsrc,function(x,src) {src=src.trim();src=(!src||src.indexOf('http')===0)?src:app.config.enagicURL+src;origsrc[x]=src});return origsrc.join(', ')});$('[src]',$newElements).attr('src',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[data-srcset]',$newElements).attr('data-srcset',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[href]',$newElements).attr('href',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$newElements.find('.fa-question-circle-o').toggleClass('fa-question-circle-o fa-question-circle has-text-primary');$('.viewport-section',$newElements).removeClass('viewport-section');$('.info-icon[title]',$newElements).each(function(){var $this=$(this),title=$this.eq(0).parent().text().trim();$this.data('helpMsg',$this.attr('title'))}).helpModal()},initWaterPage:function() {var app=this,$page=$('#waterPage');if(!$page.length) return;var onBeforeInject=function($newElements) {$('[srcset]',$newElements).prop('srcset',function(i,origsrc){origsrc=origsrc.split(',');$.each(origsrc,function(x,src) {src=src.trim();src=(!src||src.indexOf('http')===0)?src:app.config.enagicURL+src;origsrc[x]=src});return origsrc.join(', ')});$('[src]',$newElements).attr('src',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[data-srcset]',$newElements).attr('data-srcset',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[href]',$newElements).attr('href',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('.container-fluid',$newElements).toggleClass('container-fluid container');$('.more-block a.btn-success',$newElements).prop('href','/kangen-water/uses');$('.fa-question-circle-o',$newElements).toggleClass('fa-question-circle-o fa-question-circle');$('.viewport-section',$newElements).removeClass('viewport-section');$('.certification-area a',$newElements).prop('href','/certifications');$('.certification-list li',$newElements).wrapInner($(''));$('.info-icon[title]',$newElements).each(function(){var $this=$(this),title=$this.eq(0).parent().text().trim();$this.data('helpMsg',$this.attr('title'))}).helpModal()};var onAfterInject=function($newElements) {$('.bg-stretch',$newElements).retinaCover();$.initLightbox($newElements)};if($page.is(':empty')) {$page.loadElement('https://www.enagic.com/?c=water','#main',onBeforeInject,onAfterInject)}else{onBeforeInject($page);onAfterInject($page)}},initFAQPage:function() {var app=this,$page=$('#faqPage');if(!$page.length) return;var onBeforeInject=function($newElements) {$('[srcset]',$newElements).prop('srcset',function(i,origsrc){origsrc=origsrc.split(',');$.each(origsrc,function(x,src) {src=src.trim();src=(!src||src.indexOf('http')===0)?src:app.config.enagicURL+src;origsrc[x]=src});return origsrc.join(', ')});$('[src]',$newElements).attr('src',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[data-srcset]',$newElements).attr('data-srcset',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[href]',$newElements).attr('href',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('.container-fluid',$newElements).toggleClass('container-fluid container');$('.more-block a.btn-success',$newElements).prop('href','/kangen-water/uses');$('.fa-question-circle-o',$newElements).toggleClass('fa-question-circle-o fa-question-circle');$('.viewport-section',$newElements).removeClass('viewport-section');$('.certification-area a',$newElements).prop('href','/certifications');$('.certification-list li',$newElements).wrapInner($(''));$('.info-icon[title]',$newElements).each(function(){var $this=$(this),title=$this.eq(0).parent().text().trim();$this.data('helpMsg',$this.attr('title'))}).helpModal()};var onAfterInject=function($newElements) {$('.bg-stretch',$newElements).retinaCover();$.initLightbox($newElements);$('#main .faq-area .container').prepend('').find('#inputFilter').on('keyup',debounce(filterFAQ,500))};$page.loadElement('https://www.enagic.com/?c=water-faq','#main',onBeforeInject,onAfterInject)},initProductComparisonPage:function() {var app=this,$page=$('#products-comparison');if(!$page.length) return;$('html,body').scrollTop(0);var onBeforeInject=function($newElements) {$('[srcset]',$newElements).prop('srcset',function(i,origsrc){origsrc=origsrc.split(',');$.each(origsrc,function(x,src) {src=src.trim();src=(!src||src.indexOf('http')===0)?src:app.config.enagicURL+src;origsrc[x]=src});return origsrc.join(', ')});$('[src]',$newElements).attr('src',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[data-srcset]',$newElements).attr('data-srcset',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[href]',$newElements).attr('href',function(i,origsrc){origsrc=origsrc.replace('https://www.enagic.com','');return(!origsrc||origsrc.indexOf('http')===0)?origsrc:origsrc.replace('/?c=product-','/products/').replace('/products/videos','/videos')});$('.container-fluid',$newElements).toggleClass('container-fluid container');$('.more-block a.btn-success',$newElements).prop('href','/kangen-water/uses');$('.fa-question-circle-o',$newElements).toggleClass('fa-question-circle-o fa-question-circle');$('.viewport-section',$newElements).removeClass('viewport-section');$('.certification-area a',$newElements).prop('href','/certifications');$('.certification-list li',$newElements).wrapInner($(''));$('.info-icon[title]',$newElements).each(function(){var $this=$(this),title=$this.eq(0).parent().text().trim();$this.data('helpMsg',$this.attr('title'))}).helpModal();$('.spec-block-container',$newElements).mobileNav({menuActiveClass:'height-active',menuOpener:'.height-opener',onToggle:function(app){setTimeout(function(){jQuery(window).trigger('resize')},400)}});$('.block').hide();$.each(app.config.productcodes,function(i,code){$('.'+code).show()})};var onAfterInject=function($newElements) {$('html,body').scrollTop(0);$('.bg-stretch',$newElements).retinaCover();$.initLightbox($newElements)};if($page.is(':empty')) {$page.loadElement('https://www.enagic.com/?c=product-comparison','#main',onBeforeInject,onAfterInject)}else{onBeforeInject($page);onAfterInject($page)}},initUsesPage:function() {var app=this,$page=$('#usesPage');if(!$page.length) return;var onBeforeInject=function($newElements) {$('[srcset]',$newElements).prop('srcset',function(i,origsrc){origsrc=origsrc.split(',');$.each(origsrc,function(x,src) {src=src.trim();src=(!src||src.indexOf('http')===0)?src:app.config.enagicURL+src;origsrc[x]=src});return origsrc.join(', ')});$('[src]',$newElements).attr('src',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('[data-srcset]',$newElements).attr('data-srcset',function(i,origsrc){return(!origsrc||origsrc.indexOf('http')===0)?origsrc:app.config.enagicURL+origsrc});$('.container-fluid',$newElements).toggleClass('container-fluid container');$('.more-block a.btn-success',$newElements).prop('href','/kangen-water-uses');$('.fa-question-circle-o',$newElements).toggleClass('fa-question-circle-o fa-question-circle');$('.viewport-section',$newElements).removeClass('viewport-section');$('.certification-area a',$newElements).prop('href','/certifications');$('.certification-list li',$newElements).wrapInner($(''));$('.info-icon[title]',$newElements).each(function(){var $this=$(this),title=$this.eq(0).parent().text().trim();$this.data('helpMsg',$this.attr('title'))}).helpModal()};var onAfterInject=function($newElements) {$('.bg-stretch',$newElements).retinaCover();$.initLightbox($newElements)};if($page.is(':empty')) {$page.loadElement('https://www.enagic.com/?c=water-usage','#main',onBeforeInject,onAfterInject)}else{onBeforeInject($page);onAfterInject($page)}},initSearchBar:function() {var app=this,$header=$('#searchui'),$headerForm=$header.find('form'),$butOpen=$('.nav-search'),$butClose=$('#nav-search-close'),$headerInput=$header.find('input.searchquery'),$inputs=$('input.searchquery');var openHeaderSearch=function(e) {if(e&&['click','touchstart'].indexOf(e.originalEvent.type)>=0)e.preventDefault();$header.addClass('open');setTimeout(function(){$('#searchui form input')[0].focus()},500);return!1};var closeHeaderSearch=function(e) {if(e&&e.originalEvent&&['click','touchstart'].indexOf(e.originalEvent.type)>=0)e.preventDefault();$('body').removeClass('modal-open');$header.removeClass('open');$headerInput.val('');return!1};$butOpen.on('click touchstart',openHeaderSearch);$butClose.on('click touchstart',closeHeaderSearch);$headerInput.on('blur',function(){if($headerInput.val())return;closeHeaderSearch()});$inputs.on('blur',function(){$(this).parents('form').find('.search-results').fadeOut()}).on('focus',function(){var $this=$(this);if($this.val()!=='')$this.parents('form').find('.search-results').fadeIn()});$('.search-form').on('keypress',function(e) {if(e.which===13) {e.preventDefault();return!1}});var thread=null;$inputs.on('keyup',function(key) {var $this=$(this),searchtext=$this.val(),$results=$this.parents('.search-form-container').find('.search-results');if(key.which===27) {$this.val('').blur();$results.fadeOut();return!1} if(key.which===13) {key.preventDefault();return!1} if(searchtext===$this.data('lastsearch'))return!1;$results.html('');clearTimeout(thread);thread=setTimeout(function(){searchSite($this.val(),$results)},750);$results.fadeIn();$('body').addClass('modal-open');$this.data('lastsearch',searchtext);return!1});function searchSite(str,$results) {if(!str)return!1;app.debug({url:app.config.searchurl,s:str,locale:app.config.locale},'searchSite');$.getJSON(app.config.searchurl,{s:str,locale:app.config.locale},function(data) {var items=[];if(data.length===0) {$("#search-noresults").clone().prop('id','').appendTo($results.empty());return} $.each(data,function(key,match) {match.baseurl=app.config.baseurl;items.push(app.getHTMLTemplate('search-result-item',match))});$("