var $youtubeBGVideos={};function _fbRowGetAllElementsWithAttribute(e){var t,i,o=[],a=document.getElementsByTagName("*");for(t=0,i=a.length;t<i;t++)a[t].getAttribute(e)&&!jQuery(a[t]).parents(".tfs-slider").length&&o.push(a[t]);return o}function _fbRowOnPlayerReady(e){var t,i,o=e.target,a=0,d=!0;o.playVideo(),o.isMute&&o.mute(),0!==jQuery("[data-youtube-video-id="+o.getVideoData().video_id+"]").data("loop")&&(t=o.getCurrentTime(),i=+new Date/1e3,o.loopInterval=setInterval(function(){void 0!==o.loopTimeout&&clearTimeout(o.loopTimeout),t===o.getCurrentTime()?a=t+(+new Date/1e3-i):(a=o.getCurrentTime(),i=+new Date/1e3),t=o.getCurrentTime(),a+(d?.45:.21)>=o.getDuration()&&(o.pauseVideo(),o.seekTo(0),o.playVideo(),d=!1)},150))}function _fbRowOnPlayerStateChange(e){e.data===YT.PlayerState.ENDED?(void 0!==e.target.loopTimeout&&clearTimeout(e.target.loopTimeout),0!==jQuery("[data-youtube-video-id="+e.target.getVideoData().video_id+"]").data("loop")&&e.target.seekTo(0)):e.data===YT.PlayerState.PLAYING&&jQuery(e.target.getIframe()).parent().css("opacity","1")}function resizeVideo(e){var t,i,o,a,d,n,s,u,r,f,v,l,c,y,m=e.parent();m.find("iframe").hasClass("fusion-hidden")&&m.find("iframe").attr("data-privacy-src")||(null!==m.find("iframe").width()?((t=e).css({width:"auto",height:"auto",left:"auto",top:"auto"}),t.css("position","absolute"),c=m.find("> div").data("display"),a=m.width(),d=m.height(),i=m.outerWidth(),o=m.outerHeight(),u=[16,9],void 0!==e.attr("data-video-aspect-ratio")&&-1!==e.attr("data-video-aspect-ratio").indexOf(":")&&((u=e.attr("data-video-aspect-ratio").split(":"))[0]=parseFloat(u[0]),u[1]=parseFloat(u[1])),s=o,n=u[0]/u[1]*o,"contain"===c?(m.css("paddingTop",m.parent("li").find(".slide-content-container").css("paddingTop")),s>=o&&(r=o,f=u[0]/u[1]*o),f>=i&&(f=i,r=u[1]/u[0]*i)):n>=i&&s>=o?(r=o,f=u[0]/u[1]*o):(f=i,r=u[1]/u[0]*i),v=-(r-d)/2,l=-(f-a)/2,1>m.find(".fusion-video-cover").length&&m.find("iframe").parent().prepend('<div class="fusion-video-cover">&nbsp;</div>'),m.is(":visible")&&(m.find(".fusion-video-cover").css({"z-index":0,width:f,height:r,position:"absolute"}),y="iframe",m.hasClass("video-background")&&(y="iframe.fusion-container-video-bg"),m.find(y).parent().css({marginLeft:l,marginTop:v}),m.find(y).css({width:f,height:r,"z-index":-1}))):setTimeout(function(){resizeVideo(e)},500))}if(Number(fusionVideoBgVars.status_yt))var onYouTubeIframeAPIReady=function(){var e,t,i,o,a,d=_fbRowGetAllElementsWithAttribute("data-youtube-video-id");if("function"!=typeof fusionGetConsent||fusionGetConsent("youtube"))for(e=0;e<d.length;e++){for(t=d[e].getAttribute("data-youtube-video-id"),i="",o=0;o<d[e].childNodes.length;o++)if(/div/i.test(d[e].childNodes[o].tagName)){i=d[e].childNodes[o].getAttribute("id");break}""!==i&&((a=new YT.Player(i,{height:"auto",width:"auto",videoId:t,playerVars:{autohide:1,autoplay:1,fs:0,showinfo:0,modestBranding:1,start:0,controls:0,rel:0,disablekb:1,iv_load_policy:3,wmode:"transparent"},events:{onReady:_fbRowOnPlayerReady,onStateChange:_fbRowOnPlayerStateChange}})).isMute=!1,"yes"===d[e].getAttribute("data-mute")&&(a.isMute=!0),"true"===d[e].getAttribute("data-youtube-video-id")&&a.setPlaybackQuality("hd720"),setTimeout(function(){jQuery("#"+i).css("visibility","visible")},500))}};function vimeoReady(e){var t,i=jQuery("#"+e).parents("[data-vimeo-video-id]").first();("function"!=typeof fusionGetConsent||fusionGetConsent("vimeo"))&&(t=new Vimeo.Player(e),"yes"===i.data("mute")&&t.setVolume(0),"no"===i.data("mute")&&t.setVolume(1),t.on("timeupdate",function(e){i.css("opacity","1"),t.off("timeupdate")}),jQuery("#"+e).attr("data-privacy-src")&&resizeVideo(i))}function fusionInitVimeoPlayers(){var e,t,i,o,a;if(("function"!=typeof fusionGetConsent||fusionGetConsent("vimeo"))&&Number(fusionVideoBgVars.status_vimeo)&&0<(e=jQuery("[data-vimeo-video-id]")).length)for(i=(t=e.find('> iframe, iframe[data-privacy-type="vimeo"]')).length,a=0;a<i;a++)o=t[a],jQuery("html").hasClass("ua-ie-11")&&jQuery(o).parent().css("opacity","1"),"function"==typeof vimeoReady&&vimeoReady(o.getAttribute("id"))}jQuery(document).ready(function(e){e("body").hasClass("vc_editor")||(e(".bg-parallax.video, .fusion-bg-parallax.video").each(function(){e(this).prependTo(e(this).next().addClass("video")),e(this).css({opacity:Math.abs(parseFloat(e(this).attr("data-opacity"))/100)})}),e("[data-youtube-video-id], [data-vimeo-video-id]").parent().css("overflow","hidden"),e("[data-youtube-video-id], [data-vimeo-video-id]").each(function(){var t=e(this);setTimeout(function(){resizeVideo(t)},100)}),e("[data-youtube-video-id], [data-vimeo-video-id]").each(function(){var t=e(this);setTimeout(function(){resizeVideo(t)},1e3)}),e(window).resize(function(){e("[data-youtube-video-id], [data-vimeo-video-id]").each(function(){var t=e(this);setTimeout(function(){resizeVideo(t)},2)})}),fusionInitVimeoPlayers())}),jQuery(window).on("load fusion-element-render-fusion_builder_container",function(e,t){var i=void 0!==t?jQuery('div[data-cid="'+t+'"]').find("[data-youtube-video-id], [data-vimeo-video-id]"):jQuery("[data-youtube-video-id], [data-vimeo-video-id]");void 0!==t&&Number(fusionVideoBgVars.status_yt)&&onYouTubeIframeAPIReady(),i.each(function(){var e=jQuery(this);setTimeout(function(){resizeVideo(e)},500)})});