var openRND = null;
var or_m=false;
var ort_m="";
var urld=null;
var lpdd;
var oop=null;
var sval,medTT,alTXT;
var zslen=0;
var rndX=true;
var rnd=[];
var rndBJ=0;
var reN;
var xdbj=0,xxL,xxR;
var sewin=false;
var mute=false;
var playFlg=false;
var img_Mute0=new Image();
img_Mute0.src="pic/mute0.gif";
var img_Mute1=new Image();
img_Mute1.src="pic/mute1.gif";
var img_rnd0=new Image();
img_rnd0.src="pic/rnd0.gif";
var img_rnd1=new Image();
img_rnd1.src="pic/rnd1.gif";
var img_Playt0=new Image();
img_Playt0.src="pic/Playt0.gif";
var img_Playt1=new Image();
img_Playt1.src="pic/Playt1.gif";
var img_Playt3=new Image();
img_Playt3.src="pic/Playt3.gif";
var img_Playt4=new Image();
img_Playt4.src="pic/Playt4.gif";
var img_Stopt0=new Image();
img_Stopt0.src="pic/Stopt0.gif";
var img_Stopt1=new Image();
img_Stopt1.src="pic/Stopt1.gif";
var img_Prevt0=new Image();
img_Prevt0.src="pic/prevt0.gif";
var img_Prevt1=new Image();
img_Prevt1.src="pic/prevt1.gif";
var img_Nextt0=new Image();
img_Nextt0.src="pic/Nextt0.gif";
var img_Nextt1=new Image();
img_Nextt1.src="pic/Nextt1.gif";
function imgChange(id,act,alt){eval("my"+id+".src=img_"+id+act+".src");
if(alt){eval("my"+id+".alt = \""+alt+"\"")}};
function monerror(){or_m=true;
ort_m="找不到您系统中的Media Player，请先安装好Media Player V9.0以上版本。"};
function m_r_sj(zsj){var min,sec,str;
min=Math.floor(zsj/60);
sec=Math.floor(zsj%60);
if(isNaN(min)){return"0:00"}str=min.toString()+":";
if(sec>
9){str+=sec.toString()}else{str+="0"+sec.toString()}return str};
function mediaClass(){this.obj=document.getElementById("mediaPlayerObj");
this.gotov=5;
this.setss=null;
this.obj.settings.volume=100;
this.open=function(url){this.obj.URL=url;
try{this.play()}catch(hh){}};
this.play=function(){this.obj.controls.play()};
this.pause=function(){this.obj.controls.pause()};
this.stop=function(){try{this.obj.controls.stop();
this.obj.controls.currentPosition=0}catch(hh){}};
this.go=function(s){this.obj.controls.currentPosition=s};
this.pos=function(){return this.obj.controls.currentPosition};
this.length=function(){try{return this.obj.currentMedia.duration}catch(hh){}};
this.state=function(){var ps=this.obj.PlayState;
return ps!=0&&ps!=1&&ps!=8};
this.mute=function(s){this.obj.settings.mute=s};
this.sjxs=m_r_sj;
this.closed=function(){this.stop()}};
function newlist(zzs){if(zzs){urld=[];
rnd=[]}rndBJ=urld.length};
function playlist(zzs){if(urld.length<1){urld[0]=new urlDataClass("列表为空",0)}createList();
newrnd(rndBJ);
imgChange('Playt',1,"点击暂停");

if(zzs)
{   if(rndX)
      playrnd();
      //openfile(0);
    else
      openfile(0);
  }
};





function urlDataClass(uu,oo)
{str=unescape(uu).replace(/\\/g,"/").split("|");
this.nn=str[0];
this.mid=str[2];
this.oo=oo;
this.uu=str[1];
};


