//复制地址
function copyToClipboard(url,title){
   window.clipboardData.setData("Text",url);
   do_alert(title);setTimeout('close_alert()', 2000);
}
//动态显示赞歌曲
function getdinglist(_id){
    $.get(web_url+"index.php/ding/lists/"+_id,function(data) {
           if(data){
		document.getElementById('dhits').innerHTML = unescape(data);
           }else{
                do_alert('网络连接失败！');setTimeout('close_alert()', 2000);
           }
    });
}
//赞歌曲
function getdhits(_id){
    $.get(web_url+"index.php/ding/go/ding/"+_id,function(data) {
           if(data){
               if(data=='Err_110'){
                   do_alert('您今天已经赞过了！');setTimeout('close_alert()', 2000);
               }else{
		  getdinglist(_id);
               }
           }else{
                do_alert('网络连接失败！');setTimeout('close_alert()', 2000);
           }
    });
}
function play_hits_tags(_id){
      for(var i=1;i<=3;i++){
            var curC=document.getElementById("play_tags_"+i);
            var curB=document.getElementById("play_list_"+i);
            if(_id==i){
                curB.style.display="block";
                curC.className="song_p_nav_clo"
            }else{
                curB.style.display="none";
                curC.className=""
            }
      }
}

function play_reco_tag_top(_id){
      for(var i=1;i<=3;i++){
            var curC=document.getElementById("reco_top_"+i);
            var curB=document.getElementById("reco_list_"+i);
            if(_id==i){
                curB.style.display="block";
                curC.className="recommend_tit_clo"
            }else{
                curB.style.display="none";
                curC.className=""
            }
      }
}

function play_reco_tag(_id,_n){
      if(_n==1){
           if(_id==1){
               var id=3;
           }else{
               var id=_id-1;
           }
      }
      if(_n==2){
           if(_id==3){
               var id=1;
           }else{
               var id=_id+1;
           }
      }
      for(var i=1;i<=3;i++){
            var curC=document.getElementById("reco_top_"+i);
            var curB=document.getElementById("reco_list_"+i);
            if(id==i){
                curB.style.display="block";
                curC.className="recommend_tit_clo"
            }else{
                curB.style.display="none";
                curC.className=""
            }
      }
}

function reco_tab(_id){
      for(var i=1;i<=5;i++){
            var curC=document.getElementById("reco_"+i);
            var curB=document.getElementById("reco_list"+i);
            if(_id==i){
                curB.style.display="block";
                curC.className="selected"
            }else{
                curB.style.display="none";
                curC.className=""
            }
      }
}

function vod_hits(_id){
      for(var i=1;i<=2;i++){
            var curC=document.getElementById("vod_hits_"+i);
            var curB=document.getElementById("p_other_"+i);
            if(_id==i){
                curB.style.display="block";
                curC.className="p_other_tit_clo"
            }else{
                curB.style.display="none";
                curC.className=""
            }
      }
}

function so_tabs(){
      document.getElementById("seh_sort").style.display='';
}

function so_tab(){
      var cur=document.getElementById("seh_sort").style.display;
      if(cur=='none'){
          document.getElementById("seh_sort").style.display='';
      }else{
          document.getElementById("seh_sort").style.display='none';
      }
}

function getsearch(type,text){
          so_tab();
          document.getElementById("keytype").value=type;
          document.getElementById("keytxt").innerHTML=text;
}

function search_ok(){
      var key=document.getElementById("cscms_key").value;
      var type=document.getElementById("keytype").value;
      if(key==''){
            do_alert('请输入要搜索的关键字');setTimeout('close_alert()', 2000);
      }else{
	    var url=web_url+"index.php/"+type+"/so/key/"+encodeURIComponent(key);
	    window.open(url);
      }
}

$$ = 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 playsong(_id,_act)
{
    var v = [];
　　var a=$("input[name='check']");  
    for (var i = 0; i < a.length; i++) {
            if(a[i].checked==true){}else{ a[i].checked="checked";}
            if (a[i].checked) { v.push(a[i].value); }
    }

    if(_act!='all'){
        if (3 > v.length){ 
			do_alert('至少选择三首歌曲以上才能进行连播！'); setTimeout('close_alert()', 2000);
			return; 
	}else if(v.length > 50){
			do_alert('一次最多连续播放50首歌曲！'); setTimeout('close_alert()', 2000);
			return; 
	}else{
		window.open(''+web_url+'index.php/dance/playsong?id=' + v.join(','), 'play');
	}
    }
}

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(document.getElementById('msgInfo'));
};