AC.QuickTime.CircularController=Class.create();Object.extend(AC.QuickTime.CircularController.prototype,AC.QuickTime.Controller.prototype);
Object.extend(AC.QuickTime.CircularController.prototype,{setProgressColor:function(a){this._progressColor=a;
this._rgbaProgressColor=this.makeRGBA(a.red,a.green,a.blue,a.alpha)},makeRGBA:function(){return"rgba("+[].slice.call(arguments,0).join(",")+")"
},clearFrame:function(a){a.clearRect(0,0,a.canvas.clientWidth,a.canvas.clientHeight)
},loadingAnimation:function(b,l,a,i,p,f){var q=true,j=0,d=360/l,o=null,h=(Math.PI/180),m=this;
function c(r,s,t){r.fillStyle=m.makeRGBA(f.red,f.green,f.blue,(s+f.alpha)/(l));
r.beginPath();r.arc(0,0,i,h*-5,h*-25,true);r.arc(0,0,i+p.height,h*-25,h*-5,false);
r.closePath();r.fill()}function g(r){return 2*r*Math.PI/l}function n(r){angle=g(r);
return{y:(i*Math.cos(-angle)),x:(i*Math.sin(-angle)),angle:angle}}function k(r,v){m.clearFrame(r);
if(!o){r.save();r.translate(a.x,a.y);for(var s=0;s<l;s++){var t=(v+s)%l;r.save();
r.rotate(g(t));c(b,s,v);r.restore()}if(o){o.src=r.canvas.toDataURL()}r.restore()
}else{r.save();var u=g((v%l));r.translate((r.canvas.width/2),(r.canvas.height/2));
r.rotate(u);r.drawImage(o,-(r.canvas.width/2),-(r.canvas.height/2),r.canvas.width,r.canvas.height);
r.restore()}}var e={stop:function(){this.animating=false;window.clearTimeout(this.animatingTimeout);
m.clearFrame(b)},start:function(){this.animating=true;this.nextAnimation(0)},nextAnimation:function(){if(!this.animating){return
}j=(j+1)%l;k(b,j);var r=this;if(this.animatingTimeout){window.clearTimeout(this.animatingTimeout)
}this.animatingTimeout=setTimeout(function(){r.nextAnimation()},100)}};return e
},superStartLoadingIndicator:AC.QuickTime.CircularController.prototype._startLoadingIndicator,_startLoadingIndicator:function(a){this.superStartLoadingIndicator(a);
var b=this;this.launchLoadingAnimation()},superStopLoadingIndicator:AC.QuickTime.CircularController.prototype._stopLoadingIndicator,_stopLoadingIndicator:function(a){this.superStopLoadingIndicator(a);
this._loadingAnimation.stop()},launchLoadingAnimation:function(){var e=this._controlRadius?this._controlRadius:(this._controlRadius=this.playControl.clientWidth/2),a=this._controllerRadius?this._controllerRadius:(this._controllerRadius=this.controllerPanel.clientWidth/2),f=(a-e),d=f*0.6,b=e+(f*0.08),c=this._animationCanvas;
c.width=c.clientWidth;c.height=c.clientHeight;c.style.cssText="background:#transparent; position: absolute";
this.setProgressColor({red:50,green:50,blue:51,alpha:0.8});this._loadingAnimation=this.loadingAnimation(c.getContext("2d"),12,{x:(c.width/2),y:(c.height/2)},b,{width:4,height:d},this._progressColor);
this._loadingAnimation.start()},render:function(a){if(typeof a!=="undefined"&&!$(a)){throw new Error("Specified container ID, '"+a+"' not found in DOM")
}this.controllerPanel=$(document.createElement("div"));Element.addClassName(this.controllerPanel,"ACQuicktimeCircularController panel");
this.controllerPanel.appendChild((this._animationCanvas=document.createElement("canvas")));
if(typeof G_vmlCanvasManager!=="undefined"){this._animationCanvas=G_vmlCanvasManager.initElement(this._animationCanvas)
}this.controllerPanel.appendChild((this._backroundElement=document.createElement("div")));
Element.addClassName(this._backroundElement,"ACQuicktimeCircularController");Element.addClassName(this._backroundElement,"background");
this.playControl=document.createElement("div");Element.addClassName(this.playControl,"ACQuicktimeCircularController");
Element.addClassName(this.playControl,"control");Element.addClassName(this.playControl,"play");
this.playControl.innerHTML="Play";this.playControl.onclick=this.Play.bind(this);
this.pauseControl=document.createElement("div");Element.addClassName(this.pauseControl,"ACQuicktimeCircularController");
Element.addClassName(this.pauseControl,"control");Element.addClassName(this.pauseControl,"pause");
this.pauseControl.innerHTML="Pause";this.pauseControl.onclick=this.Stop.bind(this);
var b=document.createElement("div");Element.addClassName(b,"background");this.playControl.appendChild(b);
b=document.createElement("div");Element.addClassName(b,"background");this.pauseControl.appendChild(b);
var c=false;if(null!==this.movie){c=this.GetAutoPlay()}this.currentControl=(c)?this.pauseControl:this.playControl;
this.controllerPanel.appendChild(this.currentControl);if(a){$(a).appendChild(this.controllerPanel);
if(this.delegate&&typeof this.delegate.didRenderController==="function"){this.delegate.didRenderController(this)
}this._eventSource.fire("QuickTime:didRenderController",{controller:this});if(this.movie){this.monitorMovie()
}}return this.controllerPanel},drawPlayingProgress:function(d,f){var b=this._animationCanvas.getContext("2d"),a,c;
if(!AC.Detector.isIEStrict()){b.canvas.width=2*b.canvas.clientWidth;b.canvas.height=2*b.canvas.clientHeight
}a=c=b.canvas.width/2;if(d===f){this.clearFrame(b)}else{var g=-Math.PI/2,e=g+((d/f)*Math.PI*2);
b.beginPath();b.moveTo(a,a);b.arc(a,a,c,g,e,false);b.closePath();b.strokeStyle=b.fillStyle=this._rgbaProgressColor;
b.fill();b.stroke()}},superDidPlayProgress:AC.QuickTime.CircularController.prototype._didPlayProgress,_didPlayProgress:function(a,b){this.drawPlayingProgress(a,b);
this.superDidPlayProgress(a,b)},updateController:function(a){if(!this.controllerPanel){return
}if(this.isJogging||this.isPlaying()){var d=this.currentTime,b=this.GetTime(),c=this.GetDuration();
if(!isNaN(d)&&!isNaN(b)&&d!==b){this._didPlayProgress(b,c)}}},monitorMovie:function(){if(!this.movie){throw new Error("Cannot begin monitoring until attached to a movie")
}this.state.monitorMovie.call(this);this._hasBegunMonitoring=true},super_attach:AC.QuickTime.Controller.prototype._attach,_attach:function(a){this.super_attach(a);
if(this._shouldStop){this.Stop();this._shouldStop=false}},superPlay:AC.QuickTime.Controller.prototype.Play,Play:function(){if(this.controllerPanel){this.controllerPanel.replaceChild(this.pauseControl,this.currentControl);
this.currentControl=this.pauseControl}var a=this;this._shouldStop=false;a.superPlay()
},Stop:function(){if(null!==this.movie){try{this.movie.Stop();if(this.controllerPanel){this.controllerPanel.replaceChild(this.playControl,this.currentControl);
this.currentControl=this.playControl}this.Rewind();this.reset()}catch(a){}}else{this._shouldStop=true
}},superReset:AC.QuickTime.Controller.prototype.reset,reset:function(){this.superReset();
this._didPlayProgress(this.GetDuration(),this.GetDuration())},superattachToMovie:AC.QuickTime.Controller.prototype.attachToMovie,attachToMovie:function(a,b){this.superattachToMovie(a,b)
}});