﻿var s_list,cookiestr,TotalSongs,M_sid,newi,oldi;
newi = 1;
var s_list = "";
function showItem(o1,o2){
	$("itemtHIS").className="";
	$("itemtTOP").className="";
	$("LList").style.display = "none";
	$("classTop").style.display = "none";
	o2.className="this";
	$(o1).style.display = "block";
};
function Insertsong(musicId){
	var songstr;
	songstr=eval("u" + musicId)+"|"+musicId+"|"+eval("n" + musicId)+"|"+eval("t" + musicId)+"|"+eval("s" + musicId);
	var tstr;
	tstr = songstr.split("|");
	if(tstr.length >= 4){
		if (cookiestr == null)
			cookiestr = songstr;
		else
			cookiestr = cookiestr + "#Ylmv#" + songstr;
		InitList();
	}
};
function InitList(){
	var songarray,htmlstr,i,tstr,ttstr;
	htmlstr = "";
	songarray = cookiestr.split("#Ylmv#");
	TotalSongs = 0;
	for(var i=0;i<songarray.length;i++){
		TotalSongs+= 1;
		tstr = songarray[i].split("|");
		ttstr = "&nbsp;"+TotalSongs + ". " + tstr[2];
		htmlstr += "<li id=\"music_"+TotalSongs+"\" class=\"\" title=\""+tstr[2]+"\" isdel=\"0\" singer=\""+tstr[4]+"\" mid=\""+tstr[1]+"\" mt=\""+tstr[3]+"\" url=\""+tstr[0]+"\" onMouseOver=\"COver(this);\" onMouseOut=\"COut(this);\"><span><a href=\"#\" onclick=\"del(music_"+TotalSongs+")\" id=\"del_"+TotalSongs+"\" title=\"删除\/恢复\">√</a></span><a href=\"javascript:myplay(music_"+TotalSongs+")\">"+ttstr+"</a></li>";
	}
	$("LplayList").innerHTML=htmlstr;
};
function myplay(t){
	var obj;
	obj = eval("music_"+ newi);
	obj.className="";
	obj = eval(t);
	M_sid = obj.mid;
	Ylmv_Player.url = s_list + obj.url;
	obj.className="f";
	newi = obj.id.substr(6)*1;
	var ia=newi-1;
	var ib=newi+1;
	if(newi<2)ia=TotalSongs;
	if(newi>=TotalSongs)ib=1;
	document.title="مۇڭكۈي كۈيچىسى--( " + obj.title + " ) ";
	$("songName").innerHTML ="ئاڭلاۋاتقىنىڭىز:" + obj.title;
        $("nahxaisim").innerHTML ="«"+ obj.title+"»";
	$("doFAV_Down").innerHTML ="<a class=\"abuts\" target=\"box\" href=\""+web_url+"User/User_Addcollect.asp?collect="+M_sid+"\">ساقلىۋېلىش</a> <a class=\"abuts\" target=\"box\" href=\""+web_url+"Down.asp?id="+M_sid+"\">چۈشۈرۈش</a>";
	$("lastSong").innerHTML="ئالدىنقىسى:<a href='#none' onClick='myplay(music_"+ia+");'>"+eval("music_"+ ia).title+"</a>";
	$("nextSong").innerHTML="كېيىنكىسى:<a href='#none' onClick='myplay(music_"+ib+");'>"+eval("music_"+ ib).title+"</a>";
	$("doHits").innerHTML="<a onClick=\"doHits('"+M_sid+"','upHits')\"><span><img src=\""+web_url+"Skin/Skin_02/Images/p_up.gif\"></span><span class=\"wz\">ياقتۇردۇم  </span></a><a onClick=\"doHits('"+M_sid+"','downHits')\"><span><img src=\""+web_url+"Skin/Skin_02/Images/p_down.gif\"></span><span class=\"wz tC1\">ياقتۇرمىدىم</span></a>";
	$("doError").innerHTML="<a target=\"error\" href=\""+web_url+"Dj_Error.asp?Ylmv_Com_Show=add&id="+M_sid+"\">خاتالىقنى مەلۇم قىلىش</a>";
	$("itemtTOP").innerHTML ="<span id=\"itemtTOP\" onClick=\"showItem('classTop',this);playTopLista("+obj.mt+");\">كۆپ ئاڭلانغانلىرى</span>"
	if(((obj.id).substr(6)-1) * 25 < LplayList.scrollTop)
		LplayList.scrollTop=((obj.id).substr(6)-1) * 25 ;

	if(((obj.id).substr(6)) * 25 >= LplayList.scrollTop+LplayList.style.pixelHeight-1)
		LplayList.scrollTop=((obj.id).substr(6)) * 13 - LplayList.style.pixelHeight+20;
	CHKPlay();
	do1Hits(M_sid);

         $("nahxatekisit").innerHTML = "<li style=\"margin-top:85px\" class=\"tC\"><img src=\""+web_url+"Skin/Skin_02/Images/loading.gif\" /> ئېچىلىۋاتىدۇ....</li>";
xmlHttp.open("get",""+web_url+"Skin/Skin_02/tekisit.asp?id="+M_sid);
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState == 4){
			if(xmlHttp.status == 200){ 
                                  var nahxats; 
                                  nahxats=unescape(xmlHttp.responseText);
                                  if(nahxats=="" || nahxats=="暂无") 
                                  {
                                   
                                   nahxats="تېخى يېزىلمىدى"
                                  }
                                  $("nahxatekisit").innerHTML = nahxats; 
                                  
				
			}else alert("ئۇلىنىش مەغلۇب بولدى");
		}
	}
	xmlHttp.send(null);
};


