/*

    Copyright © 2000-2010 Apple Inc. All Rights Reserved.
    
*/

if(!Element){window.Element={}}if(!Element.show){Element.show=function(A){A.style.display=A.cssDisplayCache||"";A.cssDisplayCache=undefined}}if(!Element.hide){Element.hide=function(A){if(typeof A.cssDisplayCache=="undefined"){var B=A.style.display;if(B!="none"){A.cssDisplayCache=B}}A.style.display="none"}}var Media={MIN_QUICKTIME_VERSION:"7.4",create:function(B,H,D){var E,F,C,A;if(Media.Detection.Firefox()){Element.addClassName(B,"mozilla")}if(Media.Detection.IE()){Media._createEventSource()}if(Media._isHTML5VideoAvailable()&&!Media.Detection.Mobile()){return G(Media.Spec.Video)}if(Media._isQuickTimeAvailable(Media.MIN_QUICKTIME_VERSION)||Media.Detection.Mobile()){return G(Media.Spec.QuickTime)}if(Media._shouldShowDownloadPrompt()){Media.createDownloadPrompt(B,H,D)}function G(M){A=Media.Controller(B,D);E=M.create(B,H,D);F=Media.VideoInterface(E,A);var I=M.eventsToRegister;for(var L in I){var J=I[L].name||I[L],K=I[L].callback;F.registerEvent(L,J,K)}if(M.pollForChanges){F.pollForChanges(M.pollForChanges)}if(M.interfaceMethods){F.override(M.interfaceMethods)}F.setup();A.setVideo(F);A.container=B;A.movieLoadingPanelClass="movie-loading-panel";if(typeof D.width!="undefined"&&typeof D.height!="undefined"){A.movieLoadingPanelClass="movie-loading-panel_"+D.width+"x"+D.height}Element.addClassName(B,A.movieLoadingPanelClass);if(D.captions){A.setCaptionText(Media.CaptionText(D.captions,F))}return A}return false},createDownloadPrompt:function(A,D,B){var C=document.createElement("a");Element.addClassName(C,"quicktime-download");if(typeof B.width!=="undefined"&&typeof B.height!=="undefined"){Element.addClassName(C,"size"+B.width+"x"+B.height)}C.setAttribute("href","http://www.apple.com/quicktime/download/");C.innerHTML=B.downloadText||"Get the latest QuickTime.";A.appendChild(C);if("fire" in Element){Element.fire(document.body,"QuickTime:noCompatibleQTAvailable",{controller:this,minVersion:Media.MIN_QUICKTIME_VERSION})}return C},_isHTML5VideoAvailable:function(){return Media.Detection.HTML5()},_isQuickTimeAvailable:function(){return Media.Detection.QuickTime(Media.MIN_QUICKTIME_VERSION)},_shouldShowDownloadPrompt:function(){return !Media.Detection.Mobile()},_createEventSource:function(){var C="qt_event_source",B,A;if(document.getElementById(C)){return }B=document.createElement("object");B.id=C;B.setAttribute("clsid","CB927D12-4FF7-4a9e-A169-56E4B8A75598");A=document.getElementsByTagName("head")[0];A.appendChild(B)},version:function(){return 1}};Media.PERSIST_SLIM_CONTROLS=2;Media.OVERLAY=3;Media.Detection={HTML5:function(){if(!("HTMLMediaElement" in window)){return false}var A=document.createElement("video");return(A.canPlayType&&A.canPlayType("video/mp4")!==""&&A.canPlayType("video/quicktime")!==""&&navigator.userAgent.indexOf("Chrome")===-1)},QuickTime:function(A){return AC.Detector.isValidQTAvailable(A)},Mobile:function(){return AC.Detector.isMobile()},IE:function(){return AC.Detector.isIEStrict()},Firefox:function(){return AC.Detector.isFirefox()},CSSTransitions:function(){try{var A=document.createElement("div").style;A.setProperty("-webkit-transition","inherit",null);A.setProperty("-moz-transition","inherit",null);A.setProperty("transition","inherit",null);return(A.getPropertyValue("-webkit-transition")=="inherit"||A.getPropertyValue("-moz-transition")=="inherit"||A.getPropertyValue("transition")=="inherit")}catch(B){return false}}};Media.Spec={Video:{create:function(A,E,B){if(!A){return }var D=document.createElement("video"),C=document.createElement("source");if(D.canPlayType("video/mp4")){var F=B.id||(A.id?A.id+"_video":"");D.setAttribute("id",F);Element.addClassName(D,(D.playerType="video"));C.setAttribute("src",E);C.setAttribute("type","video/mp4");D.appendChild(C);this._configure(D,E,B);Event.observe(window,"unload",function(){try{D.stop()}catch(G){}D.style.display="none";D=null});A.appendChild(D)}else{D=this._createFallback(A,E,B)}return D},eventsToRegister:{load:"load",timeupdate:"timeupdate",durationchange:"durationchange",progress:"progress",playing:"playing",canplay:"canplay",play:"play",pause:"pause",ended:"ended"},interfaceMethods:{duration:function(){return this.duration},time:function(){return this.currentTime},setTime:function(A){this.currentTime=A},volume:function(){return this.volume},setVolume:function(A){this.volume=A},muted:function(){return this.muted},setMuted:function(A){this.muted=A},rate:function(){return this.playbackRate},setRate:function(A){this.playbackRate=A},defaultRate:function(){return this.defaultPlaybackRate},src:function(){return this.src},setSrc:function(A){this.src=A},status:function(){return this.status},percentLoaded:function(B){var C=this.buffered,D=this.duration,A;if(!D||!C||!C.end){return }A=C.end(0)/D;if(B){A*=100}return A},pause:function(){this.pause()},play:function(){this.play()},paused:function(){return this.paused},ended:function(){return this.ended},timeScale:function(){return 2997},movieType:function(){return"Video"},getContainer:function(){return this.parentNode}},_configure:function(C,E,B){if(!B){return }var D,A;for(D in B){if(B.hasOwnProperty(D)){A=D.toLowerCase();switch(A){case"type":case"src":case"data":case"classid":case"name":case"id":case"postdomevents":case"saveembedtags":case"factory":case"aggressiveCleanup":case"innerId":case"cache":case"aggressivecleanup":case"showlogo":break;case ("class"):Element.addClassName(C,B[D]);break;case ("controls"):if(B[D]){C.setAttribute("controls","controls")}break;case ("autoplay"):case ("autostart"):if(B[D]){C.setAttribute("autoplay","true")}break;default:C.setAttribute(A,B[D]);break}}}},_createFallback:function(A,C,B){if(Media._isQuickTimeAvailable()){return Media.Spec.QuickTime.create(A,C,B)}if(Media._shouldShowDownloadPrompt()){return Media.createDownloadPrompt(A,C,B)}return false}},QuickTime:{create:function(B,D,C){var F=this._createObject(D,C),A=null,E=C.id||(B.id?B.id+"_video":"");F.setAttribute("id",E);if(!Media.Detection.IE()){A=this._createEmbed(D,C);F.appendChild(A)}else{F.style.behavior="url(#qt_event_source)";if(C.aggressiveCleanup!==false){Event.observe(window,"unload",function(){try{F.Stop()}catch(G){}F.style.display="none";F=null})}}this._configure(A,F,C);F.setAttribute("classid","clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B");Element.addClassName(F,(F.playerType="quicktime"));B.appendChild(F);return A||F},pollForChanges:["load","timeupdate","durationchange","progress","canplay","playing","play","pause","ended"],interfaceMethods:{setup:function(){},duration:function(){var D,A,B;try{A=this.GetDuration();B=this.GetTimeScale();if(B>0){D=A/B}}catch(C){}return D||0},time:function(){var C=0,B,A;B=this.GetTime();A=this.GetTimeScale();if(B<=0){C=0}else{if(A>0){C=B/A}else{C=B}}return C},setTime:function(A){try{this.SetTime(A*this.GetTimeScale())}catch(B){}},volume:function(){return this.GetVolume()/255},setVolume:function(A){this.SetVolume(A*255)},muted:function(){return this.GetMute()},setMuted:function(A){this.SetMute(A)},rate:function(){var A;try{A=this.GetRate()}catch(B){}return A||1},setRate:function(A){this.SetRate(A)},status:function(){return this.GetPluginStatus()},percentLoaded:function(){var A=0;try{A=this.GetMaxBytesLoaded()/this.GetMovieSize()}catch(B){}return A},pause:function(){switch(typeof this.Stop){case"unknown":case"function":this.Stop();break;default:break}},play:function(){switch(typeof this.Play){case"unknown":case"function":this.Play();break;default:break}},paused:function(){return this.GetRate()===0},ended:function(){return this.ended},src:function(){var B;try{B=this.GetURL()}catch(A){}return B||""},setSrc:function(A){this.SetURL(A)},timeScale:function(){return this.GetTimeScale()},movieType:function(){return"QuickTime"},getContainer:function(){return this._container}},_configure:function(A,E,C){if(!C){return }var D=null,B=null;for(D in C){if(C.hasOwnProperty(D)){B=D.toLowerCase();switch(B){case ("type"):case ("src"):case ("data"):case ("classid"):case ("name"):case ("id"):case ("postdomevents"):case ("saveembedtags"):case ("factory"):case ("aggressiveCleanup"):break;case ("class"):Element.addClassName(E,C[D]);break;case ("innerId"):if(A){A.setAttribute("id",C[D])}break;case ("autoplay"):this._addParameter(E,"autostart",C[D]);this._addParameter(A,"autostart",C[D]);break;case ("width"):case ("height"):E.setAttribute(B,C[D]);if(A){A.setAttribute(B,C[D])}break;default:this._addParameter(E,B,C[D]);this._addParameter(A,B,C[D]);break}}}},_addParameter:function(B,A,C){if(!B){return }var D=document.createElement("param");D.setAttribute("value",C);D.setAttribute("name",A);B.appendChild(D);D=null},_createEmbed:function(B,A){var C=document.createElement("embed");C.setAttribute("src",B);C.setAttribute("type","video/quicktime");if(!Media.Detection.Firefox()){C.setAttribute("wmode","transparent")}C.setAttribute("postdomevents",true);C.setAttribute("controller",false);C.setAttribute("showlogo",false);C.setAttribute("scale","tofit");if(A){if(!isNaN(parseInt(A.width,10))){C.setAttribute("width",A.width)}if(!isNaN(parseInt(A.height,10))){C.setAttribute("height",A.height)}}return C},_createObject:function(C,B){var A=document.createElement("object"),D="7,3,0,0";if(Media.Detection.Mobile()&&B.posterFrame){this._addParameter(A,"src",B.posterFrame);this._addParameter(A,"href",C);this._addParameter(A,"target","myself")}else{this._addParameter(A,"src",C);if(!Media.Detection.Firefox()){this._addParameter(A,"wmode","transparent")}}A.setAttribute("id",name);this._addParameter(A,"showlogo",false);this._addParameter(A,"saveembedtags",true);this._addParameter(A,"postdomevents",true);if(null!==B&&(typeof B.codebase!=="undefined")&&""!==B.codebase){D=B.codeBase}A.setAttribute("codebase","http://www.apple.com/qtactivex/qtplugin.cab#version="+D);return A}}};Media.VideoInterface=function(D,B){var E=D,C=B,A;return{object:function(){return E},setObject:function(F){E=F},setDelegate:function(F){C=F},setup:function(){},override:function(G){var H;function F(I,J){return function(){return J.apply(E,arguments)}}for(H in G){this[H]=F(H,G[H])}return this},registerEvent:function(H,F,G){if(!G&&typeof (F)=="function"){G=F;F=null}var I=F||H;Event.observe(E,I,function(J){if(G){G.apply(this)}this.messageDelegate(H)}.bind(this))},pollForChanges:function(F){if(A){window.clearInterval(A)}if(F){A=window.setInterval(function(){try{for(var G=0,H;H=F[G];G++){this.messageDelegate(H)}}catch(I){}}.bind(this),480)}},messageDelegate:function(F){if(!C){return }F=F.charAt(0).toUpperCase()+F.substring(1);var G="videoReceived"+F+"Event";if(G in C){C[G](this)}}}};Media.CaptionText=function(B,D){if(!D){return }var A={},E;function C(Q){var H,F,K,O,P,R,L,J,N,M=-1,G=30,I=1;H={};J=[];N=1;F=D.getContainer();K=function(T){var S=document.createElement("span");S.innerHTML=T;return S};O=function(){return{begin:0,end:0,duration:0,row:0,col:0,value:"",element:null}};L={};L.clobber=0;L.preloaded=0;L.store={};L.lines=[];L.timeToNumber=function(U,T){var S=U.split(":"),V=S[2]*1;V+=(S[1]*60);V+=(S[0]*3600),word=V.toString(),point=word.indexOf("."),PRECISION_OFFSET=2;if(point<0){return V*1}return V.toPrecision(PRECISION_OFFSET+point)*1};L.onload=function(Z){var X,Y,V,U,a,b,T,d,c,S,W;X=Z.getElementsByTagName("p");Y=X.length;L.store.groups={};for(V=0;V<Y;V+=1){W=L.timeToNumber(X[V].getAttribute("begin"));S=Math.floor(W/G);if(!L.store.groups[S]){c=L.store.groups[S]={}}else{c=L.store.groups[S]}if(!c[W]){c[W]=[]}a=O();c[W].push(a);a.begin=W;a.end=L.timeToNumber(X[V].getAttribute("end"));a.duration=a.end-W;b=X[V].childNodes;T=b.length;d=[];for(U=0;U<T;U+=1){switch(b[U].nodeType){case 1:if(b[U].nodeName==="metadata"){a.row=(b[U].getAttribute("ccrow")*1);a.col=(b[U].getAttribute("cccol")*1)}break;case 3:d.push(b[U].textContent);break;default:break}}a.value=d.join(" ")}};H.batchCallbacks=function(S){var U,V,T;U=Math.floor(S/G);if(U<=M){return }this.clearCallbacks(S);M=U;for(V=M;V<=M+I;++V){if(!L.store.groups||!L.store.groups[V]){return }for(T in L.store.groups[V]){(function(){var a=M,Y=T,Z,W,X;if(T-S<0){return }Z=L.store.groups[a][Y];if(typeof Z==="undefined"){return }W=Z.length;for(X=0;X<W;X+=1){J.push(setTimeout((function(){var b=Z[X];return function(){H.showCaption(b)}}()),((1000*(T-S))+Math.random())/N))}}())}}};H.clearCallbacks=function(S){var T=0;len=J.length;for(T;T<len;T+=1){clearTimeout(J[T]);J[T]=null}J=[];M=-1};H.updateTime=function(X){var U=0,W=0,V=0,T=0,Y=0,S=0;return function(b){W=U;U=b;T=V;V=U-W;Y=((T*S)+V)/(++S);var a,Z;a=Math.floor(b);Z=b.toPrecision(2);this.batchCallbacks(b)}}();H.videoCanPlay=function(S){return true};H.videoPlay=function(S){this.batchCallbacks(S);return true};H.videoPause=function(S){this.clearCallbacks(S);return true};H.videoShouldPlay=function(S){this.batchCallbacks(S);return true};H.videoShouldPause=function(S){this.clearCallbacks(S);return true};H.videoEndSeeking=function(S){this.clearCallbacks(S)};H.showCaption=function(S){if(!S||S.value===""){return }S.element=K(S.value);H.element.appendChild(S.element);setTimeout(function(){H.hideCaption(S)},1000*(S.duration)/N)};H.hideCaption=function(S){try{H.element.removeChild(S.element)}catch(T){}S.element=null};H.element=document.createElement("div");H.element.className="caption-text-container";if(F){F.appendChild(H.element)}R=function(){try{return new window.XMLHttpRequest()}catch(W){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(V){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(U){}try{return new window.ActiveXObject("Msxml2.XMLHTTP")}catch(T){}try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(S){}return null}();R.open("GET",B);R.setRequestHeader("Response-Type","text/xml");R.onreadystatechange=function(){if(this.readyState==4){if(this.status==200||this.status==201){L.onload(this.responseXML)}}};R.send(null);H.show=function(){this.element.style.display="block"};H.hide=function(){this.element.style.display="none"};H.setRate=function(T,S){N=Math.abs(T);this.clearCallbacks(S);this.batchCallbacks(S)};H.hide();return H}switch(D.movieType()){case"QuickTime":E=C({type:"QuickTime"});E.batchCallbacks=function(F){};E.clearCallbacks=function(F){};E.updateTime=function(F){};E.videoCanPlay=function(F){return true};E.videoPlay=function(F){};E.videoPause=function(F){};E.videoShouldPlay=function(F){return true};E.videoShouldPause=function(F){return true};E.videoEndSeeking=function(F){};E.setRate=function(G,F){};E.onCaptionsTrackIdentified=function(H,F){var G=false;return function(L){if(G&&typeof L==="function"){L(G);return }var J=D.object(),I,K;if(!J){return }I=J.GetTrackCount();for(K=1;K<=I;K+=1){if(J.GetTrackType(K)==="Closed Caption"){G=K;if(typeof L==="function"){L(G)}return }}if(typeof F==="function"){F("No captions were found.")}}}();E.enableCaptions=function(){this.onCaptionsTrackIdentified(function(F){D.object().SetTrackEnabled(F,true);D.object().captionsEnabled=true})};E.disableCaptions=function(){this.onCaptionsTrackIdentified(function(F){D.object().SetTrackEnabled(F,false);D.object().captionsEnabled=false})};E.show=function(){this.enableCaptions()};E.hide=function(){this.disableCaptions()};break;case"Video":E=C({type:"Video"});break;default:return ;break}if(E){return E}};Media.Controller=function(E,G){var Q=E,U,T,W,D,N,B,A,C=false,O,M=false,K=false,P=false,I=false,J=true,S=true,H="true",F=true;if(G){F=G.type||true;H=G.autosize||"true";B=G.onerror||function(){};autoplay=G.autoplay||false}function V(Z){if(!W){return }W.show();window.clearTimeout(N);var Y=W.element;mouseElement=Z.target||Z.srcElement;if(mouseElement==Y){N=window.setTimeout(function(){if(W&&typeof W!="undefined"){if(W.controllerType.indexOf("slim")>-1&&F===Media.PERSIST_SLIM_CONTROLS){return }W.hide()}},2500)}}function L(Y){if(!W){return }window.clearTimeout(N);N=window.setTimeout(function(){if(W){if(W.controllerType.indexOf("slim")>-1&&F===Media.PERSIST_SLIM_CONTROLS){return }W.hide()}},50)}function X(Y){if(!W){return }if(W.controllerType.indexOf("slim")>-1&&F===Media.PERSIST_SLIM_CONTROLS){return }window.clearTimeout(N);W.show()}function R(Y){if(!Y){return }Q.style.width=Y.width+"px";Q.style.height=Y.height+"px"}if(H=="true"&&G&&G.width&&G.height){R({width:G.width,height:G.height})}return{_send:function(Z,Y){if(U&&Z in U){Y=[this].concat(Y);return U[Z].apply(U,Y)}},_fireEvent:function(Y,Z){Media.Controller.fireEvent(Y,Z)},reset:function(){C=false;K=false;P=false;I=false},setDelegate:function(Y){U=Y},setVideo:function(Y){K=false;P=false;T=Y;A=T.duration()||0;try{T.object().addEventListener("error",B,true)}catch(a){}if(autoplay){var Z=setInterval(function(){if(T.percentLoaded(true)>50){if(T.paused()&&T.time()===0){T.play()}clearInterval(Z)}},20)}if(W&&W.videoObjectHasChanged){W.videoObjectHasChanged(T)}return this},video:function(){return T},resize:function(Y){return R(Y)},setControlPanel:function(Y){W=Y;if(W){W.delegate=this;Event.observe(E,"mousemove",V);Event.observe(E,"mouseout",L);Event.observe(E,"mouseover",X);if(D){W.captionsControl.showControl()}}else{Event.stopObserving(E,"mousemove",V);Event.stopObserving(E,"mouseout",L);Event.stopObserving(E,"mouseover",X)}return this},captionText:function(){return D},setCaptionText:function(Y){D=Y;if(W){W.captionsControl.showControl()}},beginSeeking:function(){if(C){return }C=true;O=!T.paused()&&this.rate()==1;this.pause();var Y=T.time();this._send("didStartJogging",Y);this._fireEvent("QuickTime:didStartJogging",{controller:this,time:Y})},endSeeking:function(){if(O){this.play()}C=false;var Y=T.time();this._send("didStopJogging",Y);this._fireEvent("QuickTime:didStopJogging",{controller:this,time:Y});if(D){D.videoEndSeeking(T.time())}},time:function(){return T.time()||this._lastTime||0},setTime:function(Y){if(Y==A){Y-=0.51}T.setTime(Y);this.videoReceivedTimeupdateEvent()},duration:function(){if(!A){A=T.duration()}return A},volume:function(){return T.volume()},setVolume:function(Y){T.setMuted(false);T.setVolume(Y)},setMuted:function(Y){T.setMuted(Y)},toggleMute:function(){var Y=T.muted();if(Y){this.setMuted(false)}else{this.setMuted(true)}return !Y},playPause:function(){var Y=T.paused(),Z=this.rate();if(Y&&Z===1){this.play()}else{if(Z!==1){this.setRate(1)}else{this.pause()}}return T.paused()},playing:function(){return I},play:function(){if(D&&!D.videoShouldPlay(T.time())){return }T.play();I=true;J=false},pause:function(){if(D&&!D.videoShouldPause(T.time())){return }T.pause();I=false;S=false},stop:function(){T.pause();I=false;S=false;P=true},setRate:function(Y){T.setRate(Y);if(D){D.setRate(Y,this.time())}},rate:function(){return T.rate()},src:function(){return T.src()},setSrc:function(Y){this.setSrc(Y)},timeScale:function(){return T.timeScale()},movieType:function(){return T.movieType()},videoReceivedCanplayEvent:function(Y){if(M){return }if(D&&!D.videoCanPlay(T.time())){return }if(W&&typeof W.enableBasicControls!=="undefined"&&typeof W.enableConditionalControls!=="undefined"){if(this.movieType()!="QuickTime"||T.status()=="Playable"){W.enableBasicControls();W.enableConditionalControls({captions:D});M=true}}},videoReceivedPlayingEvent:function(Y){if(!K&&(this.movieType()=="Video"||this.time()>0)){K=true;if(W&&typeof W.enableBasicControls!=="undefined"&&typeof W.enableConditionalControls!=="undefined"){W.enableBasicControls();W.enableConditionalControls({captions:D})}I=true;Element.removeClassName(this.container,this.movieLoadingPanelClass);this._send("didBecomePlayable");this._fireEvent("QuickTime:canplaythrough",{controller:this});this._send("didBegin");this._fireEvent("QuickTime:begin",{controller:this});N=window.setTimeout(function(){if(W&&typeof W!="undefined"){if(W.controllerType.indexOf("slim")>-1&&F===Media.PERSIST_SLIM_CONTROLS){return }W.hide()}},2500)}},videoReceivedLoadEvent:function(Y){if(W){W.updatePercentLoaded(T.percentLoaded())}},videoReceivedEndedEvent:function(Y){var Z=T.time();A=T.duration();if(P){return }if(K&&(Z>=A||(T.movieType()=="Flash"&&Z>=(A-0.5)))){P=true;this.videoReceivedTimeupdateEvent(this);this._send("onMovieFinished");this._send("didEnd");this._fireEvent("QuickTime:end",{controller:this})}},videoReceivedPlayEvent:function(Y){if(J){return }J=true;if(D){D.videoPlay(this.time())}this._send("didStart");this._fireEvent("QuickTime:start",{controller:this})},videoReceivedPauseEvent:function(Y){if(S){return }S=true;if(D){D.videoPause(this.time())}this._send("didStop");this._fireEvent("QuickTime:stop",{controller:this})},videoReceivedTimeupdateEvent:function(Y){var a=this.time(),Z=Math.floor(a);if(W){W.updateTime(a)}if(D){D.updateTime(a)}if(this.rate()<0&&Z<2&&I){this.pause();this.setTime(0.01)}if(this._lastTime!==a){this._fireEvent("QuickTime:didPlayProgress",{controller:this,currentTime:a,duration:this.duration()})}this._lastTime=a},videoReceivedProgressEvent:function(Y){if(W){W.updatePercentLoaded(T.percentLoaded())}},videoReceivedDurationchangeEvent:function(Y){if(W){W.updateRemainingTime(this.duration()-this.time())}},showCaptions:function(){D.show(T)},hideCaptions:function(){D.hide(T)}}};Media.Controller.fireEvent=function(B,C){var A=document.body;if("fire" in A){A.fire(B,C)}};Media.ControlsWidget=function(C,A,B){this.container=C;this.delegate=A;this.options=B;this._createTemplate();this._setupControls()};Media.ControlsWidget.TEMPLATE='<div id="controls">	<div class="ACMediaControllerSpeedDisplay" id="speed-display-container">		<div class="directionDisplay"></div>		<div class="speedDisplay" id="speed-display"></div>	</div>    <div class="mediaControllerPanel" id="controls-panel">		<div class="slim-left-cap"></div>        <div class="ACMediaController" id="mediaController">            <div class="volumeMute" id="volume-mute"></div>            <div class="volumePanel">                <div class="volumeTrack" id="volume-track">                    <div id="control-volume-progress" class="volumeTrackProgress"></div>                    <div class="volumePlayHead" id="volume-handle"></div>                </div>            </div>			<div class="volumeFull" id="volume-full"></div>            <div class="fastBackward" id="control-fastbackward"></div>            <div id="control-play-pause"></div>            <div class="fastForward" id="control-fastforward"></div>			<div class="accessibilitiesMenuControl" id="control-accessibilities-menu"></div>			<div class="sizesMenuControl" id="control-sizes-menu"></div>			<div class="downloadMenuControl" id="control-download-menu"></div>			<div class="shareMenuControl" id="control-share-menu"></div>			<div class="track-container">      	      <div class="timeDisplay" id="control-timeDisplay"><span id="min-played">00</span>:<span id="sec-played">00</span></div>	            <div class="trackPanel">	                <div id="control-track" class="track">	                    <div id="control-loaded-progress" class="loadedProgress"></div>	                    <div id="control-track-progress" class="trackProgress"></div>	                    <div id="control-playhead" class="playHead"></div>	                </div>					<div id="track-end-cap" class="track-right-cap"></div>	            </div>	            <div class="durationDisplay" id="control-durationDisplay">-<span id="min-remain">00</span>:<span id="sec-remain">00</span></div>			</div>            <div class="closedCaptioning"></div>        </div>		<div class="slim-right-cap"></div>    </div></div>';Media.ControlsWidget.show=function(A){if(A.fadeElement&&!A._showing){if(A._effect){try{A._effect.cancel()}catch(B){}delete A._effect}A._showing=true;A._hiding=false;if(A.fadeElement){if(Media.Detection.CSSTransitions()===true){A._effect=function(){Element.removeClassName(A.fadeElement,"fade")};A._effect()}else{A._effect=new Effect.Opacity(A.fadeElement,{to:1,duration:0.5,afterFinish:function(){A._showing=false}})}}}};Media.ControlsWidget.hide=function(A){if(A.fadeElement&&!A._hiding){if(A._effect){try{A._effect.cancel()}catch(B){}delete A._effect}A._hiding=true;A._showing=false;if(A.fadeElement){if(Media.Detection.CSSTransitions()===true){A._effect=function(){Element.addClassName(A.fadeElement,"fade")};A._effect()}else{A._effect=new Effect.Opacity(A.fadeElement,{to:0,duration:0.5,afterFinish:function(){A._hiding=false}})}}}};Media.ControlsWidget.prototype={delegate:null,element:null,_createTemplate:function(){function A(D){var B=document.createElement("div"),C;B.innerHTML=D;C=B.firstChild;return C}this.controllerType="regular";if(Media.Detection.Firefox()||(typeof this.options!="undefined"&&this.options.slimController===true)){Element.addClassName(this.container,"slim");this.controllerType="slim"}if(this.options&&this.options.type&&this.options.type===Media.OVERLAY){if(parseInt(Element.getStyle(this.container,"width"),10)<450){Element.addClassName(this.container,"small-overlay")}}else{if(parseInt(Element.getStyle(this.container,"width"),10)<450){Element.addClassName(this.container,"slim");Element.addClassName(this.container,"short-slim");this.controllerType="short-slim"}}this.container.appendChild(A(Media.ControlsWidget.TEMPLATE));this.element=document.getElementById("controls")},_setupControls:function(){this.fadeElement=C("controls-panel");this.trackEndCap=C("track-end-cap");this.movieLoadingPanelClass="movie-loading-panel_"+this.element.offsetWidth+"x"+this.element.offsetHeight;Element.addClassName(this.element,this.movieLoadingPanelClass);function D(E){if(!E){return }if(E.baseClassName){return }E.baseClassName=E.className}function A(G){D(G);function E(H){Element.addClassName(this,this.baseClassName+"-active")}function F(H){try{Element.removeClassName(this,this.baseClassName+"-active")}catch(I){}}Event.observe(G,"mousedown",E.bind(G));Event.observe(G,"mouseup",F.bind(G));Event.observe(document.documentElement,"mouseup",F.bind(G))}function C(H,L,K){var J,G=L||document,F,E,I;J=G.getElementById(H);if(J){return J}if(document.getElementsByClassName){J=G.getElementsByClassName(H);if(J&&J.length){if(K){return J[0]}return J}}else{J=G.getElementsByTagName("*");E=J.length;F=[];for(I=0;I<E;I+=1){if(!J[I].className){continue}if(J[I].className.indexOf(H)>-1){if(K){return J[I]}F.push(J[I])}}if(F.length>0){return F}}}this.toggleControl=C("control-play-pause");this.playControl=document.createElement("div");Element.addClassName(this.playControl,"play");A(this.playControl);this.playControl.id="play-control";Event.observe(this.playControl,"click",this.play.bind(this));this.playControl.innerHTML="Play";this.playControl.style.display="none";this.pauseControl=document.createElement("div");Element.addClassName(this.pauseControl,"pause");A(this.pauseControl);this.pauseControl.id="pause-control";Event.observe(this.pauseControl,"click",this.pause.bind(this));this.pauseControl.innerHTML="Pause";this.pauseControl.style.display="none";Element.show(this._send("playing")?this.pauseControl:this.playControl);var B=C("control-play-pause");B.appendChild(this.playControl);B.appendChild(this.pauseControl);this.fastBackwardControl=C("control-fastbackward");Event.observe(this.fastBackwardControl,"click",this.fastBackward.bind(this));A(this.fastBackwardControl);this.fastForwardControl=C("control-fastforward");Event.observe(this.fastForwardControl,"click",this.fastForward.bind(this));A(this.fastForwardControl);this.volumeMuteControl=C("volume-mute");Event.observe(this.volumeMuteControl,"click",this.muteVolume.bind(this));A(this.volumeMuteControl);this.volumeFullControl=C("volume-full");Event.observe(this.volumeFullControl,"click",this.fullVolume.bind(this));A(this.volumeFullControl);this.captionsControl=C("closedCaptioning",document,true);Event.observe(this.captionsControl,"click",this.toggleCaptions.bind(this));A(this.captionsControl);this.captionsControl.showControl=function(){this.style.visibility="visible"};this.captionsControl.hideControl=function(){this.style.visibility="hidden"};this.captionsControl.hideControl();this.speedDisplayContainer=C("speed-display-container");this.speedDisplay=C("speed-display");this.volumeThumb=C("volume-handle");this.volumeTrack=C("volume-track");this.volumeProgress=C("control-volume-progress");this.playhead=C("control-playhead");this.track=C("control-track");this.trackProgress=C("control-track-progress");this.controlLoadedProgress=C("control-loaded-progress");this.timeDisplay=C("control-timeDisplay");this.minutesPlayed=C("min-played");this.secondsPlayed=C("sec-played");this.durationDisplay=C("control-durationDisplay");this.minutesRemaining=C("min-remain");this.secondsRemaining=C("sec-remain");D(this.timeDisplay);D(this.durationDisplay);if(!this.volumeScrubber&&this.element!==null){A(this.volumeThumb);this.volumeScrubber=new Control.Slider(this.volumeThumb,this.volumeTrack,{alignX:-3,onSlide:function(E){this._seeking=true;this._send("setVolume",E);this.volumeProgress.style.width=this.volumeThumb.style.left}.bind(this),onChange:function(E){this._seeking=false;this.volumeProgress.style.width=this.volumeThumb.style.left}.bind(this)});this.volumeScrubber.setValue(1);A(this.volumeThumb)}if(!this.scrubber&&this.element!==null){A(this.playhead);this.scrubber=new Control.Slider(this.playhead,this.track,{alignX:-5,onSlide:function(E){if(!this._seeking){this._seeking=true;this._send("beginSeeking");this.resetRate()}this._send("setTime",E*this._send("duration"));this.trackProgress.style.width=this.playhead.style.left}.bind(this),onChange:function(E){if(this._seeking){this._seeking=false;this._send("endSeeking")}this.trackProgress.style.width=this.playhead.style.left}.bind(this)})}},_enableControl:function(A){Element.addClassName(A,A.baseClassName+"-enabled")},_disableControl:function(A){Element.removeClassName(A,A.baseClassName+"-enabled")},reset:function(){this.playhead.style.left="0px";this.trackProgress.style.width=this.playhead.style.left;this.show();Element.show(this.playControl);Element.hide(this.pauseControl);this._disableControl(this.volumeMuteControl);this._disableControl(this.volumeFullControl);this._disableControl(this.volumeThumb);this._disableControl(this.playControl);this._disableControl(this.pauseControl);this._disableControl(this.playhead);this._disableControl(this.fastBackwardControl);this._disableControl(this.fastForwardControl);Element.removeClassName(this.fastBackwardControl,"two-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"four-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"eight-times-fast-backward");Element.removeClassName(this.fastForwardControl,"two-times-fast-forward");Element.removeClassName(this.fastForwardControl,"four-times-fast-forward");Element.removeClassName(this.fastForwardControl,"eight-times-fast-forward");Element.removeClassName(this.fastBackwardControl,"fastBackward-active");Element.removeClassName(this.fastForwardControl,"fastForward-active")},enableBasicControls:function(){Element.hide(this.playControl);Element.show(this.pauseControl);this._enableControl(this.volumeMuteControl);this._enableControl(this.volumeFullControl);this._enableControl(this.volumeThumb);this._enableControl(this.playControl);this._enableControl(this.pauseControl);this._enableControl(this.playhead);this._enableControl(this.fastBackwardControl);this._enableControl(this.fastForwardControl);this._enableControl(this.timeDisplay);this._enableControl(this.durationDisplay)},enableConditionalControls:function(A){if(!A){return }if(A.captions){this._enableControl(this.captionsControl)}},_send:function(B,A){if(this.delegate&&B in this.delegate){A=[].concat(A);return this.delegate[B].apply(this.delegate,A)}},show:function(){Media.ControlsWidget.show(this)},hide:function(){if(this._seeking){return }Media.ControlsWidget.hide(this);Element.removeClassName(this.fastBackwardControl,"two-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"four-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"eight-times-fast-backward");Element.removeClassName(this.fastForwardControl,"two-times-fast-forward");Element.removeClassName(this.fastForwardControl,"four-times-fast-forward");Element.removeClassName(this.fastForwardControl,"eight-times-fast-forward");Element.removeClassName(this.speedDisplayContainer,"fastBackward");Element.removeClassName(this.speedDisplayContainer,"fastForward")},resetRate:function(){if(this._send("rate")!==1){Element.removeClassName(this.fastBackwardControl,"two-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"four-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"eight-times-fast-backward");Element.removeClassName(this.fastForwardControl,"two-times-fast-forward");Element.removeClassName(this.fastForwardControl,"four-times-fast-forward");Element.removeClassName(this.fastForwardControl,"eight-times-fast-forward");Element.removeClassName(this.speedDisplayContainer,"fastBackward");Element.removeClassName(this.speedDisplayContainer,"fastForward");Element.removeClassName(this.fastBackwardControl,"fastBackward-active");Element.removeClassName(this.fastForwardControl,"fastForward-active");this._send("setRate",1)}},play:function(){this.resetRate();this._send("play");Element.hide(this.playControl);Element.show(this.pauseControl)},pause:function(){this.resetRate();this._send("pause");Element.hide(this.pauseControl);Element.show(this.playControl)},togglePlaying:function(){var A=this._send("playing");if(A){this.pause()}else{this.resetRate();this.play()}},fastBackward:function(){var A=this._send("rate");if(this._send("playing")===false){this._send("play")}else{Element.hide(this.pauseControl);Element.show(this.playControl)}switch(A){case -2:this._send("setRate",-4);this.speedDisplay.innerHTML="4x";Element.removeClassName(this.speedDisplay,"two-times-speed-display");Element.removeClassName(this.speedDisplay,"eight-times-speed-display");Element.addClassName(this.speedDisplay,"four-times-speed-display");Element.removeClassName(this.fastBackwardControl,"two-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"eight-times-fast-backward");Element.addClassName(this.fastBackwardControl,"four-times-fast-backward");break;case -4:this._send("setRate",-8);this.speedDisplay.innerHTML="8x";Element.removeClassName(this.speedDisplay,"two-times-speed-display");Element.removeClassName(this.speedDisplay,"four-times-speed-display");Element.addClassName(this.speedDisplay,"eight-times-speed-display");Element.removeClassName(this.fastBackwardControl,"two-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"four-times-fast-backward");Element.addClassName(this.fastBackwardControl,"eight-times-fast-backward");break;default:this._send("setRate",-2);this.speedDisplay.innerHTML="2x";Element.removeClassName(this.speedDisplay,"four-times-speed-display");Element.removeClassName(this.speedDisplay,"eight-times-speed-display");Element.addClassName(this.speedDisplay,"two-times-speed-display");Element.removeClassName(this.fastBackwardControl,"four-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"eight-times-fast-backward");Element.addClassName(this.fastBackwardControl,"two-times-fast-backward");break}Element.removeClassName(this.fastForwardControl,"two-times-fast-forward");Element.removeClassName(this.fastForwardControl,"four-times-fast-forward");Element.removeClassName(this.fastForwardControl,"eight-times-fast-forward");Element.removeClassName(this.speedDisplayContainer,"fastForward");Element.addClassName(this.speedDisplayContainer,"fastBackward");Element.removeClassName(this.fastForwardControl,"fastForward-active");Element.addClassName(this.fastBackwardControl,"fastBackward-active")},fastForward:function(){var A=this._send("rate");if(this._send("playing")===false){this._send("play")}else{Element.hide(this.pauseControl);Element.show(this.playControl)}switch(A){case 2:this._send("setRate",4);this.speedDisplay.innerHTML="4x";Element.removeClassName(this.speedDisplay,"two-times-speed-display");Element.removeClassName(this.speedDisplay,"eight-times-speed-display");Element.addClassName(this.speedDisplay,"four-times-speed-display");Element.removeClassName(this.fastForwardControl,"two-times-fast-forward");Element.removeClassName(this.fastForwardControl,"eight-times-fast-forward");Element.addClassName(this.fastForwardControl,"four-times-fast-forward");break;case 4:this._send("setRate",8);this.speedDisplay.innerHTML="8x";Element.removeClassName(this.speedDisplay,"two-times-speed-display");Element.removeClassName(this.speedDisplay,"four-times-speed-display");Element.addClassName(this.speedDisplay,"eight-times-speed-display");Element.removeClassName(this.fastForwardControl,"two-times-fast-forward");Element.removeClassName(this.fastForwardControl,"four-times-fast-forward");Element.addClassName(this.fastForwardControl,"eight-times-fast-forward");break;default:this._send("setRate",2);this.speedDisplay.innerHTML="2x";Element.removeClassName(this.speedDisplay,"four-times-speed-display");Element.removeClassName(this.speedDisplay,"eight-times-speed-display");Element.addClassName(this.speedDisplay,"two-times-speed-display");Element.removeClassName(this.fastForwardControl,"four-times-fast-forward");Element.removeClassName(this.fastForwardControl,"eight-times-fast-forward");Element.addClassName(this.fastForwardControl,"two-times-fast-forward");break}Element.removeClassName(this.fastBackwardControl,"two-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"four-times-fast-backward");Element.removeClassName(this.fastBackwardControl,"eight-times-fast-backward");Element.removeClassName(this.speedDisplayContainer,"fastBackward");Element.addClassName(this.speedDisplayContainer,"fastForward");Element.removeClassName(this.fastBackwardControl,"fastBackward-active");Element.addClassName(this.fastForwardControl,"fastForward-active")},muteVolume:function(){this._send("setMuted",true);this.volumeScrubber.setValue(0)},fullVolume:function(){this._send("setMuted",false);this._send("setVolume",1);this.volumeScrubber.setValue(1)},updatePercentLoaded:function(A){if(typeof this.controlLoadedProgress!=="undefined"&&A){this.controlLoadedProgress.style.width=A*100+"%"}if(A===1){Element.addClassName(this.trackEndCap,"track-right-cap-loaded");Element.removeClassName(this.trackEndCap,"track-right-cap")}},updateTime:function(A){var B=this._send("duration");if(A===0||A===B){Element.removeClassName(this.fastBackwardControl,"active");Element.removeClassName(this.fastForwardControl,"active")}this.scrubber.setValue((A/B)||0);this.updateElapsedTime(A);this.updateRemainingTime(B-A)},_setTimeForReadout:function(D,B,E){var A=parseInt(D/60,10),C=parseInt(D%60,10);if(A<10){A="0"+A}if(C<10){C="0"+C}B.innerHTML=A;E.innerHTML=C},updateElapsedTime:function(B){var A=this.minutesPlayed,C=this.secondsPlayed;this._setTimeForReadout(B,A,C)},updateRemainingTime:function(B){var A=this.minutesRemaining,C=this.secondsRemaining;this._setTimeForReadout(B,A,C)},toggleCaptions:function(){var B=this.captionsControl,A=this.captionsControl.baseClassName+"-on";if(Element.hasClassName(B,A)){Element.removeClassName(B,A);this._send("hideCaptions")}else{Element.addClassName(B,A);this._send("showCaptions")}}};Media.Preview=function(D){var J=D.container,G=D.url||null,I=D.autoplay||"true",F=D.autosize||"true",P=D.width||640,N=D.height||360,O=D.controller||"false",S=D.delegate||{},E=D.type||null,C=D.captions||null,M=D.controls||false,A=D.onerror||function(){},B=D.button||null,Q=D.border||"4px solid #fff",H=D.shadow||"0 0 6px #999",R=D.background||"#fff",L,K;if(!G){return false}L=Media.create(J,G,{autoplay:I,autosize:F,width:P,height:N,controller:O,controls:M,type:E,captions:C,onerror:A});if(L){K=new Media.ControlsWidget(J,null,{type:E});L.setControlPanel(K);L.setDelegate(S)}return L};if("undefined"===typeof (Control)){var Control={}}Control.Slider=Class.create(coherent.View,{constructor:function(B,A,C){this.thumb=B;this.thumbRect=Element.getRect(B);this.track=A;this.trackRect=Element.getRect(A);this.options=C;this.alignX=parseInt(this.options.alignX||0,10);this.setValue(0);this.base(this.track)},trackWidth:function(){return this.getMaxOffset()-this.getMinOffset()},getMinOffset:function(){return this.trackRect.left+this.alignX},getMaxOffset:function(){return this.trackRect.width},onmousedown:function(B){this.scrubbing=true;var A=B.pageX||B.clientX;if(!(this.thumbRect.left<A&&this.thumbRect.right>A)){this.jumpTrack(A)}this.thumbRect=Element.getRect(this.thumb);this.trackRect=Element.getRect(this.track);this.offset=A-this.thumbRect.left;this.startX=A-this.trackRect.left;if("onBegin" in this.options){this.options.onBegin(this.value)}},onmousedrag:function(B){var A=B.pageX||B.clientX,E=(A-this.trackRect.left-this.offset),C=E/(this.trackRect.width-this.thumbRect.width);Event.stop(B);if(window.getSelection){var D=window.getSelection();if(D&&D.removeAllRanges){D.removeAllRanges()}}else{if(document.selection&&document.selection.empty){document.selection.empty()}}this.setValue(C);if("onSlide" in this.options){this.options.onSlide(this.value)}},onmouseup:function(A){this.scrubbing=false;if("onChange" in this.options){this.options.onChange(this.value)}},setValue:function(C){C=Math.max(0,Math.min(C,1));var A=this.value;this.value=C;var B=C*(this.trackRect.width-this.thumbRect.width)-this.alignX;this.thumb.style.left=Math.round(B)+"px";if(!this.scrubbing&&C!=A){if("onChange" in this.options){this.options.onChange(C)}}},jumpTrack:function(C){var B=C-this.trackRect.left-(this.thumbRect.width/2);var A=B/(this.trackRect.width-this.thumbRect.width);this.setValue(A);if("onSlide" in this.options){this.options.onSlide(this.value)}}});Media.Detection.QuickTime=function(A){return apple.quicktime.isVersionCompatible(A)};Media.Detection.Flash=function(A){return false};Media.Detection.Mobile=function(){return coherent.Browser.MobileSafari};Media.Detection.IE=function(){return coherent.Browser.IE};Media.Detection.Firefox=function(){return coherent.Browser.Mozilla};Media.ControlsWidget.show=function(A){if(A.fadeElement&&!A._showing){A._hiding=false;A._showing=true;if(Media.Detection.CSSTransitions()){Element.removeClassName(A.fadeElement,"fade")}else{coherent.Animator.setStyles(A.fadeElement,{opacity:1},{duration:100,callback:function(){A._showing=false}})}}};Media.ControlsWidget.hide=function(A){if(A.fadeElement&&!A._hiding){A._showing=false;A._hiding=true;if(Media.Detection.CSSTransitions()){Element.addClassName(A.fadeElement,"fade")}else{coherent.Animator.setStyles(A.fadeElement,{opacity:0},{duration:100,callback:function(){A._hiding=false}})}}};
