CurrentID = 1;
function ChangeLayer(iSrc)
{
	var TarOB = eval("document.all.VW_" + CurrentID);
	if(TarOB != null){TarOB.style.display = "none";}

	var SrcOB = eval("document.all.VW_" + iSrc);
	SrcOB.style.display = "block";

	var TarOB = eval("document.all.VC_" + CurrentID);
	var SrcOB = eval("document.all.VC_" + iSrc);
	TarOB.className = "right238_BG_select2";
	SrcOB.className = "right238_BG_select";
	CurrentID = iSrc;
}

CurrentIDup = 1;
function ChangeHYupload(iSrc)
{
	var TarOB = eval("document.all.UPList_" + CurrentIDup);
	if(TarOB != null){TarOB.style.display = "none";}

	var SrcOB = eval("document.all.UPList_" + iSrc);
	SrcOB.style.display = "block";

	var TarOB = eval("document.all.UP_" + CurrentIDup);
	var SrcOB = eval("document.all.UP_" + iSrc);
	TarOB.className = "right238_BG_select2";
	SrcOB.className = "right238_BG_select";
	CurrentIDup = iSrc;
}

CurrentIDvp = 1;
function ChangeHYvpload(iSrc)
{
	var TarOB = eval("document.all.VPList_" + CurrentIDvp);
	if(TarOB != null){TarOB.style.display = "none";}

	var SrcOB = eval("document.all.VPList_" + iSrc);
	SrcOB.style.display = "block";

	var TarOB = eval("document.all.VP_" + CurrentIDvp);
	var SrcOB = eval("document.all.VP_" + iSrc);
	TarOB.className = "right238_BG_select2";
	SrcOB.className = "right238_BG_select";
	CurrentIDvp = iSrc;
}

CurrentIDdown = 1;
function ChangeDown(iSrc)
{
	var TarOB = eval("document.all.DownList_" + CurrentIDdown);
	if(TarOB != null){TarOB.style.display = "none";}

	var SrcOB = eval("document.all.DownList_" + iSrc);
	SrcOB.style.display = "block";

	var TarOB = eval("document.all.Down_" + CurrentIDdown);
	var SrcOB = eval("document.all.Down_" + iSrc);
	TarOB.className = "djoye02";
	SrcOB.className = "djoye01";
	CurrentIDdown = iSrc;
}
CurrentIDdown2 = 1;
function ChangeDown2(iSrc)
{
	var TarOB = eval("document.all.DownList2_" + CurrentIDdown2);
	if(TarOB != null){TarOB.style.display = "none";}

	var SrcOB = eval("document.all.DownList2_" + iSrc);
	SrcOB.style.display = "block";

	var TarOB = eval("document.all.Down2_" + CurrentIDdown2);
	var SrcOB = eval("document.all.Down2_" + iSrc);
	TarOB.className = "djoye02";
	SrcOB.className = "djoye01";
	TarOB.className = "djoye04";
	SrcOB.className = "djoye03";
	CurrentIDdown2 = iSrc;
}
CurrentIDdown3 = 1;
function ChangeDown3(iSrc)
{
	var TarOB = eval("document.all.DownList3_" + CurrentIDdown3);
	if(TarOB != null){TarOB.style.display = "none";}

	var SrcOB = eval("document.all.DownList3_" + iSrc);
	SrcOB.style.display = "block";

	var TarOB = eval("document.all.Down3_" + CurrentIDdown3);
	var SrcOB = eval("document.all.Down3_" + iSrc);
	TarOB.className = "djoye02";
	SrcOB.className = "djoye01";
	CurrentIDdown3 = iSrc;
}

function SelectAll(F){
	//全选
	var l = F.elements.length;
	var e;
	for(var i = 0; i < l; i++){
		e = F.elements[i];
		if(e.type == "checkbox"){
			e.checked = true;
		}
	}
}

function ReSelect(F){
	//反选
	var l = F.elements.length;
	var e;
	for(var i = 0; i < l; i++){
		e = F.elements[i];
		if(e.type == "checkbox"){
			if(e.checked)
				e.checked = false;
		else
		e.checked = true;
		}
	}
}

function Play(Param){
	//播放选择
	var a = "";
	var length = Param.elements.length;
	var c = 0;
	for(var i = 0; i < length;i++){
		if(Param.elements[i].type == "checkbox"){
			if(Param.elements[i].checked){
				c++;
				if(a == ""){
					a = Param.elements[i].value;
				}else{
					a = a + "," + Param.elements[i].value;
				}
			}
		}
	}
		
	if(c == 0){
		alert("请至少选择三首歌曲！");
	}else if(c > 100){
		alert("对不起！一次最多允许点播100首歌曲！");
	}else{
		var PlayWin = window.open("../../playsong.php?ID=" + a,"","");
		if(PlayWin == null){
			alert("不能打开播放窗口，请检查您的浏览器是否已经设置了弹出窗口拦截！");
		}		
	}	
	
}

window.onerror=function(){ return true; };

$ = function(em) {
    if (document.getElementById){ return document.getElementById(em); }
    else if (document.all){ return document.all[em]; }
    else if (document.layers){ return document.layers[em]; }
    else{ return null; }
};

$F = function(em){	return document.getElementById(em).value;	};

function show_select(_title, _options, _input){
    option_obj = $(_options);
    option_obj.style.display = (option_obj.style.display == '') ? 'none' : '';
    option_obj.onblur = function() { option_obj.style.display = 'none'; };
    option_obj.focus();
    for (var i = 0; i < option_obj.childNodes.length; i++){
        option_obj.childNodes[i].onmouseover = function(){ this.className = 'options_over pointer'; };
        option_obj.childNodes[i].onmouseout = function(){ this.className = 'options_out pointer'; };
        option_obj.childNodes[i].onclick = function(){
            $(_title).innerHTML = this.innerHTML;
            $(_input).value = this.id;
            option_obj.blur();
            option_obj.style.display = 'none';
        }
    }
 };

