<!--
//
//============================================================【程序信息及版权宣告】====
//ExoBUD MP(II) v4.1tc+ [Traditional Chinese Version]
//Copyright(Pe) 1999-2003 Jinwoong Yu[ExoBUD], Kendrick Wong[kiddiken.net].yune_lee[liyu.net]
//======================================================================================
//程序原作者: 庾珍雄(Jinwoong Yu) 
//个人网站: http://exobud.nayana.org 
//电子邮件: exobud@hanmail.net
//繁体中文化作者: 惊直(Kendrick Wong/kiddiken)
//个人网站: http://kiddiken.net
//电子邮件: webmaster@kiddiken.net
//简体中文化作者: liyu(yune_lee)
//个人网站: http://www.liyu.net
//电子邮件: yune_lee@163.net
//0ICQ 账号: 4410162
//发表日期: 2003.01.10(此版本原韩文版) 
//发表日期: 2003.03.23(繁体中文首个版本)
//发表日期: 2003.05.22(简体中文首个版本)
//======================================================================================
//版权所有。
//请尊重智慧财产权： 无论您对本程序 ExoBUD MP(II) 作任何修改、制作(或翻译)面板，请您
//*必须*保留此段版权宣告的内容，包括程序(及面板)原作者及中文化作者的名字和网站连结。
//如果您想要以繁体中文版或简体中文版的程序为基础，翻译成其它语言的版本，及／或在因特网上，
//公开发表您所修改过的版本，请您首先以传送电子邮件的方式，征求我们的同意。
//请不要将程序(或面板)原作者或中文化作者的名字改成您自己的名字，
//然后以另一程序名称重新命名后在网络上公开发表及散播本程序，因为这是严重的侵权行为。
//这是公益免费程序，所以请不要使用在商业用途上。
//另外，您亦不可将本程序(全部或部份)复制到其它储存媒体(例如光盘片)上作贩卖获利用途。
//假如因为使用本程序而令您蒙受数据遗失或损毁，程序原作者及中文化作者均不用对其负责。
//======================================================================================
// 当您修改本程序的原始码时，请注意执行修改后的程序，可能会导致一些正在执行中的应用程序
// 无法正常运作；另外亦要留意在JavaScript上所使用的变量名称和设定值，大小写是有分别的。
var objMmInfo = null;
var intMmCnt = 0;
var intSelMmCnt = 0;
var intActMmCnt = 0;
var cActIdx = 0;
var cActTit = "nAnT";
var strMmInfo = "ExoBUD MP(II) v4.1tc+ 网站媒体播放程序(liyu.net简体汉化版) ";
var blnfpl = false;
var blnEnabled = false;
var blnEOT = false;
var arrSelMm = null;
var arrActMm = null;
var intExobudStat = 0;
var tidTLab = null;
var tidErr = null;
var tidMsg = null;
var intErrCnt = 0;
var blnRept = false;
var blnAutoProc = true;//自动连续播放

var blnElaps=true;//显示时间方式
var intDelay =500;//每首曲目之间的延迟时间

function wmpInit(){
var wmps = Exobud.settings;
var wmpc = Exobud.ClosedCaption;
wmps.autoStart=true;
wmps.balance=0;
wmps.enableErrorDialogs=false;
wmps.invokeURLs = false;
wmps.mute=false;
wmps.playCount=1;
wmps.rate=1;
wmps.volume = 100;
if(blnUseSmi){wmpc.captioningID="capText"; capText.style.display="";}
}

function mkMmPath(u, t, f,s){
this.mmUrl = u;
this.mmTit =t;
this.mmDur =0;
this.selMm=f;
this.actMm=f;
if(blnUseSmi){this.mmSmi=s;}
}

function mkList(u,t,s,f){
var cu=u;
var ct=t;
var cs=s;
var cf=f;
var idx=0;
if(objMmInfo == null){ objMmInfo=new Array(); idx=0;}
else{ idx=objMmInfo.length;}
if(u=="" || u==null){cu="mms://";}
if(t=="" || t==null){ct="nAnT";}
if(f=="f" || f=="F"){cf="f";}
else{cf="t"; intSelMmCnt=intSelMmCnt+1;}
if(blnUseSmi){ objMmInfo[idx]=new mkMmPath(cu,ct,cf,cs);}
else{objMmInfo[idx]=new mkMmPath(cu,ct,cf);}
intActMmCnt=intSelMmCnt;
intMmCnt=objMmInfo.length;
}