function createList(){document.getElementById("loplist").options.length=urld.length;
for(var ii=0;
ii<urld.length;
ii++){document.getElementById("loplist").options[ii].text=ii+1+"."+urld[ii].nn}document.getElementById("loplist").selectedIndex=0}function newrnd(s){for(var ii=s;
ii<urld.length;
ii++){rnd[rnd.length++]=ii}}function playrnd(){if(rnd.length==0){return}var rr,zzz;
rr=Math.floor(Math.random()*rnd.length);
zzz=rnd[rr];
rnd[rr]=rnd[rnd.length-1];
rnd.length--;
openfile(zzz)}function closedObj(){clearTimeout(medTT);
clearInterval(sval);
if(xdbj!=0){xdbj=2}oop.closed();
mode.innerHTML="空闲"}function openfile(uu){if(oop!=null){closedObj()}oop=null;
lpdd=uu;

if(urld[lpdd].mid==0){document.getElementById("musicName").innerHTML="<a href=\""+urld[lpdd].uu+"\" target=\"c\">"+(lpdd+1)+"."+urld[lpdd].nn+"</a>";}
else
{document.getElementById("musicName").innerHTML="<a href=\"http://0792dj.com/Player/"+urld[lpdd].mid+"/\" target=\"c\">"+(lpdd+1)+"."+urld[lpdd].nn+"</a>";}

document.getElementById("loplist").selectedIndex=lpdd;
var zzo=urld[lpdd].oo;
if(zzo!=0){if(or_m){ort_m=or_player(ort_m);
return}oop=new mediaClass()}else{return}reN=0;
oop.open(urld[lpdd].uu);
oop.mute(mute);
playBar.setposition(0);
zslen=0;
sval=setInterval("genzong(lpdd)",300)}function or_player(n){if(n!=""){alert(n)}dsts("系统无播放控件!");
medTT=setTimeout("autonext();",1000);
return""}function genzong(uu){var lpdd=uu;
var zzl=oop.length();
try{var pos=oop.pos();
if(zslen==0){if(zzl<=0){return}zslen=zzl}else{if(!playBar.moing){playBar.setposition(Math.round(playBar.mlength()/zslen*pos))}if(xdbj!=0&&pos>
xxR)oop.go(xxL)}document.getElementById("showTime").innerHTML="["+oop.sjxs(pos)+"/"+oop.sjxs(zzl)+"]"}catch(hh){}}function imgChengePlay(id,act,alt){if(act==3){if(playFlg){imgChange(id,3,"点击播放")}else{imgChange(id,1,"点击暂停")}}else if(act==4){if(playFlg){imgChange(id,0,"点击播放")}else{imgChange(id,4,"点击暂停")}}}function selectMusic(){home.focus();
if(urld==null){dsts();
return}if(urld.length<=1){dsts("目前没有列表！");
return}openfile(document.getElementById("loplist").selectedIndex);
imgChange('Playt',1,"点击暂停")}function pPlay(){playFlg=!playFlg;
if(playFlg){imgChange('Playt',0,"点击播放");
if(oop==null){dsts();
return}oop.pause()}else{imgChange('Playt',1,"点击暂停");
if(oop==null){dsts();
return}oop.play()}}function go_play(i){if(urld==null){dsts();
return}if(urld.length<=0){dsts("目前没有列表！");
return}else if(urld.length==1){dsts("目前只有一首舞曲！");
return}playFlg=false;
imgChange('Playt',1,"点击暂停");
openfile(i)}function pStop(){playFlg=true;
imgChange('Playt',0,"点击播放");
if(oop==null){dsts();
return}oop.stop()}function pPrevt(){imgChange('Playt',1,"点击暂停");
if(urld==null){dsts();
return}if(urld.length<=0){dsts("目前没有列表！");
return}else if(urld.length==1){dsts("目前只有一首舞曲！");
return}if(lpdd<=0){playFlg=false;
openfile(urld.length-1);
return}playFlg=false;
openfile(lpdd-1)}function pNext(){imgChange('Playt',1,"点击暂停");
if(urld==null){dsts();
return}if(urld.length<=0){dsts("目前没有列表！");
return}else if(urld.length==1){dsts("目前只有一首舞曲！");
return}if(lpdd>=urld.length-1){playFlg=false;
openfile(0);
return}playFlg=false;
openfile(lpdd+1)}function changeBar(){if(zslen==0){return}var nx=playBar.getposition();
var zzs=Math.round(zslen/playBar.mlength()*nx);
oop.go(zzs)}function setMute(){mute=!mute;
eval("myMute.src=img_Mute"+(mute?"1":"0")+".src");
if(oop!=null){oop.mute(mute)}}function setRndPlay(){rndX=!rndX;
eval("myRndPlay.src=img_rnd"+(rndX?"1":"0")+".src");
myRndPlay.alt="随机播放："+(rndX?"开":"关")}function gonext(){if(urld.length<=1){oop.go(0);
setTimeout("oop.play();",1000);
return}if(urld.length<=1){return}if(rndX){if(rnd.length==0){newrnd(0)}playrnd()}else{if(lpdd<urld.length-1){openfile(lpdd+1);
return}openfile(0)}}function errorreplay(){reN++;
if(reN<=3){dsts("错误！重试"+reN+"次");
medTT=setTimeout("oop.play();",1000)}else{dsts("文件无法播放！");
medTT=setTimeout("autonext();",1000)}}function autonext(){if(urld.length<=1){return}if(rndX){if(rnd.length==0){newrnd(0)}playrnd()}else{if(lpdd<urld.length-1){openfile(lpdd+1);
return}openfile(0)}}function mdip_tt(f){if(oop==null){return}if(oop.constructor!=mediaClass){return}var fs=["未知状态","播放停止","播放暂停","正在播放","向前搜索","向后搜索","缓冲中..","等待中..","播放完毕","缓冲中..","准备就绪"];
if(f<0||f>=fs.length){return}mode.innerHTML=fs[f];
if(f==8){medTT=setTimeout("gonext();",500)}}function miderror(){if(oop==null){return}if(oop.constructor!=mediaClass){return}errorreplay()}function dsts(t){clearTimeout(alTXT);
Jts1.innerHTML=t||"当前无法执行！";
Jts1.style.display="block";
Jts2.style.display="none";
alTXT=setTimeout('Jts2.style.display="block";Jts1.style.display="none";',1000)}
function closelw(){try{sewin.close()}catch(hh){}}
var sTE=false;function START(){newlist(true);
sTE=true}function DATA(u){if(!sTE){return}addlist(u)}var chshdjcms=DATA;
function END(){sTE=false;
playlist(true)};

function addlist(u){urld[urld.length]=new urlDataClass(u)};

window["onload"]=function(){loadDataFile()};
function loadDataFile(){if(openRND){setRndPlay()}window["document"]["getElementById"]("lodapl")["src"]="js/data.php"};