Array.prototype.contains = function(o){
	var tc = false;
	for(var i=0,l=this.length;i<l;i++){
		if(this[i]==o){
		tc = true;
		}
	}
	return tc
}

function ChkForm(oForm){
	if(oForm.username.value==""){
		alert("还没填写用户名");
		oForm.username.focus();
		return false;
	}
	if(oForm.password.value==""){
		alert("还没填写用户密码");
		oForm.password.focus();
		return false;
	}
}

function SelectAll(oForm){
	for(var i=0;i<oForm.url.length;i++){
		oForm.url[i].checked=true;
	}
}

function TurnOver(oForm){
	for(var i=0;i<oForm.url.length;i++){
		oForm.url[i].checked=!oForm.url[i].checked;
	}
}

function PlaySelected(oForm){
	var arrPlayList = [];
	var intPlayNum=0;
	if(oForm.url.length){
	for(var i=0;i<oForm.url.length;i++){
		if(oForm.url[i].checked==true&&!arrPlayList.contains(oForm.url[i].value)){
			arrPlayList[arrPlayList.length] = oForm.url[i].value
		}
	}
	}
	else{
		if(oForm.url.checked==true)arrPlayList[0] = oForm.url.value
	}
	if (arrPlayList.length>0){
		CleanPlayList('PlayList');
		var objWindow = window.open('','dj99play')
		for (var j=0;j<arrPlayList.length ;j++ )
		{
			intPlayNum = intPlayNum + setCookies('PlayList',arrPlayList[j]+"$$");
		}

		var setTime = 1000;
		if (setTime){
			var date = new Date();
			date.setTime(date.getTime()+(setTime*60*60*24));
			var expires = "; expires="+date.toGMTString();
		}
		else 
			var expires = "";
		document.cookie = "[playAuto]=1" +expires+";path=/";
		document.cookie = "[playOrder]=2"+expires+";path=/";
		document.cookie = "[playNumber]="+intPlayNum+expires+";path=/";
		var aSong = arrPlayList[0].split("||")
		if(aSong.length==5)
			if (aSong[4]!="0")
				objWindow.location = "/music/p/"+aSong[3]+".html";
			else
				objWindow.location = "/music/p/"+aSong[3]+".html"
		else
			objWindow.location = "/music/p/"+aSong[3]+".html"
	}
	else{
		alert("请选择连播的歌曲");
	}
}

function LyricSee(ID){
	window.open('/Lyric/html/'+ID+'.htm','TT79','scrollbars=yes,resizable=no,width=500,height=369,menubar=no,top=66,left=116');
}