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