(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,ajax_compat:false,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(g){try{if(typeof _EPYT_.epdovol!=="undefined"&&_EPYT_.epdovol){var e=parseInt(g.target.getIframe().getAttribute("data-vol"));if(!isNaN(e)){if(e===0){g.target.mute()}else{if(g.target.isMuted()){g.target.unMute()}g.target.setVolume(e)}}}var d=parseInt(g.target.getIframe().getAttribute("data-epautoplay"));if(!isNaN(d)&&d===1){g.target.playVideo()}}catch(f){}},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);if(!d.epytsetupdone){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 check")}},1000)},selectText:function(f){if(document.selection){var d=document.body.createTextRange();d.moveToElementText(f);d.select()}else{if(a.getSelection){var e=a.getSelection();var d=document.createRange();d.selectNode(f);e.removeAllRanges();e.addRange(d)}}},setVidSrc:function(d,e){d.attr("src",e);d.get(0).epytsetupdone=false;a._EPADashboard_.setupevents(d.attr("id"))},pageReady: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 m=g.data("ep-gallerysrc").replace("GALLERYVIDEOID",i);var l=h.find(".epyt-pagebutton").first().data("thumbplay");if(l!=="0"&&l!==0){if(m.indexOf("autoplay")>0){m=m.replace("autoplay=0","autoplay=1")}else{m+="&autoplay=1"}g.addClass("epyt-thumbplay")}var j=b("html").scrollTop();var k=g.offset().top-parseInt(_EPYT_.gallery_scrolloffset);if(j>k){b("html, body").animate({scrollTop:k},500,function(){a._EPADashboard_.setVidSrc(g,m)})}else{a._EPADashboard_.setVidSrc(g,m)}}).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("epcolumns"),showTitle:b(this).data("showtitle"),showPaging:b(this).data("showpaging"),autonext:b(this).data("autonext"),hidethumbimg:b(this).data("hidethumbimg"),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");if(h.find(".epyt-pagebutton").first().data("autonext")!="1"){var l=b("html").scrollTop();var m=h.find(".epyt-gallery-list").offset().top-parseInt(_EPYT_.gallery_scrolloffset);if(l>m){b("html, body").animate({scrollTop:m},500)}}})})})}}}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="//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_.apiInit();a._EPADashboard_.log("YT API available")}else{b(a).on("load._EPYT_",function(){a._EPADashboard_.apiInit();a._EPADashboard_.log("YT API available 2")})}}}if(a._EPYT_.pageLoaded){a._EPADashboard_.doubleCheck()}else{b(a).on("load._EPYT_",function(){a._EPADashboard_.doubleCheck()})}b(document).ready(function(){a._EPADashboard_.pageReady();if(a._EPYT_.ajax_compat){b(a).on("load._EPYT_",function(){b(document).ajaxSuccess(function(f,g,d){if(g&&g.responseText&&g.responseText.indexOf("