/*!
 * MediaElementPlayer
 * http://mediaelementjs.com/
 *
 * Creates a controller bar for HTML5 <video> add <audio> tags
 * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
 *
 * Copyright 2010-2011, John Dyer (http://j.hn/)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 */
if(typeof jQuery!="undefined"){mejs.$=jQuery}else{if(typeof ender!="undefined"){mejs.$=ender}}(function(a){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,audioWidth:400,audioHeight:30,startVolume:0.8,loop:false,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true};mejs.mepIndex=0;mejs.MediaElementPlayer=function(c,d){if(!(this instanceof mejs.MediaElementPlayer)){return new mejs.MediaElementPlayer(c,d)}var b=this;b.$media=b.$node=a(c);b.node=b.media=b.$media[0];if(typeof b.node.player!="undefined"){return b.node.player}else{b.node.player=b}b.options=a.extend({},mejs.MepDefaults,d);b.init();return b};mejs.MediaElementPlayer.prototype={init:function(){var c=this,d=mejs.MediaFeatures,f=a.extend(true,{},c.options,{success:function(h,g){c.meReady(h,g)},error:function(g){c.handleError(g)}}),b=c.media.tagName.toLowerCase();c.isDynamic=(b!=="audio"&&b!=="video");if(c.isDynamic){c.isVideo=c.options.isVideo}else{c.isVideo=(b!=="audio"&&c.options.isVideo)}if((d.isiPad&&c.options.iPadUseNativeControls)||(d.isiPhone&&c.options.iPhoneUseNativeControls)){c.$media.attr("controls","controls");c.$media.removeAttr("poster");if(d.isiPad&&c.media.getAttribute("autoplay")!==null){c.media.load();c.media.play()}}else{if(d.isAndroid&&c.AndroidUseNativeControls){}else{c.$media.removeAttr("controls");c.id="mep_"+mejs.mepIndex++;c.container=a('<div id="'+c.id+'" class="mejs-container"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(c.$media[0].className).insertBefore(c.$media);c.container.addClass((d.isAndroid?"mejs-android ":"")+(d.isiOS?"mejs-ios ":"")+(d.isiPad?"mejs-ipad ":"")+(d.isiPhone?"mejs-iphone ":"")+(c.isVideo?"mejs-video ":"mejs-audio "));if(d.isiOS){var e=c.$media.clone();c.container.find(".mejs-mediaelement").append(e);c.$media.remove();c.$node=c.$media=e;c.node=c.media=e[0]}else{c.container.find(".mejs-mediaelement").append(c.$media)}c.controls=c.container.find(".mejs-controls");c.layers=c.container.find(".mejs-layers");if(c.isVideo){if(c.options.videoWidth>0||c.options.videoWidth.toString().indexOf("%")>-1){c.width=c.options.videoWidth}else{if(c.media.style.width!==""&&c.media.style.width!==null){c.width=c.media.style.width}else{if(c.media.getAttribute("width")!==null){c.width=c.$media.attr("width")}else{c.width=c.options.defaultVideoWidth}}}if(c.options.videoHeight>0||c.options.videoHeight.toString().indexOf("%")>-1){c.height=c.options.videoHeight}else{if(c.media.style.height!==""&&c.media.style.height!==null){c.height=c.media.style.height}else{if(c.$media[0].getAttribute("height")!==null){c.height=c.$media.attr("height")}else{c.height=c.options.defaultVideoHeight}}}}else{c.width=c.options.audioWidth;c.height=c.options.audioHeight}c.setPlayerSize(c.width,c.height);f.pluginWidth=c.height;f.pluginHeight=c.width}}mejs.MediaElement(c.$media[0],f)},controlsAreVisible:true,showControls:function(b){var c=this;b=typeof b=="undefined"||b;if(c.controlsAreVisible){return}if(b){c.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){c.controlsAreVisible=true});c.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){c.controlsAreVisible=true})}else{c.controls.css("visibility","visible").css("display","block");c.container.find(".mejs-control").css("visibility","visible").css("display","block");c.controlsAreVisible=true}c.setControlsSize()},hideControls:function(b){var c=this,b=typeof b=="undefined"||b;if(!c.controlsAreVisible){return}if(b){c.controls.stop(true,true).fadeOut(200,function(){a(this).css("visibility","hidden").css("display","block");c.controlsAreVisible=false});c.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){a(this).css("visibility","hidden").css("display","block")})}else{c.controls.css("visibility","hidden").css("display","block");c.container.find(".mejs-control").css("visibility","hidden").css("display","block");c.controlsAreVisible=false}},controlsTimer:null,startControlsTimer:function(c){var b=this,c=typeof c!="undefined"?c:500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();b.killControlsTimer("hide")},c)},killControlsTimer:function(c){var b=this;if(b.controlsTimer!==null){clearTimeout(b.controlsTimer);delete b.controlsTimer;b.controlsTimer=null}},controlsEnabled:true,disableControls:function(){var b=this;b.killControlsTimer();b.hideControls(false);this.controlsEnabled=false},enableControls:function(){var b=this;b.showControls(false);b.controlsEnabled=true},meReady:function(c,f){var j=this,i=mejs.MediaFeatures,g=f.getAttribute("autoplay"),d=!(typeof g=="undefined"||g===null||g==="false"),b,k;if(j.created){return}else{j.created=true}j.media=c;j.domNode=f;if(!(i.isAndroid&&j.options.AndroidUseNativeControls)&&!(i.isiPad&&j.options.iPadUseNativeControls)&&!(i.isiPhone&&j.options.iPhoneUseNativeControls)){j.buildposter(j,j.controls,j.layers,j.media);j.buildoverlays(j,j.controls,j.layers,j.media);j.findTracks();for(b in j.options.features){k=j.options.features[b];if(j["build"+k]){try{j["build"+k](j,j.controls,j.layers,j.media)}catch(h){}}}j.container.trigger("controlsready");j.setPlayerSize(j.width,j.height);j.setControlsSize();if(j.isVideo){if(mejs.MediaFeatures.hasTouch){console.log("enabling touch control style");j.$media.bind("touchstart",function(){console.log("touch click. visible: "+j.controlsAreVisible+", enabled: "+j.controlsEnabled);if(j.controlsAreVisible){j.hideControls(false)}else{if(j.controlsEnabled){j.showControls(false)}}})}else{if(j.media.pluginType=="native"){j.$media.click(function(){if(c.paused){c.play()}else{c.pause()}})}else{a(j.media.pluginElement).click(function(){if(c.paused){c.play()}else{c.pause()}})}j.container.bind("mouseenter mouseover",function(){if(j.controlsEnabled){if(!j.options.alwaysShowControls){j.killControlsTimer("enter");j.showControls();j.startControlsTimer(2500)}}}).bind("mousemove",function(){if(j.controlsEnabled){if(!j.controlsAreVisible){j.showControls()}j.startControlsTimer(2500)}}).bind("mouseleave",function(){if(j.controlsEnabled){if(!j.media.paused&&!j.options.alwaysShowControls){j.startControlsTimer(1000)}}})}if(d&&!j.options.alwaysShowControls){j.hideControls()}if(j.options.enableAutosize){j.media.addEventListener("loadedmetadata",function(l){if(j.options.videoHeight<=0&&j.domNode.getAttribute("height")===null&&!isNaN(l.target.videoHeight)){j.setPlayerSize(l.target.videoWidth,l.target.videoHeight);j.setControlsSize();j.media.setVideoSize(l.target.videoWidth,l.target.videoHeight)}},false)}}j.media.addEventListener("ended",function(l){j.media.setCurrentTime(0);j.media.pause();if(j.setProgressRail){j.setProgressRail()}if(j.setCurrentRail){j.setCurrentRail()}if(j.options.loop){j.media.play()}else{if(!j.options.alwaysShowControls&&j.controlsEnabled){j.showControls()}}},false);j.media.addEventListener("loadedmetadata",function(l){if(j.updateDuration){j.updateDuration()}if(j.updateCurrent){j.updateCurrent()}if(!j.isFullScreen){j.setPlayerSize(j.width,j.height);j.setControlsSize()}},false);setTimeout(function(){j.setPlayerSize(j.width,j.height);j.setControlsSize()},50);a(window).resize(function(){if(!(j.isFullScreen||(mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen))){j.setPlayerSize(j.width,j.height)}j.setControlsSize()})}if(d&&c.pluginType=="native"){c.load();c.play()}if(j.options.success){j.options.success(j.media,j.domNode,j)}},handleError:function(c){var b=this;b.controls.hide();if(b.options.error){b.options.error(c)}},setPlayerSize:function(g,b){var e=this;if(e.height.toString().indexOf("%")>0){var h=(e.media.videoWidth&&e.media.videoWidth>0)?e.media.videoWidth:e.options.defaultVideoWidth,d=(e.media.videoHeight&&e.media.videoHeight>0)?e.media.videoHeight:e.options.defaultVideoHeight,f=e.container.parent().width(),c=parseInt(f*d/h,10);if(e.container.parent()[0].tagName.toLowerCase()==="body"){f=a(window).width();c=a(window).height()}e.container.width(f).height(c);e.$media.width("100%").height("100%");e.container.find("object embed").width("100%").height("100%");if(e.media.setVideoSize){e.media.setVideoSize(f,c)}e.layers.children(".mejs-layer").width("100%").height("100%")}else{e.container.width(e.width).height(e.height);e.layers.children(".mejs-layer").width(e.width).height(e.height)}},setControlsSize:function(){var c=this,f=0,h=0,g=c.controls.find(".mejs-time-rail"),d=c.controls.find(".mejs-time-total"),e=c.controls.find(".mejs-time-current"),b=c.controls.find(".mejs-time-loaded");others=g.siblings();if(c.options&&!c.options.autosizeProgress){h=parseInt(g.css("width"))}if(h===0||!h){others.each(function(){if(a(this).css("position")!="absolute"){f+=a(this).outerWidth(true)}});h=c.controls.width()-f-(g.outerWidth(true)-g.outerWidth(false))}g.width(h);d.width(h-(d.outerWidth(true)-d.width()));if(c.setProgressRail){c.setProgressRail()}if(c.setCurrentRail){c.setCurrentRail()}},buildposter:function(e,b,g,f){var d=this,h=a('<div class="mejs-poster mejs-layer"></div>').appendTo(g),c=e.$media.attr("poster");if(e.options.poster!==""){c=e.options.poster}if(c!==""&&c!=null){d.setPoster(c)}else{h.hide()}f.addEventListener("play",function(){h.hide()},false)},setPoster:function(c){var d=this,e=d.container.find(".mejs-poster"),b=e.find("img");if(b.length==0){b=a('<img width="100%" height="100%" />').appendTo(e)}b.attr("src",c)},buildoverlays:function(e,b,g,f){if(!e.isVideo){return}var h=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(g),c=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(g),d=a('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(g).click(function(){if(f.paused){f.play()}else{f.pause()}});f.addEventListener("play",function(){d.hide();h.hide();c.hide()},false);f.addEventListener("playing",function(){d.hide();h.hide();c.hide()},false);f.addEventListener("pause",function(){if(!mejs.MediaFeatures.isiPhone){d.show()}},false);f.addEventListener("waiting",function(){h.show()},false);f.addEventListener("loadeddata",function(){h.show()},false);f.addEventListener("canplay",function(){h.hide()},false);f.addEventListener("error",function(){h.hide();c.show();c.find("mejs-overlay-error").html("Error loading this resource")},false)},findTracks:function(){var b=this,c=b.$media.find("track");b.tracks=[];c.each(function(){b.tracks.push({srclang:a(this).attr("srclang").toLowerCase(),src:a(this).attr("src"),kind:a(this).attr("kind"),entries:[],isLoaded:false})})},changeSkin:function(b){this.container[0].className="mejs-container "+b;this.setPlayerSize();this.setControlsSize()},play:function(){this.media.play()},pause:function(){this.media.pause()},load:function(){this.media.load()},setMuted:function(b){this.media.setMuted(b)},setCurrentTime:function(b){this.media.setCurrentTime(b)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(b){this.media.setVolume(b)},getVolume:function(){return this.media.volume},setSrc:function(b){this.media.setSrc(b)}};if(typeof jQuery!="undefined"){jQuery.fn.mediaelementplayer=function(b){return this.each(function(){new mejs.MediaElementPlayer(this,b)})}}window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);(function(a){a.extend(mejs.MepDefaults,{playpauseText:"Play/Pause"});a.extend(MediaElementPlayer.prototype,{buildplaypause:function(d,b,g,f){var c=this,e=a('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+c.id+'" title="'+c.options.playpauseText+'"></button></div>').appendTo(b).click(function(h){h.preventDefault();if(f.paused){f.play()}else{f.pause()}return false});f.addEventListener("play",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);f.addEventListener("playing",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);f.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);f.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);(function(a){a.extend(mejs.MepDefaults,{stopText:"Stop"});a.extend(MediaElementPlayer.prototype,{buildstop:function(e,b,g,f){var d=this,c=a('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+d.id+'" title="'+d.options.stopText+"></button></div>").appendTo(b).click(function(){if(!f.paused){f.pause()}if(f.currentTime>0){f.setCurrentTime(0);b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left","0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));g.find(".mejs-poster").show()}})}})})(mejs.$);(function(a){a.extend(MediaElementPlayer.prototype,{buildprogress:function(m,n,f,c){a('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(n);var o=this,k=n.find(".mejs-time-total"),g=n.find(".mejs-time-loaded"),j=n.find(".mejs-time-current"),i=n.find(".mejs-time-handle"),l=n.find(".mejs-time-float"),b=n.find(".mejs-time-float-current"),e=function(t){var p=t.pageX,u=k.offset(),r=k.outerWidth(),q=0,s=0;if(p>u.left&&p<=r+u.left&&c.duration){q=((p-u.left)/r);s=(q<=0.02)?0:q*c.duration;if(h){c.setCurrentTime(s)}var v=p-u.left;l.css("left",v);b.html(mejs.Utility.secondsToTimeCode(s))}},h=false,d=false;k.bind("mousedown",function(p){if(p.which===1){h=true;e(p);return false}});n.find(".mejs-time-total").bind("mouseenter",function(p){d=true}).bind("mouseleave",function(p){d=false});a(document).bind("mouseup",function(p){h=false}).bind("mousemove",function(p){if(h||d){e(p)}});c.addEventListener("progress",function(p){m.setProgressRail(p);m.setCurrentRail(p)},false);c.addEventListener("timeupdate",function(p){m.setProgressRail(p);m.setCurrentRail(p)},false);o.loaded=g;o.total=k;o.current=j;o.handle=i},setProgressRail:function(f){var b=this,d=(f!=undefined)?f.target:b.media,c=null;if(d&&d.buffered&&d.buffered.length>0&&d.buffered.end&&d.duration){c=d.buffered.end(0)/d.duration}else{if(d&&d.bytesTotal!=undefined&&d.bytesTotal>0&&d.bufferedBytes!=undefined){c=d.bufferedBytes/d.bytesTotal}else{if(f&&f.lengthComputable&&f.total!=0){c=f.loaded/f.total}}}if(c!==null){c=Math.min(1,Math.max(0,c));if(b.loaded&&b.total){b.loaded.width(b.total.width()*c)}}},setCurrentRail:function(){var b=this;if(b.media.currentTime!=undefined&&b.media.duration){if(b.total&&b.handle){var d=b.total.width()*b.media.currentTime/b.media.duration,c=d-(b.handle.outerWidth(true)/2);b.current.width(d);b.handle.css("left",c)}}}})})(mejs.$);(function(a){a.extend(mejs.MepDefaults,{duration:-1});a.extend(MediaElementPlayer.prototype,{buildcurrent:function(d,b,f,e){var c=this;a('<div class="mejs-time"><span class="mejs-currenttime">'+(d.options.alwaysShowHours?"00:":"")+(d.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);c.currenttime=c.controls.find(".mejs-currenttime");e.addEventListener("timeupdate",function(){d.updateCurrent()},false)},buildduration:function(d,b,f,e){var c=this;if(b.children().last().find(".mejs-currenttime").length>0){a(' <span> | </span> <span class="mejs-duration">'+(c.options.duration>0?mejs.Utility.secondsToTimeCode(c.options.duration,c.options.alwaysShowHours||c.media.duration>3600,c.options.showTimecodeFrameCount,c.options.framesPerSecond||25):((d.options.alwaysShowHours?"00:":"")+(d.options.showTimecodeFrameCount?"00:00:00":"00:00")))+"</span>").appendTo(b.find(".mejs-time"))}else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");a('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(c.options.duration>0?mejs.Utility.secondsToTimeCode(c.options.duration,c.options.alwaysShowHours||c.media.duration>3600,c.options.showTimecodeFrameCount,c.options.framesPerSecond||25):((d.options.alwaysShowHours?"00:":"")+(d.options.showTimecodeFrameCount?"00:00:00":"00:00")))+"</span></div>").appendTo(b)}c.durationD=c.controls.find(".mejs-duration");e.addEventListener("timeupdate",function(){d.updateDuration()},false)},updateCurrent:function(){var b=this;if(b.currenttime){b.currenttime.html(mejs.Utility.secondsToTimeCode(b.media.currentTime,b.options.alwaysShowHours||b.media.duration>3600,b.options.showTimecodeFrameCount,b.options.framesPerSecond||25))}},updateDuration:function(){var b=this;if(b.media.duration&&b.durationD){b.durationD.html(mejs.Utility.secondsToTimeCode(b.media.duration,b.options.alwaysShowHours,b.options.showTimecodeFrameCount,b.options.framesPerSecond||25))}}})})(mejs.$);(function(a){a.extend(mejs.MepDefaults,{muteText:"Mute Toggle"});a.extend(MediaElementPlayer.prototype,{buildvolume:function(k,l,h,d){var m=this,e=a('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+m.id+'" title="'+m.options.muteText+'"></button><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(l),n=e.find(".mejs-volume-slider"),b=e.find(".mejs-volume-total"),g=e.find(".mejs-volume-current"),f=e.find(".mejs-volume-handle"),j=function(r){if(!n.is(":visible")){n.show();j(r);n.hide();return}var q=b.height(),p=b.position(),o=q-(q*r);f.css("top",p.top+o-(f.height()/2));g.height(q-o);g.css("top",p.top+o)},c=function(t){var q=b.height(),p=b.offset(),o=parseInt(b.css("top").replace(/px/,""),10),s=t.pageY-p.top,r=(q-s)/q;if(p.top==0){return}r=Math.max(0,r);r=Math.min(r,1);if(s<0){s=0}else{if(s>q){s=q}}f.css("top",s-(f.height()/2)+o);g.height(q-s);g.css("top",s+o);if(r==0){d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute")}r=Math.max(0,r);r=Math.min(r,1);d.setVolume(r)},i=false;e.hover(function(){n.show()},function(){n.hide()});n.bind("mousedown",function(o){c(o);i=true;return false});a(document).bind("mouseup",function(o){i=false}).bind("mousemove",function(o){if(i){c(o)}});e.find("button").click(function(){d.setMuted(!d.muted)});d.addEventListener("volumechange",function(o){if(!i){if(d.muted){j(0);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{j(o.target.volume);e.removeClass("mejs-unmute").addClass("mejs-mute")}}},false);j(k.options.startVolume);if(d.pluginType==="native"){d.setVolume(k.options.startVolume)}}})})(mejs.$);(function(a){a.extend(mejs.MepDefaults,{forcePluginFullScreen:false,newWindowCallback:function(){return""},fullscreenText:"Fullscreen"});a.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,docStyleOverflow:null,isInIframe:false,buildfullscreen:function(h,i,f,d){if(!h.isVideo){return}h.isInIframe=(window.location!=window.parent.location);if(mejs.MediaFeatures.hasTrueNativeFullScreen){console.log("added change event: "+mejs.MediaFeatures.fullScreenEventName);h.container.bind(mejs.MediaFeatures.fullScreenEventName,function(k){console.log("fullscreenchange event: "+mejs.MediaFeatures.isFullScreen());if(mejs.MediaFeatures.isFullScreen()){h.isNativeFullScreen=true;h.setControlsSize()}else{h.isNativeFullScreen=false;h.exitFullScreen()}})}var j=this,g=0,c=0,b=h.container,e=a('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+j.id+'" title="'+j.options.fullscreenText+'"></button></div>').appendTo(i).click(function(){var k=(mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen())||h.isFullScreen;if(k){h.exitFullScreen()}else{h.enterFullScreen()}});h.fullscreenBtn=e;a(document).bind("keydown",function(k){if(((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen())||j.isFullScreen)&&k.keyCode==27){h.exitFullScreen()}})},enterFullScreen:function(){var c=this;if(c.media.pluginType!=="native"&&(mejs.MediaFeatures.isGecko||c.options.forcePluginFullScreen)){c.media.setFullscreen(true);return}docStyleOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden";normalHeight=c.container.height();normalWidth=c.container.width();console.log("true: "+mejs.MediaFeatures.hasTrueNativeFullScreen+", semi: "+mejs.MediaFeatures.hasSemiNativeFullScreen);if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(c.container[0])}else{if(mejs.MediaFeatures.hasSemiNativeFullScreen){c.media.webkitEnterFullscreen();return}}if(c.isInIframe){var b=c.options.newWindowCallback(this);if(b!==""){if(!mejs.MediaFeatures.hasTrueNativeFullScreen){c.pause();window.open(b,c.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}else{setTimeout(function(){if(!c.isNativeFullScreen){c.pause();window.open(b,c.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250)}}}c.container.addClass("mejs-container-fullscreen").width("100%").height("100%");if(mejs.MediaFeatures.hasTrueNativeFullScreen){setTimeout(function(){c.container.css({width:"100%",height:"100%"})},500)}if(c.pluginType==="native"){c.$media.width("100%").height("100%")}else{c.container.find("object embed").width("100%").height("100%");c.media.setVideoSize(a(window).width(),a(window).height())}c.layers.children("div").width("100%").height("100%");if(c.fullscreenBtn){c.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen")}c.setControlsSize();c.isFullScreen=true},exitFullScreen:function(){var b=this;if(b.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox){b.media.setFullscreen(false);return}if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||b.isFullScreen)){mejs.MediaFeatures.cancelFullScreen()}document.documentElement.style.overflow=docStyleOverflow;b.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);if(b.pluginType==="native"){b.$media.width(normalWidth).height(normalHeight)}else{b.container.find("object embed").width(normalWidth).height(normalHeight);b.media.setVideoSize(normalWidth,normalHeight)}b.layers.children("div").width(normalWidth).height(normalHeight);b.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");b.setControlsSize();b.isFullScreen=false}})})(mejs.$);(function(a){a.extend(mejs.MepDefaults,{startLanguage:"",translations:[],translationSelector:false,googleApiKey:"",tracksText:"Captions/Subtitles"});a.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(f,b,h,g){if(!f.isVideo){return}if(f.tracks.length==0){return}var e=this,d,c="";f.chapters=a('<div class="mejs-chapters mejs-layer"></div>').prependTo(h).hide();f.captions=a('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>').prependTo(h).hide();f.captionsText=f.captions.find(".mejs-captions-text");f.captionsButton=a('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+e.id+'" title="'+e.options.tracksText+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+f.id+'_captions" id="'+f.id+'_captions_none" value="none" checked="checked" /><label for="'+f.id+'_captions_none">None</label></li></ul></div></div>').appendTo(b).hover(function(){a(this).find(".mejs-captions-selector").css("visibility","visible")},function(){a(this).find(".mejs-captions-selector").css("visibility","hidden")}).delegate("input[type=radio]","click",function(){lang=this.value;if(lang=="none"){f.selectedTrack=null}else{for(d=0;d<f.tracks.length;d++){if(f.tracks[d].srclang==lang){f.selectedTrack=f.tracks[d];f.captions.attr("lang",f.selectedTrack.srclang);f.displayCaptions();break}}}});if(!f.options.alwaysShowControls){f.container.bind("mouseenter",function(){f.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("mouseleave",function(){if(!g.paused){f.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")}})}else{f.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}f.trackToLoad=-1;f.selectedTrack=null;f.isLoadingTrack=false;if(f.tracks.length>0&&f.options.translations.length>0){for(d=0;d<f.options.translations.length;d++){f.tracks.push({srclang:f.options.translations[d].toLowerCase(),src:null,kind:"subtitles",entries:[],isLoaded:false,isTranslation:true})}}for(d=0;d<f.tracks.length;d++){if(f.tracks[d].kind=="subtitles"){f.addTrackButton(f.tracks[d].srclang,f.tracks[d].isTranslation)}}f.loadNextTrack();g.addEventListener("timeupdate",function(i){f.displayCaptions()},false);g.addEventListener("loadedmetadata",function(i){f.displayChapters()},false);f.container.hover(function(){if(f.hasChapters){f.chapters.css("visibility","visible");f.chapters.fadeIn(200)}},function(){if(f.hasChapters&&!g.paused){f.chapters.fadeOut(200,function(){a(this).css("visibility","hidden");a(this).css("display","block")})}});if(f.node.getAttribute("autoplay")!==null){f.chapters.css("visibility","hidden")}if(f.options.translationSelector){for(d in mejs.language.codes){c+='<option value="'+d+'">'+mejs.language.codes[d]+"</option>"}f.container.find(".mejs-captions-selector ul").before(a('<select class="mejs-captions-translations"><option value="">--Add Translation--</option>'+c+"</select>"));f.container.find(".mejs-captions-translations").change(function(){var i=a(this);lang=i.val();if(lang!=""){f.tracks.push({srclang:lang,src:null,entries:[],isLoaded:false,isTranslation:true});if(!f.isLoadingTrack){f.trackToLoad--;f.addTrackButton(lang,true);f.options.startLanguage=lang;f.loadNextTrack()}}})}},loadNextTrack:function(){var b=this;b.trackToLoad++;if(b.trackToLoad<b.tracks.length){b.isLoadingTrack=true;b.loadTrack(b.trackToLoad)}else{b.isLoadingTrack=false}},loadTrack:function(c){var d=this,b=d.tracks[c],e=function(){b.isLoaded=true;d.enableTrackButton(b.srclang);d.loadNextTrack()};if(b.isTranslation){mejs.TrackFormatParser.translateTrackText(d.tracks[0].entries,d.tracks[0].srclang,b.srclang,d.options.googleApiKey,function(f){b.entries=f;e()})}else{a.ajax({url:b.src,success:function(f){b.entries=mejs.TrackFormatParser.parse(f);e();if(b.kind=="chapters"&&d.media.duration>0){d.drawChapters(b)}},error:function(){d.loadNextTrack()}})}},enableTrackButton:function(c){var b=this;b.captionsButton.find("input[value="+c+"]").prop("disabled",false).siblings("label").html(mejs.language.codes[c]||c);if(b.options.startLanguage==c){a("#"+b.id+"_captions_"+c).click()}b.adjustLanguageBox()},addTrackButton:function(e,d){var c=this,b=mejs.language.codes[e]||e;c.captionsButton.find("ul").append(a('<li><input type="radio" name="'+c.id+'_captions" id="'+c.id+"_captions_"+e+'" value="'+e+'" disabled="disabled" /><label for="'+c.id+"_captions_"+e+'">'+b+((d)?" (translating)":" (loading)")+"</label></li>"));c.adjustLanguageBox();c.container.find(".mejs-captions-translations option[value="+e+"]").remove()},adjustLanguageBox:function(){var b=this;b.captionsButton.find(".mejs-captions-selector").height(b.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+b.captionsButton.find(".mejs-captions-translations").outerHeight(true))},displayCaptions:function(){if(typeof this.tracks=="undefined"){return}var d=this,c,b=d.selectedTrack;if(b!=null&&b.isLoaded){for(c=0;c<b.entries.times.length;c++){if(d.media.currentTime>=b.entries.times[c].start&&d.media.currentTime<=b.entries.times[c].stop){d.captionsText.html(b.entries.text[c]);d.captions.show();return}}d.captions.hide()}else{d.captions.hide()}},displayChapters:function(){var c=this,b;for(b=0;b<c.tracks.length;b++){if(c.tracks[b].kind=="chapters"&&c.tracks[b].isLoaded){c.drawChapters(c.tracks[b]);c.hasChapters=true;break}}},drawChapters:function(f){var c=this,b,d,e=0,g=0;c.chapters.empty();for(b=0;b<f.entries.times.length;b++){d=f.entries.times[b].stop-f.entries.times[b].start;e=Math.floor(d/c.media.duration*100);if(e+g>100||b==f.entries.times.length-1&&e+g<100){e=100-g}c.chapters.append(a('<div class="mejs-chapter" rel="'+f.entries.times[b].start+'" style="left: '+g.toString()+"%;width: "+e.toString()+'%;"><div class="mejs-chapter-block'+((b==f.entries.times.length-1)?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+f.entries.text[b]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(f.entries.times[b].start)+"&ndash;"+mejs.Utility.secondsToTimeCode(f.entries.times[b].stop)+"</span></div></div>"));g+=e}c.chapters.find("div.mejs-chapter").click(function(){c.media.setCurrentTime(parseFloat(a(this).attr("rel")));if(c.media.paused){c.media.play()}});c.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={pattern_identifier:/^([a-zA-z]+-)?[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,split2:function(c,b){return c.split(b)},parse:function(g){var e=0,d=this.split2(g,/\r?\n/),c={text:[],times:[]},b,f;for(;e<d.length;e++){if(this.pattern_identifier.exec(d[e])){e++;b=this.pattern_timecode.exec(d[e]);if(b&&e<d.length){e++;f=d[e];e++;while(d[e]!==""&&e<d.length){f=f+"\n"+d[e];e++}c.text.push(f);c.times.push({start:mejs.Utility.timeCodeToSeconds(b[1]),stop:mejs.Utility.timeCodeToSeconds(b[3]),settings:b[5]})}}}return c},translateTrackText:function(f,j,e,g,h){var b={text:[],times:[]},c,d;this.translateText(f.text.join(" <a></a>"),j,e,g,function(i){c=i.split("<a></a>");for(d=0;d<f.text.length;d++){b.text[d]=c[d];b.times[d]={start:f.times[d].start,stop:f.times[d].stop,settings:f.times[d].settings}}h(b)})},translateText:function(j,f,d,c,i){var l,e=[],h,b=1000,k="",g=function(){if(e.length>0){h=e.shift();mejs.TrackFormatParser.translateChunk(h,f,d,c,function(m){if(m!="undefined"){k+=m}g()})}else{i(k)}};while(j.length>0){if(j.length>b){l=j.lastIndexOf(".",b);e.push(j.substring(0,l));j=j.substring(l+1)}else{e.push(j);j=""}}g()},translateChunk:function(e,g,c,d,f){var b={q:e,langpair:g+"|"+c,v:"1.0"};if(d!==""&&d!==null){b.key=d}a.ajax({url:"https://ajax.googleapis.com/ajax/services/language/translate",data:b,type:"GET",dataType:"jsonp",success:function(h){f(h.responseData.translatedText)},error:function(h){f(null)}})}};if("x\n\ny".split(/\n/gi).length!=3){mejs.TrackFormatParser.split2=function(f,d){var e=[],b="",c;for(c=0;c<f.length;c++){b+=f.substring(c,c+1);if(d.test(b)){e.push(b.replace(d,""));b=""}}e.push(b);return e}}})(mejs.$);(function(a){a.extend(mejs.MepDefaults,contextMenuItems=[{render:function(b){if(typeof b.enterFullScreen=="undefined"){return null}if(b.isFullScreen){return"Turn off Fullscreen"}else{return"Go Fullscreen"}},click:function(b){if(b.isFullScreen){b.exitFullScreen()}else{b.enterFullScreen()}}},{render:function(b){if(b.media.muted){return"Unmute"}else{return"Mute"}},click:function(b){if(b.media.muted){b.setMuted(false)}else{b.setMuted(true)}}},{isSeparator:true},{render:function(b){return"Download Video"},click:function(b){window.location.href=b.media.currentSrc}}]);a.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(c,b,e,d){c.contextMenu=a('<div class="mejs-contextmenu"></div>').appendTo(a("body")).hide();c.container.bind("contextmenu",function(f){if(c.isContextMenuEnabled){f.preventDefault();c.renderContextMenu(f.clientX-1,f.clientY-1);return false}});c.container.bind("click",function(){c.contextMenu.hide()});c.contextMenu.bind("mouseleave",function(){c.startContextMenuTimer()})},isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var b=this;b.killContextMenuTimer();b.contextMenuTimer=setTimeout(function(){b.hideContextMenu();b.killContextMenuTimer()},750)},killContextMenuTimer:function(){var b=this.contextMenuTimer;if(b!=null){clearTimeout(b);delete b;b=null}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(b,j){var g=this,f="",d=g.options.contextMenuItems;for(var e=0,c=d.length;e<c;e++){if(d[e].isSeparator){f+='<div class="mejs-contextmenu-separator"></div>'}else{var h=d[e].render(g);if(h!=null){f+='<div class="mejs-contextmenu-item" data-itemindex="'+e+'" id="element-'+(Math.random()*1000000)+'">'+h+"</div>"}}}g.contextMenu.empty().append(a(f)).css({top:j,left:b}).show();g.contextMenu.find(".mejs-contextmenu-item").each(function(){var i=a(this),k=parseInt(i.data("itemindex"),10),l=g.options.contextMenuItems[k];if(typeof l.show!="undefined"){l.show(i,g)}i.click(function(){if(typeof l.click!="undefined"){l.click(g)}g.contextMenu.hide()})});setTimeout(function(){g.killControlsTimer("rev3")},100)}})})(mejs.$);