function mkSel(){
arrSelMm=null;
intSelMmCnt=0;
var selidx = 0;
if(intMmCnt<=0){intExobudStat=1; blnEnabled=false; return;} 
arrSelMm = new Array();
for(var i=0; i<intMmCnt; i++){
if(objMmInfo[i].selMm =="t"){arrSelMm[selidx]=i;selidx++;}
}
intSelMmCnt=arrSelMm.length;
if(intSelMmCnt<=0){blnEnabled=false; intExobudStat=2; arrSelMm=null; return;}
else {blnEnabled=true; mkAct();}
}
function mkAct(){
arrActMm=null;
intActMmCnt=0;
var selidx=0;
var actidx=0;
if(blnEnabled){
arrActMm=new Array();
for(var i=0; i<intSelMmCnt;i++){
selidx=arrSelMm[i];
if(objMmInfo[selidx].actMm=="t"){arrActMm[actidx]=selidx; actidx=actidx+1;}
}
intActMmCnt=arrActMm.length;
}
else{return;}
if(intActMmCnt<=0){blnEOT=true;arrActMm=null;}
else{blnEOT=false;}
}
function chkAllSel(){
for(var i=0; i<intMmCnt; i++){
objMmInfo[i].selMm="t";
objMmInfo[i].actMm="t";
}
mkSel();
}

function chkAllDesel(){
for(var i=0; i<intMmCnt; i++){
objMmInfo[i].selMm="f";
objMmInfo[i].actMm="f";
}
mkSel();
}
function chkItemSel(idx){
if(objMmInfo[idx].selMm =="t"){objMmInfo[idx].selMm="f";objMmInfo[idx].actMm="f";}
else{objMmInfo[idx].selMm="t";objMmInfo[idx].actMm="t";}
mkSel();
}

function chkItemAct(idx){
objMmInfo[idx].actMm="f";
mkAct();
}

function mkSelAct(){
var idx=0;
for(var i=0; i<intSelMmCnt; i++){
idx=arrSelMm[i];
objMmInfo[idx].actMm="t";
}
mkAct();
}

function initExobud(){
wmpInit();
mkSel();
blnfpl = false;
if(blnRept) {;}
else {;}
if(blnRndPlay) {;}
else {;}
showTLab();
disp1.innerHTML = "ExoBUD MP(II) v4.1tc+ 网站媒体播放程序(liyu.net简体汉化版) ";
if(blnStatusBar){ window.status=('ExoBUD MP(II) v4.1tc+ 网站媒体播放程序(liyu.net简体汉化版) ');}
if(blnAutoStart){startExobud();}
}

function startExobud(){
var wmps = Exobud.playState;
if(wmps==2){Exobud.controls.play(); return;}
if(wmps==3){ return;}
blnfpl=false;
if(!blnEnabled){waitMsg();return;}
if(blnEOT){mkSelAct();}
if(intErrCnt>0){intErrCnt=0;tidErr=setTimeout('retryPlay(),1000');return;}
if(blnRndPlay){rndPlay();}
else {cActIdx=arrActMm[0]; selMmPlay(cActIdx);}
}

function selMmPlay(idx){
clearTimeout(tidErr);
cActIdx=idx;
var trknum=idx+1;
var ctit =objMmInfo[idx].mmTit;
if(ctit=="nAnT"){ctit=""}
if(blnUseSmi){Exobud.ClosedCaption.SAMIFileName = objMmInfo[idx].mmSmi;}
Exobud.URL = objMmInfo[idx].mmUrl;
cActTit = "T" + trknum + ". " + ctit;
disp1.innerHTML = cActTit;
if(blnStatusBar){ window.status=(cActTit);}
chkItemAct(cActIdx);
}
function wmpPlay(){Exobud.controls.play();}

function wmpStop(){
intErrCnt=0;
clearTimeout(tidErr);
clearInterval(tidTLab);
showTLab();
mkSelAct();
Exobud.controls.stop();
Exobud.close();
disp1.innerHTML = "ExoBUD MP(II) v4.1tc+ 网站媒体播放程序(liyu.net简体汉化版) ";
if(blnStatusBar){ window.status=('ExoBUD MP(II) v4.1tc+ 网站媒体播放程序(liyu.net简体汉化版) ');return true;}
}
function wmpPause(){Exobud.controls.pause();}

