/* 
CaptivateController()
Version 0.9.2, works with Adobe Captivate 2, 3, 4 & 5
Copyright (c) 2009-2010 Philip Hutchison
http://pipwerks.com/lab/captivate
MIT-style license. Full license text can be found at 
http://www.opensource.org/licenses/mit-license.php
*/
var CaptivateController=function(m,l){if(typeof m==="undefined"){return false;}var f="cpSkinLoader_mc.",n="rdcmnd",p="cpCmnd",r,z="undefined",y="unknown",o="number",g=true,q=false,h=this,e=null,x="",t=q,d="",b="GetVariable",u="SetVariable",c="CaptivateVersion",a=q,j=q,v=document.getElementById(m);if(!v){return q;}var s=function(){var W=null,A=null,C=null,L=null,S=null,F=null,K=q,Z=q,V=q,X,D,E,H,Y,R;if(typeof v.cpEIGetValue!==z){try{C=v.cpEIGetValue(c);}catch(Q){}try{L=v.cpEIGetValue(f+c);}catch(P){}}if(typeof v.cpGetValue!==z){try{W=v.cpGetValue(c);}catch(N){}try{A=v.cpGetValue(f+c);}catch(M){}}if(typeof v.GetVariable!==z){try{S=v.GetVariable(c);}catch(J){}try{F=v.GetVariable(f+c);}catch(I){}}X=typeof S;D=typeof F;E=typeof W;H=typeof A;Y=typeof C;R=typeof L;V=(X!==z&&X!==y&&S!==null)||(D!==z&&D!==y&&F!==null)||q;K=((E!==z&&E!==y&&W!==null)||(H!==z&&H!==y&&A!==null))||q;Z=((Y!==z&&Y!==y&&C!==null)||(R!==z&&R!==y&&L!==null))||q;x=(Z)?C||L||q:(K)?W||A||q:S||F||q;t=(x!==q);if(!t){return q;}e=parseInt(x.replace(/v/gi,"").split(".")[0],10);a=(e>4||(e>3&&!V));if(Z){b="cpEIGetValue";u="cpEISetValue";}else{if(K){b="cpGetValue";u="cpSetValue";}}if(!l){var O=(e>3)?"isCPMovie":"rdIsMainMovie",B=q;try{var T=v[b](f+O),G=typeof T;B=(G!==z&&G!==y&&T!==null);}catch(U){}l=B;}d=(l)?f:"";r=(e>3)?p:n;};var w=function(){if(e===null){s();}return t;};var k=function(B,A){if(!w()){return q;}if(typeof A===z){A=1;}switch(B){case"pause":B=n+"Pause";break;case"resume":B=n+"Resume";break;case"next":B=n+"NextSlide";break;case"previous":B=n+"Previous";break;case"rewindAndStop":if(e===5){B=r+"GotoSlide";A=0;}else{B=n+"RewindAndStop";}break;case"rewindAndPlay":B=(e===5)?q:n+"RewindAndPlay";if(e===5){v[u](d+n+"Pause",1);B=n+"GotoFrameAndResume";}else{B=n+"RewindAndPlay";}break;case"gotoSlideAndPlay":if(!j){A=A-1;}v[u](d+r+"GotoSlide",A);B=r+"Resume";A=1;break;case"gotoSlideAndStop":if(!j){A=A-1;}B=r+"GotoSlide";break;case"gotoFrameAndPlay":v[u](d+n+"Pause",1);B=n+"GotoFrameAndResume";break;case"gotoFrameAndStop":B=n+"GotoFrame";break;case"volume":B=p+"Volume";break;case"mute":B=r+"Mute";break;case"unmute":B=r+"Mute";A=0;break;case"muteAndShowCaptions":v[u](d+r+"Mute",1);B=r+"CC";break;case"unmuteAndHideCaptions":v[u](d+r+"Mute",0);B=r+"CC";A=0;break;case"showCaptions":B=r+"CC";break;case"hideCaptions":B=r+"CC";A=0;break;case"info":B=(e===5)?q:n+"Info";break;case"hidePlaybar":B=(e>3)?p+"ShowPlaybar":n+"HidePlaybar";A=(e>3)?0:1;break;case"showPlaybar":B=(e>3)?p+"ShowPlaybar":n+"HidePlaybar";A=(e>3)?1:0;break;case"lockTOC":B=(e>3)?"cpLockTOC":q;break;case"unlockTOC":B=(e>3)?"cpLockTOC":q;A=0;break;case"exit":B=n+"Exit";break;default:B=q;}if(B){v[u](d+B,A);}return h;};var i=function(B,A){if(!w()){return q;}var L=null,K=(typeof A!==z&&A)?"":d;switch(B){case"rdinfoHasPlaybar":try{L=v[b](B);}catch(I){}if(typeof L===z||L===null){try{L=v[b](K+B);}catch(H){}}L=(typeof L!==z)?L:q;break;case"playbarHeight":case"playbarPosition":if(!a){try{L=v.GetVariable(B);}catch(G){try{L=v.GetVariable(K+B);}catch(F){}}}else{if(e===5){K="";}L=v[b](K+B);}break;case"movieXML":case"PlaybarProperties":try{L=v.cpEIXMLGetValue(K+B);}catch(E){}if(typeof L===z||L===null){try{L=v.cpEIXMLGetValue(B);}catch(D){}}break;default:try{L=v[b](K+B);}catch(C){}if(typeof L===z||L===null){try{L=v[b](B);}catch(J){}}}return(typeof L!==z)?L:null;};this.swf=v;this.useZeroIndex=function(A){j=(A)?g:q;};this.pause=function(){return k("pause");};this.resume=function(){return k("resume");};this.next=function(){return k("next");};this.previous=function(){return k("previous");};this.rewindAndStop=function(){return k("rewindAndStop");};this.rewindAndPlay=function(){return k("rewindAndPlay");};this.gotoSlideAndStop=function(A){if(typeof A===o){return k("gotoSlideAndStop",A);}};this.gotoSlideAndPlay=function(A){if(typeof A===o){return k("gotoSlideAndPlay",A);}};this.gotoFrameAndStop=function(A){if(typeof A===o){return k("gotoFrameAndStop",A);}};this.gotoFrameAndPlay=function(A){if(typeof A===o){return k("gotoFrameAndPlay",A);}};this.showInfoBox=function(){return k("info");};this.exit=function(){return k("exit");};this.lockTOC=function(){return k("lockTOC");};this.unlockTOC=function(){return k("unlockTOC");};this.hidePlaybar=function(){return k("hidePlaybar");};this.showPlaybar=function(){return k("showPlaybar");};this.mute=function(){return k("mute");};this.unmute=function(){return k("unmute");};this.muteAndShowCaptions=function(){return k("muteAndShowCaptions");};this.unmuteAndHideCaptions=function(){return k("unmuteAndHideCaptions");};this.showCaptions=function(){return k("showCaptions");};this.hideCaptions=function(){return k("hideCaptions");};this.volume=function(A){if(w()&&(e>3)){if(typeof A===o){k("volume",A);}return i("cpCmndVolume");}return null;};this.query=function(A){return i(A);};this.queryExternalSkin=function(A){return i(A,g);};this.captivateVersion=function(){return(w())?e:q;};this.asVersion=function(){return(w())?(a)?3:2:q;};this.hasSkinSWF=function(){return(w())?l:q;};this.hasTOC=function(){return(w()&&i("NoOfTOCEntries")!==null)?g:q;};this.width=function(){return(w()&&(e>3))?i("cpMovieWidth"):v.TGetProperty("/",8);};this.height=function(){return(w()&&(e>3))?i("cpMovieHeight"):v.TGetProperty("/",9);};this.FPS=function(){if(!w()){return q;}return i("rdinfoFPS")||i("cpInfoFPS")||"";};this.hasPlaybar=function(){if(!w()){return q;}if(e>3){return(i("cpInfoHasPlaybar"))?g:q;}return(i("rdinfoHasPlaybar"))?g:q;};this.percentLoaded=function(){return v.PercentLoaded();};this.getname=function(){return v.TGetProperty("/",13);};this.geturl=function(){return v.TGetProperty("/",15);};return this;};