function CHKPlay(){
	if(Ylmv_Player.PlayState==1 || Ylmv_Player.PlayState==10)
		playn();
	setTimeout("CHKPlay()",1000);
};
function PlayModer(t){
	if($F("playMethod")==1){
		$("playMethod").value=2;
		t.value="随机播放";
	}else if($F("playMethod")==2){
		$("playMethod").value=3;
		t.value="单曲循环";
	}else{
		$("playMethod").value=1;
		t.value="顺序播放";
	}
};
function del(t){
	var N=parseInt(t.id.substr(6));
	if(t.isdel==0){
		t.isdel=1;
		$("del_"+N).innerHTML="×";
		$("del_"+N).style.color="#26b100";
	}else{
		t.isdel=0;
		$("del_"+N).innerHTML="√";
		$("del_"+N).style.color="#f8942d";
	}
};
playn = function(){
	var obj=eval("music_"+newi);
	var N=newi;
	if($F("playMethod")!=3){
		obj.className="";
		if($F("playMethod")==2) N=Math.floor(Math.random()*TotalSongs+1);
		do{
			N=N+1;
			if(N>TotalSongs) N=1;
			obj=eval("music_"+N);
		}while(obj.isdel==1)
	}
	myplay(obj);
};
playp = function(){
	var obj=eval("music_"+newi);
	var N=newi;
	if($F("playMethod")!=3){
		obj.className="";
		if($F("playMethod")==2) N=Math.floor(Math.random()*TotalSongs+1);
		do{
			N=N-1;
			if(N<1) N=TotalSongs;
			obj=eval("music_"+N);
		}while(obj.isdel==1)
	}
	myplay(obj);
};
COver=function(t,act){
	if(t.className!="f")	t.className="over";
};
COut=function(t,act){
	if(t.className!="f")	t.className="out";
};

var xmlHttp;
function createXMLHttpRequest(){
	if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
};





function playTopLista(_id){
	$("classTopList").innerHTML = "<li class=\"tC\"><img src=\""+web_url+"Skin/Skin_02/Images/loading.gif\" /> ئېچىلىۋاتىدۇ....</li>";
	createXMLHttpRequest();
	xmlHttp.open("get",""+web_url+"Skin/Skin_02/Ajax.asp?action=playTopList&l=d&musicType="+_id);
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState == 4){
			if(xmlHttp.status == 200){
				$("classTopList").innerHTML = unescape(xmlHttp.responseText);
			}else alert("ئۇلىنىش مەغلۇب بولدى");
		}
	}
	xmlHttp.send(null);
};






function doHits(_Id,_do){
	createXMLHttpRequest();
	xmlHttp.open("post",""+web_url+"Skin/Skin_02/Ajax.asp",true);
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState == 4){
			if(xmlHttp.status == 200){
				$("doHits").innerHTML = unescape(xmlHttp.responseText);
			}else alert("ئۇلىنىش مەغلۇب بولدى");
		}
	}
	xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlHttp.send("action=doHits&id="+escape(_Id)+"&dowhat="+escape(_do));
};
function do1Hits(_Id){
	createXMLHttpRequest();
	xmlHttp.open("post",""+web_url+"Skin/Skin_02/Ajax.asp",true);
	xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlHttp.send("action=do1Hits&id="+escape(_Id));
};