function get_tags(parentobj, tag){
    if (typeof parentobj.getElementsByTagName != 'undefined'){ return parentobj.getElementsByTagName(tag);
    }else if (parentobj.all && parentobj.all.tags){ return parentobj.all.tags(tag);
    }else{ return new Array(); }
};

function clk(_act, _id) {
    var v = [];
    var a = get_tags($(_id), 'input');

    for (var i = 0; i < a.length; i++) {
        if (_act == 'all' ) {a[i].checked = true;}
        else if (_act == 'un' ) { a[i].checked = (a[i].checked) ? false : true; }
        else { if (0 < a[i].value && a[i].checked){ v.push(a[i].value); } }
    }
    if ( 'play' == _act ) {
        if (3 > v.length){ alert('至少选择三首歌曲以上才能进行连播！'); return; }
        window.open(''+web_url+'playsong.php?id=' + v.join(','), 'play');
    }
};


function get_cookie(_name){
	var Res=eval('/'+_name+'=([^;]+)/').exec(document.cookie);
	return Res==null?'':unescape(Res[1]);
};

function set_cookie(_name, _value, _hours){
    var expdate = new Date();
    if( null != _hours ) expdate.setTime(expdate.getTime() + _hours * 3600000);
   document.cookie = _name + '=' + escape (_value) + '; path=/;domain=top.location.hostname;' +((_hours == null) ? '' : ('; expires='+ expdate.toGMTString()));
};

function SetCookie(name, value){
	var expdate = new Date();
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
	document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))+((secure == true) ? "; secure" : "");
};

function create_div( _str, _msgw, _msgh ){
    //document.documentElement.style.overflow='hidden';
    //document.getElementsByTagName('body')[0].style.overflow='hidden';
    var bgObj=document.createElement('div');
    bgObj.setAttribute('id','bgDiv');
    bgObj.style.position='absolute';
    bgObj.style.top='0px';
    bgObj.style.left='0px';
    bgObj.style.background='#FFFFFF';
    bgObj.style.opacity='0.60';
    bgObj.style.filter = 'alpha(opacity=60)';
    bgObj.style.width='100%';
    bgObj.style.height=document.body.scrollHeight + 'PX';
    bgObj.style.zIndex = '10000';
    document.body.appendChild(bgObj);

    var msgObj = document.createElement('div');
    var _width = document.body.clientWidth;
    var _height = document.documentElement.clientHeight||document.body.clientHeight;
    var LeftPosition = (_width) ? (_width - _msgw)/2 : 0  ;
    var TopPosition = (_height) ? (_height - _msgh)/2 + document.documentElement.scrollTop : 0 ;
    msgObj.setAttribute('id','msgDiv');
    msgObj.setAttribute('align','center');
    msgObj.style.position = 'absolute';
    msgObj.style.border='0';
    msgObj.style.left = LeftPosition + 'px';
    msgObj.style.top  = TopPosition + 'px';
    msgObj.style.width = _msgw + 'px';
    msgObj.style.height = _msgh + 'px';
    msgObj.style.textAlign = 'center';
    msgObj.style.zIndex = '10001';
    msgObj.innerHTML= _str;
    document.body.appendChild(msgObj);
};
function close_div(){
    //document.documentElement.style.overflow='auto';
    document.body.removeChild($('bgDiv'));
    document.body.removeChild($('msgDiv'));
};


function do_alert( msg ){
    var _height = document.documentElement.clientHeight||document.body.clientHeight;
    var _top = (_height) ? (_height - 39)/2 + document.documentElement.scrollTop : 0;
    var msgObj=document.createElement('div');
    msgObj.setAttribute('id', 'msgInfo');
    msgObj.setAttribute('align', 'center');
    msgObj.style.position = 'absolute';
    msgObj.style.top = _top + 'px';
    msgObj.style.left = '0';
    msgObj.style.width = '100%';
    msgObj.style.height = '33px';
    msgObj.style.zIndex = '999';
    msgObj.innerHTML = '<span id="alert">'+ msg +'</span>';
    document.body.appendChild(msgObj);
};

function close_alert(){
    document.body.removeChild($('msgInfo'));
};

function ShowDiv(_current, n){
    for(i=1;i<=n;i++){
        $('DivNum_' + i).className = (i == _current) ? 'now' : 'now2';
        $('newmusic_' + i).style.display  = (i == _current) ? '' : 'none';
    }
};

function ShowHot(_current, n){
    for(i=1;i<=n;i++){
        $('DivHot_' + i).className = (i == _current) ? 'now' : 'now2';
        $('musichot_' + i).style.display  = (i == _current) ? '' : 'none';
    }
};

function strLen(str) {
	var charset = document.charset; 
	var len = 0;
	for(var i = 0; i < str.length; i++) {
		len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == "utf-8" ? 3 : 2) : 1;
	}
	return len;
}

//控制在同一窗口中打开
function Listen(ListenURL) {
	var Listen = window.open(ListenURL,"Listens","resizable=yes,scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes,top=0,left=0");
	return false;
}

function open_comment(_id){
    try{
        if( '' == $('f_comment').getAttribute('src') ) { $('f_comment').setAttribute('src', ''+web_url+'Skins/index/comment.php?id=' + _id); }
        parent.document.documentElement.scrollTop = 530;
        parent.document.body.scrollTop = 530;
    }catch(e){
       return;
    }
};

function openWin(tag) {
	window.open(tag,"ylmv","resizable=yes,scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes,top=0,left=0");
};

function stop(){
return false;
}
document.oncontextmenu=stop;

