/*************************** econtioPlayer.js *******************************
**** Version 3.02.0001
**** last changed 24.02.2011
**** (c) 2007/2008 Bernd Rudolf, econtio GmbH, www.econtio.de
****************************************************************************/
var ePlayerList=new Object();var playerTypes=new Object();function extendPlayerVars(a){a.currentURL="";a.playState=0;a.playStateCode=0;a.bHasBeenStarted=false;a.playerInterval=null;a.networkInterval=null;a.seekInterval=null;a.bTCJump=false;a.TCJump="";a.bBuffering=false;a.bMute=false;a.bDebug=false;a.pTime=250;a.sTime=1000;a.intervalTime=a.pTime;a.framesSkipped=0;a.dropsPerMinute=[0,0,0,0,0];a.dropLimit=20;a.fallbackTime=null;a.OldState=0;a.mainDebugElement=mainDebugElement;a.panel=null;a.globalStatus=null;a.playFromTC=null;a.timeTotal=null;a.timeElapsed=null;a.currTC=null;a.bUserPause=false;a.bFastForward=false;a.bFastReverse=false;a.selLanguage="de";a.initVolume=100;a.currentVolume=100;a.customPlaylist=[];a.playlistCounter=0;a.loopPlaylist=false;a.bAutostart=false;a.storedTC=["00:00:00:00"];a.sendPlayerCommand=function(b,c){switch(b){case"PLAY":this.play();break;case"PAUSE":this.pause();break;case"SETTC":if(typeof(c)=="object"){this.setTC(c[0],c[1]);}else{this.setTC(c);}break;case"SETSTOREDTC":this.setStoredTC(c);break;case"TOGGLEPAUSE":this.togglePause();break;case"TOGGLEUSERPAUSE":this.toggleUserPause();break;case"STOP":this.stop();break;case"MUTE":this.mute(c);break;case"TOGGLEMUTE":this.toggleMute();break;case"VOLUME":this.volume(c);break;case"PLAYFROM":this.playFromTC=c;this.play();break;case"GOTONEXTEVENT":if(this.timeLine){if(tc=this.timeLine.findNextEvent(c)){}this.setTC(tc);}break;case"GOTOLASTEVENT":if(this.timeLine){if(tc=this.timeLine.findLastEvent(c)){}this.setTC(tc);}break;default:break;}};a.setStoredTC=function(b){b=parseInt(b);if(!!this.storedTC[this.storedTC.length-1+b]){this.setTC(this.storedTC[this.storedTC.length-1+b]);}};}playerTypes.MediaPlayer=function(c,a,b,d){this.name="";this.type="MediaPlayer";this.version="2.04.0003";this.playerName=c;this.windowlessVideo=false;this.uiMode=false;this.stretchToFit=true;this.bMP11Bugfix=false;extendPlayerVars(this);this.currentPlayListItem=null;this.debugElement=a.newSubElement("debugMPlayer",d);this.timeLine=new econtioTimeLine("TL-"+c,a,this.debugElement.getElementById("debugSub4"));this.play=function(){this.bFastForward=false;this.bFastReverse=false;if(!this.bUserPause){this.debuglog("PLAY");this.p.controls.play();}};this.pause=function(){this.debuglog("PAUSE");this.p.controls.pause();};this.stop=function(){this.debuglog("STOP");this.setLoop(false);if(this.p){this.p.controls.stop();}};this.togglePause=function(){switch(this.p.playState){case 2:if(!this.bUserPause){this.play();}break;case 3:this.pause();break;case 4:this.bUserPause=false;this.play();break;case 5:this.bUserPause=false;this.play();break;}};this.toggleUserPause=function(){switch(this.p.playState){case 1:this.play();break;case 2:if(this.bUserPause){this.bUserPause=false;this.play();}break;case 3:this.bUserPause=true;this.pause();break;case 4:this.bUserPause=false;this.play();break;case 5:this.bUserPause=false;this.play();break;}};this.toggleMute=function(){this.bMute=!this.bMute;this.p.settings.mute=this.bMute;this.debuglog("MUTE: "+this.bMute);this.debugprint("Mute",this.p.settings.mute);};this.mute=function(e){this.bMute=e;this.p.settings.mute=this.bMute;this.debuglog("MUTE: "+this.bMute);this.debugprint("Mute",this.p.settings.mute);};this.volume=function(e){this.debugprint("Volume",e);this.debuglog("VOLUME: "+e);this.p.settings.volume=e;this.currentVolume=e;if(this.panel){this.panel.userVolume(e);}};this.volumeUpDown=function(e){var f=this.p.settings.volume+e;f=f>100?100:f;f=f<0?0:f;this.volume(f);};this.toggleFastForward=function(){if(this.bFastForward){this.play();}else{this.bFastForward=true;this.p.controls.fastForward();if(this.panel){this.panel.guiPause(true);}}};this.toggleFastReverse=function(){if(this.bFastReverse){this.play();}else{this.bFastReverse=true;this.p.controls.fastReverse();if(this.panel){this.panel.guiPause(true);}}};this.setFullScreen=function(e){this.p.fullScreen=e;};this.mediaChange=function(){this.debuglog("...mediaChange");this.playlistCounter+=1;if(this.playlistCounter>=this.p.currentPlaylist.count){this.stopEvent(true);}else{this.userMediaChange(this.playlistCounter);}};this.userMediaChange=function(){};this.createPlaylist=function(f,e){return this.p.newPlaylist(f,e);};this.addToPlayList=function(e,g,h){this.debuglog("...adding "+e+" to playlist!");var f=this.p.newMedia(e);if(!!h){h.appendItem(f);}else{this.p.currentPlaylist.appendItem(f);}return f;};this.startPlaylist=function(e){this.debuglog("...startPlaylistItem");this.playlistCounter=0;this.onReady=function(){this.play();this.onReady=function(){};};if(!!e){this.p.currentPlaylist=e;}else{this.p.controls.playItem(this.p.currentPlaylist.item(0));}this.volume(this.initVolume);};this.nextPlaylistItem=function(e){this.debuglog("...nextPlaylistItem");if(this.playlistCounter<this.customPlaylist.length-1){this.playlistCounter+=1;}else{if(this.loopPlaylist){this.playlistCounter=0;}else{this.debuglog("End of Playlist!");this.stop();return;}}this.p.controls.next();this.userMediaChange(this.playlistCounter,e);};this.previousPlaylistItem=function(e){this.debuglog("...previousPlaylistItem");if(this.playlistCounter>0){this.playlistCounter-=1;}else{if(this.loopPlaylist){this.playlistCounter=this.customPlaylist.length-1;}else{this.debuglog("End of Playlist!");this.stop();return;}}this.p.controls.previous();this.userMediaChange(this.playlistCounter,e);};this.URL=function(e){this.playlistCounter=0;this.debugprint("URL",e);this.debuglog("URL: "+e);if(mecoVariables.VIDEO_RES=="half"){this.debugprint(this.globalStatus,"Video: reduziert");}this.p.URL=e;this.play();window.setTimeout(this.play.bind(this),3000);this.volume(this.initVolume);this.p.stretchToFit=true;};this.setLoop=function(e){this.p.settings.setMode("loop",e);};this.toggleVideoRes=function(){if(mecoVariables.VIDEO_RES=="full"){this.fallback();}else{this.fallforward();}};this.switchLanguage=function(e){this.debuglog("...setting Language "+e);if(this.selLanguage!=e){this.selLanguage=e;t=this.userSwitchLanguage(this.playlistCounter);if(t){this.debuglog("swtiching audio channel "+e);if(this.p.controls.audioLanguageCount>1){switch(e){case"en":this.p.controls.currentAudioLanguageIndex=2;break;case"de":this.p.controls.currentAudioLanguageIndex=1;break;default:break;}}}}};this.userSwitchLanguage=function(){return true;};this.crossTitle=function(e){this.fallbackTime=this.evaluateTC();this.debuglog("crossing Title @ "+this.fallbackTime+"...");if(this.p.currentPlaylist.count>1){var g=this.p.currentMedia;var f=this.p.newMedia(e);this.p.currentPlaylist.insertItem(this.playlistCounter+1,f);this.nextPlaylistItem();this.p.currentPlaylist.removeItem(g);this.playlistCounter-=1;}else{this.URL(e);}};this.fallforward=function(){this.debugprint(this.globalStatus,"Video: voll");this.fallbackTime=this.evaluateTC();this.debuglog("fallforward @ "+this.fallbackTime+"...");meco.execScript("videoFallforward",false,null);mecoVariables.VIDEO_RES="full";this.URL(this.p.URL.replace(/half/,"full"));};this.fallback=function(){this.debugprint(this.globalStatus,"Video: reduziert");this.fallbackTime=this.evaluateTC();this.debuglog("fallback @ "+this.fallbackTime+"...");meco.execScript("videoFallback",false,null);mecoVariables.VIDEO_RES="half";this.URL(this.p.URL.replace(/full/,"half"));};this.checkDrops=function(e){this.dropsPerMinute[e]=this.framesSkipped-this.dropsPerMinute[0];this.debuglog("checkdrops: "+e+" - "+this.dropsPerMinute[e]);this.dropsPerMinute[0]=this.framesSkipped;if((e==1&&this.dropsPerMinute[1]>100)||(e==3&&this.dropsPerMinute[1]>this.dropLimit&&this.dropsPerMinute[2]>this.dropLimit&&this.dropsPerMinute[3]>this.dropLimit)){this.pause();if(confirm("Es wurde festgestellt, dass das Video nicht fl�ssig abgespielt werden kann!\n\nSie k�nnen die Gr��e des Videos reduzieren, um das Abspielen zu verbessern!\n\nSoll das Video jetzt reduziert werden?")){this.fallback();}}};this.evaluateTC=function(){var f=this.p.controls.currentPositionString.split(":");if(f.length==2){var i=(f[0]-(f[0]%60))/60;var e=f[0]-i*60;var g=f[1];}else{var i=f[0];var e=f[1];var g=f[2];}var j=makeTC(i,e,g);this.timeElapsed=this.p.controls.currentPositionString;if(this.panel){this.panel.setTimeElapsed(this.timeElapsed);}return j;};this.getTC=function(){var e=this.evaluateTC();if(!!this.timeLine){this.timeLine.checkEvent(e);}if(this.p.playState>2&&this.p.playState<6){this.playerInterval=window.setTimeout(this.getTC.bind(this),this.intervalTime);}if(this.bMP11Bugfix&&!!this.MP11BugfixTime){this.debuglog("getTC: "+this.MP11BugfixTime+" - "+e);if(e>=this.MP11BugfixTime){this.debuglog("----display!");$fx("waitVideo").setDisplay(false);this.mute(false);$fx(this.p).setDisplay(true);this.MP11BugfixTime=null;}}};this.fixMP11Bug=function(f,e){this.debuglog("----setTC: "+this.bMP11Bugfix);if(this.bMP11Bugfix){this.debuglog("------hide!");this.mute(true);$fx(this.p).setDisplay(false);$fx("waitVideo").setDisplay(true);this.MP11BugfixTime=shiftTC(f,e);e-=1;}else{this.MP11BugfixTime=null;}return(e);};this.setTC=function(h,f){f=f?f:0;this.debuglog("setTC: "+h+"...");this.fallbackTime=null;f=this.fixMP11Bug(h,f);if(this.playerInterval){window.clearTimeout(this.playerInterval);}this.p.controls.pause();var e=h.split(":");var g=parseFloat(e[0])*3600+parseFloat(e[1])*60+parseFloat(e[2])+f;this.debuglog("... going to "+g);this.bTCJump=true;if(!!this.timLine){this.timeLine.bTCJump=true;}this.p.controls.currentPosition=g;this.bUserPause=false;this.play();};this.jumpTCDiff=function(e){e=this.fixMP11Bug(this.evaluateTC(),e);this.debuglog("jumpTCDiff: "+e);this.p.controls.currentPosition=Math.floor(this.p.controls.currentPosition)+e;this.bUserPause=false;this.play();};this.statusChange=function(){if(this.p&&this.p.status){this.debugprint("status",this.p.status);this.debuglog(this.p.status);if(this.p.playstate==7&&this.p.status.substr(0,26)=="Verbindung zu Codec-Server"){alert("Codec fehlt!");}if(this.p.playstate==7&&p.status=="Codec wird gedownloadet: 100% abgeschlossen"){alert("Codec kann installiert werden!");}}};this.errorHandler=function(){try{if(this.p&&this.p.error){var g=this.p.error.errorCount;var k;var f;var j;var m="";var h=0;while(h<g){k=this.p.error.item(h);f=k.errorCode;j=k.errorDescription;m+="Fehler ("+f+"):<br/>"+j+"<br/><br/>";h++;}try{m+="Datei: "+this.p.URL+"<br/>";}catch(l){}this.debugprint("error",m);if(typeof(this.mainDebugElement.adjustDisplay)=="function"){this.mainDebugElement.adjustDisplay(true);this.mainDebugElement.switchSubElement(this.debugElement.id);debdetails(this.debugElement,1);}else{this.debuglog("Fehler im Windows-MediaPlayer: "+m);alert("Fehler im Windows-MediaPlayer: "+m.replace(/<br\/>/g,"\n"));}window.clearInterval(this.networkInterval);this.stopEvent();}}catch(l){this.debuglog("Nicht behandelbarer Fehler in WMPLayer.errorHandler: "+l.description);alert("Nicht behandelbarer Fehler in WMPLayer.errorHandler: "+l.description);}};this.stopEvent=function(){};this.onReady=function(){};this.startPlaying=function(){};this.delayedSetStretchToFit=function(){this.p.stretchToFit=this.stretchToFit;};this.playStateChange=function(f){if(this.p&&this.p.playState){this.debugprint("playstate",this.p.playState);this.playState=this.p.playState;this.playStateCode=this.playState;}this.debuglog("Playstate: "+f);if(!this.networkInterval){this.networkInterval=window.setInterval(this.network.bind(this),1000);}if(this.seekInterval){window.clearTimeout(this.seekInterval);}this.bBuffering=false;switch(f){case 1:if(this.playerInterval){window.clearTimeout(this.playerInterval);}if(this.networkInterval){window.clearInterval(this.networkInterval);}this.stopEvent(true);if(this.p.fullScreen){this.p.fullScreen=false;}break;case 2:if(this.panel){this.panel.guiPause(true);}window.clearTimeout(this.playerInterval);break;case 3:if(this.panel){this.panel.guiPause(false);}if(!!this.playFromTC){var e=this.playFromTC;this.playFromTC=null;this.storedTC=[e];this.setTC(e);}this.startPlaying();if(!!this.timeLine){this.timeLine.bTCJump=this.bTCJump;}this.bTCJump=false;this.currentPlayListItem=this.p.currentMedia;window.setTimeout(this.delayedAudioSwitch.bind(this),100);window.setTimeout(this.delayedSetStretchToFit.bind(this),2000);if(this.playerInterval){window.clearTimeout(this.playerInterval);}this.intervalTime=this.pTime;this.playerInterval=window.setTimeout(this.getTC.bind(this),this.pTime);if(this.fallbackTime){this.setTC(this.fallbackTime);}this.timeTotal=this.p.currentMedia.durationString;if(this.panel){this.panel.setTimeTotal(this.timeTotal);}break;case 6:this.bBuffering=true;if(this.playerInterval){window.clearTimeout(this.playerInterval);}break;case 7:this.bBuffering=true;break;case 8:if(this.playerInterval){window.clearTimeout(this.playerInterval);}if(!this.p.settings.getMode("loop")){this.mediaChange();}break;case 9:this.bBuffering=true;break;case 10:this.onReady();break;case 11:break;}if(this.panel){this.panel.showBuffering(0);}this.OldState=f;};this.delayedAudioSwitch=function(){try{if(this.p.controls.audioLanguageCount>1&&this.selLanguage=="en"){this.p.controls.currentAudioLanguageIndex=2;}else{this.p.controls.currentAudioLanguageIndex=1;}}catch(f){this.debuglog("XXX Error: delayedAudioSwitch failed!!");}};this.debuglog=function(f){var e=this.debugElement.getElementById("debuglog");if(this.p&&this.p.controls){f=this.p.controls.currentPositionString+" "+f;}e.innerHTML=f+"<br/>"+e.innerHTML;};this.debugprint=function(f,g){var e=f;if(typeof(f)=="string"&&!!this.debugElement){f=this.debugElement.getElementById(f);}if(f&&typeof(f)=="object"){f.innerHTML=g;}else{window.status=">>"+e+"/"+g;}};this.network=function(){if(this.p&&this.p.network){var k=this.p.network;var h=this.p;var j="";var i=new Date();j=i;try{if(this.bBuffering){if(this.panel){this.panel.showBuffering(k.bufferingProgress);}}}catch(g){}this.debugprint("networkdetails",j);this.debugprint("framesSkipped",this.p.network.framesSkipped);this.debugprint("downloadProgress",this.p.network.downloadProgress);if(k.bufferingProgress<100){this.debugprint("buffering",k.bufferingProgress+"%");}else{this.debugprint("buffering","");}if(this.p&&this.p.currentMedia&&this.p.currentMedia.error){var f=this.p.currentMedia.error;errNum=f.errorCode;errDesc=f.errorDescription;j="Fehler ("+errNum+"):<br/>"+errDesc+"<br/><br/>";this.debugprint("mediaError",j);if(typeof(this.mainDebugElement.adjustDisplay)=="function"){this.mainDebugElement.adjustDisplay(true);this.mainDebugElement.switchSubElement(this.debugElement.id);debdetails(this.debugElement,2);}else{this.debuglog("Fehler im Windows-MediaPlayer: "+errDesc);alert("Fehler im Windows-MediaPlayer: "+errDesc);}window.clearInterval(this.networkInterval);}}};this.makePlayer=function(e,i){this.name=i;var f='<OBJECT width="100%" height="100%" ID="'+i+'"    CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" STANDBY="Loading Microsoft� Windows MediaPlayer components..."  TYPE="application/x-oleobject">';f+='<PARAM NAME="URL" VALUE="">';var h=typeof(this.bAutostart)!="undefined"?this.bAutostart:(typeof(customer.playerAutostart)!=undefined?customer.playerAutostart:"false");f+='<PARAM NAME="AutoStart" VALUE="'+h+'">';f+='<PARAM NAME="ShowDisplay" VALUE="false">';f+='<PARAM NAME="ShowStatusBar" VALUE="false">';if(this.windowlessVideo){f+='<param name="windowlessVideo" value="true">';}if(!this.uiMode){f+='<param name="uiMode" value="none">';}f+="</object>";if(e.indexOf("/")==-1){oTarget=$(e);}else{var g=e.split("/");oTarget=$(g[0]).getElementById(g[1]);}this.container=oTarget.parentNode;oTarget.parentNode.innerHTML=f;this.p=document.getElementById(i);this.debugprint("Version",this.p.versionInfo);createEventListener(this.p,"error",this.errorHandler.bind(this));createEventListener(this.p,"statusChange",this.statusChange.bind(this));createEventListener(this.p,"playStateChange",this.playStateChange.bind(this));};this.destroy=function(){window.clearTimeout(this.playerInterval);this.debuglog("destroying "+this.playerName);if(this.playStateCode!=1){this.debuglog("setting stop event");ePlayerList[this.playerName].stopEvent=function(){this.container.removeChild(this.p);debuglog(this.playerName+" destroyed!");ePlayerList[this.playerName]=null;};this.stop();}else{this.container.removeChild(this.p);debuglog(this.playerName+" destroyed!");ePlayerList[this.playerName]=null;}};};playerTypes.FlashPlayer=function(c,a,b,d){this.name="";this.type="FlashPlayer";this.version="1.02.0001";this.ready=false;this.playerName=c;this.windowlessVideo=false;this.uiMode=false;this.timePosition="0";this.duration="0";extendPlayerVars(this);this.debugElement=a.newSubElement("debugMPlayer",d);this.timeLine=null;this.play=function(){if(!this.bUserPause){if(this.playState=="IDLE"&&this.oldPlayState=="PAUSED"){this.fallbackTime=this.currTC;}this.p.sendEvent("PLAY",true);}};this.pause=function(){if(this.playState=="PLAYING"){this.p.sendEvent("PLAY",false);this.pausePosition=this.timePosition;}};this.stop=function(){this.bUserPause=false;if(this.playStateCode!=1&&this.p&&!!this.p.sendEvent){this.p.sendEvent("STOP",true);}};this.togglePause=function(){switch(this.playState){case"PAUSED":if(!this.bUserPause){this.play();}break;case"PLAYING":this.pause();break;case"IDLE":this.play();break;}};this.toggleUserPause=function(){switch(this.playState){case"IDLE":case"COMPLETED":case 0:this.play();break;case"PAUSED":if(this.bUserPause){this.bUserPause=false;this.play();}break;case"PLAYING":this.bUserPause=true;this.pause();break;case"IDLE":this.play();break;}};this.toggleMute=function(){this.bMute=!this.bMute;this.p.sendEvent("MUTE",this.bMute);this.debugprint("Mute",this.bMute);};this.mute=function(e){this.bMute=e;this.p.sendEvent("MUTE",this.bMute);this.debugprint("Mute",this.bMute);};this.volume=function(e){this.currentVolume=e;this.debugprint("Volume",e);this.p.sendEvent("VOLUME",e);if(this.panel){this.panel.userVolume(e);}};this.volumeUpDown=function(e){var f=this.currentVolume+e;f=f>100?100:f;f=f<0?0:f;this.volume(f);};this.toggleFastForward=function(){this.debuglog("econtioPlayer.toggleFastForward: not supported");};this.toggleFastReverse=function(){this.debuglog("econtioPlayer.toggleFastForward: not supported");};this.URL=function(e){if(this.currentURL!=e||(this.currentURL==e&&this.playStateCode!=3)){this.stop();this.debugprint("URL",e);this.debuglog("setURL: "+e);this.onReady=function(){this.play();this.volume(this.initVolume);};this.currentURL=e;this.p.sendEvent("LOAD",e);this.autoStart();}else{if(this.currentURL==e&&!!this.playFromTC){this.setTC(this.playFromTC);}}};this.autoStart=function(){if(this.bAutostart){this.play();}};this.onReady=function(){this.autoStart();};this.toggleVideoRes=function(){if(mecoVariables.VIDEO_RES=="full"){this.fallback();}else{this.fallforward();}};this.fallforward=function(){this.debugprint(this.globalStatus,"Video: voll");this.fallbackTime=this.evaluateTC();this.debuglog("fallforward @ "+this.fallbackTime+"...");meco.execScript("videoFallforward",false,null);mecoVariables.VIDEO_RES="full";this.URL(this.p.URL.replace(/half/,"full"));};this.fallback=function(){this.debugprint(this.globalStatus,"Video: reduziert");this.fallbackTime=this.evaluateTC();this.debuglog("fallback @ "+this.fallbackTime+"...");meco.execScript("videoFallback",false,null);mecoVariables.VIDEO_RES="half";this.URL(this.p.URL.replace(/full/,"half"));};this.checkDrops=function(e){};this.evaluateTC=function(n){if(typeof(n)=="undefined"){var k=""+this.timePosition;}else{var k=""+n;}var g=k.split(".");var j=Math.floor(g[0]/3600);var e=Math.floor((g[0]-(j*3600))/60);var i=g[0]-j*3600-e*60;var l=Math.round(24*g[1]/10);k=makeTC(j,e,i,l);if(this.playState=="PLAYING"){this.timeElapsed=k.substr(3,5);if(this.panel){this.panel.setTimeElapsed(this.timeElapsed);}}return k;};this.getTC=function(){var e=this.evaluateTC();if(this.playState=="PLAYING"){this.currTC=e;if(!!this.timeLine){this.timeLine.checkEvent(e);}}this.playerInterval=window.setTimeout(this.getTC.bind(this),this.intervalTime);};this.setTC=function(h,f){this.debuglog("setTC: "+h+"...");this.fallbackTime=null;f=f?f:0;if(this.playerInterval){window.clearTimeout(this.playerInterval);}this.p.sendEvent("PLAY",false);var e=h.split(":");var g=parseFloat(e[0])*3600+parseFloat(e[1])*60+parseFloat(e[2])+f;this.debuglog("... going to "+g);this.bTCJump=true;if(!!this.timeLine){this.timeLine.bTCJump=true;this.timeLine.TCJumpTo=h;}this.p.sendEvent("SEEK",g);this.bUserPause=false;};this.jumpTCDiff=function(e){this.debuglog("jumpTCDiff: "+e);var f=Math.round(this.timePosition)+e;this.p.sendEvent("SEEK",f);this.bUserPause=false;this.play();};this.stopEvent=function(){};this.startEvent=function(){};this.startPlaying=function(){};this.stopPlaying=function(){};this.cancelEvent=function(){};this.setDuration=function(){this.timeTotal=this.evaluateTC(this.duration).substr(3,5);if(this.panel){this.panel.setTimeTotal(this.timeTotal);}};this.playStateChange=function(f){this.debugprint("playstate",f);this.oldPlayState=this.playState;this.playState=f;this.debuglog("FlashPlayer "+this.playerName+": "+this.oldPlayState+" -> "+f+" @"+this.currTC);this.bBuffering=false;switch(f){case"COMPLETED":this.playStateCode=1;if(this.playerInterval){window.clearTimeout(this.playerInterval);}if(this.panel){this.panel.guiPause(true);}if(this.timeLine){this.timeLine.init();}this.stopPlaying();this.stopEvent(true);this.bHasBeenStarted=false;break;case"IDLE":this.playStateCode=1;this.cancelEvent(true);if(this.panel){this.panel.guiPause(true);}break;case"PAUSED":if(this.panel){this.panel.guiPause(true);}this.playStateCode=2;window.clearTimeout(this.playerInterval);break;case"PLAYING":if(this.panel){this.panel.guiPause(false);}if(!!this.playFromTC){var e=this.playFromTC;this.playFromTC=null;this.storedTC=[e];this.setTC(e);}if(!this.bHasBeenStarted){this.bHasBeenStarted=true;this.startEvent();}this.playStateCode=3;if(!!this.currTC&&!this.bTCJump&&this.oldPlayState=="IDLE"){this.debuglog("XXXXX PlaystateChange: isn't this obsolete?");this.fallbackTime=this.currTC;this.currTC=null;}this.bTCJump=false;if(this.playerInterval){window.clearTimeout(this.playerInterval);}this.intervalTime=this.pTime;this.playerInterval=window.setTimeout(this.getTC.bind(this),this.pTime);if(this.fallbackTime){if(!!this.timeLine){this.timeLine.bSkipEvent=true;this.timeLine.bTCJump=true;}this.bTCJump=true;this.setTC(this.fallbackTime);}break;case"BUFFERING":this.playStateCode=6;this.bBuffering=true;break;default:}this.OldState=f;if(this.panel){this.panel.showBuffering(0);}};this.debuglog=function(f){var e=this.debugElement.getElementById("debuglog");if(this.p&&this.p.controls){f=this.p.controls.currentPositionString+" "+f;}e.innerHTML=f+"<br/>"+e.innerHTML;};this.debugprint=function(f,g){var e=f;if(typeof(f)=="string"&&this.debugElement){f=this.debugElement.getElementById(f);}if(f&&typeof(f)=="object"){f.innerHTML=g;}};this.makePlayer=function(f,m,o,e,s,q){this.ready=false;this.currentURL=s;this.name=m;var g={};var j={};var k={};var h={};g.volume="100";g.fullscreen=true;if(!this.uiMode){g.controlbar="none";}g.abouttext="econtio";g.aboutlink="http://www.econtio.de";g.target="_blank";if(!!o){var n=o.split("|");for(var l=0;l<n.length;l++){var r=n[l].split("~");g[r[0]]=r[1];}}if(!g.autostart){g.autostart=typeof(this.bAutostart)!="undefined"?this.bAutostart:(typeof(customer.playerAutostart)!="undefined"?customer.playerAutostart:"false");}if(!g.displayclick){g.displayclick="false";}if(!!e){var n=e.split("|");for(var l=0;l<n.length;l++){var r=n[l].split("~");j[r[0]]=r[1];}}j.allowscriptaccess="always";if(this.windowlessVideo){j.wmode="opaque";}k.name=m;k.id=m;if(f.indexOf("/")==-1){oTarget=$(f);}else{var u=f.split("/");oTarget=$(u[0]).getElementById(u[1]);}this.container=oTarget.parentNode;if(q==3){oIframe=document.createElement("iframe");oIframe.setAttribute("width","100%");oIframe.setAttribute("height","100%");oIframe.setAttribute("src",s);oIframe.setAttribute("frameborder","0");oIframe.setAttribute("allowfullscreen","1");oIframe.setAttribute("title","YouTube video player");oTarget.appendChild(oIframe);}else{swfobject.embedSWF("player/"+(!!customer.flashVideoPlayer?customer.flashVideoPlayer:"jwplayer45econtio.swf"),oTarget,"100%","100%","9.0.0",false,g,j,k);}};this.destroy=function(){window.clearTimeout(this.playerInterval);this.debuglog("destroying "+this.playerName);if(this.playStateCode!=1){this.debuglog("setting stop event");ePlayerList[this.playerName].stopEvent=function(){swfobject.removeSWF(this.playerName);debuglog(this.playerName+" destroyed!");ePlayerList[this.playerName]=null;};this.stop();}else{swfobject.removeSWF(this.playerName);debuglog(this.playerName+" destroyed!");ePlayerList[this.playerName]=null;}};};function playerReady(c){var d=c.id;var b=document.getElementsByName(c.id)[0];var a=ePlayerList[c.id];a.p=b;b.addModelListener("STATE","stateMonitor");b.addModelListener("TIME","timeMonitor");b.addModelListener("ERROR","errorHanlder");this.ready=true;a.onReady();}function timeMonitor(b){var a=ePlayerList[b.id];a.timePosition=b.position;if(a.duration=="0"){a.duration=b.duration;a.setDuration();}}function stateMonitor(c){var b=c.newstate;var a=ePlayerList[c.id];a.playStateChange(b);}function errorHandler(a){alert("error: "+a.error);}function metaHandler(c,b,a,d){console.dir(c);}