function wmpPP(){
var wmps = Exobud.playState;
var wmpc = Exobud.controls;
clearInterval(tidTLab);
clearTimeout(tidMsg);
if(wmps==2){wmpc.play();}
if(wmps==3){wmpc.pause(); disp2.innerHTML="Pause"; tidMsg=setTimeout('rtnTLab()',1500);}
return;
}
function rndPlay(){
if(!blnEnabled){waitMsg();return;}
intErrCnt=0;
var idx=Math.floor(Math.random() * intActMmCnt);
cActIdx=arrActMm[idx];
selMmPlay(cActIdx);
}
function playAuto(){
if(blnRept){selMmPlay(cActIdx);return;}
if(!blnAutoProc){wmpStop();return;}
if(blnfpl){wmpStop();return;}
if(!blnEnabled){wmpStop();return;}
if(blnEOT){
if(blnLoopTrk){startExobud();}
else {wmpStop();}
} else {
if(blnRndPlay){rndPlay();}
else {cActIdx=arrActMm[0]; selMmPlay(cActIdx);}
}
}
// Play a user selected element from the playlist
function selPlPlay(idx){
blnfpl=true;
selMmPlay(idx);
}
function playPrev(){
var wmps = Exobud.playState;
if(wmps==2 || wmps==3){Exobud.controls.stop();}
blnfpl=false;
if(!blnEnabled){waitMsg();return;}
if(blnEOT){mkSelAct();}
intErrCnt=0;
if(blnRndPlay){rndPlay();}
else {
var idx=cActIdx;
var blnFind=false;
for(var i=0;i<intSelMmCnt;i++){ if(cActIdx==arrSelMm[i]){idx=i-1; blnFind=true;}}
if(!blnFind){startExobud();return;}
if(idx<0){idx=intSelMmCnt-1;cActIdx=arrSelMm[idx];}
else {cActIdx=arrSelMm[idx];}
selMmPlay(cActIdx);
}
}

function playNext(){
var wmps= Exobud.playState;
if(wmps==2 || wmps==3){Exobud.controls.stop();}
blnfpl=false;
if(!blnEnabled){waitMsg();return;}
if(blnEOT){mkSelAct();}
intErrCnt=0;
if(blnRndPlay){rndPlay();}
else{ var idx=cActIdx;
var blnFind=false;
for(var i=0;i<intSelMmCnt;i++){ if(cActIdx==arrSelMm[i]){idx=i+1; blnFind=true;}}
if(!blnFind){startExobud();return;}
if(idx>=intSelMmCnt){idx=0;cActIdx=arrSelMm[idx];}
else{cActIdx=arrSelMm[idx];}
selMmPlay(cActIdx);
}
}
function retryPlay(){
selMmPlay(cActIdx);
}
function chkRept(){
var wmps = Exobud.playState;
if(wmps==3){clearInterval(tidTLab);}
if(blnRept){
blnRept=false; disp2.innerHTML="Normal";
} else {
blnRept=true; disp2.innerHTML="Repeat";
}
tidMsg=setTimeout('rtnTLab()',1500);
}
function chgPMode(){
var wmps = Exobud.playState;
if(wmps==3){clearInterval(tidTLab);}
if(blnRndPlay){
blnRndPlay=false; disp2.innerHTML="顺序播放";
} else {
blnRndPlay=true; disp2.innerHTML="随机播放";
}
tidMsg=setTimeout('rtnTLab()',1500);
}

function evtOSChg(f){

if(f==8){capText.innerHTML="Captioning [SMI]";}
if(f==13){
var strTitle = Exobud.currentMedia.getItemInfo("Title");
if(strTitle.length <= 0){strTitle = "(未命名的标题)"}
var strAuthor = Exobud.currentMedia.getItemInfo("Author");
if(strAuthor.length <= 0){strAuthor = "(未命名的演出者)"}
var strCopy = Exobud.currentMedia.getItemInfo("Copyright");
if(strCopy.length <= 0){strCopy = "(没有著作权信息)"}
var strType = Exobud.currentMedia.getItemInfo("MediaType");
var strDur = Exobud.currentMedia.durationString;
var strUrl = Exobud.URL;
var trknum = cActIdx+1;
var ctit = objMmInfo[cActIdx].mmTit;
if(ctit=="nAnT"){
objMmInfo[cActIdx].mmTit = strAuthor + " - " + strTitle;
ctit = strAuthor + " - " + strTitle;
cActTit = "T" + trknum + ". " + ctit;
disp1.innerHTML = cActTit;
}
strMmInfo = "Media (Title) : " + strTitle + "\n\n";
strMmInfo += "Media (Author) : " + strAuthor + "\n\n";
strMmInfo += "Media (Author) : " + strUrl + "\n\n";
strMmInfo += "Media (Copyright) : " + strCopy + "\n\n";
strMmInfo += "Media (Duration) : " + strDur + "\n\n\n";
strMmInfo += "Brought to you by ExoBUD MP(II).\n";
strMmInfo += "Copyright(C) 1999-2004 Jinwoong Yu.\n";
strMmInfo += "ALL RIGHTS RESERVED.\n";
if(blnShowMmInfo){alert(strMmInfo);}
}
}

