if(typeof (AC)=="undefined"){AC={};}AC.Quicktime={controllers:[],packageMovie:function(S,U,m){function y(X,b,D){if(!X){return ;}var T=document.createElement("param");T.setAttribute("value",D);T.setAttribute("name",b);X.appendChild(T);}function a(D,b,X){var L=document.createElement("object");if(AC.Detector.isiPhone()&&X.posterFrame){y(L,"src",X.posterFrame);y(L,"href",b);y(L,"target","myself");}else{y(L,"src",b);}L.setAttribute("id",D);var T="6,0,2,0";if(null!=X&&""!=X.codebase&&typeof (X.codebase)!="undefined"){T=X.codeBase;}L.setAttribute("codebase","http://www.apple.com/qtactivex/qtplugin.cab#version="+T);return L;}function B(T,X,D){var b=document.createElement("object");b.setAttribute("type","video/quicktime");b.setAttribute("data",X);b.setAttribute("id",T+"Inner");return b;}function k(){if(null==m||typeof (m)=="undefined"){return false;}for(var X in m){var b=X.toLowerCase();switch(b){case ("type"):case ("src"):case ("data"):case ("classid"):case ("name"):case ("id"):break;case ("class"):Element.addClassName(H,m[X]);break;case ("innerId"):if(V){V.setAttribute("id",m[X]);}break;case ("width"):case ("height"):H.setAttribute(b,m[X]);if(V){V.setAttribute(b,m[X]);}break;default:y(H,b,m[X]);y(V,b,m[X]);break;}}}if(S==null||U==null){throw new TypeError("Valid Name and File URL are required arguments.");}var H=a(S,U,m);if(!AC.Detector.isIEStrict()){var V=B(S,U,m);try{H.appendChild(V);H.inner=V;}catch(c){}}else{Event.observe(window,"unload",function(){try{H.Stop();}catch(b){}H.style.display="none";H=null;});}k();y(H,"saveembedtags",true);y(V,"saveembedtags",true);H.setAttribute("classid","clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B");H.toMarkup=function(){if(!H.outerHTML){return ;}var b="";b=H.outerHTML.replace("</OBJECT>","");for(var X=0;X<H.childNodes.length;X++){b+=H.childNodes[X].outerHTML;}b+="</OBJECT>";return b;};return H;},swapMovie:function(S,V,k){var H=AC.Detector.isIEStrict();if(H&&V){V.style.display="none";}Element.removeAllChildNodes(S);var a=null;if(!H){S.appendChild(k);a=k;}else{S.innerHTML=k.toMarkup();a=S.firstChild;a.style.display="block";}return a;},render:function(H,a,X){var c=$(a);var k=c.innerHTML;if(!AC.Detector.isQTInstalled()){Element.addClassName(c,"static");return ;}c.innerHTML="";Element.addClassName(c,"loading");c.appendChild(H);var B=function(D,T){return (function(){Element.removeClassName(D,"loading");D.innerHTML="";D.innerHTML=T;});};var X=X?X:{};var V=6000;if("delay" in X){V=X.delay;}if(!AC.Detector.isOpera()){var m=setTimeout(B(c,k),V);}var U=function(){b.monitorMovie();Element.removeClassName(a,"loading");Element.addClassName(a,"loaded");clearTimeout(m);};var y=function(){return ;};if("finishedState" in X){var S=function(T,D){return (function(){b.detachFromMovie();H.style.display="none";H=null;T.innerHTML="";if(typeof (D)=="string"){T.innerHTML=D;}else{T.appendChild(D);}});};y=S(c,X.finishedState);}var b=new AC.QuicktimeController(H,{onMoviePlayable:U,onMovieFinished:y});}};AC.QuicktimeController=Class.create();AC.QuicktimeController.prototype={movie:null,options:null,movieAttacher:null,attachDelay:10,movieWatcher:null,monitorDelay:400,currentTime:0,percentLoaded:0,movieSize:0,allowAttach:true,controllerPanel:null,currentControl:null,playControl:null,pauseControl:null,slider:null,track:null,playHead:null,loadedProgress:null,isJogging:false,hardPaused:false,duration:0,finished:false,playing:false,initialize:function(S,k){if(typeof (S)!="undefined"){this.attachToMovie(S,k);}Event.observe(window,"unload",function(){this.detachFromMovie();this.movie=null;}.bind(this));},attachToMovie:function(S,H){this.options=H||{};Event.observe(window,"unload",function(){this.detachFromMovie();}.bind(this));var k=function(B,V){if(!this.allowAttach){return ;}var a="";try{this.movie=S;a=this.movie.GetPluginStatus();}catch(y){try{this.movie=S.inner;a=this.movie.GetPluginStatus();}catch(y){this.movie=null;}}var c=new Date().getTime()-V;if(a=="Playable"||a=="Complete"){clearInterval(this.movieAttacher);if(!this.alreadyRecorded){AC.Quicktime.controllers.push(this);this.alreadyRecorded=true;}if(typeof (B)=="function"){B();}}else{if(a&&a.match(/error/i)||c>10000){clearInterval(this.movieAttacher);}}};clearInterval(this.movieAttacher);if(null==document.getElementById(S.id)){throw new ReferenceError("Movie has to be appended to document prior to initializing controller.");}this.movieAttacher=setInterval(k.bind(this,this.options.onMoviePlayable,new Date().getTime()),this.attachDelay);},detachFromMovie:function(){this.allowAttach=false;clearInterval(this.movieAttacher);clearTimeout(this.movieWatcher);AC.Quicktime.controllers=AC.Quicktime.controllers.without(this);this.movie=null;this.reset();this.allowAttach=true;},reset:function(){this.duration=0;this.movieSize=0;this.percentLoaded=0;if(this.slider){this.slider.setValue(0);this.slider.trackLength=this.slider.maximumOffset()-this.slider.minimumOffset();}},render:function(S){this.controllerPanel=document.createElement("div");Element.addClassName(this.controllerPanel,"ACQuicktimeController");this.playControl=document.createElement("div");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,"control");Element.addClassName(this.pauseControl,"pause");this.pauseControl.innerHTML="Pause";this.pauseControl.onclick=this.Stop.bind(this);var k=false;if(null!=this.movie){k=this.GetAutoPlay();}this.currentControl=(k)?this.pauseControl:this.playControl;this.controllerPanel.appendChild(this.currentControl);this.sliderPanel=document.createElement("div");Element.addClassName(this.sliderPanel,"sliderPanel");this.track=document.createElement("div");Element.addClassName(this.track,"track");this.sliderPanel.appendChild(this.track);this.loadedProgress=document.createElement("div");Element.addClassName(this.loadedProgress,"loadedProgress");this.track.appendChild(this.loadedProgress);this.trackProgress=document.createElement("div");Element.addClassName(this.trackProgress,"trackProgress");this.track.appendChild(this.trackProgress);this.playHead=document.createElement("div");Element.addClassName(this.playHead,"playHead");this.track.appendChild(this.playHead);this.controllerPanel.appendChild(this.sliderPanel);if(S){$(S).appendChild(this.controllerPanel);if(this.movie){this.monitorMovie();}}return this.controllerPanel;},monitorMovie:function(){function S(H){return (function(){if(H.controllerPanel!==null){var y=H.isPlaying()&&(H.currentControl==H.playControl);var c=!H.isPlaying()&&(H.currentControl==H.pauseControl);if(!H.isJogging&&y){H.controllerPanel.replaceChild(H.pauseControl,H.currentControl);H.currentControl=H.pauseControl;}else{if(!H.isJogging&&c){H.controllerPanel.replaceChild(H.playControl,H.currentControl);H.currentControl=H.playControl;}}if(H.percentLoaded<=1){var a=Element.getDimensions(H.track).width;var B=H.GetMaxBytesLoaded()/H.GetMovieSize();if(!isNaN(B)&&0!==B){H.percentLoaded=B;}var V=a*H.percentLoaded;Element.setStyle(H.loadedProgress,{width:V+"px"});}if(H.isPlaying()){H.slider.setValue(H.GetTime()/H.GetDuration());}}if(H.isPlaying()){if(!H.playing){H.playing=true;if(typeof (H.options.onMovieStart)=="function"){H.options.onMovieStart();}}}else{if(H.playing){H.playing=false;if(typeof (H.options.onMovieStop)=="function"){H.options.onMovieStop();}}}if(H.isFinished()){if(!H.finished){if(typeof (H.options.onMovieFinished)=="function"){H.options.onMovieFinished();}H.finished=true;}}else{H.finished=false;}if(H.movie!==null){H.movieWatcher=setTimeout(k,H.monitorDelay);}});}var k=S(this);if(this.controllerPanel!==null){this.slider=new Control.Slider(this.playHead,this.track,{onSlide:function(H){if(isNaN(H)){return ;}this.trackProgress.style.width=this.slider.translateToPx(H);try{this.movie.Stop();this.isJogging=true;this.SetTime(H*this.GetDuration());}catch(a){}}.bind(this),onChange:function(H){if(isNaN(H)){return ;}this.trackProgress.style.width=this.slider.translateToPx(H);if(!this.isPlaying()&&!this.hardPaused&&!this.isFinished()){try{this.movie.Play();}catch(a){}}this.isJogging=false;}.bind(this)});}this.movieWatcher=setTimeout(k,this.monitorDelay);},Play:function(){if(null!=this.movie){this.hardPaused=false;this.movie.Play();}},Stop:function(){this.hardPaused=true;this.movie.Stop();},Rewind:function(){if(null!=this.movie){this.movie.Stop();this.movie.Rewind();}},Step:function(S){this.movie.Step(S);},ShowDefaultView:function(){this.movie.ShowDefaultView();},GoPreviousNode:function(){this.movie.GoPreviousNode();},GetQuicktimeVersion:function(){return this.movie.GetQuickTimeVersion();},GetQuicktimeLanguage:function(){return this.movie.GetQuicktimeLanguage();},GetQuicktimeConnectionSpeed:function(){return this.movie.GetQuicktimeConnectionSpeed();},GetIsQuickTimeRegistered:function(){return this.movie.GetIsQuickTimeRegistered();},GetComponentVersion:function(){return this.movie.GetComponentVersion();},GetPluginVersion:function(){return this.movie.GetPluginVersion();},ResetPropertiesOnReload:function(){this.movie.ResetPropertiesOnReload();},GetPluginStatus:function(){return this.movie.GetPluginStatus();},GetAutoPlay:function(){return this.movie.GetAutoPlay();},SetAutoPlay:function(S){this.movie.SetAutoPlay(S);},GetControllerVisible:function(){return this.movie.GetControllerVisible();},SetControllerVisible:function(S){this.movie.SetControllerVisible(S);},GetRate:function(){return this.movie.GetRate();},SetRate:function(S){this.movie.SetRate();},GetTime:function(){var k=0;try{k=this.movie.GetTime();}catch(S){}if(0===k){k=this.currentTime+this.monitorDelay;}else{this.currentTime=k;}return k;},SetTime:function(S){this.movie.SetTime(S);},GetVolume:function(){return this.movie.GetVolume();},SetVolume:function(S){this.movie.SetVolume(S);},GetMute:function(){return this.movie.GetMute();},SetMute:function(S){this.movie.SetMute();},GetMovieName:function(){return this.movie.GetMovieName();},SetMovieName:function(S){this.movie.SetMovieName(S);},GetMovieID:function(){return this.movie.GetMovieID();},SetMovieID:function(S){this.movie.SetMovieID(S);},GetStartTime:function(){return this.movie.GetStartTime();},SetStartTime:function(S){this.movie.SetStartTime(S);},GetEndTime:function(){return this.movie.GetEndTime();},SetEndTime:function(S){this.movie.SetEndTime(S);},GetBgColor:function(){return this.movie.GetBgColor();},SetBgColor:function(S){this.movie.SetBgColor(S);},GetIsLooping:function(){return this.movie.GetIsLooping();},SetIsLooping:function(S){this.movie.SetIsLooping(S);},GetLoopIsPalindrome:function(){return this.movie.GetLoopIsPalindrome();},SetLoopIsPalindrome:function(S){this.movie.SetLoopIsPalindrome(S);},GetPlayEveryFrame:function(){return this.movie.GetPlayEveryFrame();},SetPlayEveryFrame:function(S){this.movie.SetPlayEveryFrame(S);},GetHREF:function(){return this.movie.GetHREF();},SetHREF:function(S){this.movie.SetHREF(S);},GetTarget:function(){return this.movie.GetTarget();},SetTarget:function(S){this.movie.SetTarget(S);},GetQTNEXTUrl:function(){return this.movie.GetQTNEXTUrl();},SetQTNEXTUrl:function(k,S){this.movie.SetQTNEXTUrl(k,S);},GetURL:function(){return this.movie.GetURL();},SetURL:function(S){this.movie.SetURL(S);this.reset();},GetKioskMode:function(){return this.movie.GetKioskMode();},SetKioskMode:function(S){this.movie.SetKioskMode(S);},GetDuration:function(){if(null==this.duration||0===this.duration){try{this.duration=this.movie.GetDuration();}catch(S){this.duration=null;}}return this.duration;},GetMaxTimeLoaded:function(){return this.movie.GetMaxTimeLoaded();},GetTimeScale:function(){return this.movie.GetTimeScale();},GetMovieSize:function(){if(0===this.movieSize){this.movieSize=this.movie.GetMovieSize();}return this.movieSize;},GetMaxBytesLoaded:function(){return this.movie.GetMaxBytesLoaded();},GetTrackCount:function(){return this.movie.GetTrackCount();},GetMatrix:function(){return this.movie.GetMatrix();},SetMatrix:function(S){this.movie.SetMatrix(S);},GetRectangle:function(){return this.movie.GetRectangle();},SetRectangle:function(S){this.movie.SetRectangle(S);},GetLanguage:function(){return this.movie.GetLanguage();},SetLanguage:function(S){this.movie.SetLanguage(S);},GetMIMEType:function(){return this.movie.GetMIMEType();},GetUserData:function(S){return this.movie.GetUserData(S);},GetIsVRMovie:function(){return this.movie.GetIsVRMovie();},GetHotspotUrl:function(S){return this.movie.GetHotspotUrl(S);},SetHotspotUrl:function(S,k){this.movie.SetHotspotUrl(S,k);},GetHotspotTarget:function(S){return this.movie.GetHotspotTarget(S);},SetHotspotTarget:function(S,k){this.movie.SetHotspotTarget(S,k);},GetPanAngle:function(){return this.movie.GetPanAngle();},SetPanAngle:function(S){this.movie.SetPanAngle(S);},GetTiltAngle:function(){return this.movie.GetTiltAngle();},SetTiltAngle:function(S){this.movie.SetTiltAngle(S);},GetFieldOfView:function(){return this.movie.GetFieldOfView();},SetFieldOfView:function(S){this.movie.SetFieldOfView(S);},GetNodeCount:function(){return this.movie.GetNodeCount();},SetNodeID:function(S){this.movie.SetNodeID(S);},GetTrackName:function(S){return this.movie.GetTrackName(S);},GetTrackType:function(S){return this.movie.GetTrackType(S);},GetTrackEnabled:function(S){return this.movie.GetTrackEnabled(S);},SetTrackEnabled:function(k,S){this.movie.SetTrackEnabled(k,S);},GetSpriteTrackVariable:function(k,S){return this.movie.GetSpriteTrackVariable(k,S);},SetSpriteTrackVariable:function(k,S){this.movie.SetSpriteTrackVariable(k,S);},isPlaying:function(){var S=false;try{S=this.movie.GetRate()!==0;}catch(k){}return S;},isFinished:function(){var H=true;var S=false;try{H=this.movie.GetRate()===0;S=this.movie.GetTime()==this.GetDuration();}catch(k){return false;}return H&&S;},toggle:function(){if(this.isPlaying()){this.Stop();}else{this.Play();}}};
