var names="";
var namess;
var Cs, St;
var lrcT;
var yclink=new Array(30);
var ddd=0;
var conts=0;
var fanfu=false;
var firmu=false;
var ffbb=0;
function danqu(){
if($("danq").checked)
fanfu=true;
else
fanfu=false;
}
function getname(songname) {addbox(songname); AJAXCALL("inc/songurl.asp?type=url1&keyword="+songname+"&attach=play","musiclist","isXML=true"); namess=songname;}
function sousuo(){
$("guanxin").style.display="none";
$("msg").style.display="block";
AJAXCALL("inc/songurl.asp?type=url1&keyword="+$("name").value+"&attach=sou","sousuolist","isXML=true");
}
function top() {AJAXCALL("inc/songlist.asp?ac=new","toplist","isXML=true");}
function toplist(doc){
var items=getElementsByClass(doc,"item");
var linker=new Array();
var linkers=new Array();
var tmp="<ul>";
for(var i=0;i<items.length;i++){
if(getTagValue(items[i], "singer")=="")
{
linker[i]="";
linkers[i]="";
}
else
{
linker[i]="("+getTagValue(items[i], 'singer').replace(/ /g," ")+")";
linkers[i]=" "+getTagValue(items[i], 'singer').replace(/ /g," ");
}
var d=i+1;
tmp+='<li>'+d+'. <a href=javascript:getname("'+getTagValue(items[i], 'songname').replace(/ /g," ")+linkers[i]+'") title="'+getTagValue(items[i], 'songname').replace(/ /g," ")+linker[i]+'">'+getTagValue(items[i], 'songname').replace(/ /g," ")+linker[i]+'</a></li>';
}
tmp+="</ul>";
$("toplist").innerHTML=tmp;
}
function s2() {AJAXCALL("inc/songlist.asp?ac=all","s3","isXML=true");}
function s3(doc){
var items=getElementsByClass(doc,"item");
var linker=new Array();
var linkers=new Array();
var tmp="<ul>";
for(var i=0;i<items.length;i++){
if(getTagValue(items[i], "singer")=="")
{
linker[i]="";
linkers[i]="";
}
else
{
linker[i]="("+getTagValue(items[i], 'singer').replace(/ /g," ")+")";
linkers[i]=" "+getTagValue(items[i], 'singer').replace(/ /g," ");
}
var d=i+1;
tmp+='<li>'+d+'. <a href=javascript:getname("'+getTagValue(items[i], 'songname').replace(/ /g," ")+linkers[i]+'") title="'+getTagValue(items[i], 'songname').replace(/ /g," ")+linker[i]+'">'+getTagValue(items[i], 'songname').replace(/ /g," ")+linker[i]+'</a></li>';
}
tmp+="</ul>";
$("topalllist").innerHTML=tmp;
}
function musiclist(doc){
if(getTagValue(doc,"type")=="no") {delbox(namess,"0"); firmu=false; alert('抱歉,未找到与"'+namess+'"相关的歌曲!'); if(shunxu.length>0) gonext(); else return;}
else { var items=getElementsByClass(doc,"item");
var tmp="<table width=200 border=0 cellpadding cellspacing style=position:relative>";
var nomes=new Array();
var d=0;
for(var i=0;i<yclink.length;i++) yclink[i]=new Array(3);
for(var i=0;i<items.length;i++){
var type=getTagValue(items[i], 'type').split(";;");
nomes[i]=getTagValue(items[i], 'songname').replace(/ /g,' ')+' '+getTagValue(items[i], 'singer').replace(/ /g,' ');
nomes[i]=nomes[i].replace(/ /g," ").replace(/(^\s*)|(\s*$)/g,"").replace(/ /g," ");
yclink[d][0]=getTagValue(items[i], "type");
yclink[d][1]=getTagValue(items[i], "link").replace(/ /g,' ');
yclink[d][2]=nomes[i].replace(/ /g," ");
d+=1;
tmp+='<tr><td><input type=text class=play_sn value="'+d+'"><a title="试听点'+d+':'+nomes[i]+'('+type[0]+')" href=javascript:play("'+getTagValue(items[i], 'type')+'","'+getTagValue(items[i], 'link').replace(/ /g,' ')+'","'+nomes[i]+'","'+d+'")>'+nomes[i]+'</a></td></tr>';
}
ddd=d;
tmp+="</table>";
$("list").innerHTML=tmp;
$("msg").style.display="none";
play(yclink[0][0],yclink[0][1],yclink[0][2],1);}
}
function sousuolist(doc){
if(getTagValue(doc,"type")=="no") {$("msg").style.display="none"; alert('抱歉,未找到与"'+$("name").value+'"相关的歌曲!');return;}
var items=getElementsByClass(doc,"item");
var tmp="<table width=200 border=0 cellpadding cellspacing style=position:relative>";
var nomes=new Array();
for(var i=0;i<items.length;i++){
nomes[i]=getTagValue(items[i], 'songname').replace(/ /g,' ')+' '+getTagValue(items[i], 'singer').replace(/ /g,' ');
nomes[i]=nomes[i].replace(/ /g," ").replace(/(^\s*)|(\s*$)/g,"").replace(/ /g," ");
tmp+='<tr><td><img src="img/list.gif" /> <a title="找到相关的歌曲'+(i+1)+':'+nomes[i]+'" href=javascript:getname("'+nomes[i]+'")>'+nomes[i]+'</a></td></tr>';
}
tmp+="</table>";
$("list").innerHTML=tmp;
setTimeout('$("msg").style.display="none";getname("'+$("name").value+'")',1000);
}
function play(obj,url,nome,num){
clearTimeout(lrcT);
if($("MPlayer")) mpstop();
var wmas=obj.split(";;");
conts=parseInt(num);
$("guanxin").style.display="none";
$("msg").style.display="block";
if(names != nome) {AJAXCALL("inc/lyrics0.asp?"+url,"getlrc","isXML=true"); names=nome;}
AJAXCALL("inc/songurl.asp?type=url2&"+url+"&attach="+wmas[0],"gotoplay","isXML=true");
}
var tl;
function getlrc(doc){
tl="";
var items=getElementsByClass(doc,"item");
var lyrics=getTagValue(doc,"lyric");
var tmp="<div id=LrcDiv class=LrcDiv>";
for(var i=0;i<items.length;i++){
tmp+='<div class=div id=T_'+getTagValue(items[i], 'time')+' onclick=To(\''+getTagValue(items[i], 'time')+'\')>'+getTagValue(items[i], 'lrc')+'</div>';
tl+=getTagValue(items[i], 'time')+"|";
}
tmp+="</div>";
$("lrc").innerHTML=tmp;
St=0;
if(lyrics=="no"){
$("urllrc").innerHTML="";
$("urllrc").style.height="0px";}
else{
lyrics="http://ting.mbox.sogou.com/downlrc.jsp?lyricId="+lyrics;
var link3=cuturl(lyrics);
$("urllrc").style.height="25px";
$("urllrc").innerHTML="<div id=lrcurl>歌词下载:<a href="+lyrics+" target='_blank'>"+lyrics+"</a></div>";}//link3.replace(/ /g," ")+"</
}
function gotoplay(docs){
var link=getTagValue(docs, "link");
var link3=cuturl(link);
if($("MPlayer"))
{
MPlayer.URL=link;
MPlayer.controls.play();
}
else
$("players").innerHTML=mdplayer(link);
if($("butt").innerHTML=="") $("butt").innerHTML='<div id="anniu"><input id="danq" type="checkbox" onclick="danqu()"> 单曲重复 <span onclick="getname(shunxu[shunxu.length-1])">上一首</span> <span onclick="miderror()">换歌址</span> <span onclick="gonext()">下一首</span> <span onclick="offset(1)">歌词(+)</span> <span onclick="offset(0)">歌词(0)</span> <span onclick="offset(-1)">歌词(-)</span></div>';
$("wmaurl").innerHTML="试听"+conts+"出处:<a href="+link.replace(/ /g," ")+" target='_blank' title='点右键另存:"+names+"'>"+link3.replace(/ /g," ")+"</a>";
$("msg").style.display="none";
setTimeout(guanxin,1000);
ldL();
if(conts==ddd) gonext();
}
function guanxin() {$("guanxin").style.display="block"; setTimeout('$("guanxin").style.display="none";',10000);}
var player;
function mdplayer(str){
player='<object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" id="MPlayer" width="100%" height="64"><param name="url" value="'+str+'"><param name="enablecontextmenu" value="0"><param name="enableerrordialogs" value="0"></object><script language="JavaScript" for="MPlayer" event="playStateChange(rStatus)">mdip_tt(rStatus);</script><script language="JavaScript" for="MPlayer" event="openStateChange(sf)">evtOSChg(sf);</script><script language="JavaScript" for="MPlayer" event="error">miderror();</script>';
return player;
}
function mdip_tt(f) {if(