﻿$ = function(em){	return document.getElementById(em);	};
$F = function(em){	return document.getElementById(em).value;	};

function ChkAll(form){
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		e.checked = true;
	}
	return false;
};
function ChkFan(form){
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		e.checked = false;
	}
	return false;
};
function doSearch(){
	if($F("key") == "") alert("关键词不允许为空!"); else window.open("http://so.36dj.com/"+escape($F("key"))+"_1.html",'search');
	return false;
};
function doPlay(myform){
	var strCBValue = "/Lplayer.html?ids=";	
	var checknum=0;
	var N = myform.elements.length;
	for (var i=0;i<N;i++){
		var e = myform.elements[i];
		if (e.type=="checkbox"){
			if(e.checked){
					strCBValue += e.value + ",";	
					checknum=checknum+1;				
			}
		}
	}
	if(strCBValue=="/Lplayer.html?ids="){
		alert("请选择要播放的歌曲(可多选)");
		return false;
	}else{
		if(checknum>100){
			alert("系统限制100首歌曲连播，您选择了"+checknum+"首歌曲超出了"+(checknum-100)+"！");
			return false;
		}else{
			window.open(strCBValue,'DJ_Player');
		}
	}
};
function ranArray(n){
	var a,r,l=n.length,x,d=new Array(l);
	for(x=l-1;x>=0;x--)
	{
		r=Math.floor(Math.random()*(x+1));
		d[x]=n[r];
		n[r]=n[x];
	}
	return d;
}
//随机播放
function SelectRandAll(form){
	var k=[];
	for(var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		e.checked = false;
		k[i]=i;
	}
	var newform=ranArray(k);
	var l=[];
	for (var i=0;i<newform.length && i<form.elements.length/2;i++){
		l[i]=newform[i];
		var e = form.elements[newform[i]];
		e.checked = true;
	}
	doPlay(form)
}
showMsg=function(){
	var bgObj,msgObj;
	this.creatBG = function(){
		bgObj=document.createElement("div"); 
		bgObj.setAttribute('id','bgDiv'); 
		bgObj.style.position="absolute"; 
		bgObj.style.top="0"; 
		bgObj.style.left="0"; 
		bgObj.style.background="#333"; 
		bgObj.style.filter="alpha(opacity=40)"; 
		bgObj.style.opacity="0.4"; 
		bgObj.style.width="100%"; 
		bgObj.style.height=(document.body.scrollHeight)+"px";
		bgObj.style.zIndex = "10000"; 
		document.body.appendChild(bgObj);
		msgObj=document.createElement("div")
		msgObj.setAttribute("id","msgDiv");
		msgObj.setAttribute("align","center");
		msgObj.style.background="white";
		msgObj.style.position = "absolute";
		msgObj.style.left = (screen.width-400)/2+"px";
		msgObj.style.top = ((screen.height-270)/2+document.documentElement.scrollTop)+"px";
		msgObj.style.filter="alpha(opacity=90)";
		msgObj.style.opacity="0.9";
		msgObj.style.width = "400px";
		msgObj.style.height = "300px";
		msgObj.style.zIndex = "10001";
		document.body.appendChild(msgObj);
	}
	this.closeObj = function(){
		document.body.removeChild(bgObj);
		document.body.removeChild(msgObj);
	}
	this.creatObj=function(_Id){
		this.creatBG();
		var frame=document.createElement("p");
		frame.innerHTML="<iframe marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\" src=\"/News.asp?id="+_Id+"\" height=\"300px\" width=\"400px\"></iframe>";
		$("msgDiv").appendChild(frame);
	}
}

function killErrors(){return true;}
window.onerror = killErrors;