//////////////////////////////////////////////////////////////////////////////// // Media Modeler 1.8 build 162 date: 04/13/2005 05:25 PM // MediaModeler(tm) www.mediamodeler.com // Copyright (c) 2003 Zetools Inc. All rights reserved. // This code, in whole or in part may not be reproduced, redistributed // or resold without express permission in writing from Zetools Inc. // Media Modeler and Zetools are Trademarks of Zetools Inc., All Rights Reserved. //////////////////////////////////////////////////////////////////////////////// var toString_tabs=0; function getTabs(){ var ret=''; for(var i=0;i0){ ret[ret.length]=n%16; n=parseInt(n/16,10); } n=ret.length; while(n>0){ val+=''+toDigit(ret[--n]); } return val; } function toDigit(n){ if(n<=9) return n; else{ switch(n){ case 10:return 'A'; case 11:return 'B'; case 12:return 'C'; case 13:return 'D'; case 14:return 'E'; case 15:return 'F'; } } return '_'; } function isHex(str){ var hex=/^[#]?[0-9A-Fa-f]{6}$/; var und; if(str==''||str==und||str==null)return false; else return hex.test(str); } function isRGB(str){ var rgb=/^\s*rgb\s*\(\s*[0-9]{0,3}\s*,\s*[0-9]{0,3}\s*,\s*[0-9]{0,3}\s*\)\s*(;\s*)?$/; var und; if(str==''||str==und||str==null)return false; else return rgb.test(str); } function toDecColor(str){ if(isHex(str)) return hex2dec(str); else if(isRGB(str)) return rgb2dec(str); else return 0; } function hex2dec(str){ var ret=0; var und; if(str==''||str==und||str==null)return 0; str=str.toUpperCase(); for(var i=0;i=0){ ret=ret*16+v; } } return ret; } function rgb2dec(str){ var t; var r,g,b; var und; if(str==''||str==und||str==null)return 0; t=str.indexOf("(")+1; str=str.substring(t); r=parseInt(str); t=str.indexOf(",")+1; str=str.substring(t); g=parseInt(str); t=str.indexOf(",")+1; str=str.substring(t); b=parseInt(str); return(((r*256)+g)*256)+b; } function isEmpty(o){ return(isNothing(o)||o==''); }; function isNothing(o){ var und; return(o==und||o==null); }; function setStyle(style,obj){ if(style=='')return; var o=obj.style; var parts=style.split(/\s*;\s*/); for(var i=0;i2){ for(var k=2;k=0||s.indexOf("internet explorer")>=0){ v=Detection.B_IEXPLORER; }else if(ua.indexOf("safari")>=0){ v=Detection.B_SAFARI; }else if(s.indexOf("netscape")>=0){ v=Detection.B_NETSCAPE; }else v=Detection.B_OTHER; this.browser=v; var v=0; if(this.browser==Detection.B_IEXPLORER){ tmp=ua.indexOf("msie ") v=parseInt(ua.substring(tmp+5)); }else if(this.browser==Detection.B_SAFARI){ tmp=ua.indexOf("safari/"); if(tmp>=0){ tmp=parseInt(ua.substring(tmp+7)); v=(tmp<=85)?1:2; } }else{ var av=parseInt(navigator.appVersion); if(av<=4)v=av; else{ tmp=ua.indexOf("netscape/"); if(tmp>=0) v=parseInt(ua.substring(tmp+9)); else{ tmp=ua.indexOf("rv:"); if(tmp>=0){ tmp=parseFloat(ua.substring(tmp+3)); v=(tmp>1.3)?7:(tmp>=1.0)?6:0; } } } } this.version=v; }; Detection.prototype.detectFlash=function(){ var ret=false; if(this.detectedPlugin(Detection.P_FLASH))return true; var tmp=new DetectionPlugin(); tmp.id=Detection.P_FLASH; tmp.name="Flash"; if(Detection.detectableWithVB){ var i=20; while(!ret&&i>0){ ret=detectActiveXControl('ShockwaveFlash.ShockwaveFlash.'+i); if(ret)tmp.version=i; i--; } }else{ ret=this.hasMimeType('Flash'); if(ret!=null){ var tmp2=ret.description; tmp.version=getFirstNumber(tmp2); ret=true; } else{ ret=false; } } if(ret){ this.addPlugin(tmp); } return ret; }; Detection.prototype.detectJava=function(){ if(!navigator.javaEnabled()){ return false; } else { if(this.detectedPlugin(Detection.P_JAVA))return true; var tmp=new DetectionPlugin(); tmp.id=Detection.P_JAVA; tmp.name="Java"; if(Detection.detectableWithVB){ ret=false; }else{ ret=this.hasMimeType('Java'); if(ret!=null){ var tmp2=ret.description; tmp.version=getSecondNumber(tmp2); if(tmp.version<1)tmp.version=1; ret=true; } else{ ret=false; } } if(ret){ this.addPlugin(tmp); } } }; Detection.prototype.detectOS=function(){ if(navigator.userAgent.toLowerCase().indexOf('mac')>=0) this.os=Detection.OS_MAC; else if(navigator.userAgent.toLowerCase().indexOf('win')>=0) this.os=Detection.OS_WIN; else this.os=Detection.OS_OTHER; var a=navigator.userAgent; if(a.indexOf("Windows NT 5.1")>=0|| (a.indexOf("Windows NT 5.0")>=0&&this.isNS4())){ this.osversion=Detection.OSV_XP; } else if(a.indexOf("Windows NT 5.0")>=0||a.indexOf("WinNT")>=0){ this.osversion=Detection.OSV_2K; } else if(a.indexOf("Windows 98")>=0||a.indexOf("Win98")>=0){ this.osversion=Detection.OSV_98; } else if(a.indexOf("Windows 95")>=0||a.indexOf("Win95")>=0){ this.osversion=Detection.OSV_95; } else if(a.indexOf("Mac OS X")>=0){ this.osversion=Detection.OSV_X; } else if(a.indexOf("Mac")>=0||a.indexOf("PPC")>=0){ this.osversion=Detection.OSV_PX; }else{ this.osversion=Detection.OSV_OTHER; } }; Detection.prototype.detectQuickTime=function(){ var ret=false; if(this.detectedPlugin(Detection.P_QUICKTIME))return true; var tmp=new DetectionPlugin(); tmp.id=Detection.P_QUICKTIME; tmp.name="Quicktime"; if(Detection.detectableWithVB){ ret=detectQuickTimeActiveXControl(); tmp.version=parseInt(ret.toString(16).substring(0,1),16); }else{ ret=this.hasMimeType('QuickTime'); if(ret!=null){ var tmp2=ret.name; tmp.version=getFirstNumber(tmp2); ret=true; } else{ ret=false; } } if(ret){ this.addPlugin(tmp); } return ret; }; Detection.prototype.detectReal=function(){ if(this.detectedPlugin(Detection.P_REAL))return true; var ret=false; if(Detection.detectableWithVB) ret=((detectActiveXControl('rmocx.RealPlayer G2 Control')|| detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)')|| detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'))); else ret=(this.hasPlugin('RealPlayer')||this.hasPlugin('RealOne')); if(!ret)return false; var tmp=new DetectionPlugin(); tmp.id=Detection.P_REAL; tmp.name="Real"; if(this.isWin()&&this.isIE()){ var rpversion=detectRealOneActiveXControl()+""; var rpparams=rpversion.split("."); tmp.version=(rpparams[2]>8)?9:8; }else{ tmp.version=(this.hasPlugin("RealOne"))?9:8; } this.addPlugin(tmp); return true; }; Detection.prototype.detectWindowsMedia=function(){ if(this.detectedPlugin(Detection.P_WINMEDIA))return true; var ver=0; if(Detection.detectableWithVB){ if(detectActiveXControl('WMPlayer.OCX')){ ver=parseInt(getWindowsMediaVersion()); } else if(detectActiveXControl('MediaPlayer.MediaPlayer.1')){ ver=6; } else{ ver=0; } }else{ if(this.isMac()){ if(this.hasMime("application/x-mplayer2")){ ver=6; } else if(this.hasPlugin("Windows")){ ver=6; } }else{ var ret=this.hasMimeType('Windows Media Player'); if(ret!=null){ ver=6; } } } if(ver>0){ var tmp=new DetectionPlugin(); tmp.id=Detection.P_WINMEDIA; tmp.name="Windows Media"; tmp.version=ver; this.addPlugin(tmp); return true; } return(ver>0); }; Detection.prototype.getPlugin=function(id){ for(var i=0;i=0){ return navigator.mimeTypes[i].enabledPlugin; } } } return null; }; Detection.prototype.hasMime=function(name){ return(navigator.mimeTypes &&navigator.mimeTypes[name] &&navigator.mimeTypes[name].enabledPlugin); }; Detection.prototype.hasPlugin=function(name){ if(navigator.plugins){ for(i=0;i=0){ return true; } } } return(this.hasMimeType(name)!=null); }; Detection.prototype.initWinIE=function(){ var s=''; s+='\n'; document.writeln(s); }; Detection.prototype.isIE=function(){ return(this.browser==Detection.B_IEXPLORER); }; Detection.prototype.isNS=function(){ return(this.browser==Detection.B_NETSCAPE); }; Detection.prototype.isNS4=function(){ return(this.browser==Detection.B_NETSCAPE&& this.version<=4); }; Detection.prototype.isNS5=function(){ return(this.browser==Detection.B_NETSCAPE&& this.version>4); }; Detection.prototype.isMac=function(){ return(this.os==Detection.OS_MAC); }; Detection.prototype.isNewMac=function(){ return(this.os==Detection.OS_MAC&&this.osversion!=Detection.OSV_PX); }; Detection.prototype.isOldMac=function(){ return(this.os==Detection.OS_MAC&&this.osversion==Detection.OSV_PX); }; Detection.prototype.isSafari=function(){ return(this.browser==Detection.B_SAFARI); }; Detection.prototype.isWinXP=function(){ return(this.osversion==Detection.OSV_XP); }; Detection.prototype.isWin=function(){ return(this.os==Detection.OS_WIN); }; Detection.prototype.isWinIE=function(){ return(this.isWin()&&this.isIE()); }; Detection.prototype.isWinNS=function(){ return(this.isWin()&&this.isNS()); }; Detection.prototype.isWinNS4=function(){ return(this.isWin()&&this.isNS4()); }; Detection.prototype.isWinNS5=function(){ return(this.isWin()&&this.isNS5()); }; Detection.prototype.isMacIE=function(){ return(this.isMac()&&this.isIE()); }; Detection.prototype.isMacNS=function(){ return(this.isMac()&&this.isNS()); }; Detection.prototype.isMacNS4=function(){ return(this.isMac()&&this.isNS4()); }; Detection.prototype.toString=function(){ var nl="
\n"; var ret='Detection results:'+nl; ret+="OS: "+this.os+nl; ret+="OSv: "+this.osversion+nl; ret+="Browser: "+Detection.BROWSERS[this.browser]+nl; ret+="Version: "+this.version+nl; ret+="Speed: "+Detection.BANDWIDTH[this.speed]+nl; ret+=nl for(var i=0;i0){ var tmp=parseInt(str); if(isNaN(tmp)) return getFirstNumber(str.substring(1)); else return tmp; }else return 0; }; function getSecondNumber(str){ if(str==null)return 0; if(str.length>0){ if(!isDigit(str.substring(0,1))) return getSecondNumber(str.substring(1)); else{ var tmp=parseInt(str); tmp=tmp+' '; return getFirstNumber(str.substring(tmp.length-1)); } }else return 0; }; function isDigit(c){ return !isNaN(parseInt(c)); }; function Cookie(){ this.keys=new Array(); this.values=new Array(); var query=document.cookie; var pairs=query.split("; "); for(var i=0;i=0){ var argname=pairs[i].substring(0,pos); var value=unescape(pairs[i].substring(pos+1)); this.keys[this.keys.length]=argname; this.values[this.values.length]=value; } } }; Cookie.prototype.enabled=function(){ var testVal=18391; var testCookie='testCookie_2110'; document.cookie=testCookie+'='+testVal; if(document.cookie.indexOf(testCookie+'='+testVal)!=-1){ document.cookie=testCookie+'=;expires= 1 Jan 1980;'; return true; } else{ return false; } }; Cookie.prototype.getValue=function(key){ for(var i=0;i0); }; Cookie.prototype.toString=function(){ var c=''; for(i=0;i0) this.url=url.substring(0,t); else this.url=url; var query=unescape(location.search.substring(1)); var pairs=query.split("&"); for(i=0;i=0){ var argname=pairs[i].substring(0,pos); var value=pairs[i].substring(pos+1); this.keys[this.keys.length]=argname; this.values[this.values.length]=value; } } }; QueryString.prototype.getValue=function(key){ for(var i=0;i0){ for(var i=0;i=5){ players[1].available=(plugin!=null); players[2].available=(plugin!=null); } } plugin=this.detect.getPlugin(Detection.P_REAL); players[3].available=(plugin!=null&&plugin.version==8); players[4].available=(plugin!=null&&plugin.version>=8); players[5].available=(plugin!=null&&plugin.version>8); plugin=this.detect.getPlugin(Detection.P_WINMEDIA); players[6].available=(plugin!=null); this.autoSelectPlayer(); }; Chooser.prototype.detectSpeed=function(v){ var und; if(v==und||v==null)v=10; if(!this.detect.ready&&v>0){ setTimeout('Chooser.instance.detectSpeed('+(v-1)+');',200); }else{ var n=this.detect.speed; if(n==Detection.BW_SLOW) n=1; else if(n==Detection.BW_FAST) n=2; else{ n=1; } this.speeds[n].selected=true; this.selectedSpeed=this.speeds[n].value; this.speeds[0].value=this.speeds[n].value; this.ready=true; } }; Chooser.prototype.getList=function(){ var det=this.detect; if(det.isWinIE()){ return Chooser.WIN_IE; }else if(det.isWinNS()){ return Chooser.WIN_NS; }else if(det.isMacIE()){ return Chooser.MAC_IE; }else if(det.isMacNS()){ return Chooser.MAC_NS; }else if(det.isSafari()){ return Chooser.MAC_SAF; }else return Chooser.OTHER; }; Chooser.getGridPlayerName=function(player){ if((player&Chooser.R)!=0|| (player&Chooser.RO)!=0|| (player&Chooser.RE)!=0){ return "Real Player"; }else if((player&Chooser.WM)!=0){ return "Windows Media"; }else if((player&Chooser.QT)!=0|| (player&Chooser.QTE)!=0){ return "QuickTime"; }else return ""; } Chooser.prototype.hasSettings=function(){ var sp=null; var ss=null; sp=this.query.getValue("MM_Player"); ss=this.query.getValue("MM_Speed"); if(sp==null)sp=this.cookie.getValue("MM_Player"); if(sp!=null)this.savedPlayer=sp; if(ss==null)ss=this.cookie.getValue("MM_Speed"); if(ss!=null)this.savedSpeed=ss; var validPlayer=false; for(var i=1;i0)validPlayer=true; } } for(var i=1;i0){ validPlayer=this.players[i].available; } } if(ss>0&&sp>0&&validPlayer){ this.selectedPlayer=sp; this.selectedSpeed=ss; return true; }else{ if(this.autodetect){ this.autoSelectPlayer(); return true; } return false; } }; Chooser.prototype.save=function(){ var url=null; var bln=this.saveSettings() Channel.instance.player=this.selectedPlayer; Channel.instance.bitrate=this.selectedSpeed; Channel.instance.tPlayItem=Channel.instance.selectFeature(); Channel.instance.beginPlay(); }; Chooser.prototype.saveSettings=function(){ var cookie=new Cookie(); if(cookie.enabled()){ if((this.selectedPlayer<3)){ var exp=(Chooser.debug)?30:60*60*24*7; cookie.setValue("MM_Player",0,exp); cookie.setValue("MM_Speed",0,exp); return true; }else{ var exp=(Chooser.debug)?30:60*60*24*7; cookie.setValue("MM_Player",this.selectedPlayer,exp); cookie.setValue("MM_Speed",this.selectedSpeed,exp); return true; } }return false; }; Chooser.prototype.setEnabled=function(playerMask){ var und; if(playerMask==und||playerMask==null||playerMask==0)playerMask=-1; for(var i=1;i'+ str+''; var v; if(optLayer){ if(this.detect.isNS4()){ v=document.layers["divPlayer"] if(v!=null&&v!=und){ v.document.open(); v.document.write(str); v.document.close(); } }else{ v=document.getElementById("divPlayer"); if(v!=null&&v!=und){ v.innerHTML=str; } } } return str; }; Chooser.prototype.showSpeedOptions=function(optLayer,style){ var und; if(optLayer==und||optLayer!=false)optLayer=true; if(style==und||style==null||this.detect.isNS4())style=""; else style='style=\"'+style+'" '; if(this.ready){ var str=''; for(n=0;n'+ str+''; var v; if(optLayer){ if(this.detect.isNS4()){ v=document.layers["divSpeed"]; if(v!=null&&v!=und){ v.document.open(); v.document.write(str); v.document.close(); } }else{ v=document.getElementById("divSpeed") if(v!=null&&v!=und){ v.innerHTML=str; } } } return str; }else{ setTimeout('Chooser.instance.showSpeedOptions()',50); } }; Chooser.prototype.start=function(){ var query=new QueryString(); var cookie=new Cookie(); var mask=query.getValue("MM_Mask"); if(mask!=null) this.setEnabled(mask); else{ mask=cookie.getValue("MM_Mask"); if(mask!=null) this.setEnabled(mask); } this.showPlayerOptions(); this.showSpeedOptions(); }; Chooser.prototype.toString=function(){ return(this.selectedPlayer+" "+this.selectedSpeed); }; function SelectItem(name,value,available){ var und; if(available==und||available!=true)available=false; this.name=name; this.value=value; this.selected=false; this.available=available; this.enabled=true; }; SelectItem.prototype.toString=function(){ if(this.available&&this.enabled){ return ''; } else return ""; }; SelectItem.prototype.setEnabledViaMask=function(playerMask){ this.enabled=((playerMask&this.value)>0); }; function Container(name,left,top,width,height,zindex){ this.name=name; this.left=left; this.top=top; this.width=width; this.height=height; this.zindex=zindex; this.currentMedia=null; }; Container.prototype.clear=function(){ this.setContents(''); this.reposition(); this.hide(); }; Container.prototype.dump=function(){ this.clear(); this.currentMedia=null; }; Container.prototype.getHeight=function(){ return this.height; }; Container.prototype.getHTML=function(src){ var und; if(src==und||src==null)src=' .'; var mylayer='
'+src+'
'; return mylayer; }; Container.prototype.getWidth=function(){ return this.width; }; Container.prototype.hide=function(){ if(document.getElementById){ layer=document.getElementById(this.name); layer.style.visible='hidden'; layer.style.left=-1000; } else if(document.layers){ layer=document.layers[this.name]; if(layer){ layer.visibility="hidden"; layer.left=-1000; }else return false; } return true; }; Container.prototype.show=function(){ if(document.getElementById){ layer=document.getElementById(this.name); layer.style.visible='visible'; layer.style.left=this.left; layer.style.top=this.top; } else if(document.layers){ layer=document.layers[this.name]; if(layer){ layer.visibility="show"; layer.left=this.left; layer.top=this.top; } } return true; }; Container.prototype.reposition=function(){ var layer=null; this.resize(); if(document.getElementById){ layer=document.getElementById(this.name); layer.style.backgroundColor=''; } else if(document.layers){ layer=document[this.name]; if(layer){ layer.bgColor=null; }else return false; } return true; }; Container.prototype.resize=function(){ var layer=null; if(document.getElementById){ layer=document.getElementById(this.name); layer.style.clip=new Clip(0,this.width,this.height,0); layer.style.left=this.left; layer.style.width=this.width; } else if(document.layers){ layer=document.layers[this.name]; if(layer){ layer.left=this.left; layer.width=this.width; layer.clip.left=0; layer.clip.right=this.width; layer.clip.height=this.height; layer.clip.width=this.width; }else return false; } return true; }; Container.prototype.setBgColor=function(color){ var det=Detection.instance; if(det.isNS4()){ var layer=document.layers[this.name]; this.resize(); layer.bgColor=color; layer.document.bgColor=color; } else if(det.isNS()){ document.getElementById(this.name).style.backgroundColor=color; } else if(det.isIE()){ document.all[this.name].style.backgroundColor=color; } }; Container.prototype.setContents=function(contents){ var det=Detection.instance; if(det.isNS4()){ var layer=document.layers[this.name]; if(layer){ layer.document.open(); layer.document.write(contents); layer.document.close(); }else return false; } else if(det.isIE()){ document.all[this.name].innerHTML=contents; } else{ document.getElementById(this.name).innerHTML=contents; } return true; }; Container.prototype.setOverflow=function(overflow){ var det=Detection.instance; if(det.isNS4()){ var layer=document.layers[this.name]; if(layer){ layer.overflow=overflow; }else return false; } else if(det.isNS()){ document.getElementById(this.name).style.overflow=overflow; } else if(det.isIE()){ document.all[this.name].style.overflow=overflow; } return true; }; function Area(x,y,w,h,link,mouseover){ var und; this.x=(x==null||x==und)?0:x; this.y=(y==null||y==und)?0:y; this.w=(w==null||w==und)?-1:w; this.h=(h==null||h==und)?-1:h; this.link=(link==null||link==und)?'':link; this.mouseover=(mouseover==null||mouseover==und)?'':mouseover; }; Area.prototype.toString=function(container){ var mOverText; if(this.mouseover=='') mOverText=this.link; else mOverText=this.mouseover; mOverText='onMouseOver="window.status=\''+mOverText+ '\';return true" '+ 'onMouseOut="window.status=\'\'; return true;"'; var sw=(this.w==-1)?container.width:this.w; var sh=(this.h==-1)?container.height:this.h; var ret='
'; if(this.link.substring(0,11).toLowerCase()=='javascript:'){ ret+=''; } else{ ret+=''; } ret+= ''+ ''+ '
'; return ret; }; Temporal.syncPlaylist=true; function Temporal(type,id){ this.parent=null; this.type=type.toUpperCase(); this.id=id; this.children=new Array(); this.index=-1; this.leftToPlay=0; this.nowPlaying=-1; this.forceFinish=false; }; Temporal.prototype.add=function(itm){ if(itm.parent!=null){ if(itm.parent!=this){ alert('The item already has a parent'); return; } } var i=this.children.length; this.children[i]=itm; itm.index=i; itm.parent=this; this.leftToPlay++; }; Temporal.prototype.addTemporal=function(itm){ this.add(itm); }; Temporal.prototype.findChild=function(id){ if(this.id==id){ return this; } else{ var retVal=null; for(var i=0;i=2){ var tmp=convertToNumber(id.substring(0,2)); id=id.substring(2); var child=this.children[tmp]; if(child.type=='PAR'||child.type=='SEQ'){ return this.children[tmp].getObject(id); } else { return this.children[tmp]; } } return this; } Temporal.prototype.getPlayerList=function(){ var ret=0; var n=this.children.length; for(var i=0;i=2){ var tmp=convertToNumber(temporalIndex.substring(0,2)); if(this.children[tmp].type=='PAR'||this.children[tmp].type=='SEQ') this.children[tmp].playMedia(temporalIndex.substring(2)); else if(temporalIndex.substring(2).length<2) { this.children[tmp].finish(); } else alert('index does not point to a temporal, see Temporal.playMedia'); }else{ if(this.leftToPlay<=0||this.children.length<=0){ var p=this.parent; if(p.nowPlaying<=this.index){ p.nowPlaying=this.index+1; } p.leftToPlay--; if(this.forceFinish)Channel.instance.forceFinishCounter--; if(p.parent!=null){ p.playMedia(''); } return; }else{ if(this.type=='SEQ'){ if(this.nowPlaying<0){ if(Temporal.syncPlaylist)Playlist.setActive(this.id); if(this.forceFinish)Channel.instance.forceFinishCounter++; this.nowPlaying=0; } var tmp=this.children[this.nowPlaying]; var und; if(tmp==null||tmp==und)return; if(tmp.type=='PAR'||tmp.type=='SEQ') tmp.playMedia(''); else{ tmp.playMedia(); } }else{ if(this.nowPlaying<0){ if(Temporal.syncPlaylist)Playlist.setActive(this.id); if(this.forceFinish)Channel.instance.forceFinishCounter++; for(var k=0;k0) tmp.playMedia(''); } else{ tmp.playMedia(); } } } } } } }; Temporal.prototype.preloadFunction=function(){ var n=this.children.length; for(var i=0;i'+ ''+ ''+ ''+ ''+ ''+ ''; return ret; } else{ return ''; } return ''; }; EmbeddedPlayer.prototype.openWindow=function(){ window.location.replace(this.src); }; function Media(){ this.parent=null; this.dest=null; this.files=null; this.areas=null; this.timerID=0; this.type="MEDIA"; this.index=0; this.dur=0; this.playing=false; this.container=null; this.isPaused=false; this.label=null; this.endOnUnPause=false; this.inframe=false; this.linkurl=null; this.map=null; this.init("",null); }; Media.prototype.init=function(dest,label){ var und; this.dest=dest; this.label=(label==und||label==null)?"[Unlabeled Media]":label; this.files=new Array(); this.areas=new Array(); this.playing=false; this.timerID=0; this.isPaused=false; this.endOnUnPause=false; this.inframe=false; }; Media.prototype.addArea=function(link,mouseover,x,y,w,h){ this.areas[this.areas.length]=new Area(x,y,w,h,link,mouseover); }; Media.prototype.addFile=function(player,bw,src,dur,lang,options){ this.files[this.files.length]=new MediaFile(player,bw,src,dur,lang,options); }; Media.prototype.findContainers=function(){ this.container=Channel.instance.getContainer(this.dest); } Media.prototype.finish=function(){ if(this.isPaused){ this.endOnUnPause=true; return; } if(this.timerID!=0){ clearTimeout(this.timerID); this.timerID=0; } var p=this.parent; if(p.nowPlaying<=this.index) p.nowPlaying=this.index+1; p.leftToPlay--; p.playMedia(''); }; Media.prototype.getAreas=function(){ var ret=''; for(var i=0;iret[j+1].bitrate){ var tmp=ret[j]; ret[j]=ret[j+1]; ret[j+1]=tmp; } } } closestMatch=ret[0]; for(i=0;i=0) ret=ret|this.files[i].player; return ret; }; Media.prototype.pause=function(){ this.isPaused=true; } Media.prototype.unpause=function(){ if(this.isPaused){ this.isPaused=false; if(this.endOnUnPause){ this.finish(); return; } } } Media.prototype.play=function(){ if(this.playing){ this.unpause(); return; } if(this.files.length<=0){ this.finish(); return; } this.startTimer(); }; Media.prototype.playMedia=function(){ if(this.playing)return false; if(this.files.length<=0){ this.finish(); return; } var c=null; if(this.container!=null){ c=this.container.currentMedia; if(c!=null){ c.unload(); } } this.play(); }; Media.prototype.preloadFunction=function(){ }; Media.prototype.reset=function(){ if(this.timerID!=0){ clearTimeout(this.timerID); this.timerID=0; } this.playing=false; this.timerID=0; this.isPaused=false; this.endOnUnPause=false; }; Media.prototype.startTimer=function(){ if(this.playing)return false; this.playing=true; this.timerID=setTimeout('Channel.instance.playMedia(\''+this.getEncodedIndex() +'\');',this.dur*1000); }; Media.prototype.stop=function(){ this.isPaused=true; } Media.prototype.toString=function(){ var ret=getTabs()+'Media('+this.type+','+ this.getEncodedIndex()+'):\n'; toString_tabs++; for(var i=0;i=0)return str+'&ord='+ord; else return str+'?ord='+ord; } Picture.prototype.play=function(){ if(this.playing){ this.unpause(); return; } if(this.files.length<=0){ this.finish(); return; } var file=this.getBestFile(); if(file==null)file=this.files[0]; var img=''; var und; if(this.linkurl!=null&&this.linkurl!=""){ if(this.linkurl.substring(0,11)=='javascript:'){ img+=''; } else{ img+=''; } } img+=''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''; con.setContents(tmp); }else{ var alternate=(navigator.platform.toLowerCase().indexOf("mac")>=0&&document.all); if(alternate){ var o=this.files[0]; o.alternate=true; con.setContents(o.write(this.dest,0,this.linkurl,scrollMode,this.characterWidth)); this.text_width=o.text.length*this.characterWidth; }else{ var o=this.files[0]; o.cwidth=con.width; con.setContents(o.write(this.dest,0,this.linkurl,scrollMode,this.characterWidth)); this.text_width=o.text.length*this.characterWidth+con.width; } this.con_left=con.left; this.con_width=con.width; this.left=this.con_left; this.width=this.con_width+100; this.clip.bottom=con.height; this.clip.left=0; this.clip.right=con.width; this.clip.top=0; if(alternate){ Text.scroll_macie(this.dest); }else{ Text.scroll(this.dest); } } } else{ con.setContents(this.files[0].write(this.dest,0,this.linkurl,scrollMode,this.characterWidth)); clearTimeout(this.renderTimer); setTimeout('Text.switchLines("'+this.dest+'",'+(-1)+');',5); } }; Text.prototype.removeUnused=function(player,bitrate,lang){ }; Text.prototype.setContent=function(str,dur){ this.content=str; this.strdur=dur; } Text.prototype.unload=function(){ if(this.renderTimer!=0){ clearTimeout(this.renderTimer); this.renderTimer=0; } this.container.dump(); }; Text.switchLines=function(dest,n){ var con=Channel.instance.getContainer(dest); if(con==null)return; var media=con.currentMedia; if(media==null)return; var length=media.files.length; var outer=dest; n++; n=n%length; con.setContents(media.files[n].write(media.dest,n,media.linkurl,media.mode)); media.renderTimer=setTimeout('Text.switchLines("'+dest+'",'+n+')', media.files[n].dur*1000); }; Text.scroll_macie=function(outer){ var con=Channel.instance.getContainer(outer); if(con==null)return; var media=con.currentMedia; if(media==null)return; clearTimeout(media.renderTimer); var layer; layer=media.layer.all["txt0"]; media.clip.right-=4; if(media.clip.right<=-media.text_width) media.clip.right=media.con_width; layer.style.left=media.clip.right; media.renderTimer=setTimeout('Text.scroll_macie("'+outer+'")',250); }; Text.scroll=function(outer){ var con=Channel.instance.getContainer(outer); if(con==null){ if(Text.debug)alert('oops, can\'t scroll'); return; } var media=con.currentMedia; if(media==null)return; clearTimeout(media.renderTimer); if(navigator.platform.toLowerCase().indexOf("mac")>=0){ scrollDelta=3; scrollDelay=225; }else{ scrollDelta=1; scrollDelay=75; } if(media.left-100<=media.con_left-media.text_width){ media.clip.left=0; media.clip.right=media.con_width; media.clip.top=0; media.clip.bottom=con.height; media.left=media.con_left; media.width=media.con_width+300; }else{ media.clip.left+=scrollDelta; media.clip.right+=scrollDelta; media.left-=scrollDelta; media.width+=scrollDelta; } if(document.getElementById){ media.layer.style.clip=media.clip.toString(); media.layer.style.left=media.left; media.layer.style.width=media.width; } else if(document.layers){ media.layer.left=media.left; media.layer.width=media.width*10; media.layer.clip.left=media.clip.left; media.layer.clip.right=media.clip.right; if(media.layer.left%30==0){ } if(media.layer.left%30==-15){ } } media.renderTimer=setTimeout('Text.scroll("'+outer+'")',scrollDelay); }; function Clip(top,right,bottom,left){ this.top=top; this.right=right; this.bottom=bottom; this.left=left; }; Clip.prototype.toString=function(){ return 'rect('+this.top+'px '+ this.right+'px '+ this.bottom+'px '+ this.left+'px)'; }; function TextLine(text,dur,lang,textObj){ this.text=text; this.dur=dur; this.lang=lang; this.alternate=false; this.cwidth=0; this.parent=textObj; }; TextLine.prototype.write=function(dest,index,url,scrollMode,charWidth){ var font1=''; var font2=''; var ret=''; if(url!=null){ if(url.substring(0,11).toLowerCase()=='javascript:'){ ret+=''+ this.text+ ''; } else{ ret+=''+ this.text+ ''; } } else{ ret+=this.text; } ret=''+font1+ret+font2+''; if(this.alternate){ ret='
'+ ret+'
'; return ret; }else{ return '
'+ret+ '
'; } }; TextLine.prototype.toString=function(){ var ret=getTabs()+'TextLine('+this.text+','+this.dur+','+ this.lang+'):\n'; return ret; }; Player.instanceCount=0; Player.maxdelay=15; Player.debug=false; function Player(parentVideo){ if(Detection.instance==null) new Detection(); this.parent=parentVideo; this.det=Detection.instance; this.channel=Channel.instance; this.layername; this.playername; this.player=null; this.previousPosition=0; this.plugin=null; this.qtiframe=!this.det.isNS(); this.newWMP=7; if(this.channel.player&8){ this.plugin=this.channel.detect.getPlugin(Detection.P_WINMEDIA); } }; Player.prototype.detectObjectIsPaused=function(){ var det=Detection.instance; if(this.player==null)return; if(det.isWinIE()){ if(this.channel.player&32){ } if(this.channel.player&8){ if(this.player.PlayState==1||this.player.PlayState==0){ return true; } } if(this.channel.player&16){ } } return false; }; Player.prototype.doObject=function(p){ return this.det.isWinIE(); }; Player.prototype.getDuration=function(){ var und; var duration=0; if(this.player==null||this.player==und){ if(this.getPlayerObject()==null){ return 0; } } if(this.channel.player&32){ var d=this.player.GetEndTime()/1000; if(d>1000000) return this.player.GetDuration()/1000; else return d; } if(this.channel.player&8){ if(this.det.isWinIE()){ if(this.plugin.version>=this.newWMP){ return this.player.currentMedia.duration; }else{ return this.player.Duration; } } } if(this.channel.player&16){ if(this.det.isWinXP()&&this.det.isNS5()){ return this.player.GetLength/1000; }else{ if(Player.debug)alert(this.player.GetLength()); return this.player.GetLength()/1000; } } return 0; }; Player.prototype.getPlayerObject=function(){ var obj; var det=this.det; if(this.channel.player&32&&!this.parent.inframe&&false){ if(document.getElementById){ alert('l'); obj=document.frames[0]; alert(obj); alert(obj.test); var nodes=obj.getElementsByTagName('embed'); if(nodes.length!=1){ nodes=obj.getElementsByTagName('object'); if(nodes.length!=1)nodes=null; } if(nodes!=null)obj=nodes[0]; alert('embed/object:'+obj.nodeName); }else if(det.isNS4()){ obj=document.layers[this.layername].document.embeds[this.playername]; }else{ obj==null; } }else{ if(det.isIE()){ obj=document.all[this.playername]; }else if(det.isNS4()){ obj=document.layers[this.layername].document.embeds[this.playername]; }else if(det.isNS()){ obj=document.embeds[this.playername]; }else{ obj==null; } } this.player=obj; return obj; }; Player.prototype.getPosition=function(){ if(this.player==null){ if(this.getPlayerObject()==null){ return 0; } } if(this.det.isWinIE()){ if(this.channel.player&8){ if(this.plugin.version>=this.newWMP&&this.player.controls){ return this.player.controls.currentPosition; } else{ return this.player.CurrentPosition; } } } if(this.channel.player&32){ return this.player.GetTime()/1000; } if(this.channel.player&8){ return this.player.GetCurrentPosition(); } if(this.channel.player&16){ if(this.det.isWinXP()&&this.det.isNS5()) return this.player.GetPosition/1000; else return this.player.GetPosition()/1000; } return 0; }; Player.prototype.getRemaining=function(){ if(Player.debug)alert('in getRemaining'); var duration=this.getDuration(); if(Player.debug)alert('after getDuration:'+duration); var currpos=this.getPosition(); if(Player.debug)alert('after getPosition:'+currpos); if(Player.debug)alert("getRemaining"+duration+" "+currpos); if(duration>0){ var r=duration-currpos; if(Player.debug)window.status='getRemaining:dur'+duration+' pos'+currpos; if(currpos3){ return(r>Player.maxdelay)?Player.maxdelay:3; }else{ return r; } }else{ if(Player.debug)window.status='getRemaining=-1'; return -1; } }; Player.prototype.setPlayer=function(lyr,plr){ this.layername=lyr; this.playername=plr; this.previousPosition=0; return(this.getPlayerObject()!=null); }; Player.prototype.pause=function(){ var det=this.det; if(det.isMac()||det.isNS5()||Channel.instance.player&32){ this.parent.reset(); var c=this.parent.container; c.setContents(''); }else{ if(this.player==null)return; if((this.channel.player&16)!=0)this.player.DoPause(); if((this.channel.player&8)!=0){ if(this.plugin.version>=this.newWMP){ if(this.player.controls) this.player.controls.pause(); } else{ this.player.Pause(); } } if((this.channel.player&32)!=0){ this.player.Stop(); } } }; Player.prototype.play=function(){ previousPosition=0; if(this.player==null)return; if(this.channel.player&16)this.player.DoPlay(); if(this.channel.player&8){ if(this.plugin.version>=this.newWMP){ if(this.player.controls){ this.player.controls.play(); } } else{ this.player.Play(); } } if(this.channel.player&32)this.player.Play(); }; Player.prototype.stop=function(){ var det=this.det; if(det.isMac()||det.isNS5()||Channel.instance.player&32){ this.parent.reset(); var c=this.parent.container; c.setContents(''); }else{ if(this.player==null)return; if(this.channel.player&16){ if(this.det.isNS5()) this.player.DoStop; else this.player.DoStop(); }else if(this.channel.player&8){ if(this.det.isNS5()){ }else{ if(this.plugin.version>=this.newWMP){ if(this.player.controls) this.player.controls.stop(); } else{ this.player.Stop(); } } }else if(this.channel.player&32){ this.player.Stop(); } } }; Player.prototype.unload=function(){ this.stop(); if(this.det.isWinIE()&&this.channel.player&8){ if(this.player==null)return; if(this.plugin.version>=7){ this.player.close(); } } }; Player.prototype.writePlayer=function(src,width,height,playerName){ var chan=Channel.instance.player; this.player=null; if(chan&32&&!this.parent.inframe&&this.qtiframe){ var url=window.location.href; var a=url.indexOf('#'); if(a>0)url=url.substring(0,a); if(url.indexOf('?')<0)url+='?'; else url+='&'; url+='DirectPlay=true&ID='+this.parent.getEncodedIndex()+ '&B='+Channel.instance.bitrate+'&P='+Channel.instance.player; return ''; } if(chan&16){ if(this.doObject(chan)){ return ''+ ''+ ''+ ''+ ''+ ''; }else{ return ''; } } if(chan&8&&this.plugin.version>=this.newWMP){ var full=window.location.href; var base=full.substring(0,full.lastIndexOf('/')+1); if(this.doObject(chan)){ return ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''; }else{ return ''+ ''; } } else if(chan&8){ var full=window.location.href; var base=full.substring(0,full.lastIndexOf('/')+1); if(this.doObject(chan)){ return ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''; }else{ return ''+ ''; } } if(chan&32){ if(this.doObject(chan)){ return ''+ ''+ ''+ ''+ ''+ ''+ '' + ''+ ''; }else{ return ''; } } if(chan&1){ if(this.doObject(chan)){ return ''+ ''+ ''+ ''+ ''+ ''; }else{ return ''; } } if(chan&2){ window.location.replace(src); } return ''; }; Video.prototype=new Media(); Video.superclass=Media.prototype; Video.instanceCount=0; Video.delay=20; Video.debug=false; function Video(dest,label){ var und; this.guessedDuration=5; this.init(dest,label); this.dur=1; this.detectionTimerID=0; this.type="VIDEO"; this.playerName=dest+"_MediaPlayer"+(Video.instanceCount++); this.player=new Player(this); this.unloaded=true; this.inframe=false; }; Video.prototype.finish=function(){ var remaining=this.getTimeRemaining(); var finished=false; if(remaining<=0.1){ if(this.timerID!=0){ clearTimeout(this.timerID); this.timerID=0; } var p=this.parent; if(p.nowPlaying<=this.index) p.nowPlaying=this.index+1; p.leftToPlay--; p.playMedia(''); } else{ this.dur=remaining; this.playing=false; this.startTimer(); this.dur=0; } }; Video.prototype.getPlayerCode=function(){ var file=this.getBestFile(); var con=Channel.instance.getContainer(this.dest); var pl=this.player.writePlayer(file.src,con.width,con.height,this.playerName); return pl; }; Video.prototype.getTimeRemaining=function(){ var det=Detection.instance; if(this.files.length<=0)return 0; if(det.isMacIE()||(det.isWinNS5()&&Channel.instance.player&8)){ var d=this.dur; var x=Video.delay/2; this.dur=0; if(d<=0)return 0; if(d=0){ return r; }else{ return this.dur; } }; Video.prototype.pause=function(){ this.isPaused=true; this.player.pause(); } Video.prototype.play=function(){ var det=Detection.instance; if(this.playing&&!this.unloaded){ this.unpause(); this.player.play(); return false; } if(this.files.length<=0){ this.finish(); return; } var file=this.getBestFile(); if(file==null){ this.finish(); return; } this.guessedDuration=file.dur; this.dur=file.dur; var delay=(Detection.instance.os==Detection.OS_WIN&& (Channel.instance.player&8)!=0)?2:Video.delay; this.detectionTimerID=setTimeout( 'Channel.instance.getContainer("'+this.dest+'").currentMedia.finish()', delay*1000 ); this.dur-=(Video.delay/2); var con=Channel.instance.getContainer(this.dest); con.currentMedia=this; con.show(); this.unloaded=false; var pl=this.player.writePlayer(file.src,con.width,con.height,this.playerName); if(pl.indexOf(''; if(det.isWinIE()&&(Channel.instance.player&32)!=0){ var layer=this.dest; con.setContents(pl+this.getAreas()); setTimeout('document.all["'+layer+'"].style.display="none";',200); setTimeout('document.all["'+layer+'"].style.display="inline";',250); }else{ con.setContents(pl+this.getAreas()); } if(((Channel.instance.player&8)!=0)&&det.isWinIE()){ if(document.all[this.playerName]!=null){ document.all[this.playerName].FileName=file.src; } } if(!this.player.setPlayer(this.dest,this.playerName)){ if(Video.debug)alert('couldn\'t find the player in the dom,report this to miguel\n(basically we can\'t get duration on this)'); } } else{ con.setContents(pl); } }; Video.prototype.preloadFunction=function(){}; Video.prototype.reset=function(){ this.dur=this.guessedDuration; if(this.timerID!=0){ clearTimeout(this.timerID); this.timerID=0; } if(this.detectionTimerID!=0){ clearTimeout(this.detectionTimerID); this.detectionTimerID=0; } this.playing=false; this.unloaded=true; }; Video.prototype.stop=function(){ var det=Detection.instance; this.player.stop(); } Video.prototype.unload=function(){ this.player.unload(); this.reset(); this.container.dump(); }; PlayerStopper.prototype=new Media(); PlayerStopper.superclass=Media.prototype; function PlayerStopper(){ this.init(""); this.type="PLAYERSTOPPER"; this.addFile(-1,0,'',0); }; PlayerStopper.prototype.play=function(){ Channel.instance.stop(); }; function Channel(){ if(Channel.instance==null) Channel.instance=this; if(Chooser.instance==null) new Chooser(); if(Detection.instance==null) new Detection(this.path); this.chooser=Chooser.instance; this.detect=Detection.instance; this.autodetect=true; this.bitrate=256000; this.player=8; this.lang="en"; this.realPlayer=new EmbeddedPlayer(1); this.realOne=new EmbeddedPlayer(2); this.cancelClick=false; this.clickDelay=0.5; this.parent=null; this.type='CHANNEL'; this.containers=new Array(); this.children=new Array(); this.players=0; this.cookie=new Cookie(); this.query=new QueryString(); this.tPlayItem=0; this.status=-1; this.forceFinishCounter=0; }; Channel.instance=null; Channel.T_CHOOSER=0; Channel.T_FEATURE=1; Channel.T_KIDDIE=2; Channel.T_ERROR=3; Channel.path='MM_player/'; Channel.loadingLayer=new Container("loading",0,0,0,0,0); Channel.debug=false; Channel.PLAYING=2; Channel.PAUSED=1; Channel.STOPPED=0; Channel.MIN_FLASH_VERSION=4; Channel.prototype.addContainer=function(name,left,top,width,height,zindex){ var c=new Container(name,left,top,width,height,zindex); this.containers[this.containers.length]=c; return c; }; Channel.prototype.add=function(temp){ var l=this.children.length; this.children[l]=temp; temp.parent=this; temp.index=l; }; Channel.prototype.beginPlay=function(){ this.unloadAll(); this.forceFinishCounter=0; this.status=Channel.PLAYING; if((this.player&1)!=0||(this.player&2)!=0){ if(this.player&1||this.realOne.src==null){ var c=this.getContainer('RPCONTAINER'); c.setContents(this.realPlayer.toString()); c.show(); }else{ var c=this.getContainer('RPOCONTAINER'); c.setContents(this.realOne.toString()); c.show(); } } else{ this.playChapter(this.children[this.tPlayItem].id); this.cancelClick=false; } return; }; Channel.delayErrorPage=function(){ var str='Your browser is not supported, goodbye.'; Channel.loadingLayer.setContents(str); } Channel.prototype.doIFrameWorkaround=function(){ var o=this.getObject(this.query.getValue('ID')); var c=this.getContainer(o.dest); o.inframe=true; c.left=0; c.top=0; this.player=32; document.write(c.getHTML(o.getPlayerCode())); window.test='asdf'; } Channel.prototype.findContainers=function(){ var n=this.children.length; for(var i=0;i=2){ var tmp=convertToNumber(id.substring(0,2)); if(this.children[tmp].type=='PAR'||this.children[tmp].type=='SEQ') return this.children[tmp].getObject(id.substring(2)); else{ alert('invalid id used at Channel.playMedia(...)'); } }else{ alert('invalid id used at Channel.playMedia(...), (too short)'); } return null; }; Channel.prototype.getPlayerList=function(){ this.players=0; var n=this.children.length; for(var i=0;i4); }else if(b==Detection.B_IEXPLORER){ tmp=(v>=5); }else if(b==Detection.B_SAFARI){ tmp=(v>=1); }else{ } if(!tmp){ ret+='Your browser is not supported.\n'; } p=d.getPlugin(Detection.P_FLASH); if(p==null||p.versionDownload here.\n'; } req=det.isNS4(); p=d.getPlugin(Detection.P_JAVA); if(p==null&&req){ ret+='Java is required. '+ 'Download here.\n'; } if(Channel.debug&&false){ ret+='You have debug turned on, it is reporting an error for testing\n'; ret+='This is a fake error message\n'; ret+='This is a fake error message\n'; ret+='You have debug turned on, it is reporting an error for testing\n'; ret+='This is a fake error message\n'; ret+='This is a fake error message\n'; ret+='You have debug turned on, it is reporting an error for testing\n'; ret+='This is a fake error message\n'; ret+='This is a fake error message\n'; } return ret; } Channel.prototype.isKiddieSystem=function(){ var d=Detection.instance; if(d.isOldMac()){ return true; } } Channel.prototype.isIFrameWorkaround=function(){ return(this.query.getValue('DirectPlay')=='true'); } Channel.prototype.pause=function(){ if(this.forceFinishCounter>0){ return; } if(this.status!=Channel.PLAYING){ }else{ for(var i=0;i0){ return; } if(this.status==Channel.STOPPED){ this.cancelClick=false; this.beginPlay(); }else if(this.status==Channel.PAUSED){ for(var i=0;i0){ return; } if((this.player&1)!=0||(this.player&2)!=0){ }else{ if(this.cancelClick)return; this.cancelClick=true; setTimeout('Channel.instance.cancelClick=false;',this.clickDelay*1000); for(var index=0;index=2){ var tmp=convertToNumber(id.substring(0,2)); if(this.children[tmp].type=='PAR'||this.children[tmp].type=='SEQ') this.children[tmp].playMedia(id.substring(2)); else{ alert('invalid id used at Channel.playMedia(...)'); } }else{ alert('invalid id used at Channel.playMedia(...), (too short)'); } }; Channel.prototype.preloadFunction=function(){ var n=this.children.length; for(var i=0;i0){ return; } if(this.status==Channel.STOPPED){ }else{ for(var i=0;i=0); if(!blnSingle){ tmp=''; this.dur=file.dur; this.startTimer(); con.setContents(tmp); }else{ document.write('
'); tmp=Animation.getCode(this.playerName,file.src,con.width,con.height); tmp+=this.getAreas(); document.write(tmp); } }else{ var tmp=''; if(con==null) return; this.dur=file.dur; tmp=Animation.getCode(this.playerName,file.src,con.width,con.height); tmp+=this.getAreas(); this.startTimer(); con.setContents(tmp); } }; Animation.prototype.unload=function(){ this.container.dump(); }; Animation.getCode=function(name,src,w,h){ return ''+ ' '+ ' '+ ' '+ ' '+ ''+ ''+ ' '+ ''; }; Shockwave.prototype=new Media(); Shockwave.superclass=Media.prototype; function Shockwave(dest){ this.init(dest); this.playerName=dest+"_ShockwavePlayer"; this.type="SHOCKWAVE"; this.params=new Array(); this.values=new Array(); }; Shockwave.prototype.addParam=function(name,value){ var i=this.params.length; this.params[i]=name; this.values[i]=value; } Shockwave.prototype.play=function(){ if(this.playing)return false; var tmp=''; var con=Channel.instance.getContainer(this.dest); if(con==null) return; var file=this.files[0]; con.currentMedia=this; this.dur=file.dur; tmp=Shockwave.getCode(this.playerName,file.src,con.width,con.height); tmp+=this.getAreas(); this.startTimer(); updateLayer(this.dest,tmp); }; Shockwave.prototype.unload=function(){ this.container.dump(); }; Shockwave.getCode=function(name,src,w,h){ var objParams=''; var embParams=''; for(var i=0;i'; embParams+=this.params[i]+'="'+this.values[i]+'" '; } return ''+ ''+ ' '+ ''+ ''+ objParams+ ' '+ ''; }; PlayerPicker.prototype=new Media(); PlayerPicker.superclass=Media.prototype; function PlayerPicker(dest,dur,style){ this.init(dest); var und; this.type="PLAYERPICKER"; this.dur=(dur==und||dur<=0)?0:dur; this.style=(style==und||style==null)?"":style; this.addFile(-1,0,'',0); }; PlayerPicker.prototype.play=function(){ if(this.playing){ this.unpause(); return; } var con=this.container; var style=this.style+"width:"+con.width+"px;" var str=Chooser.instance.showPlayerOptions(false,style); con.setContents(str); con.currentMedia=this; con.show(); if(this.dur>0) this.startTimer(); else this.finish(); }; PlayerPicker.prototype.unload=function(){ this.container.dump(); }; SpeedPicker.prototype=new Media(); SpeedPicker.superclass=Media.prototype; function SpeedPicker(dest,dur,style){ this.init(dest); var und; this.type="SPEEDPICKER"; this.dur=(dur==und||dur<=0)?0:dur; this.style=(style==und||style==null)?"":style; this.notReadyTimer=0; this.addFile(-1,0,'',0); }; SpeedPicker.prototype.play=function(){ if(this.playing){ this.unpause(); return; } var con=this.container; con.currentMedia=this; if(!Chooser.instance.ready){ this.notReadyTimer=setTimeout( 'Channel.instance.getContainer("'+this.dest+'").currentMedia.play()', 100 ); }else{ var style=this.style+"width:"+con.width+"px;" var str=Chooser.instance.showSpeedOptions(false,style); con.setContents(str); con.show(); if(this.dur>0) this.startTimer(); else this.finish(); } }; SpeedPicker.prototype.unload=function(){ this.container.dump(); }; MediaLister.prototype=new Media(); MediaLister.superclass=Media.prototype; function MediaLister(dest,dur){ this.init(dest); var und; this.type="MEDIALISTER"; this.dur=(dur==und||dur<=0)?0:dur; this.list=null; this.addFile(-1,0,'',0); this.listType="VIDEO"; this.listTemporal=Channel.T_FEATURE; }; MediaLister.titleFontStyle='font-family: Verdana,sans-serif; font-size: 14px; font-weight: bold; padding-left: 5px;'; MediaLister.playerLabelStyle='font-family: Verdana,sans-serif; font-size: 10px; padding: 0px; text-align: center;'; MediaLister.playerSpeedStyle='font-family: Verdana,sans-serif; font-size: 10px; padding: 0px;'; MediaLister.playerLinkStyle='font-family: Verdana,sans-serif; font-size: 10px; padding: 0px; text-align: center; color: darkblue;'; MediaLister.bodyBGColor="#FFFFFF"; MediaLister.playerBGColor="#C0C0C0"; MediaLister.titleBGColor="#000000"; MediaLister.titleColor="#FFFF88"; MediaLister.rowBGColor="#FFFFFF"; MediaLister.row1Color="rgb(100, 150, 200);"; MediaLister.prototype.getList=function(ar,temporal,cn){ for(var i=0;i0) this.startTimer(); else this.finish(); }; MediaLister.prototype.showItem=function(index){ var str=''; var con=this.container; var p=(index>0)?index-1:-1; var n=(index'+ this.list[index].getHTML(p,n)+ ' '; con.setContents(this.list[index].getHTML(p,n)); }; MediaLister.prototype.unload=function(){ if(this.renderTimer!=0){ clearTimeout(this.renderTimer); this.renderTimer=0; } this.container.dump(); }; function MediaListerItem(obj,w,h,parent){ var und; this.parent=parent; this.obj=(obj==null||obj==und)?null:obj; this.width=w; this.height=h; }; MediaListerItem.prototype.getHTML=function(p,n){ var str=''; var obj=this.obj; var pList=new Array(); pList[0]=Chooser.QT|Chooser.QTE; pList[1]=Chooser.R|Chooser.RE|Chooser.RO; pList[2]=Chooser.WM; if(obj==null){ str+="Internal Error"; }else{ var tmpTD1=''; var tmpTD2=''; var tmpTD3=''; str+=''+ ''+ tmpTD1+' '; var tmpPlayers=new Array("QT","RP","WMP"); for(var i=0;i'+ tmpPlayers[i]+'

'; } str+='
'; for(var tmp=0;tmp<1;tmp++){ for(var i=1;i'+ tmpTD2+Chooser.speeds[i].name+''; for(var j=0;j<3;j++){ var f=obj.getBestFile(pList[j],Chooser.speeds[i].value,0); str+=tmpTD3; if(f!=null){ str+='View'; }else str+=' '; str+=''; } str+='\n'; } } str+=''; str+='
'+ ''+ this.obj.label+'
 
