/*
VideoJS - HTML5 Video Player
v2.0.2

This file is part of VideoJS. Copyright 2010 Zencoder, Inc.

VideoJS is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

VideoJS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with VideoJS.  If not, see <http://www.gnu.org/licenses/>.
*/

(function(a,b){var c=a.document;(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.JRClass=function(){};JRClass.extend=function(c){function g(){if(!a&&this.init)this.init.apply(this,arguments)}var d=this.prototype;a=true;var e=new this;a=false;for(var f in c){e[f]=typeof c[f]=="function"&&typeof d[f]=="function"&&b.test(c[f])?function(a,b){return function(){var c=this._super;this._super=d[a];var e=b.apply(this,arguments);this._super=c;return e}}(f,c[f]):c[f]}g.prototype=e;g.constructor=g;g.extend=arguments.callee;return g}})();var d=JRClass.extend({init:function(a,e){if(typeof a=="string"){this.video=c.getElementById(a)}else{this.video=a}this.video.player=this;this.values={};this.elements={};this.options={autoplay:false,preload:true,useBuiltInControls:false,controlsBelow:false,controlsAtStart:false,controlsHiding:true,defaultVolume:.85,playerFallbackOrder:["html5","flash","links"],flashPlayer:"htmlObject",flashPlayerVersion:false};if(typeof d.options=="object"){_V_.merge(this.options,d.options)}if(typeof e=="object"){_V_.merge(this.options,e)}if(this.getPreloadAttribute()!==b){this.options.preload=this.getPreloadAttribute()}if(this.getAutoplayAttribute()!==b){this.options.autoplay=this.getAutoplayAttribute()}this.box=this.video.parentNode;this.linksFallback=this.getLinksFallback();this.hideLinksFallback();this.each(this.options.playerFallbackOrder,function(a){if(this[a+"Supported"]()){this[a+"Init"]();return true}});this.activateElement(this,"player");this.activateElement(this.box,"box")},behaviors:{},newBehavior:function(a,b,c){this.behaviors[a]=b;this.extend(c)},activateElement:function(a,b){if(typeof a=="string"){a=c.getElementById(a)}this.behaviors[b].call(this,a)},errors:[],warnings:[],warning:function(a){this.warnings.push(a);this.log(a)},history:[],log:function(a){if(!a){return}if(typeof a=="string"){a={type:a}}if(a.type){this.history.push(a.type)}if(this.history.length>=50){this.history.shift()}try{console.log(a.type)}catch(b){try{opera.postError(a.type)}catch(b){}}},setLocalStorage:function(a,b){if(!localStorage){return}try{localStorage[a]=b}catch(c){if(c.code==22||c.code==1014){this.warning(d.warnings.localStorageFull)}}},getPreloadAttribute:function(){if(typeof this.video.hasAttribute=="function"&&this.video.hasAttribute("preload")){var a=this.video.getAttribute("preload");if(a===""||a==="true"){return"auto"}if(a==="false"){return"none"}return a}},getAutoplayAttribute:function(){if(typeof this.video.hasAttribute=="function"&&this.video.hasAttribute("autoplay")){var a=this.video.getAttribute("autoplay");if(a==="false"){return false}return true}},bufferedPercent:function(){return this.duration()?this.buffered()[1]/this.duration():0},each:function(a,b){if(!a||a.length===0){return}for(var c=0,d=a.length;c<d;c++){if(b.call(this,a[c],c)){break}}},extend:function(a){for(var b in a){if(a.hasOwnProperty(b)){this[b]=a[b]}}}});d.player=d.prototype;d.player.extend({flashSupported:function(){if(!this.flashElement){this.flashElement=this.getFlashElement()}if(this.flashElement&&this.flashPlayerVersionSupported()){return true}else{return false}},flashInit:function(){this.replaceWithFlash();this.element=this.flashElement;this.video.src="";var a=d.flashPlayers[this.options.flashPlayer];this.extend(d.flashPlayers[this.options.flashPlayer].api);a.init.context(this)()},getFlashElement:function(){var a=this.video.children;for(var b=0,c=a.length;b<c;b++){if(a[b].className=="vjs-flash-fallback"){return a[b]}}},replaceWithFlash:function(){if(this.flashElement){this.box.insertBefore(this.flashElement,this.video);this.video.style.display="none"}},flashPlayerVersionSupported:function(){var a=this.options.flashPlayerVersion?this.options.flashPlayerVersion:d.flashPlayers[this.options.flashPlayer].flashPlayerVersion;return d.getFlashVersion()>=a}});d.flashPlayers={};d.flashPlayers.htmlObject={flashPlayerVersion:9,init:function(){return true},api:{width:function(a){if(a!==b){this.element.width=a;this.box.style.width=a+"px";this.triggerResizeListeners();return this}return this.element.width},height:function(a){if(a!==b){this.element.height=a;this.box.style.height=a+"px";this.triggerResizeListeners();return this}return this.element.height}}};d.player.extend({linksSupported:function(){return true},linksInit:function(){this.showLinksFallback();this.element=this.video},getLinksFallback:function(){return this.box.getElementsByTagName("P")[0]},hideLinksFallback:function(){if(this.linksFallback){this.linksFallback.style.display="none"}},showLinksFallback:function(){if(this.linksFallback){this.linksFallback.style.display="block"}}});d.merge=function(a,b,c){for(var d in b){if(b.hasOwnProperty(d)&&(!c||!a.hasOwnProperty(d))){a[d]=b[d]}}return a};d.extend=function(a){this.merge(this,a,true)};d.extend({setupAllWhenReady:function(a){d.options=a;d.DOMReady(d.setup)},DOMReady:function(a){d.addToDOMReady(a)},setup:function(a,b){var e=false,f=[],g;if(!a||a=="All"){a=d.getVideoJSTags()}else if(typeof a!="object"||a.nodeType==1){a=[a];e=true}for(var h=0;h<a.length;h++){if(typeof a[h]=="string"){g=c.getElementById(a[h])}else{g=a[h]}f.push(new d(g,b))}return e?f[0]:f},getVideoJSTags:function(){var a=c.getElementsByTagName("video"),b=[],d;for(var e=0,f=a.length;e<f;e++){d=a[e];if(d.className.indexOf("video-js")!=-1){b.push(d)}}return b},browserSupportsVideo:function(){if(typeof d.videoSupport!="undefined"){return d.videoSupport}d.videoSupport=!!c.createElement("video").canPlayType;return d.videoSupport},getFlashVersion:function(){if(typeof d.flashVersion!="undefined"){return d.flashVersion}var b=0,c;if(typeof navigator.plugins!="undefined"&&typeof navigator.plugins["Shockwave Flash"]=="object"){c=navigator.plugins["Shockwave Flash"].description;if(c&&!(typeof navigator.mimeTypes!="undefined"&&navigator.mimeTypes["application/x-shockwave-flash"]&&!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)){b=parseInt(c.match(/^.*\s+([^\s]+)\.[^\s]+\s+[^\s]+$/)[1],10)}}else if(typeof a.ActiveXObject!="undefined"){try{var e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(e){b=parseInt(e.GetVariable("$version").match(/^[^\s]+\s(\d+)/)[1],10)}}catch(f){}}d.flashVersion=b;return d.flashVersion},isIE:function(){return!+"1"},isIPad:function(){return navigator.userAgent.match(/iPad/i)!==null},isIPhone:function(){return navigator.userAgent.match(/iPhone/i)!==null},isIOS:function(){return d.isIPhone()||d.isIPad()},iOSVersion:function(){var a=navigator.userAgent.match(/OS (\d+)_/i);if(a&&a[1]){return a[1]}},isAndroid:function(){return navigator.userAgent.match(/Android/i)!==null},androidVersion:function(){var a=navigator.userAgent.match(/Android (\d+)\./i);if(a&&a[1]){return a[1]}},warnings:{videoNotReady:"Video is not ready yet (try playing the video first).",localStorageFull:"Local Storage is Full"}});if(d.isIE()){c.createElement("video")}a.VideoJS=a._V_=d;d.player.extend({html5Supported:function(){if(d.browserSupportsVideo()&&this.canPlaySource()){return true}else{return false}},html5Init:function(){this.element=this.video;this.fixPreloading();this.supportProgressEvents();this.volume(localStorage&&localStorage.volume||this.options.defaultVolume);if(d.isIOS()){this.options.useBuiltInControls=true;this.iOSInterface()}else if(d.isAndroid()){this.options.useBuiltInControls=true;this.androidInterface()}if(!this.options.useBuiltInControls){this.video.controls=false;if(this.options.controlsBelow){_V_.addClass(this.box,"vjs-controls-below")}this.activateElement(this.video,"playToggle");this.buildStylesCheckDiv();this.buildAndActivatePoster();this.buildBigPlayButton();this.buildAndActivateSpinner();this.buildAndActivateControlBar();this.loadInterface();this.getSubtitles()}},canPlaySource:function(){if(this.canPlaySourceResult){return this.canPlaySourceResult}var a=this.video.children;for(var b=0,c=a.length;b<c;b++){if(a[b].tagName.toUpperCase()=="SOURCE"){var d=this.video.canPlayType(a[b].type)||this.canPlayExt(a[b].src);if(d=="probably"||d=="maybe"){this.firstPlayableSource=a[b];this.canPlaySourceResult=true;return true}}}this.canPlaySourceResult=false;return false},canPlayExt:function(a){if(!a){return""}var b=a.match(/\.([^\.]+)$/);if(b&&b[1]){var c=b[1].toLowerCase();if(d.isAndroid()){if(c=="mp4"||c=="m4v"){return"maybe"}}else if(d.isIOS()){if(c=="m3u8"){return"maybe"}}}return""},forceTheSource:function(){this.video.src=this.firstPlayableSource.src;this.video.load()},fixPreloading:function(){if(typeof this.video.hasAttribute=="function"&&this.video.hasAttribute("preload")&&this.video.preload!="none"){this.video.autobuffer=true}else{this.video.autobuffer=false;this.video.preload="none"}},supportProgressEvents:function(a){_V_.addListener(this.video,"progress",this.playerOnVideoProgress.context(this))},playerOnVideoProgress:function(a){this.setBufferedFromProgress(a)},setBufferedFromProgress:function(a){if(a.total>0){var b=a.loaded/a.total*this.duration();if(b>this.values.bufferEnd){this.values.bufferEnd=b}}},iOSInterface:function(){if(d.iOSVersion()<4){this.forceTheSource()}if(d.isIPad()){this.buildAndActivateSpinner()}},androidInterface:function(){this.forceTheSource();_V_.addListener(this.video,"click",function(){this.play()});this.buildBigPlayButton();_V_.addListener(this.bigPlayButton,"click",function(){this.play()}.context(this));this.positionBox();this.showBigPlayButtons()},loadInterface:function(){if(!this.stylesHaveLoaded()){if(!this.positionRetries){this.positionRetries=1}if(this.positionRetries++<100){setTimeout(this.loadInterface.context(this),10);return}}this.hideStylesCheckDiv();this.showPoster();if(this.video.paused!==false){this.showBigPlayButtons()}if(this.options.controlsAtStart){this.showControlBars()}this.positionAll()},buildAndActivateControlBar:function(){this.controls=_V_.createElement("div",{className:"vjs-controls"});this.box.appendChild(this.controls);this.activateElement(this.controls,"controlBar");this.activateElement(this.controls,"mouseOverVideoReporter");this.playControl=_V_.createElement("div",{className:"vjs-play-control",innerHTML:"<span></span>"});this.controls.appendChild(this.playControl);this.activateElement(this.playControl,"playToggle");this.progressControl=_V_.createElement("div",{className:"vjs-progress-control"});this.controls.appendChild(this.progressControl);this.progressHolder=_V_.createElement("div",{className:"vjs-progress-holder"});this.progressControl.appendChild(this.progressHolder);this.activateElement(this.progressHolder,"currentTimeScrubber");this.loadProgressBar=_V_.createElement("div",{className:"vjs-load-progress"});this.progressHolder.appendChild(this.loadProgressBar);this.activateElement(this.loadProgressBar,"loadProgressBar");this.playProgressBar=_V_.createElement("div",{className:"vjs-play-progress"});this.progressHolder.appendChild(this.playProgressBar);this.activateElement(this.playProgressBar,"playProgressBar");this.timeControl=_V_.createElement("div",{className:"vjs-time-control"});this.controls.appendChild(this.timeControl);this.currentTimeDisplay=_V_.createElement("span",{className:"vjs-current-time-display",innerHTML:"00:00"});this.timeControl.appendChild(this.currentTimeDisplay);this.activateElement(this.currentTimeDisplay,"currentTimeDisplay");this.timeSeparator=_V_.createElement("span",{innerHTML:" / "});this.timeControl.appendChild(this.timeSeparator);this.durationDisplay=_V_.createElement("span",{className:"vjs-duration-display",innerHTML:"00:00"});this.timeControl.appendChild(this.durationDisplay);this.activateElement(this.durationDisplay,"durationDisplay");this.volumeControl=_V_.createElement("div",{className:"vjs-volume-control",innerHTML:"<div><span></span><span></span><span></span><span></span><span></span><span></span></div>"});this.controls.appendChild(this.volumeControl);this.activateElement(this.volumeControl,"volumeScrubber");this.volumeDisplay=this.volumeControl.children[0];this.activateElement(this.volumeDisplay,"volumeDisplay");this.fullscreenControl=_V_.createElement("div",{className:"vjs-fullscreen-control",innerHTML:"<div><span></span><span></span><span></span><span></span></div>"});this.controls.appendChild(this.fullscreenControl);this.activateElement(this.fullscreenControl,"fullscreenToggle")},buildAndActivatePoster:function(){this.updatePosterSource();if(this.video.poster){this.poster=c.createElement("img");this.box.appendChild(this.poster);this.poster.src=this.video.poster;this.poster.className="vjs-poster";this.activateElement(this.poster,"poster")}else{this.poster=false}},buildBigPlayButton:function(){this.bigPlayButton=_V_.createElement("div",{className:"vjs-big-play-button",innerHTML:"<span></span>"});this.box.appendChild(this.bigPlayButton);this.activateElement(this.bigPlayButton,"bigPlayButton")},buildAndActivateSpinner:function(){this.spinner=_V_.createElement("div",{className:"vjs-spinner",innerHTML:"<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>"});this.box.appendChild(this.spinner);this.activateElement(this.spinner,"spinner")},buildStylesCheckDiv:function(){this.stylesCheckDiv=_V_.createElement("div",{className:"vjs-styles-check"});this.stylesCheckDiv.style.position="absolute";this.box.appendChild(this.stylesCheckDiv)},hideStylesCheckDiv:function(){this.stylesCheckDiv.style.display="none"},stylesHaveLoaded:function(){if(this.stylesCheckDiv.offsetHeight!=5){return false}else{return true}},positionAll:function(){this.positionBox();this.positionControlBars();this.positionPoster()},positionBox:function(){if(this.videoIsFullScreen){this.box.style.width="";this.element.style.height="";if(this.options.controlsBelow){this.box.style.height="";this.element.style.height=this.box.offsetHeight-this.controls.offsetHeight+"px"}}else{this.box.style.width=this.width()+"px";this.element.style.height=this.height()+"px";if(this.options.controlsBelow){this.element.style.height=""}}},getSubtitles:function(){var a=this.video.getElementsByTagName("TRACK");for(var b=0,c=a.length;b<c;b++){if(a[b].getAttribute("kind")=="subtitles"&&a[b].getAttribute("src")){this.subtitlesSource=a[b].getAttribute("src");this.loadSubtitles();this.buildSubtitles()}}},loadSubtitles:function(){_V_.get(this.subtitlesSource,this.parseSubtitles.context(this))},parseSubtitles:function(a){var b=a.split("\n"),c="",d,e,f;this.subtitles=[];this.currentSubtitle=false;this.lastSubtitleIndex=0;for(var g=0;g<b.length;g++){c=_V_.trim(b[g]);if(c){d={id:c,index:this.subtitles.length};c=_V_.trim(b[++g]);e=c.split(" --> ");d.start=this.parseSubtitleTime(e[0]);d.end=this.parseSubtitleTime(e[1]);f=[];for(var h=g;h<b.length;h++){c=_V_.trim(b[++g]);if(!c){break}f.push(c)}d.text=f.join("<br/>");this.subtitles.push(d)}}},parseSubtitleTime:function(a){var b=a.split(":"),c=0;c+=parseFloat(b[0])*60*60;c+=parseFloat(b[1])*60;var d=b[2].split(/\.|,/);c+=parseFloat(d[0]);ms=parseFloat(d[1]);if(ms){c+=ms/1e3}return c},buildSubtitles:function(){this.subtitlesDisplay=_V_.createElement("div",{className:"vjs-subtitles"});this.box.appendChild(this.subtitlesDisplay);this.activateElement(this.subtitlesDisplay,"subtitlesDisplay")},addVideoListener:function(a,b){_V_.addListener(this.video,a,b.rEvtContext(this))},play:function(){this.video.play();return this},onPlay:function(a){this.addVideoListener("play",a);return this},pause:function(){this.video.pause();return this},onPause:function(a){this.addVideoListener("pause",a);return this},paused:function(){return this.video.paused},currentTime:function(a){if(a!==b){try{this.video.currentTime=a}catch(c){this.warning(d.warnings.videoNotReady)}this.values.currentTime=a;return this}return this.video.currentTime},onCurrentTimeUpdate:function(a){this.currentTimeListeners.push(a)},duration:function(){return this.video.duration},buffered:function(){if(this.values.bufferStart===b){this.values.bufferStart=0;this.values.bufferEnd=0}if(this.video.buffered&&this.video.buffered.length>0){var a=this.video.buffered.end(0);if(a>this.values.bufferEnd){this.values.bufferEnd=a}}return[this.values.bufferStart,this.values.bufferEnd]},volume:function(a){if(a!==b){this.values.volume=Math.max(0,Math.min(1,parseFloat(a)));this.video.volume=this.values.volume;this.setLocalStorage("volume",this.values.volume);return this}if(this.values.volume){return this.values.volume}return this.video.volume},onVolumeChange:function(a){_V_.addListener(this.video,"volumechange",a.rEvtContext(this))},width:function(a){if(a!==b){this.video.width=a;this.box.style.width=a+"px";this.triggerResizeListeners();return this}return this.video.offsetWidth},height:function(a){if(a!==b){this.video.height=a;this.box.style.height=a+"px";this.triggerResizeListeners();return this}return this.video.offsetHeight},supportsFullScreen:function(){if(typeof this.video.webkitEnterFullScreen=="function"){if(!navigator.userAgent.match("Chrome")&&!navigator.userAgent.match("Mac OS X 10.5")){return true}}return false},html5EnterNativeFullScreen:function(){try{this.video.webkitEnterFullScreen()}catch(a){if(a.code==11){this.warning(d.warnings.videoNotReady)}}return this},enterFullScreen:function(){if(this.supportsFullScreen()){this.html5EnterNativeFullScreen()}else{this.enterFullWindow()}},exitFullScreen:function(){if(this.supportsFullScreen()){}else{this.exitFullWindow()}},enterFullWindow:function(){this.videoIsFullScreen=true;this.docOrigOverflow=c.documentElement.style.overflow;_V_.addListener(c,"keydown",this.fullscreenOnEscKey.rEvtContext(this));_V_.addListener(a,"resize",this.fullscreenOnWindowResize.rEvtContext(this));c.documentElement.style.overflow="hidden";_V_.addClass(this.box,"vjs-fullscreen");this.positionAll()},exitFullWindow:function(){this.videoIsFullScreen=false;c.removeEventListener("keydown",this.fullscreenOnEscKey,false);a.removeEventListener("resize",this.fullscreenOnWindowResize,false);c.documentElement.style.overflow=this.docOrigOverflow;_V_.removeClass(this.box,"vjs-fullscreen");this.positionAll()},onError:function(a){this.addVideoListener("error",a);return this},onEnded:function(a){this.addVideoListener("ended",a);return this}});d.player.newBehavior("player",function(a){this.onError(this.playerOnVideoError);this.onPlay(this.playerOnVideoPlay);this.onPlay(this.trackCurrentTime);this.onPause(this.playerOnVideoPause);this.onPause(this.stopTrackingCurrentTime);this.onEnded(this.playerOnVideoEnded);this.trackBuffered();this.onBufferedUpdate(this.isBufferFull)},{playerOnVideoError:function(a){this.log(a);this.log(this.video.error)},playerOnVideoPlay:function(a){this.hasPlayed=true},playerOnVideoPause:function(a){},playerOnVideoEnded:function(a){this.currentTime(0);this.pause()},trackBuffered:function(){this.bufferedInterval=setInterval(this.triggerBufferedListeners.context(this),500)},stopTrackingBuffered:function(){clearInterval(this.bufferedInterval)},bufferedListeners:[],onBufferedUpdate:function(a){this.bufferedListeners.push(a)},triggerBufferedListeners:function(){this.isBufferFull();this.each(this.bufferedListeners,function(a){a.context(this)()})},isBufferFull:function(){if(this.bufferedPercent()==1){this.stopTrackingBuffered()}},trackCurrentTime:function(){if(this.currentTimeInterval){clearInterval(this.currentTimeInterval)}this.currentTimeInterval=setInterval(this.triggerCurrentTimeListeners.context(this),100);this.trackingCurrentTime=true},stopTrackingCurrentTime:function(){clearInterval(this.currentTimeInterval);this.trackingCurrentTime=false},currentTimeListeners:[],triggerCurrentTimeListeners:function(a,b){this.each(this.currentTimeListeners,function(a){a.context(this)(b||this.currentTime())})},resizeListeners:[],onResize:function(a){this.resizeListeners.push(a)},triggerResizeListeners:function(){this.each(this.resizeListeners,function(a){a.context(this)()})}});d.player.newBehavior("mouseOverVideoReporter",function(a){_V_.addListener(a,"mousemove",this.mouseOverVideoReporterOnMouseMove.context(this));_V_.addListener(a,"mouseout",this.mouseOverVideoReporterOnMouseOut.context(this))},{mouseOverVideoReporterOnMouseMove:function(){this.showControlBars();clearInterval(this.mouseMoveTimeout);this.mouseMoveTimeout=setTimeout(this.hideControlBars.context(this),4e3)},mouseOverVideoReporterOnMouseOut:function(a){var b=a.relatedTarget;while(b&&b!==this.box){b=b.parentNode}if(b!==this.box){this.hideControlBars()}}});d.player.newBehavior("box",function(a){this.positionBox();_V_.addClass(a,"vjs-paused");this.activateElement(a,"mouseOverVideoReporter");this.onPlay(this.boxOnVideoPlay);this.onPause(this.boxOnVideoPause)},{boxOnVideoPlay:function(){_V_.removeClass(this.box,"vjs-paused");_V_.addClass(this.box,"vjs-playing")},boxOnVideoPause:function(){_V_.removeClass(this.box,"vjs-playing");_V_.addClass(this.box,"vjs-paused")}});d.player.newBehavior("poster",function(a){this.activateElement(a,"mouseOverVideoReporter");this.activateElement(a,"playButton");this.onPlay(this.hidePoster);this.onEnded(this.showPoster);this.onResize(this.positionPoster)},{showPoster:function(){if(!this.poster){return}this.poster.style.display="block";this.positionPoster()},positionPoster:function(){if(!this.poster||this.poster.style.display=="none"){return}this.poster.style.height=this.height()+"px";this.poster.style.width=this.width()+"px"},hidePoster:function(){if(!this.poster){return}this.poster.style.display="none"},updatePosterSource:function(){if(!this.video.poster){var a=this.video.getElementsByTagName("img");if(a.length>0){this.video.poster=a[0].src}}}});d.player.newBehavior("controlBar",function(a){if(!this.controlBars){this.controlBars=[];this.onResize(this.positionControlBars)}this.controlBars.push(a);_V_.addListener(a,"mousemove",this.onControlBarsMouseMove.context(this));_V_.addListener(a,"mouseout",this.onControlBarsMouseOut.context(this))},{showControlBars:function(){if(!this.options.controlsAtStart&&!this.hasPlayed){return}this.each(this.controlBars,function(a){a.style.display="block"})},positionControlBars:function(){this.updatePlayProgressBars();this.updateLoadProgressBars()},hideControlBars:function(){if(this.options.controlsHiding&&!this.mouseIsOverControls){this.each(this.controlBars,function(a){a.style.display="none"})}},onControlBarsMouseMove:function(){this.mouseIsOverControls=true},onControlBarsMouseOut:function(a){this.mouseIsOverControls=false}});d.player.newBehavior("playToggle",function(a){if(!this.elements.playToggles){this.elements.playToggles=[];this.onPlay(this.playTogglesOnPlay);this.onPause(this.playTogglesOnPause)}this.elements.playToggles.push(a);_V_.addListener(a,"click",this.onPlayToggleClick.context(this))},{onPlayToggleClick:function(a){if(this.paused()){this.play()}else{this.pause()}},playTogglesOnPlay:function(a){this.each(this.elements.playToggles,function(a){_V_.removeClass(a,"vjs-paused");_V_.addClass(a,"vjs-playing")})},playTogglesOnPause:function(a){this.each(this.elements.playToggles,function(a){_V_.removeClass(a,"vjs-playing");_V_.addClass(a,"vjs-paused")})}});d.player.newBehavior("playButton",function(a){_V_.addListener(a,"click",this.onPlayButtonClick.context(this))},{onPlayButtonClick:function(a){this.play()}});d.player.newBehavior("pauseButton",function(a){_V_.addListener(a,"click",this.onPauseButtonClick.context(this))},{onPauseButtonClick:function(a){this.pause()}});d.player.newBehavior("playProgressBar",function(a){if(!this.playProgressBars){this.playProgressBars=[];this.onCurrentTimeUpdate(this.updatePlayProgressBars)}this.playProgressBars.push(a)},{updatePlayProgressBars:function(a){var c=a!==b?a/this.duration():this.currentTime()/this.duration();if(isNaN(c)){c=0}this.each(this.playProgressBars,function(a){if(a.style){a.style.width=_V_.round(c*100,2)+"%"}})}});d.player.newBehavior("loadProgressBar",function(a){if(!this.loadProgressBars){this.loadProgressBars=[]}this.loadProgressBars.push(a);this.onBufferedUpdate(this.updateLoadProgressBars)},{updateLoadProgressBars:function(){this.each(this.loadProgressBars,function(a){if(a.style){a.style.width=_V_.round(this.bufferedPercent()*100,2)+"%"}})}});d.player.newBehavior("currentTimeDisplay",function(a){if(!this.currentTimeDisplays){this.currentTimeDisplays=[];this.onCurrentTimeUpdate(this.updateCurrentTimeDisplays)}this.currentTimeDisplays.push(a)},{updateCurrentTimeDisplays:function(a){if(!this.currentTimeDisplays){return}var b=a?a:this.currentTime();this.each(this.currentTimeDisplays,function(a){a.innerHTML=_V_.formatTime(b)})}});d.player.newBehavior("durationDisplay",function(a){if(!this.durationDisplays){this.durationDisplays=[];this.onCurrentTimeUpdate(this.updateDurationDisplays)}this.durationDisplays.push(a)},{updateDurationDisplays:function(){if(!this.durationDisplays){return}this.each(this.durationDisplays,function(a){if(this.duration()){a.innerHTML=_V_.formatTime(this.duration())}})}});d.player.newBehavior("currentTimeScrubber",function(a){_V_.addListener(a,"mousedown",this.onCurrentTimeScrubberMouseDown.rEvtContext(this))},{onCurrentTimeScrubberMouseDown:function(a,b){a.preventDefault();this.currentScrubber=b;this.stopTrackingCurrentTime();this.videoWasPlaying=!this.paused();this.pause();_V_.blockTextSelection();this.setCurrentTimeWithScrubber(a);_V_.addListener(c,"mousemove",this.onCurrentTimeScrubberMouseMove.rEvtContext(this));_V_.addListener(c,"mouseup",this.onCurrentTimeScrubberMouseUp.rEvtContext(this))},onCurrentTimeScrubberMouseMove:function(a){this.setCurrentTimeWithScrubber(a)},onCurrentTimeScrubberMouseUp:function(a){_V_.unblockTextSelection();c.removeEventListener("mousemove",this.onCurrentTimeScrubberMouseMove,false);c.removeEventListener("mouseup",this.onCurrentTimeScrubberMouseUp,false);if(this.videoWasPlaying){this.play();this.trackCurrentTime()}},setCurrentTimeWithScrubber:function(a){var b=_V_.getRelativePosition(a.pageX,this.currentScrubber);var c=b*this.duration();this.triggerCurrentTimeListeners(0,c);if(c==this.duration()){c=c-.1}this.currentTime(c)}});d.player.newBehavior("volumeDisplay",function(a){if(!this.volumeDisplays){this.volumeDisplays=[];this.onVolumeChange(this.updateVolumeDisplays)}this.volumeDisplays.push(a);this.updateVolumeDisplay(a)},{updateVolumeDisplays:function(){if(!this.volumeDisplays){return}this.each(this.volumeDisplays,function(a){this.updateVolumeDisplay(a)})},updateVolumeDisplay:function(a){var b=Math.ceil(this.volume()*6);this.each(a.children,function(a,c){if(c<b){_V_.addClass(a,"vjs-volume-level-on")}else{_V_.removeClass(a,"vjs-volume-level-on")}})}});d.player.newBehavior("volumeScrubber",function(a){_V_.addListener(a,"mousedown",this.onVolumeScrubberMouseDown.rEvtContext(this))},{onVolumeScrubberMouseDown:function(a,b){_V_.blockTextSelection();this.currentScrubber=b;this.setVolumeWithScrubber(a);_V_.addListener(c,"mousemove",this.onVolumeScrubberMouseMove.rEvtContext(this));_V_.addListener(c,"mouseup",this.onVolumeScrubberMouseUp.rEvtContext(this))},onVolumeScrubberMouseMove:function(a){this.setVolumeWithScrubber(a)},onVolumeScrubberMouseUp:function(a){this.setVolumeWithScrubber(a);_V_.unblockTextSelection();c.removeEventListener("mousemove",this.onVolumeScrubberMouseMove,false);c.removeEventListener("mouseup",this.onVolumeScrubberMouseUp,false)},setVolumeWithScrubber:function(a){var b=_V_.getRelativePosition(a.pageX,this.currentScrubber);this.volume(b)}});d.player.newBehavior("fullscreenToggle",function(a){_V_.addListener(a,"click",this.onFullscreenToggleClick.context(this))},{onFullscreenToggleClick:function(a){if(!this.videoIsFullScreen){this.enterFullScreen()}else{this.exitFullScreen()}},fullscreenOnWindowResize:function(a){this.positionControlBars()},fullscreenOnEscKey:function(a){if(a.keyCode==27){this.exitFullScreen()}}});d.player.newBehavior("bigPlayButton",function(a){if(!this.elements.bigPlayButtons){this.elements.bigPlayButtons=[];this.onPlay(this.bigPlayButtonsOnPlay);this.onEnded(this.bigPlayButtonsOnEnded)}this.elements.bigPlayButtons.push(a);this.activateElement(a,"playButton")},{bigPlayButtonsOnPlay:function(a){this.hideBigPlayButtons()},bigPlayButtonsOnEnded:function(a){this.showBigPlayButtons()},showBigPlayButtons:function(){this.each(this.elements.bigPlayButtons,function(a){a.style.display="block"})},hideBigPlayButtons:function(){this.each(this.elements.bigPlayButtons,function(a){a.style.display="none"})}});d.player.newBehavior("spinner",function(a){if(!this.spinners){this.spinners=[];_V_.addListener(this.video,"loadeddata",this.spinnersOnVideoLoadedData.context(this));_V_.addListener(this.video,"loadstart",this.spinnersOnVideoLoadStart.context(this));_V_.addListener(this.video,"seeking",this.spinnersOnVideoSeeking.context(this));_V_.addListener(this.video,"seeked",this.spinnersOnVideoSeeked.context(this));_V_.addListener(this.video,"canplay",this.spinnersOnVideoCanPlay.context(this));_V_.addListener(this.video,"canplaythrough",this.spinnersOnVideoCanPlayThrough.context(this));_V_.addListener(this.video,"waiting",this.spinnersOnVideoWaiting.context(this));_V_.addListener(this.video,"stalled",this.spinnersOnVideoStalled.context(this));_V_.addListener(this.video,"suspend",this.spinnersOnVideoSuspend.context(this));_V_.addListener(this.video,"playing",this.spinnersOnVideoPlaying.context(this));_V_.addListener(this.video,"timeupdate",this.spinnersOnVideoTimeUpdate.context(this))}this.spinners.push(a)},{showSpinners:function(){this.each(this.spinners,function(a){a.style.display="block"});clearInterval(this.spinnerInterval);this.spinnerInterval=setInterval(this.rotateSpinners.context(this),100)},hideSpinners:function(){this.each(this.spinners,function(a){a.style.display="none"});clearInterval(this.spinnerInterval)},spinnersRotated:0,rotateSpinners:function(){this.each(this.spinners,function(a){a.style.WebkitTransform="scale(0.5) rotate("+this.spinnersRotated+"deg)";a.style.MozTransform="scale(0.5) rotate("+this.spinnersRotated+"deg)"});if(this.spinnersRotated==360){this.spinnersRotated=0}this.spinnersRotated+=45},spinnersOnVideoLoadedData:function(a){this.hideSpinners()},spinnersOnVideoLoadStart:function(a){this.showSpinners()},spinnersOnVideoSeeking:function(a){},spinnersOnVideoSeeked:function(a){},spinnersOnVideoCanPlay:function(a){},spinnersOnVideoCanPlayThrough:function(a){this.hideSpinners()},spinnersOnVideoWaiting:function(a){this.showSpinners()},spinnersOnVideoStalled:function(a){},spinnersOnVideoSuspend:function(a){},spinnersOnVideoPlaying:function(a){this.hideSpinners()},spinnersOnVideoTimeUpdate:function(a){if(this.spinner.style.display=="block"){this.hideSpinners()}}});d.player.newBehavior("subtitlesDisplay",function(a){if(!this.subtitleDisplays){this.subtitleDisplays=[];this.onCurrentTimeUpdate(this.subtitleDisplaysOnVideoTimeUpdate);this.onEnded(function(){this.lastSubtitleIndex=0}.context(this))}this.subtitleDisplays.push(a)},{subtitleDisplaysOnVideoTimeUpdate:function(a){if(this.subtitles){if(!this.currentSubtitle||this.currentSubtitle.start>=a||this.currentSubtitle.end<a){var b=false,c=this.subtitles[this.lastSubtitleIndex].start>a,d=this.lastSubtitleIndex-c?1:0;while(true){if(c){if(d<0||this.subtitles[d].end<a){break}if(this.subtitles[d].start<a){b=d;break}d--}else{if(d>=this.subtitles.length||this.subtitles[d].start>a){break}if(this.subtitles[d].end>a){b=d;break}d++}}if(b!==false){this.currentSubtitle=this.subtitles[b];this.lastSubtitleIndex=b;this.updateSubtitleDisplays(this.currentSubtitle.text)}else if(this.currentSubtitle){this.currentSubtitle=false;this.updateSubtitleDisplays("")}}}},updateSubtitleDisplays:function(a){this.each(this.subtitleDisplays,function(b){b.innerHTML=a})}});d.extend({addClass:function(a,b){if((" "+a.className+" ").indexOf(" "+b+" ")==-1){a.className=a.className===""?b:a.className+" "+b}},removeClass:function(a,b){if(a.className.indexOf(b)==-1){return}var c=a.className.split(/\s+/);c.splice(c.lastIndexOf(b),1);a.className=c.join(" ")},createElement:function(a,b){return this.merge(c.createElement(a),b)},blockTextSelection:function(){c.body.focus();c.onselectstart=function(){return false}},unblockTextSelection:function(){c.onselectstart=function(){return true}},formatTime:function(a){var b=Math.round(a);var c=Math.floor(b/60);c=c>=10?c:"0"+c;b=Math.floor(b%60);b=b>=10?b:"0"+b;return c+":"+b},getRelativePosition:function(a,b){return Math.max(0,Math.min(1,(a-this.findPosX(b))/b.offsetWidth))},findPosX:function(a){var b=a.offsetLeft;while(a=a.offsetParent){b+=a.offsetLeft}return b},getComputedStyleValue:function(b,c){return a.getComputedStyle(b,null).getPropertyValue(c)},round:function(a,b){if(!b){b=0}return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},addListener:function(a,b,c){if(a.addEventListener){a.addEventListener(b,c,false)}else if(a.attachEvent){a.attachEvent("on"+b,c)}},removeListener:function(a,b,c){if(a.removeEventListener){a.removeEventListener(b,c,false)}else if(a.attachEvent){a.detachEvent("on"+b,c)}},get:function(a,b){if(typeof XMLHttpRequest=="undefined"){XMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(b){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(c){}throw new Error("This browser does not support XMLHttpRequest.")}}var c=new XMLHttpRequest;c.open("GET",a);c.onreadystatechange=function(){if(c.readyState==4&&c.status==200){b(c.responseText)}}.context(this);c.send()},trim:function(a){return a.toString().replace(/^\s+/,"").replace(/\s+$/,"")},bindDOMReady:function(){if(c.readyState==="complete"){return d.onDOMReady()}if(c.addEventListener){c.addEventListener("DOMContentLoaded",d.DOMContentLoaded,false);a.addEventListener("load",d.onDOMReady,false)}else if(c.attachEvent){c.attachEvent("onreadystatechange",d.DOMContentLoaded);a.attachEvent("onload",d.onDOMReady)}},DOMContentLoaded:function(){if(c.addEventListener){c.removeEventListener("DOMContentLoaded",d.DOMContentLoaded,false);d.onDOMReady()}else if(c.attachEvent){if(c.readyState==="complete"){c.detachEvent("onreadystatechange",d.DOMContentLoaded);d.onDOMReady()}}},DOMReadyList:[],addToDOMReady:function(a){if(d.DOMIsReady){a.call(c)}else{d.DOMReadyList.push(a)}},DOMIsReady:false,onDOMReady:function(){if(d.DOMIsReady){return}if(!c.body){return setTimeout(d.onDOMReady,13)}d.DOMIsReady=true;if(d.DOMReadyList){for(var a=0;a<d.DOMReadyList.length;a++){d.DOMReadyList[a].call(c)}d.DOMReadyList=null}}});d.bindDOMReady();Function.prototype.context=function(a){var b=this,c=function(){return b.apply(a,arguments)};return c};Function.prototype.evtContext=function(a){var b=this,c=function(){var c=this;return b.call(a,arguments[0],c)};return c};Function.prototype.rEvtContext=function(a,b){if(this.hasContext===true){return this}if(!b){b=a}for(var c in b){if(b[c]==this){b[c]=this.evtContext(a);b[c].hasContext=true;return b[c]}}return this.evtContext(a)};if(a.jQuery){(function(a){a.fn.VideoJS=function(a){this.each(function(){d.setup(this,a)});return this};a.fn.player=function(){return this[0].player}})(jQuery)}a.VideoJS=a._V_=d})(window)