function evtPSChg(f){
// 0(Undefined) 1(Stopped) 2 (Paused) 3(Playing) 4(ScanFowrd) 5(ScanReverse)
// 6(Buffering) 7(Waitng) 8(MediaEnded) 9(Transitioning) 10(Redy)
switch(f){
case 1:
evtStop();
break;
case 2:
evtPause();
break;
case 3:
evtPlay();
break;
case 8:
setTimeout('playAuto()', intDelay);
break;
}
}
function evtWmpBuff(f){
if(f){
disp2.innerHTML = "Buffering";
var msg = "(Buffering) " + cActTit;
disp1.innerHTML = msg;
if(blnStatusBar){ window.status=(msg);}
} else {
disp1.innerHTML = cActTit; showTLab();
}
}

function evtWmpError(){
intErrCnt++;
Exobud.Error.clearErrorQueue();
if(intErrCnt<=3){
disp2.innerHTML = "Reset (" + intErrCnt + ")";
var msg = "(Play Attempt" + intErrCnt + ") " + cActTit;
disp1.innerHTML = "<Play Error> " + cActTit;
if(blnStatusBar){ window.status=(msg);}
tidErr=setTimeout('retryPlay()',1000);
} else {
clearTimeout(tidErr);
intErrCnt=0;showTLab();
var msg = "New Media Play Set";
if(blnStatusBar){ window.status=(msg);}
setTimeout('playAuto()',1000);}
}

function evtStop(){
clearTimeout(tidErr);
clearInterval(tidTLab);
showTLab();
intErrCnt=0;
disp1.innerHTML = "Waiting";
if(blnStatusBar){ window.status=('Waiting');return true;}
}

function evtPause(){
clearInterval(tidTLab);
showTLab();
}
function evtPlay(){
tidTLab=setInterval('showTLab()',1500);
}

function showTLab(){
var ps = Exobud.playState;
if(ps==2 || ps==3){
var cp=Exobud.controls.currentPosition;
var cps=Exobud.controls.currentPositionString;
var dur=Exobud.currentMedia.duration;
var durs=Exobud.currentMedia.durationString;
if(blnElaps){
disp2.innerHTML = cps + " | " + durs;
var msg = cActTit + " (" + cps + " | " + durs + ")";
if(ps==2){msg = "(Pause) " + msg;}
if(blnStatusBar){ window.status=(msg);return true;}
} else {
var laps = dur-cp;
var strLaps = wmpTime(laps);
disp2.innerHTML = strLaps + " | " + durs;
var msg = cActTit + " (" + strLaps + " | " + durs + ")";
if(ps==2){msg = "(Pause) " + msg;}
if(blnStatusBar){ window.status=(msg);return true;}
}
} else {
disp2.innerHTML = "00:00 | 00:00";
}
}

function chgTimeFmt(){
var wmps = Exobud.playState;
if(wmps==3){clearInterval(tidTLab);}
if(blnElaps){
blnElaps=false; disp2.innerHTML="Laps";
} else {
blnElaps=true; disp2.innerHTML="ELaps";
}
tidMsg=setTimeout('rtnTLab()',1000);
}

function rtnTLab(){
clearTimeout(tidMsg);
var wmps=Exobud.playState;
if(wmps == 3){tidTLab=setInterval('showTLab()',1000);}
else{showTLab();}
}
function wmpTime(dur){
var hh, min, sec, timeLabel
hh = Math.floor(dur/3600);
min = Math.floor(dur / 60)%60;
sec = Math.floor(dur % 60);
if (isNaN(min)){ return "00:00"; }
if (isNaN(hh) || hh==0){timeLabel="";}
else{
if(hh >9){timeLabel = hh.toString()+":";}
else{timeLabel="0"+hh.toString() +":";}
}
if ( min > 9 ){ timeLabel = timeLabel + min.toString() + ":"; }
else {timeLabel = timeLabel + "0" +min.toString() + ":";}
if ( sec > 9 ){timeLabel = timeLabel + sec.toString();}
else{timeLabel = timeLabel + "0" + sec.toString();}
return timeLabel;
}