'; str+='\n\n
'+ ''+ ''+ ''+ ''+ ((p>=0)? ''+ 'View Previous Item'+ '':'' )+ ''+ ''+ ''+ ((n>=0)? ''+ 'View Next Item'+ '':'' )+ '
\n\n'; str+='
'; } return str; }; Java.prototype=new Media(); Java.superclass=Media.prototype; function Java(dest){ this.init(dest); this.type="JAVA"; this.addFile(-1,0,'',0); }; Java.prototype.play=function(){ if(this.playing){ this.unpause(); return; } if(this.files.length<=0){ this.finish(); return; } var ch=Channel.instance; var file=this.getBestFile(); var con=this.container; con.currentMedia=this; var tmp=''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''; con.setContents(tmp); con.show(); this.finish(); }; Java.prototype.unload=function(){ this.container.dump(); }; TargetAd.prototype=new Media(); TargetAd.superclass=Media.prototype; function TargetAd(dest,url,mode){ var und; if(mode==und||mode==null)mode=TargetAd.M_DBLCLICK; this.init(dest); this.type="TARGETAD"; this.url=url; this.mode=mode; this.dur=0; this.addFile(-1,-1,'','en'); }; TargetAd.M_DBLCLICK=1; TargetAd.M_GENERIC_STATIC=2; TargetAd.M_GENERIC_RANDOM=3; TargetAd.M_AVENUE_A=4; TargetAd.prototype.play=function(){ if(this.playing&&this.isPaused){ this.isPaused=false; return; } var str=''; var con=this.container; con.currentMedia=this; con.show(); var url=this.getFixedUrl(); str=''; con.setContents(str); this.startTimer(); }; TargetAd.prototype.getFixedUrl=function(){ var rand=Math.random()*10000000000000000; if(this.mode==TargetAd.M_DBLCLICK){ var regA=/^(.*ord=)([\d]+)(.*)/; var ord=rand; if(regA.test(this.url))return RegExp.$1+ord+RegExp.$3; else return this.url; }else if(this.mode==TargetAd.M_GENERIC_STATIC){ return this.url; }else if(this.mode==TargetAd.M_GENERIC_RANDOM){ var url=this.url; if(url.indexOf('?')<0)url+='?'; else url+='&'; return url+'Zrand='+rand }else if(this.mode==TargetAd.M_AVENUE_A){ var regB=/^(.*click=)([\d]*)(.*)/; if(regB.test(this.url))return RegExp.$1+rand+RegExp.$3; else return this.url; } return this.url; } TargetAd.prototype.setMode=function(m){ this.mode=m; } TargetAd.prototype.unload=function(){ this.container.dump(); }; Playlist.prototype=new Media(); Playlist.superclass=Media.prototype; Playlist.instances=new Array(); Playlist.debug=true; Playlist.cursor='pointer'; function Playlist(dest){ this.id=Playlist.instances.length; Playlist.instances[this.id]=this; if(Detection.instance.isWinIE()){ Playlist.cursor='hand'; } this.styleoff='font-family:sans-serif; font-weight:bold; font-size:11px; text-align:center; color:black;'; this.styleon='color:red;'; this.stylecur='color:green;'; this.type="PLAYLIST"; this.init(dest); this.dur=0.001; this.currentTop=null; this.currentSelected=-1; this.paddingRight=0; this.paddingLeft=0; this.paddingTop=0; this.paddingBottom=0; this.centerSmallList=false; this.rowHeight=18; this.listBuffer=-1; this.imgup=null; this.imgdn=null; this.imgslider=null; this.background=null; this.sliderX0=0; this.sliderY0=0; this.sliderX1=0; this.sliderY1=0; this.files[0]=null; this.items=new Array(); this.rows=0; this.visible=false; this.uplinked=null; this.dnlinked=null; this.clicksEnabled=true; this.lyrBG=null; this.lyrUP=null; this.lyrDN=null; this.lyrSL=null; this.lyrItems=new Array(); }; Playlist.clicked=function(){ var p=Playlist.instances[this.instanceid]; if(this.itemid<0)return false; Channel.instance.playChapter(p.items[this.itemid].chap); return false; }; Playlist.mouseover=function(){ var p=Playlist.instances[this.instanceid]; var s=p.styleon; if(this.itemid>=0)setStyle(s,this); }; Playlist.mouseout=function(){ var p=Playlist.instances[this.instanceid]; var s=p.styleoff; var s2=p.stylecur; if(p.currentSelected==this.itemid&&this.itemid>=0)setStyle(s2,this); else setStyle(s,this); }; Playlist.setActive=function(chapter){ var und; if(chapter==und||chapter==null||chapter=="")return; for(var i=0;i'+ ''+ ''; } tmp=this.imgup; if(tmp!=null){ content+='
'; } tmp=this.imgdn; if(tmp!=null){ content+='
'; } var iw=w-(this.paddingLeft+this.paddingRight); for(var i=0;i.'; } tmp=this.imgslider; if(tmp!=null){ content+='
'; content+='=0&&t=0){ this.currentSelected=id; var top=id-Math.floor((this.rows-1)/2); if(top-this.listBuffer>(this.items.length-this.rows)){ top=top-(top-this.listBuffer-(this.items.length-this.rows)); } else if(top+this.listBuffer<0){ top=-this.listBuffer; } this.currentTop=top; this.redraw(); } }; Playlist.prototype.moveDown=function(){ if(this.currentTop-this.listBuffer<(this.items.length-this.rows)){ this.currentTop++; this.redraw(); }else{ } }; Playlist.prototype.moveUp=function(){ if(this.currentTop+this.listBuffer>0){ this.currentTop--; this.redraw(); }else{ } }; Playlist.prototype.play=function(){ this.visible=true; this.draw(); this.redraw(); this.startTimer(); }; Playlist.prototype.preloadFunction=function(){ }; Playlist.prototype.redraw=function(){ if(!this.visible)return; if(this.listBuffer<0){ this.listBuffer=Math.floor(this.rows/2); } var r=''; var tmp=null; var doUpdate=false; var flag=false; var buffer=this.listBuffer; if(this.items.length<=this.rows){ if(this.centerSmallList){ this.currentTop=-Math.floor((this.rows-this.items.length)/2); this.listBuffer=0; }else{ this.currentTop=0; this.listBuffer=0; } } r=''; tmp=this.imgup; flag=(this.currentTop+this.listBuffer>0); doUpdate=(this.uplinked!=flag); this.uplinked=flag; if(doUpdate&&tmp!=null){ if(flag)r+=''; r+=''; r+='=0&&t0&&this.items.length>0){ p=((this.currentTop+this.listBuffer)/p); var x=(this.sliderX1-this.sliderX0)*p+this.sliderX0; var y=(this.sliderY1-this.sliderY0)*p+this.sliderY0; this.lyrSL.style.top=y; this.lyrSL.style.left=x; }else{ } } this.listBuffer=buffer; }; Playlist.prototype.setBackground=function(img){ this.background=img; }; Playlist.prototype.setImageDown=function(img,mimg,x,y,w,h){ this.imgdn=new PlaylistImage(img,mimg,x,y,w,h); }; Playlist.prototype.setImageUp=function(img,mimg,x,y,w,h){ this.imgup=new PlaylistImage(img,mimg,x,y,w,h); }; Playlist.prototype.setImageSlider=function(img,mimg,x0,y0,w,h,x1,y1){ this.sliderX0=x0; this.sliderY0=y0; this.sliderX1=x1; this.sliderY1=y1; this.imgslider=new PlaylistImage(img,mimg,x0,y0,w,h); }; Playlist.prototype.toString=function(){ var ret=getTabs()+'Playlist('+this.type+','+ this.getEncodedIndex()+'):\n'; return ret+getTabs()+'End Playlist\n'; }; Playlist.prototype.unload=function(){ this.container.dump(); this.visible=false; }; function PlaylistItem(index,chap,lbl){ this.index=index; this.chap=chap; this.lbl=lbl; }; PlaylistItem.prototype.getHTML=function(x,y,w,h,styleoff,styleon){ var r=''; r+=''; return r; }; function PlaylistImage(img,mimg,x,y,w,h){ var und; this.img=img; this.mimg=(mimg==und)?null:mimg; this.width=(w==und)?0:w; this.height=(h==und)?0:h; this.left=(x==und)?0:x; this.top=(y==und)?0:y; }; PlaylistImage.prototype.getHTML=function(link){ var und; if(link==und)link=null; var r='
'; if(link!=null)r+=''; r+=''; r+='
'; return r; }; ErrorList.prototype=new Media(); ErrorList.superclass=Media.prototype; function ErrorList(dest){ this.init(dest); this.type="ERRORLIST"; this.addFile(-1,0,'',0); }; ErrorList.prototype.play=function(){ var con=this.container; con.currentMedia=this; var str=Channel.instance.hasRequirements(); var html=''; if(str!=""&&str!=null){ var lines=str.split('\n'); for(var i=0;i"+lines[i]+"
"; } } this.startTimer(); con.setOverflow('auto'); con.setContents(html); con.show(); }; ErrorList.prototype.unload=function(){ this.container.dump(); }; Delay.prototype=new Media(); Delay.superclass=Media.prototype; function Delay(dur){ this.init(""); this.type="DELAY"; this.dur=dur; this.addFile(-1,0,'',0); }; Delay.prototype.play=function(){ if(this.playing)return false; if(this.dur>0) this.startTimer(); }; Redirect.prototype=new Media(); Redirect.superclass=Media.prototype; function Redirect(url){ this.init(""); this.type="REDIRECT"; this.files[0]=null; this.url=url; this.keepHistory=true; }; Redirect.prototype.play=function(){ if(this.keepHistory){ window.location.href=this.url; }else{ window.location.replace(this.url); } };