(function(a,b){a._EPYT_=a._EPYT_||{ajaxurl:"/wp-admin/admin-ajax.php",security:"",gallery_scrolloffset:100,eppathtoscripts:"/wp-content/plugins/youtube-embed-plus/scripts/",epresponsiveselector:["iframe.__youtube_prefs_widget__"],epdovol:true,evselector:'iframe.__youtube_prefs__[src], iframe[src*="youtube.com/embed/"], iframe[src*="youtube-nocookie.com/embed/"]',stopMobileBuffer:true,usingdefault:true};if(a.location.toString().indexOf("https:///")===0){a._EPYT_.ajaxurl=a._EPYT_.ajaxurl.replace("http://","https:///")}a._EPYT_.pageLoaded=false;b(a).on("load._EPYT_",function(){a._EPYT_.pageLoaded=true});if(!document.querySelectorAll){document.querySelectorAll=function(e){var g=document,f=g.documentElement.firstChild,d=g.createElement("STYLE");f.appendChild(d);g.__qsaels=[];d.styleSheet.cssText=e+"{x:expression(document.__qsaels.push(this))}";a.scrollBy(0,0);return g.__qsaels}}if(typeof a._EPADashboard_==="undefined"){a._EPADashboard_={initStarted:false,checkCount:0,onPlayerReady:function(f){try{if(typeof _EPYT_.epdovol!=="undefined"&&_EPYT_.epdovol){var d=parseInt(f.target.getIframe().getAttribute("data-vol"));if(!isNaN(d)){if(d===0){f.target.mute()}else{if(f.target.isMuted()){f.target.unMute()}f.target.setVolume(d)}}}}catch(e){}},onPlayerStateChange:function(g){var f=g.target.getIframe();if(g.data===a.YT.PlayerState.PLAYING&&g.target.ponce!==true&&f.src.indexOf("autoplay=1")===-1){g.target.ponce=true}var d=b(f).closest(".epyt-gallery");if(!d.length){d=b("#"+b(f).data("epytgalleryid"))}if(d.length){var e=d.find(".epyt-pagebutton").first().data("autonext")=="1";if(e&&g.data===a.YT.PlayerState.ENDED){var h=d.find(".epyt-current-video");if(!h.length){h=d.find(".epyt-gallery-thumb").first()}var i=h.find(" ~ .epyt-gallery-thumb").first();if(i.length){i.click()}else{d.find('.epyt-pagebutton.epyt-next[data-pagetoken!=""][data-pagetoken]').first().click()}}}},justid:function(d){return new RegExp("[\\?&]v=([^&#]*)").exec(d)[1]},setupevents:function(e){a._EPADashboard_.log("Setting up YT API events: "+e);if(typeof(a.YT)!=="undefined"&&a.YT!==null&&a.YT.loaded){var d=document.getElementById(e);d.epytsetupdone=true;return new a.YT.Player(e,{events:{onReady:a._EPADashboard_.onPlayerReady,onStateChange:a._EPADashboard_.onPlayerStateChange}})}},apiInit:function(){if(typeof(a.YT)!=="undefined"){a._EPADashboard_.initStarted=true;var d=document.querySelectorAll(_EPYT_.evselector);for(var e=0;e=5||a._EPADashboard_.initStarted){clearInterval(a._EPADashboard_.checkInterval)}else{a._EPADashboard_.apiInit();a._EPADashboard_.log("YT API init")}},1000)},selectText:function(e){if(document.selection){var d=document.body.createTextRange();d.moveToElementText(e);d.select()}else{if(a.getSelection){var d=document.createRange();d.selectNode(e);a.getSelection().addRange(d)}}}}}a.onYouTubeIframeAPIReady=typeof a.onYouTubeIframeAPIReady!=="undefined"?a.onYouTubeIframeAPIReady:function(){if(a._EPYT_.pageLoaded){a._EPADashboard_.apiInit();a._EPADashboard_.log("YT API ready")}else{b(a).on("load._EPYT_",function(){a._EPADashboard_.apiInit();a._EPADashboard_.log("YT API ready 2")})}};if(typeof a.YT==="undefined"){var c=document.createElement("script");c.src="http://www.youtube.com/iframe_api";c.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(c)}else{if(a.YT.loaded){if(a._EPYT_.pageLoaded){a._EPADashboard_.log("YT API available");a._EPADashboard_.apiInit()}else{b(a).on("load._EPYT_",function(){a._EPADashboard_.log("YT API available 2");a._EPADashboard_.apiInit()})}}}if(a._EPYT_.pageLoaded){a._EPADashboard_.doubleCheck()}else{b(a).on("load._EPYT_",function(){a._EPADashboard_.doubleCheck()})}b(document).ready(function(){b(".epyt-gallery").each(function(){var h=b(this);var g=b(this).find("iframe").first();var e=g.attr("src");if(!e){e=g.data("ep-src")}var f=b(this).find(".epyt-gallery-list .epyt-gallery-thumb").first().data("videoid");e=e.replace(f,"GALLERYVIDEOID");g.data("ep-gallerysrc",e);var d=h.find(".epyt-gallery-list");h.on("click",".epyt-gallery-list .epyt-gallery-thumb",function(){h.find(".epyt-gallery-list .epyt-gallery-thumb").removeClass("epyt-current-video");b(this).addClass("epyt-current-video");var i=b(this).data("videoid");h.data("currvid",i);var k=g.data("ep-gallerysrc").replace("GALLERYVIDEOID",i);var j=h.find(".epyt-pagebutton").first().data("thumbplay");if(j!=="0"&&j!==0){if(k.indexOf("autoplay")>0){k=k.replace("autoplay=0","autoplay=1")}else{k+="&autoplay=1"}g.addClass("epyt-thumbplay")}b("html, body").animate({scrollTop:g.offset().top-parseInt(_EPYT_.gallery_scrolloffset)},500,function(){g.attr("src",k);a._EPADashboard_.setupevents(g.attr("id"))})}).on("keydown",".epyt-gallery-list .epyt-gallery-thumb, .epyt-pagebutton",function(j){var i=j.which;if((i===13)||(i===32)){j.preventDefault();b(this).click()}});h.on("mouseenter",".epyt-gallery-list .epyt-gallery-thumb",function(){b(this).addClass("hover")});h.on("mouseleave",".epyt-gallery-list .epyt-gallery-thumb",function(){b(this).removeClass("hover")});h.on("click",".epyt-pagebutton",function(){var k={action:"my_embedplus_gallery_page",security:_EPYT_.security,options:{playlistId:b(this).data("playlistid"),pageToken:b(this).data("pagetoken"),pageSize:b(this).data("pagesize"),columns:b(this).data("columns"),showTitle:b(this).data("showtitle"),showPaging:b(this).data("showpaging"),autonext:b(this).data("autonext"),thumbplay:b(this).data("thumbplay")}};var i=b(this).hasClass("epyt-next");var j=parseInt(h.data("currpage")+"");j+=i?1:-1;h.data("currpage",j);h.find(".epyt-gallery-list").addClass("epyt-loading");b.post(_EPYT_.ajaxurl,k,function(l){h.find(".epyt-gallery-list").html(l);h.find(".epyt-current").each(function(){b(this).text(h.data("currpage"))});h.find('.epyt-gallery-thumb[data-videoid="'+h.data("currvid")+'"]').addClass("epyt-current-video");if(h.find(".epyt-pagebutton").first().data("autonext")=="1"){h.find(".epyt-gallery-thumb").first().click()}}).fail(function(){alert("Sorry, there was an error loading the next page.")}).always(function(){h.find(".epyt-gallery-list").removeClass("epyt-loading");b("html, body").animate({scrollTop:h.find(".epyt-gallery-list").offset().top-parseInt(_EPYT_.gallery_scrolloffset)},500)})})})})})(window,jQuery);