').attr({src:e.mbYTPlayer.locationProtocol+'//www.youtube.com/iframe_api?v='+e.mbYTPlayer.version,id:'YTAPI'});e('head').prepend(f)};e(document).on('YTAPIReady',function(){a.isBackground&&t.backgroundIsInited||a.isInit||(a.isBackground&&(t.backgroundIsInited=!0),a.opt.autoPlay='undefined'==typeof a.opt.autoPlay?a.isBackground?!0:!1:a.opt.autoPlay,a.opt.vol=a.opt.vol?a.opt.vol:100,e.mbYTPlayer.getDataFromAPI(a),e(a).on('YTPChanged',function(){if(!a.isInit){if(a.isInit=!0,e.browser.mobile&&a.canPlayOnMobile){if(a.opt.containment.outerWidth()>e(window).width()){a.opt.containment.css({maxWidth:'100%'});var t=.6*a.opt.containment.outerWidth();a.opt.containment.css({maxHeight:t})};return void new YT.Player(l,{videoId:a.videoID.toString(),height:'100%',width:'100%',events:{onReady:function(e){a.player=e.target,s.css({opacity:1}),a.wrapper.css({opacity:1})}}})};new YT.Player(l,{videoId:a.videoID.toString(),playerVars:d,events:{onReady:function(t){if(a.player=t.target,!a.isReady){a.isReady=a.isPlayer&&!a.opt.autoPlay?!1:!0,a.playerEl=a.player.getIframe(),o.optimizeDisplay(),a.videoID=p,e(window).on('resize.YTP',function(){o.optimizeDisplay()}),e.mbYTPlayer.checkForState(a);var r=e.Event('YTPUnstarted');r.time=a.player.time,a.canTrigger&&e(a).trigger(r)}},onStateChange:function(t){if('function'==typeof t.target.getPlayerState){var o=t.target.getPlayerState();if(a.state!=o){a.state=o;var r;switch(o){case-1:r='YTPUnstarted';break;case 0:r='YTPEnd';break;case 1:r='YTPStart',a.controlBar&&a.controlBar.find('.mb_YTPPlaypause').html(e.mbYTPlayer.controls.pause),'undefined'!=typeof _gaq&&eval(a.opt.gaTrack)&&_gaq.push(['_trackEvent','YTPlayer','Play',a.hasData?a.videoData.title:a.videoID.toString()]),'undefined'!=typeof ga&&eval(a.opt.gaTrack)&&ga('send','event','YTPlayer','play',a.hasData?a.videoData.title:a.videoID.toString());break;case 2:r='YTPPause',a.controlBar&&a.controlBar.find('.mb_YTPPlaypause').html(e.mbYTPlayer.controls.play);break;case 3:a.player.setPlaybackQuality(a.opt.quality),r='YTPBuffering',a.controlBar&&a.controlBar.find('.mb_YTPPlaypause').html(e.mbYTPlayer.controls.play);break;case 5:r='YTPCued'};var i=e.Event(r);i.time=a.player.time,a.canTrigger&&e(a).trigger(i)}}},onPlaybackQualityChange:function(t){var o=t.target.getPlaybackQuality(),r=e.Event('YTPQualityChange');r.quality=o,e(a).trigger(r)},onError:function(t){150==t.data&&(console.log('Embedding this video is restricted by Youtube.'),a.isPlayList&&e(a).playNext()),2==t.data&&a.isPlayList&&e(a).playNext(),'function'==typeof a.opt.onError&&a.opt.onError(o,t)}}})}}))})}})},getDataFromAPI:function(t){if(t.videoData=e.mbStorage.get('YYTPlayer_data_'+t.videoID),e(t).off('YTPData.YTPlayer').on('YTPData.YTPlayer',function(){if(t.hasData&&t.isPlayer&&!t.opt.autoPlay){var e=t.videoData.thumb_max||t.videoData.thumb_high||t.videoData.thumb_medium;t.opt.containment.css({background:'rgba(0,0,0,0.5) url('+e+') center center',backgroundSize:'cover'}),t.opt.backgroundUrl=e}}),t.videoData)setTimeout(function(){t.opt.ratio='auto'==t.opt.ratio?'16/9':t.opt.ratio,t.dataReceived=!0,e(t).trigger('YTPChanged');var r=e.Event('YTPData');r.prop={};for(var a in t.videoData)r.prop[a]=t.videoData[a];e(t).trigger(r)},500),t.hasData=!0;else if(e.mbYTPlayer.apiKey)e.getJSON(e.mbYTPlayer.locationProtocol+'//www.googleapis.com/youtube/v3/videos?id='+t.videoID+'&key='+e.mbYTPlayer.apiKey+'&part=snippet',function(r){function i(r){t.videoData={},t.videoData.id=t.videoID,t.videoData.channelTitle=r.channelTitle,t.videoData.title=r.title,t.videoData.description=r.description.length<400?r.description:r.description.substring(0,400)+' ...',t.videoData.aspectratio='auto'==t.opt.ratio?'16/9':t.opt.ratio,t.opt.ratio=t.videoData.aspectratio,t.videoData.thumb_max=r.thumbnails.maxres?r.thumbnails.maxres.url:null,t.videoData.thumb_high=r.thumbnails.high?r.thumbnails.high.url:null,t.videoData.thumb_medium=r.thumbnails.medium?r.thumbnails.medium.url:null,e.mbStorage.set('YYTPlayer_data_'+t.videoID,t.videoData)};t.dataReceived=!0,e(t).trigger('YTPChanged'),i(r.items[0].snippet),t.hasData=!0;var a=e.Event('YTPData');a.prop={};for(var o in t.videoData)a.prop[o]=t.videoData[o];e(t).trigger(a)});else{if(setTimeout(function(){e(t).trigger('YTPChanged')},50),t.isPlayer&&!t.opt.autoPlay){var r=e.mbYTPlayer.locationProtocol+'//i.ytimg.com/vi/'+t.videoID+'/hqdefault.jpg';t.opt.containment.css({background:'rgba(0,0,0,0.5) url('+r+') center center',backgroundSize:'cover'}),t.opt.backgroundUrl=r};t.videoData=null,t.opt.ratio='auto'==t.opt.ratio?'16/9':t.opt.ratio};t.isPlayer&&!t.opt.autoPlay&&(t.loading=e('
').addClass('loading').html('Loading').hide(),e(t).append(t.loading),t.loading.fadeIn())},removeStoredData:function(){e.mbStorage.remove()},getVideoData:function(){var e=this.get(0);return e.videoData},getVideoID:function(){var e=this.get(0);return e.videoID||!1},setVideoQuality:function(t){var r=this.get(0);e.browser.chrome||r.player.setPlaybackQuality(t)},playlist:function(t,r,o){var i=this,a=i.get(0);return a.isPlayList=!0,r&&(t=e.shuffle(t)),a.videoID||(a.videos=t,a.videoCounter=0,a.videoLength=t.length,e(a).data('property',t[0]),e(a).mb_YTPlayer()),'function'==typeof o&&e(a).on('YTPChanged',function(){o(a)}),e(a).on('YTPEnd',function(){e(a).playNext()}),i},playNext:function(){var t=this.get(0);return t.videoCounter++,t.videoCounter>=t.videoLength&&(t.videoCounter=0),e(t).changeMovie(t.videos[t.videoCounter]),this},playPrev:function(){var t=this.get(0);return t.videoCounter--,t.videoCounter<0&&(t.videoCounter=t.videoLength-1),e(t).changeMovie(t.videos[t.videoCounter]),this},changeMovie:function(t){var r=this.get(0);r.opt.startAt=0,r.opt.stopAt=0,r.opt.mute=!0,r.hasData=!1,r.hasChanged=!0,t&&e.extend(r.opt,r.defaultOpt,t),r.videoID=getYTPVideoID(r.opt.videoURL).videoID,e(r.playerEl).CSSAnimate({opacity:0},200,function(){return e(r).YTPGetPlayer().cueVideoByUrl(encodeURI(e.mbYTPlayer.locationProtocol+'//www.youtube.com/v/'+r.videoID),1,r.opt.quality),e.mbYTPlayer.checkForState(r),e(r).optimizeDisplay(),e.mbYTPlayer.getDataFromAPI(r),this})},getPlayer:function(){return e(this).get(0).player},playerDestroy:function(){var r=this.get(0);t.YTAPIReady=!1,t.backgroundIsInited=!1,r.isInit=!1,r.videoID=null;var a=r.wrapper;return a.remove(),e('#controlBar_'+r.id).remove(),clearInterval(r.checkForStartAt),clearInterval(r.getState),this},fullscreen:function(t){function l(){r.overlay.css({cursor:'none'})};function o(e,t){for(var r,i,a=['webkit','moz','ms','o',''],o=0;o
0||t&&r.opt.vol==t?r.isMute?e(r).YTPUnmute():e(r).YTPMute():(r.opt.vol=t,r.player.setVolume(r.opt.vol),r.volumeBar&&r.volumeBar.length&&r.volumeBar.updateSliderVal(t)):e(r).YTPUnmute(),this},mute:function(){var t=this.get(0);if(!t.isMute){t.player.mute(),t.isMute=!0,t.player.setVolume(0),t.volumeBar&&t.volumeBar.length&&t.volumeBar.width()>10&&t.volumeBar.updateSliderVal(0);var a=e('#controlBar_'+t.id),o=a.find('.mb_YTPMuteUnmute');o.html(e.mbYTPlayer.controls.unmute),e(t).addClass('isMuted'),t.volumeBar&&t.volumeBar.length&&t.volumeBar.addClass('muted');var r=e.Event('YTPMuted');return r.time=t.player.time,t.canTrigger&&e(t).trigger(r),this}},unmute:function(){var t=this.get(0);if(t.isMute){t.player.unMute(),t.isMute=!1,t.player.setVolume(t.opt.vol),t.volumeBar&&t.volumeBar.length&&t.volumeBar.updateSliderVal(t.opt.vol>10?t.opt.vol:10);var a=e('#controlBar_'+t.id),o=a.find('.mb_YTPMuteUnmute');o.html(e.mbYTPlayer.controls.mute),e(t).removeClass('isMuted'),t.volumeBar&&t.volumeBar.length&&t.volumeBar.removeClass('muted');var r=e.Event('YTPUnmuted');return r.time=t.player.time,t.canTrigger&&e(t).trigger(r),this}},applyFilter:function(e,t){var r=this.get(0);return r.filters[e].value=t,r.filtersEnabled&&this.YTPEnableFilters(),this},applyFilters:function(t){var r=this.get(0);return this.on('YTPReady',function(){for(var a in t)r.filters[a].value=t[a],e(r).YTPApplyFilter(a,t[a]);e(r).trigger('YTPFiltersApplied')}),this},toggleFilter:function(t,r){return this.each(function(){var a=this;a.filters[t].value?a.filters[t].value=0:a.filters[t].value=r,a.filtersEnabled&&e(this).YTPEnableFilters()})},toggleFilters:function(t){return this.each(function(){var r=this;r.filtersEnabled?(e(r).trigger('YTPDisableFilters'),e(r).YTPDisableFilters()):(e(r).YTPEnableFilters(),e(r).trigger('YTPEnableFilters')),'function'==typeof t&&t(r.filtersEnabled)})},disableFilters:function(){return this.each(function(){var t=this,r=e(t.playerEl);r.css('-webkit-filter',''),r.css('filter',''),t.filtersEnabled=!1})},enableFilters:function(){return this.each(function(){var t=this,o=e(t.playerEl),a='';for(var r in t.filters)t.filters[r].value&&(a+=r.replace('_','-')+'('+t.filters[r].value+t.filters[r].unit+') ');o.css('-webkit-filter',a),o.css('filter',a),t.filtersEnabled=!0})},removeFilter:function(t,r){return this.each(function(){'function'==typeof t&&(r=t,t=null);var o=this;if(t)e(this).YTPApplyFilter(t,0),'function'==typeof r&&r(t);else for(var a in o.filters)e(this).YTPApplyFilter(a,0),'function'==typeof r&&r(a)})},manageProgress:function(){var t=this.get(0),r=e('#controlBar_'+t.id),i=r.find('.mb_YTPProgress'),n=r.find('.mb_YTPLoaded'),s=r.find('.mb_YTPseekbar'),l=i.outerWidth(),a=Math.floor(t.player.getCurrentTime()),o=Math.floor(t.player.getDuration()),u=a*l/o,c=0,d=100*t.player.getVideoLoadedFraction();return n.css({left:c,width:d+'%'}),s.css({left:0,width:u}),{totalTime:o,currentTime:a}},buildControls:function(t){var r=t.opt;if(r.showYTLogo=r.showYTLogo||r.printUrl,!e('#controlBar_'+t.id).length){t.controlBar=e('').attr('id','controlBar_'+t.id).addClass('mb_YTPBar').css({whiteSpace:'noWrap',position:t.isBackground?'fixed':'absolute',zIndex:t.isBackground?1e4:1e3}).hide();var o=e('').addClass('buttonBar'),p=e(''+e.mbYTPlayer.controls.play+'').addClass('mb_YTPPlaypause ytpicon').click(function(){1==t.player.getPlayerState()?e(t).YTPPause():e(t).YTPPlay()}),f=e(''+e.mbYTPlayer.controls.mute+'').addClass('mb_YTPMuteUnmute ytpicon').click(function(){0==t.player.getVolume()?e(t).YTPUnmute():e(t).YTPMute()}),s=e('').addClass('mb_YTPVolumeBar').css({display:'inline-block'});t.volumeBar=s;var d=e('').addClass('mb_YTPTime'),n=r.videoURL?r.videoURL:'';n.indexOf('http')<0&&(n=e.mbYTPlayer.locationProtocol+'//www.youtube.com/watch?v='+r.videoURL);var l=e('').html(e.mbYTPlayer.controls.ytLogo).addClass('mb_YTPUrl ytpicon').attr('title','view on YouTube').on('click',function(){window.open(n,'viewOnYT')}),u=e('').html(e.mbYTPlayer.controls.onlyYT).addClass('mb_OnlyYT ytpicon').on('click',function(){e(t).YTPFullscreen(r.realfullscreen)}),i=e('').addClass('mb_YTPProgress').css('position','absolute').click(function(e){a.css({width:e.clientX-a.offset().left}),t.timeW=e.clientX-a.offset().left,t.controlBar.find('.mb_YTPLoaded').css({width:0});var r=Math.floor(t.player.getDuration());t['goto']=a.outerWidth()*r/i.outerWidth(),t.player.seekTo(parseFloat(t['goto']),!0),t.controlBar.find('.mb_YTPLoaded').css({width:0})}),c=e('').addClass('mb_YTPLoaded').css('position','absolute'),a=e('').addClass('mb_YTPseekbar').css('position','absolute');i.append(c).append(a),o.append(p).append(f).append(s).append(d),r.showYTLogo&&o.append(l),(t.isBackground||eval(t.opt.realfullscreen)&&!t.isBackground)&&o.append(u),t.controlBar.append(o).append(i),t.isBackground?e('body').after(t.controlBar):(t.controlBar.addClass('inlinePlayer'),t.wrapper.before(t.controlBar)),s.simpleSlider({initialval:t.opt.vol,scale:100,orientation:'h',callback:function(r){0==r.value?e(t).YTPMute():e(t).YTPUnmute(),t.player.setVolume(r.value),t.isMute||(t.opt.vol=r.value)}})}},checkForState:function(t){var r=t.opt.showControls?100:700;return clearInterval(t.getState),e.contains(document,t)?(e.mbYTPlayer.checkForStart(t),void(t.getState=setInterval(function(){var r=e(t).YTPManageProgress(),a=e(t),l=t.opt,i=t.opt.startAt?t.opt.startAt:0,o=t.opt.stopAt>t.opt.startAt?t.opt.stopAt:0;if(o=o400&&t.isCompact&&(t.controlBar.removeClass('compact'),t.isCompact=!1,!t.isMute&&t.volumeBar&&t.volumeBar.updateSliderVal(t.opt.vol)),1==t.player.getPlayerState()&&(parseFloat(t.player.getDuration()-1.5)0&&parseFloat(t.player.getCurrentTime())>o)){if(t.isEnded)return;if(t.isEnded=!0,setTimeout(function(){t.isEnded=!1},1e3),t.isPlayList){clearInterval(t.getState);var n=e.Event('YTPEnd');return n.time=t.player.time,void e(t).trigger(n)};l.loop?(i=i||1,t.player.pauseVideo(),t.player.seekTo(i,!0),a.YTPPlay()):(t.player.pauseVideo(),t.wrapper.CSSAnimate({opacity:0},1e3,function(){var r=e.Event('YTPEnd');r.time=t.player.time,e(t).trigger(r),t.player.seekTo(i,!0),t.isBackground||t.opt.containment.css({background:'rgba(0,0,0,0.5) url('+t.opt.backgroundUrl+') center center',backgroundSize:'cover'})}))}},r))):(e(t).YTPPlayerDestroy(),clearInterval(t.getState),void clearInterval(t.checkForStartAt))},checkForStart:function(t){var a=e(t);if(!e.contains(document,t))return void e(t).YTPPlayerDestroy();if(e.browser.chrome&&(t.opt.quality='default'),t.player.pauseVideo(),e(t).muteYTPVolume(),e('#controlBar_'+t.id).remove(),t.opt.showControls&&e.mbYTPlayer.buildControls(t),t.opt.addRaster){var r='dot'==t.opt.addRaster?'raster-dot':'raster';t.overlay.addClass(t.isRetina?r+' retina':r)}
else t.overlay.removeClass(function(t,r){var o=r.split(' '),a=[];return e.each(o,function(e,t){/raster.*/.test(t)&&a.push(t)}),a.push('retina'),a.join(' ')});t.checkForStartAt=setInterval(function(){e(t).YTPMute();var r=t.opt.startAt?t.opt.startAt:1,i=t.player.getVideoLoadedFraction()>r/t.player.getDuration();if(t.player.getDuration()>0&&t.player.getCurrentTime()>=r&&i){clearInterval(t.checkForStartAt),t.isReady=!0,'function'==typeof t.opt.onReady&&t.opt.onReady(t);var o=e.Event('YTPReady');e(t).trigger(o),t.player.pauseVideo(),t.opt.mute||e(t).YTPUnmute(),t.canTrigger=!0,t.opt.autoPlay?(a.YTPPlay(),a.css('background-image','none'),e(t.playerEl).CSSAnimate({opacity:1},1e3),t.wrapper.CSSAnimate({opacity:t.isAlone?1:t.opt.opacity},1e3)):(t.player.pauseVideo(),t.isPlayer||(e(t.playerEl).CSSAnimate({opacity:1},1e3),t.wrapper.CSSAnimate({opacity:t.isAlone?1:t.opt.opacity},1e3))),t.isPlayer&&!t.opt.autoPlay&&(t.loading.html('Ready'),setTimeout(function(){t.loading.fadeOut()},100)),t.controlBar&&t.controlBar.slideDown(1e3)}
else r>=0&&t.player.seekTo(r,!0)},1e3)},formatTime:function(e){var t=Math.floor(e/60),r=Math.floor(e-60*t);return(9>=t?'0'+t:t)+' : '+(9>=r?'0'+r:r)}},e.fn.toggleVolume=function(){var t=this.get(0);if(t)return t.player.isMuted()?(e(t).YTPUnmute(),!0):(e(t).YTPMute(),!1)},e.fn.optimizeDisplay=function(){var i=this.get(0),n=i.opt,l=e(i.playerEl),r={},s=i.wrapper;r.width=s.outerWidth(),r.height=s.outerHeight();var a=24,o=100,t={};n.optimizeDisplay?(t.width=r.width+r.width*a/100,t.height='16/9'==n.ratio?Math.ceil(9*r.width/16):Math.ceil(3*r.width/4),t.marginTop=-((t.height-r.height)/2),t.marginLeft=-(r.width*(a/2)/100),t.height765,jQuery.isAndroidDefault=jQuery.browser.android&&!/chrome/i.test(nAgt),!function(e){/iphone|ipod|ipad|android|ie|blackberry|fennec/.test(navigator.userAgent.toLowerCase());var t='ontouchstart'in window||window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture||window.DocumentTouch&&document instanceof DocumentTouch||!1;e.simpleSlider={defaults:{initialval:0,scale:100,orientation:'h',readonly:!1,callback:!1},events:{start:t?'touchstart':'mousedown',end:t?'touchend':'mouseup',move:t?'touchmove':'mousemove'},init:function(r){return this.each(function(){var a=this,o=e(a);o.addClass('simpleSlider'),a.opt={},e.extend(a.opt,e.simpleSlider.defaults,r),e.extend(a.opt,o.data());var n='h'==a.opt.orientation?'horizontal':'vertical',i=e('').addClass('level').addClass(n);o.prepend(i),a.level=i,o.css({cursor:'default'}),'auto'==a.opt.scale&&(a.opt.scale=e(a).outerWidth()),o.updateSliderVal(),a.opt.readonly||(o.on(e.simpleSlider.events.start,function(e){t&&(e=e.changedTouches[0]),a.canSlide=!0,o.updateSliderVal(e),o.css({cursor:'col-resize'}),e.preventDefault(),e.stopPropagation()}),e(document).on(e.simpleSlider.events.move,function(r){t&&(r=r.changedTouches[0]),a.canSlide&&(e(document).css({cursor:'default'}),o.updateSliderVal(r),r.preventDefault(),r.stopPropagation())}).on(e.simpleSlider.events.end,function(){e(document).css({cursor:'auto'}),a.canSlide=!1,o.css({cursor:'auto'})}))})},updateSliderVal:function(t){function n(e,t){return Math.floor(100*e/t)};var a=this,r=a.get(0);r.opt.initialval='number'==typeof r.opt.initialval?r.opt.initialval:r.opt.initialval(r);var o=e(r).outerWidth(),i=e(r).outerHeight();r.x='object'==typeof t?t.clientX+document.body.scrollLeft-a.offset().left:'number'==typeof t?t*o/r.opt.scale:r.opt.initialval*o/r.opt.scale,r.y='object'==typeof t?t.clientY+document.body.scrollTop-a.offset().top:'number'==typeof t?(r.opt.scale-r.opt.initialval-t)*i/r.opt.scale:r.opt.initialval*i/r.opt.scale,r.y=a.outerHeight()-r.y,r.scaleX=r.x*r.opt.scale/o,r.scaleY=r.y*r.opt.scale/i,r.outOfRangeX=r.scaleX>r.opt.scale?r.scaleX-r.opt.scale:r.scaleX<0?r.scaleX:0,r.outOfRangeY=r.scaleY>r.opt.scale?r.scaleY-r.opt.scale:r.scaleY<0?r.scaleY:0,r.outOfRange='h'==r.opt.orientation?r.outOfRangeX:r.outOfRangeY,r.value='undefined'!=typeof t?'h'==r.opt.orientation?r.x>=a.outerWidth()?r.opt.scale:r.x<=0?0:r.scaleX:r.y>=a.outerHeight()?r.opt.scale:r.y<=0?0:r.scaleY:'h'==r.opt.orientation?r.scaleX:r.scaleY,'h'==r.opt.orientation?r.level.width(n(r.x,o)+'%'):r.level.height(n(r.y,i)),'function'==typeof r.opt.callback&&r.opt.callback(r)}},e.fn.simpleSlider=e.simpleSlider.init,e.fn.updateSliderVal=e.simpleSlider.updateSliderVal}(jQuery),!function(e){e.mbCookie={set:function(e,t,r,a){t=JSON.stringify(t),r||(r=7),a=a?'; domain='+a:'';var i,o=new Date;o.setTime(o.getTime()+864e5*r),i='; expires='+o.toGMTString(),document.cookie=e+'='+t+i+'; path=/'+a},get:function(e){for(var a=e+'=',o=document.cookie.split(';'),r=0;r