 $(function(){var stack=$('#%parentId%');if(!stack.length>0||typeof stack==='undefined'){console.log('%stackClass% removed by 3rd party php. Execution terminated contact the vendor of the php stack.');return false;};var
sectionsVid=document.getElementById("vid-%id%"),playOnTouch='%id=playOnTouch%'=='True'?true:false,isPaused;%[if %id=type[0]%]%var isMobile=function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch;};if(isMobile()){$('.vb-%id%').addClass('is-touch-device');}%[endif]%%[if %id=type[1]%]%%[if %id=bodyVid%]%$('#vid-%id%').prependTo('body').addClass('body-vid').wrap('<div class=bg-vid_%id%></div');%[endif]%var isMobile=function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch;},runVid=function(){stacks.com_bigwhiteduck_stacks_sections_pro_video.videoCover(sectionsVid);window.addEventListener('focus',function(){if(!isPaused){sectionsVid.play();isPaused=false;}});window.addEventListener('blur',function(){isPaused=sectionsVid.paused;sectionsVid.pause();});%[if %("%id=play%"=="in-view")%]%stack.addClass('inview');stack.on('inview',function(event,isInView){if(isInView){sectionsVid.play();}else{%[if %("%id=inviewplay%"=="pause")%]%sectionsVid.pause();%[endif]%%[if %("%id=inviewplay%"=="reset")%]%sectionsVid.pause();sectionsVid.currentTime=0;%[endif]%}});%[endif]%if(!sectionsVid.muted===true){$(window).on('load',function(){if(!sectionsVid.currentTime>0&&!sectionsVid.ended&&sectionsVid.readyState>2){var playBtn=$('#play-%id%');playBtn.addClass('not-started');$('#vid-%id%').addClass('not-started');$('.vb-%id%').addClass('not-started');playBtn.on('click',function(){sectionsVid.play();$('#vid-%id%').removeClass('not-started');$('.vb-%id%').removeClass('not-started');playBtn.removeClass('not-started');});}});}
sectionsVid.onended=function(){var finsished;%[if %(%("%id=whenFinished%"!="none")%&&%("%id=controls[0]%"=="False")%)%]%$('.video-bg',stack).fadeOut(%id=fadeTime%);%[endif]%%[if %id=useTriggers%]%$('%id=vidEndSelector%').trigger('click');%[endif]%};%[if %id=useTriggers%]%var pollTimeReached=function(enable){return sectionsVid.currentTime>%id=startDelayTrigger%;};var pollTime2Reached=function(enable){return sectionsVid.currentTime>%id=startDelayTrigger2%;};var triggerDone,trigger2Done=false;sectionsVid.onplay=function(){if(!triggerDone){var vidtimer=setInterval(function(){if(pollTimeReached()){triggerDone=true;clearInterval(vidtimer);$('%id=afterStartSelector%').trigger('click');}},500);sectionsVid.onpause=function(){clearInterval(vidtimer);}}
if(!trigger2Done){var vidtimer2=setInterval(function(){if(pollTime2Reached()){trigger2Done=true;clearInterval(vidtimer2);$('%id=afterStartSelector2%').trigger('click');}},500);sectionsVid.onpause=function(){clearInterval(vidtimer2);}}};%[endif]%};if(isMobile()&&!playOnTouch){$('.vb-%id%').addClass('is-touch-device');$('#vid-%id%').remove();}else{%[if!%id=lazyLoad%]%runVid();%[else]%function addSrc(src,type){var source=document.createElement('source');source.src=src;source.type=type;sectionsVid.appendChild(source);};$(window).on('load',function(){addSrc("%id=h264_path -href%",'video/mp4');addSrc("%id=webm_path -href%",'video/webm');addSrc("%id=ogg_path -href%",'video/ogg');runVid();});%[endif]%}%[if %("%id=muteToggle%"!="")%]%%[if %id=hideMuteToggleMob%]%if(isMobile()){$('.%id=muteToggle%').css({'display':'none','visibility':'hidden'});}%[endif]%var
vid=$('#vid-%id%'),bpOpen=$('.%id=muteToggle%.joeyTrigger>.joeyOpenLabel, .%id=muteToggle%.joeyTrigger>.openIcon '),bpClosed=$('.%id=muteToggle%.joeyTrigger>.joeyCloseLabel, .%id=muteToggle%.joeyTrigger>.closeIcon ');if(!vid.prop('muted')){bpClosed.toggle();}else{bpOpen.toggle();}
$('.%id=muteToggle%').on('click',function(e){e.stopPropagation();e.preventDefault();if(vid.prop('muted')){vid.prop('muted',false);bpOpen.toggle();bpClosed.toggle();$('.%id=muteToggle%').addClass('mute-video');}else{vid.prop('muted',true);bpOpen.toggle();bpClosed.toggle();$('.%id=muteToggle%').removeClass('mute-video');}});%[endif]%%[if %("%id=playToggle%"!="")%]%%[if %id=hideMuteToggleMob%]%if(isMobile()){$('.%id=muteToggle%, .%id=playToggle%').css({'display':'none','visibility':'hidden'});}%[endif]%var
vid=$('#vid-%id%'),pbpOpen=$('.%id=playToggle%.joeyTrigger>.joeyOpenLabel, .%id=playToggle%.joeyTrigger>.openIcon '),pbpClosed=$('.%id=playToggle%.joeyTrigger>.joeyCloseLabel, .%id=playToggle%.joeyTrigger>.closeIcon ');if(sectionsVid.paused){pbpClosed.toggle();}else{pbpOpen.toggle();}
$('.%id=playToggle%').on('click',function(e){e.stopPropagation();e.preventDefault();if(sectionsVid.paused){sectionsVid.play();pbpOpen.toggle();pbpClosed.toggle();$('#vid-%id%').removeClass('not-started');$('.vb-%id%').removeClass('not-started');$('#play-%id%').removeClass('not-started');$('.%id=playToggle%').removeClass('pause-video');}else{sectionsVid.pause();pbpOpen.toggle();pbpClosed.toggle();$('.%id=muteToggle%').addClass('pause-video');}});%[endif]%%[endif]%$(window).on('load',function(){$(window).trigger('checkInView');});});
