var DomainUrl = top.location.hostname;
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; }
};

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 (_act == 'rundom' ) {
			var checkobj=document.getElementById(_id);
			var cboxs=checkobj.getElementsByTagName("input");
			var num=cboxs.length;			
			for(i=0;i<cboxs.length;i++){
				if(cboxs[i].type=="checkbox") cboxs[i].checked=false;
			}
			for(j=0;j<51;j++){
				var roundNum=Math.random()*num;
				if(cboxs[roundNum].type=="checkbox") {
						cboxs[roundNum].checked=true;
				}
			}			
		}else { if (0 < a[i].value && a[i].checked){ v.push(a[i].value); } }
    }
    if ( 'play' == _act ) {
        if (3 > v.length){ 
			alert('至少选择三首歌曲以上才能进行连播！'); 
			return; 
		}else if(v.length > 50){
			alert('一次最多连续播放30首歌曲！'); 
			return; 
		}else{
			window.open(''+web_url+'?cs=lb-id-' + v.join(',')+'.html', 'play');
		}
    }
};


function show(s){
	document.getElementById(s).style.display='block'; //显示导航层
}
function hide(s){
	document.getElementById(s).style.display='none'; //隐藏导航层
}

function ChangClass(s,ss,sss,n) {
        for(var i=1;i<=2;i++){
            var curC=document.getElementById(s+i);
            var curB=document.getElementById(ss+i);
            if(n==i){
                curC.style.display="block";
                curB.className=sss;
            }else{
                curC.style.display="none";
                curB.className="";
        }
     }
}

function banner_pic(s) {
         if(document.getElementById('banner_text_1').style.display=="block"){
              var id=1;
         }else if(document.getElementById('banner_text_2').style.display=="block"){
              var id=2;
         }else if(document.getElementById('banner_text_3').style.display=="block"){
              var id=3;
         }

         if(s=='s'){
            if(id==1){
               id=3
            }else{
               id=id-1;
            }
         }else{
            if(id==3){
               id=1
            }else{
               id=id+1;
            }
         }
         for(var i=1;i<=3;i++){
             if(id==i){
                   document.getElementById('banner_text_'+i).style.display="block";
                   document.getElementById('banner_pic_'+i).style.display="block";
                   document.getElementById('banner_on_'+i).className="on";
             }else{
                   document.getElementById('banner_text_'+i).style.display="none";
                   document.getElementById('banner_pic_'+i).style.display="none";
                   document.getElementById('banner_on_'+i).className="";
             }
         }

}

function tophits(s){
  for(var i=1;i<=6;i++){
      if(s==i){
	document.getElementById('t_'+i).style.display='block';
	document.getElementById('tt_'+i).className='on';
	document.getElementById('ttt_'+i).className='first';
      }else{
	document.getElementById('t_'+i).style.display='none';
	document.getElementById('tt_'+i).className='';
	document.getElementById('ttt_'+i).className='';
      }
  }
}

function bfq(s){
   document.writeln("<iframe marginwidth=\"0\" marginheight=\"0\" src=\"/public/real/index.html\" frameborder=\"0\" width=\"100%\" scrolling=\"no\" height=\"35\" leftmargin=\"0\" topmargin=\"0\"></iframe>");
}

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" : "");
};