var vmax = 100;
var vmin=0;
var vdep = 10;

function wmpVolUp(){ 
var wmps=Exobud.playState;
if(wmps == 3){clearInterval(tidTLab);}
var ps = Exobud.settings;
if(ps.mute){ps.mute = false; disp2.innerHTML="Speach";}
else{
if (ps.volume >= (vmax-vdep)) {ps.volume = vmax;}
else { ps.volume = ps.volume + vdep;}
disp2.innerHTML="Vol. " + ps.volume +"%";
}
tidMsg=setTimeout('rtnTLab()',1500);
}

function wmpVolDn(){ 
var wmps=Exobud.playState;
if(wmps == 3){clearInterval(tidTLab);}
var ps = Exobud.settings;
if(ps.mute){ps.mute = false;disp2.innerHTML="Speach";}
else{
if (ps.volume <= vdep){ ps.volume = vmin;}
else{ps.volume = ps.volume - vdep;}
disp2.innerHTML="Vol. " + ps.volume +"%";
}
tidMsg=setTimeout('rtnTLab()',1500);
}
vArray = new Array();
vArray[0] = 0;
vArray[2] = 20;
vArray[4] = 40;
vArray[6] = 60;
vArray[8] = 80;
vArray[10] = 100; 
function SetVolume(index)
{
var wmps=Exobud.playState;
if(wmps == 3){clearInterval(tidTLab);}
var ps = Exobud.settings;
ps.volume = vArray[index];
document.images["meter"].src = eval("meter" + index + ".src");
disp2.innerHTML="Vol. " + ps.volume +"%";
if(ps.volume != 0 && ps.mute){ps.mute = false;}
if(ps.volume == 0 && !ps.mute){ps.mute = true;disp2.innerHTML="Mute On";}
tidMsg=setTimeout('rtnTLab()',1500);
}
function MeterClick(n)
{
SetVolume(n);
}
function wmpMute(){ 
var wmps=Exobud.playState;
if(wmps == 3){clearInterval(tidTLab);}
var ps = Exobud.settings;
if(!ps.mute){ps.mute = true;disp2.innerHTML="Mute On";}
else {ps.mute = false;disp2.innerHTML="Mute Off";}
tidMsg=setTimeout('rtnTLab()',1500);
}

function waitMsg(){
capText.innerHTML="ExoBUD MP(II) (SMI)";
if(intExobudStat==1){disp1.innerHTML = "无法播放 － 播放清单上没有设定任何曲目。";}
if(intExobudStat==2){disp1.innerHTML = "无法播放 － 您没有选取播放清单上任何一首曲目。";}
if(blnStatusBar){
if(intExobudStat==1){ window.status=('无法播放 － 播放清单上没有设定任何曲目。'); return true;}
if(intExobudStat==2){ window.status=('无法播放 － 您没有选取播放清单上任何一首曲目。'); return true;}
}
}

function openPlist(){
window.open("exobudpl.htm","mplist","top=150,left=200,width=350,height=280,scrollbars=no,resizable=NO,copyhistory=no");
}
function chkWmpState(){
// 0(Undefined) 1(Stopped) 2 (Paused) 3(Playing) 4(ScanFowrd) 5(ScanReverse)
// 6(Buffering) 7(Waitng) 8(MediaEnded) 9(Transitioning) 10(Redy)
return Exobud.playState;
}
function chkWmpOState(){
// 0(Undefined) 8(MediaChanging) 9(MediaLocating) 10(MediaConnecting) 11(MediaLoading) 
// 12(MediaOpening) 13(MediaOpen) 20(MediaWaiting) 21(OpeningUnknownURL)
return Exobud.openState;
}
function chkOnline(){
// true(Network Connected) false(Network Lost)
return Exobud.isOnline;
}
function vizExobud(){
//Exobud.launchURL("http://www.94kb.com");
window.open("http://www.94kb.com","vizExobud");
}
function goSkin(){
window.open("http://www.94kb.com","goSkin");
}
//-->

