
try{document.execCommand('BackgroundImageCache',false,true);}catch(e){}
window.onload=function(){window.swfInterfaceIsReady=true;};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(el,index){var n=this.length>>>0,i=~~index;if(i<0)i+=n;for(;i<n;i++)if(i in this&&this[i]===el)return i;return-1;}}
function myrit(el,s){if(!s)s=el.value;if(!s)return;el.value=s;el.onfocus=function(){if(this.value==s){this.value='';this.style.color='#000';}};el.onblur=function(){if(!this.value){this.value=s;this.style.color='#999';}};}
function getCookie(n){var c=document.cookie.split("; ");for(var i=0;i<c.length;i++){var p=c[i].split("=");if(n==p[0])try{return decodeURIComponent(p[1])}catch(e){return null}}
return null;}
function liveli(ul){return $(ul).delegate('li:not(".chos")','mouseenter',function(){$(this).addClass('on');}).delegate('li:not(".chos")','mouseleave',function(){$(this).removeClass('on');});}
function comEvent(type,mod){var evD=$('#'+mod+'_'+type),evUl=mod+'_Ul';switch(type){case'AllSel':evD.click(function(){setIptCheck(evUl,this.checked);});break;case'FavSel':evD.click(function(){var L=Tips.getPId(evUl);L&&Tips.win('toFav',L,function(){setIptCheck(evUl,0);$('#'+mod+'_AllSel').attr('checked',0);});return false;});break;case'AddSel':evD.click(function(){playList.addSong(mod,1,!playList.isPlaying);return false;});break;case'Ul':evD.delegate('li:not(".chos")','mouseenter',function(){$(this).addClass('on');}).delegate('li:not(".chos")','mouseleave',function(){$(this).removeClass('on');});break;}
return evD;}
function getWindowSize(){var doc=document,de=doc.documentElement;return{width:(de&&de.clientWidth)||doc.body.clientWidth,height:(de&&de.clientHeight)||doc.body.clientHeight}}
function getScroll(){var doc=top.document,de=doc.documentElement;return{left:(de&&de.scrollLeft)||doc.body.scrollLeft,top:(de&&de.scrollTop)||doc.body.scrollTop}}
function setIptCheck(D,B){$('#'+D+' input:checkbox').each(function(i,n){this.checked=B;});}
function Tab(trigs,cl,fn){var ac=arguments.callee;ac.hv||(ac.hv='playList');trigs.each(function(){$('#_'+this['id']).length&&$(this).click(function(){var D=this['id'];fn&&fn.call(this,D);if(D!==ac.hv){$('#'+ac.hv).removeClass(cl);$(this).addClass(cl);$('#_'+ac.hv).hide();$('#_'+D).show();ac.hv=D;}
return false;});});}
function strLen(str){return str.replace(/[^\x00-\xff]/g,"xx").length}
var Req={oldO:{},singer:'http://suggest.mp3cn.net/singer_new/?q={key}&n={limit:0,60}&type=sengername&call=Req.{call:act_singer}',searchbox:'http://suggest.mp3cn.net/song/?q={key}&n={limit:0,33}&type={type:sengername}&call=Req.{call:act_searchbox}',sort_song:'http://ge.mp3cn.net/songSearch.php?cid={key}&n={limit:0,33}&order=hot&call=Req.{call:act_sort_song}',sort_singer:'http://ge.mp3cn.net/sengerlist.php?cid={key}&n={limit:0,60}&call=Req.{call:act_sort_singer}',favorite:'http://ge.mp3cn.net/songRequest.php?id={key}&call=Req.{call:act_favorite}',so:function(T,O,L){var reg=new RegExp('\{([^}]+?)\}','g');if(L!=='new'){$('#loading'+(L||'C')).show();var url=this[T].replace(reg,function(v,key){var arr=key.split(':');return encodeURIComponent((O[arr[0]]!==undefined?O[arr[0]]:arr[1])||'');});}else{var url=this[T].replace('hot','new').replace(reg,function(v,key){var arr=key.split(':');return encodeURIComponent((O[arr[0]]!==undefined?O[arr[0]]:arr[1])||'');});}
this.oldO=O||{};$.getScript(url);},Temp:function(id,data,def){var ac=arguments.callee,D=$('#'+id);var parseObj=ac[id]||(ac[id]=(function(html){html=html.replace(/([\'|\\])/gm,"\\$1").replace(/ style="display: ?none;?"/i,'').replace(new RegExp('{([^{}]*)}','gim'),"'+data[\"$1\"]+'").replace(/[\n\r]/gm,'');return new Function('data',["return '",html,"';"].join(''));})(D.html()));if(data.length){$.each(data,function(i,n){data[i]=parseObj(n);});}else data[0]=def||'';D.html(data.join(''));},highlight:function(st,f,t){var s=st.substr(f,t+1);return st.replace(s,'<font class="keyword">'+s+'</font>');},setPageState:function(a,b,e){a[0].className=b?'gray':'';a[1].className=e?'gray':'';},act_searchbox:function(data){var D=searchBox;$('#sB_Name').text(Req.oldO.key);D.it||(D.page[0]=0);D.page[0]+=D.it;D.page[1]=Math.ceil((data[0].split('|')[1]-0)/D.page[2]);$('#sB_Page').html((D.page[0]+1)+'/'+(D.page[1]>100?100:D.page[1])+'页');this.setPageState($('#sB_Page ~ a'),D.page[0]==0,D.page[0]+1>=Math.min(D.page[1],100));var html=[];$.each(data,function(i,n){if(i===0)return;var songHL,singerHL;if(n[2]=='songname'){songHL=Req.highlight(n[4],n[0],n[1]);singerHL=n[7];}else{songHL=n[4];singerHL=Req.highlight(n[7],n[0],n[1]);}
var search=n[7].length?"Req.so('searchbox', {\'key\':'"+n[7].replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";html.push({'id':n[3],'song':n[4],'songHL':songHL,'singer':n[7],'singerHL':singerHL,'search':search});playList.temp[n[3]]={'id':n[3],'path':n[5],'lrc':n[6],'name':n[4],'singer':n[7]};});Req.Temp('sB_Ul',html,"<li class='chos'>很抱歉, 没有找到任何东东...</li>");$('#_searchBox').fadeIn();D.it=0;$('#loadingC').hide();},act_sort_song:function(data){var D=sortRanking;D.it||(D.page[0]=0);D.page[0]+=D.it;D.page[1]=Math.ceil((data[0].split('|')[1]-0)/D.page[2]);$('#sR_Page').html((D.page[0]+1)+'/'+(D.page[1]>100?100:D.page[1])+'页');this.setPageState($('#sR_Page ~ a'),D.page[0]==0,D.page[0]+1>=Math.min(D.page[1],100));var html=[];$.each(data,function(i,n){if(i===0)return;var search=n[7].length?"Req.so('searchbox', {\'key\':'"+n[7].replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";html.push({'id':n[3],'song':n[4],'singer':n[7],'search':search});playList.temp[n[3]]={'id':n[3],'path':n[5],'lrc':n[6],'name':n[4],'singer':n[7]};});Req.Temp('sR_Ul',html);D.it=0;$('#loadingC').hide();},act_sort_singer:function(data){var D=singerRanking;D.it||(D.page[0]=0);D.page[0]+=D.it;D.page[1]=Math.ceil((data[0].split('|')[1]-0)/D.page[2]);$('#sK_Page').html((D.page[0]+1)+'/'+(D.page[1]>100?100:D.page[1])+'页');this.setPageState($('#sK_Page ~ a'),D.page[0]==0,D.page[0]+1>=Math.min(D.page[1],100));var html=[];$.each(data[1],function(){var search=this.length?"Req.so('searchbox', {\'key\':'"+this.replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";html.push({'singer':this,'singerHL':this,'search':search});});Req.Temp('sK_Ul',html);D.it=0;$('#loadingC').hide();},act_singer:function(data){var D=singerRanking,info=data[0].split('|');D.it||(D.page[0]=0,D.key=info[0]);D.page[0]+=D.it;D.page[1]=Math.ceil((info[1]-0)/D.page[2]);$('#sK_Page').html((D.page[0]+1)+'/'+(D.page[1]>100?100:D.page[1])+'页');this.setPageState($('#sK_Page ~ a'),D.page[0]==0,D.page[0]+1>=Math.min(D.page[1],100));var html=[];$.each(data,function(i,n){if(i===0)return;var singerHL=Req.highlight(n[3],n[0],n[1]);var search=n[3].length?"Req.so('searchbox', {\'key\':'"+n[3].replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";html.push({'singer':n[3],'singerHL':singerHL,'search':search});});Req.Temp('sK_Ul',html);D.it=0;$('#loadingC').hide();},act_favorite:function(data){var D=myFavorite;var html=[];$.each(data,function(){var _t=this;var search=_t.singer.length?"Req.so('searchbox', {\'key\':'"+_t.singer.replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";html.push({'id':_t.id,'song':_t.name,'singer':_t.singer,'search':search});playList.temp[_t.id]={'id':_t.id,'path':_t.path,'lrc':_t.lrc,'name':_t.name,'singer':_t.singer};});Req.Temp('mF_Ul',html);$('#loadingL').hide();}};function getSWF(id){var swf=window[id]||document[id];return navigator.userAgent.indexOf('MSIE 9.0')!==-1?swf[0]:(swf['1']||swf);}
var playList={swf:null,playId:0,isPlaying:false,temp:{},list:[],randomUrl:'http://ge.mp3cn.net/songRequest.php',_active:function(){},init:function(){var _t=this;this.swf=getSWF('musicSwf');comEvent('AllSel','pL');comEvent('FavSel','pL');comEvent('AllSel','pLg');comEvent('FavSel','pLg');comEvent('AddSel','pLg');$('#pL_DelAll').click(function(){_t.list=[];_t.swf.$Next();_t.upList().dataSave();return false;});$('#pL_Ul').delegate('li:not(".chos")','mouseenter',function(){$(this).addClass('on');}).delegate('li:not(".chos")','mouseleave',function(){parseInt(this['id'])!==_t.playId&&$(this).removeClass('on');}).delegate('li','dblclick',function(){playList.apps('play',parseInt(this['id']),1);});comEvent('Ul','pLg').delegate('a.play','click',function(){var pId=~~this['name'];playList.addSong([pId],0,1);playHistory.addSong(pId);return false;});},play:function(mod,num){var _t=this,I;_t.isPlaying=false;if(!_t.list.length)return;var max=_t.list.length-1;var sP=_t.list.indexOf(_t.playId)+num;switch(mod){case 0:(0>sP||max<sP)||(I=sP);break;case 1:if(!(0>sP||max<sP)){I=sP;}else if(0>sP){I=max;}else{I=0;}
break;case 2:I=sP-num;break;case 3:I=Math.floor(Math.random()*max);break;}
I!==undefined&&this.apps('play',_t.list[I]);},guess:function(){var _t=this,url=['n=11',new Date().getTime()];$('#loadingR').show();if(_t.isPlaying){url.push('re=id');url.push('songid='+_t.playId);music.Uid&&url.push('uid='+music.Uid);}else{if(_t.list.length){url.push('re=id');url.push('songid='+_t.list[Math.floor(Math.random()*(_t.list.length-1))]);music.Uid&&url.push('uid='+music.Uid);}else url.push('re=user');}
url=music.guessUrl+url.join('&');$.getScript(url,function(){var arr=[];$.each(evaPlayerCallBack,function(i,n){if(i===0)return;_t.temp[n.id]=n;var search=n.singer.length?"Req.so('searchbox', {\'key\':'"+n.singer.replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";arr.push({'id':n.id,'song':n.name,'singer':n.singer,'search':search});});Req.Temp('pLg_Ul',arr);$('#loadingR').hide();$('#pLg_AllSel')[0].checked=false;});},apps:function(type,id,H){switch(type){case'play':var obj=this.temp[id];this.swf.$Play(obj);this.hLight(id);this.playId=id;this.isPlaying=true;window.getIns&&getIns('music').__updateStick(obj.name+' - '+obj.singer);H&&playHistory.addSong(id);playList.guess();break;case'del':$('#'+id+'_pL').remove();var i=this.list.indexOf(id);this.list.splice(i,1);var sTop=$('#playlist-l').scrollTop();this.upList(function(){$('#playlist-l').scrollTop(sTop)});this.dataSave();if(this.playId===id){this.playId=this.list[i-1];this.swf.$Next();}
break;case'fav':Tips.win('toFav',[id],1);break;case'down':Tips.win('toDown',id);break;case'share':Tips.win('toShare',id);break;case'error':Tips.win('toErr',id);break;case'edit':Tips.win('toEdit',id);break;}},addSong:function(pUl,tip,b){var _t=this;var arr=typeof(pUl)==='string'?Tips.getPId(pUl+'_Ul'):pUl;if(!arr)return;$.each(arr,function(i,n){var num=_t.list.indexOf(n);num===-1||_t.list.splice(num,1);_t.list.push(n);});_t.upList().dataSave();Tips.ok(['歌曲播放','添加歌曲'][tip]+'成功！',function(){setIptCheck(pUl+'_Ul',0);$('#'+pUl+'_AllSel').attr('checked',0);});b&&_t.apps('play',arr[0]);},upList:function(fn){var _t=this,html=[];_t.list.length!==0&&$.each(_t.list,function(i,n){var p=playList.temp[n];var search=p.singer.length?"Req.so('searchbox', {\'key\':'"+p.singer.replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";html.push({'id':p.id,'song':p.name,'singer':p.singer,'search':search});});setTimeout(function(){Req.Temp('pL_Ul',html,'<li class="chos">您的播放列表暂时为空<br /><a href="javascript:music.switchTab(\'sortRanking\');">点击这里</a>添加您喜欢的音乐</li>');$('#playList span').html('('+_t.list.length+')');_t.hLight();fn&&fn();},0);return _t;},mp3Start:function(){var _t=this,ac=arguments.callee;this._checkCopyRight(this.playId);clearTimeout(ac.T);ac.T=setTimeout(function(){var param='songid='+_t.playId+(music.Uid?'&uid='+music.Uid:'')+'&_='+new Date().getTime();_t.swf.$request('http://ge.mp3cn.net/playlog.php',param);},1000*60);},_checkCopyRight:function(id){var T=this,obj=this.temp[id];if(obj.copyright===undefined){$.getJSON('http://ge.mp3cn.net/getCopyright.php?songid='+id+'&callback=?',function(e){obj.copyright=e;T._showTop100(e);T.dataSave();});}
T._showTop100(obj.copyright);},_showTop100:function(b){if(b){$('div.top100').fadeIn();$('#top100_iframe').attr('src','http://t.top100.cn/www/delivery/ifr_g.ashx?zid=48');}else{$('div.top100').fadeOut();$('#top100_iframe').attr('src','top100.htm');}},hLight:function(){function hLight(id){var plDom=$('#playlist-l');var cou=plDom.find('li').length;if(cou<=11)return;var st=plDom.scrollTop();var n=this.list.indexOf(id);if(n*28<st)plDom[0].scrollTop=n*28;else if(n*28>st+10*28)
plDom[0].scrollTop=(n-10)*28;}
var timer=0;return function(newId){var _t=this;if(newId){_t.playId&&$('#'+_t.playId+'_pL').removeClass('on');$('#'+newId+'_pL').addClass('on');_t.playId=newId;}else{$('#'+_t.playId+'_pL').addClass('on');}
clearTimeout(timer);timer=setTimeout(function(){hLight.call(_t,newId||_t.playId);},10);};}(),dataLoad:function(){var _t=this,html=[],P=_t.swf.$data('playList');if(P){foreach(P);}else{$.getScript(_t.randomUrl,function(){foreach(evaPlayerCallBack,1);});_t.guess();}
function foreach(P,save){$.each(P,function(i,n){_t.temp[n.id]=n;_t.list.push(~~n.id);});if(_t.list.length){_t.swf.$Play(_t.temp[_t.list[0]],false);_t.playId=_t.list[0];}
save||_t.guess();_t.upList();save&&_t.dataSave();$('#loadingL').hide();}},dataSave:function(){var _t=this,D=[],arr=_t.list;for(var i=0,len=arr.length;i<len;++i){D.push(_t.temp[arr[i]]);}
_t.swf.$data('playList',D);}};var playHistory={list:[],_active:function(){var ac=arguments.callee;ac.isRun||(ac.isRun=1,this.guess());},init:function(){var _t=this;comEvent('AllSel','pH');comEvent('AddSel','pH');comEvent('FavSel','pH');comEvent('AllSel','pHg');comEvent('FavSel','pHg');comEvent('AddSel','pHg');$('#pH_DelSel').click(function(){var L=Tips.getPId('pH_Ul');if(!L)return false;$.each(L,function(i,n){var num=_t.list.indexOf(n);num===-1||_t.list.splice(num,1);});Tips.ok('删除所选成功！');_t.upList().dataSave();return false;});comEvent('Ul','pH').add(comEvent('Ul','pHg')).delegate('a.play','click',function(){var pId=~~this['name'];playList.addSong([pId],0,1);playHistory.addSong(pId);return false;});},addSong:function(pId){var _t=this,num=_t.list.indexOf(pId);num===-1||_t.list.splice(num,1);_t.list.unshift(pId);_t.list.splice(50);_t.upList().dataSave();},upList:function(){var _t=this,html=[];_t.list.length!==0&&$.each(_t.list,function(i,n){var p=playList.temp[n];var search=p.singer.length?"Req.so('searchbox', {\'key\':'"+p.singer.replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";html.push({'id':p.id,'song':p.name,'singer':p.singer,'search':search});});Req.Temp('pH_Ul',html,'<li class="chos">您的播放历史暂时为空<br /><a href="javascript:music.switchTab(\'playList\');">点击这里</a>开始播放音乐</li>');$('#playHistory span').html('('+_t.list.length+')');$('#pH_Cen').html(_t.list.length);return _t;},dataLoad:function(){var _t=this,P=playList.swf.$data('playHistory');P&&$.each(P,function(i,n){playList.temp[n.id]||(playList.temp[n.id]=n);_t.list.push(~~n.id);});_t.upList();},dataSave:function(){var D=[],arr=this.list;for(var i=0,len=arr.length;i<len;++i){D.push(playList.temp[arr[i]]);}
playList.swf.$data('playHistory',D);},guess:function(){var _t=this,tL=playList.temp,url=['n=11',new Date().getTime()];$('#loadingR').show();if(_t.list.length){url.push('re=id');url.push('songid='+_t.list[Math.floor(Math.random()*(_t.list.length-1))]);}else url.push('re=user');url=music.guessUrl+url.join('&');$.getScript(url,function(){var arr=[];$.each(evaPlayerCallBack,function(i,n){if(i===0)return;playList.temp[n.id]=n;var search=n.singer.length?"Req.so('searchbox', {\'key\':'"+n.singer.replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";arr.push({'id':n.id,'song':n.name,'singer':n.singer,'search':search});});Req.Temp('pHg_Ul',arr);$('#loadingR').hide();$('#pHg_AllSel')[0].checked=false;});}};var myFavorite={page:[0,0,22,0],selTab:'',Queue:{L:[],fn:null},_active:function(){if(!this.selTab){this.upTab().upFav();}
var ac=arguments.callee;ac.isRun||(ac.isRun=1,this.guess());},init:function(){var _t=this;comEvent('AllSel','mF');comEvent('AddSel','mF');comEvent('AllSel','mFg');comEvent('FavSel','mFg');comEvent('AddSel','mFg');$('#mF_DelSel').click(function(){var L=Tips.getPId('mF_Ul');if(!L)return false;var cfg=getIns('music').__cfg[_t.selTab];$.each(L,function(i,n){var num=[].indexOf.call(cfg,n);num===-1||cfg.splice(num,1);});Tips.ing();_t.saveFav(_t.selTab,function(){myFavorite.upFav();Tips.hide();});return false;});$('#mF_AddTab').click(function(){Tips.win('addTab');});$('#mF_Tab').delegate('li','click',function(){var self=$(this);if(self.is('.on')){self.addClass('ac');self.bind('mouseleave',function(){self.removeClass('ac');});}else{$('#mF_Tab li:contains('+_t.selTab+')').removeClass('on');_t.selTab=self.addClass('on').attr('id');_t.upFav();}
return false;});comEvent('Ul','mF').add(comEvent('Ul','mFg')).delegate('a.play','click',function(){var pId=~~this['name'];playList.addSong([pId],0,1);playHistory.addSong(pId);return false;});},upTab:function(){var _t=this,ar=[],cfg=getIns('music').__cfg;if(music.Uid){(_t.selTab in cfg)||(_t.selTab=(function(){for(var i in cfg)return i})());for(var i in cfg){i==='__version'||ar.push({'name':i,'class':(_t.selTab!=i?'':'class="on"')});}}
$('#mF_AddTab')[['show','hide'][ar.length>0&&ar.length<5?0:1]]();setTimeout(function(){Req.Temp('mF_Tab',ar)},0);return _t;},upFav:function(){var _t=this,cfg=getIns('music').__cfg;if(!music.Uid){return Req.Temp('mF_Ul',[],'<li class="chos">注册后可永久保存您喜欢的歌曲，<a onclick="Tips.loginWin()" href="javascript:;">点击这里登录</a>或<a onclick="parent.$(\'#regist\').click()" href="javascript:;">免费注册</a>。</li>');}
_t.selTab||(_t.selTab=(function(){for(var i in cfg)return i})());if(!cfg[_t.selTab].length){return Req.Temp('mF_Ul',[],'<li class="chos">本歌单还没有收藏歌曲，<a href="javascript:music.switchTab(\'sortRanking\');">点击这里收藏歌曲</a></li>');}
Req.so('favorite',{'key':cfg[_t.selTab].join(',')},'L');},saveFav:function(key,fn){var _t=this;typeof(key)=='function'&&(fn=key,key='');getIns('music').__simpleSave(key,function(e){if(Tips.type!==null&&e){Tips.hide(fn||0);$.extend(music.__cfg,getIns('music').__cfg);}});},guess:function(){var tL=playList.temp,fid=getIns('music').__cfg[myFavorite.selTab],url=['n=11',new Date().getTime()];$('#loadingR').show();if(music.Uid&&fid.length){url.push('re=id');url.push('songid='+fid[Math.floor(Math.random()*(fid.length-1))]);url.push('uid='+music.Uid);}else url.push('re=user');url=music.guessUrl+url.join('&');$.getScript(url,function(){var arr=[];$.each(evaPlayerCallBack,function(i,n){if(i===0)return;playList.temp[n.id]=n;var search=n.singer.length?"Req.so('searchbox', {\'key\':'"+n.singer.replace(new RegExp('([\'"})])','g'),"\\$1")+"'})":"";arr.push({'id':n.id,'song':n.name,'singer':n.singer,'search':search});});Req.Temp('mFg_Ul',arr);$('#loadingR').hide();$('#mFg_AllSel')[0].checked=false;});}};var sortRanking={page:[0,0,33],it:0,selTab:null,orderType:'new',_active:function(){if(!this.selTab){this.selTab=$('#sR_Tab a:eq(0)');Req.so('sort_song',{'key':parseInt(this.selTab.attr('id'))},'new');}},init:function(){var _t=this;comEvent('AllSel','sR');comEvent('AddSel','sR');comEvent('FavSel','sR');$('#sR_Tab a').click(function(){if(_t.selTab[0]!=this){_t.selTab.removeClass('on');_t.selTab=$(this).addClass('on');if($('#sR_Tab a').index(this)===0){_t.orderType='new';Req.so('sort_song',{'key':parseInt(this['id'])},'new');}else{_t.orderType='hot';Req.so('sort_song',{'key':parseInt(this['id'])});}
$('#sR_AllSel').attr('checked',0);}
$(this).blur();return false;});$('#sR_Tab0').add('#sR_Tab1').click(function(){var left=this['id']=='sR_Tab0',ac=arguments.callee;ac.d==undefined&&(ac.d=0);if((left&&ac.d!=0)||(!left&&ac.d!=2)){ac.d=left?--ac.d:++ac.d;$('#sR_Tab0').attr('class',ac.d==0?'l0':'l1');$('#sR_Tab1').attr('class',ac.d==2?'r0':'r1');$('#sR_Tab').attr('style','left:'+-616*ac.d+'px');$('#'+['2','13','30'][ac.d]+'_Tab').click();}});comEvent('Ul','sR').delegate('a.play','click',function(){var pId=~~this['name'];playList.addSong([pId],0,1);playHistory.addSong(pId);return false;});},limit:function(num){var _t=this;if(!_t.it&&((num==1&&_t.page[0]<_t.page[1]-1)||(num==-1&&_t.page[0]>0))){$('#sR_AllSel').attr('checked',0);_t.it=num;var lim=(_t.page[0]+num)*_t.page[2]+','+_t.page[2];Req.so('sort_song',{'key':parseInt(_t.selTab.attr('id')),'limit':lim},_t.orderType);}}};var singerRanking={page:[0,0,60],it:0,key:'',selTab:null,_active:function(){if(!this.selTab){this.selTab=$('#sK_Tab li:eq(0)');Req.so('sort_singer',{'key':parseInt(this.selTab.attr('id'))});}},init:function(){var _t=this;$('#sK_Tab li').click(function(){if(_t.selTab[0]!=this){_t.selTab.removeClass('on');_t.selTab=$(this).addClass('on');Req.so('sort_singer',{'key':parseInt(this['id'])});_t.key&&(_t.key='',$('#sK_Key a.on').removeClass('on'));}
return false;}).bind('mouseenter',function(){this!=_t.selTab[0]&&$(this).addClass('hover');}).bind('mouseleave',function(){$(this).removeClass('hover');});$('#sK_Key a').click(function(){var ac=$('#sK_Key a.on');if(ac[0]!=this){var ts=$(this);ac.removeClass('on');ts.addClass('on');Req.so('singer',{'key':ts.text()});}});},limit:function(num){var _t=this;if(!_t.it&&((num==1&&_t.page[0]<_t.page[1]-1)||(num==-1&&_t.page[0]>0))){$('#sK_AllSel').attr('checked',0);_t.it=num;var lim=(_t.page[0]+num)*_t.page[2]+','+_t.page[2];if(_t.key){Req.so('singer',{'key':_t.key,'limit':lim});}else{Req.so('sort_singer',{'key':parseInt(_t.selTab.attr('id')),'limit':lim});}}}};var searchBox={page:[0,0,33],it:0,init:function(){var _t=this;comEvent('AllSel','sB');comEvent('AddSel','sB');comEvent('FavSel','sB');function sdo(){var key=$('#search_txt').val();if(key&&key!=hint)
Req.so('searchbox',{key:key,type:''});$('#suggest').hide();return false;}
var hint='请输入歌名或歌手名';var st=$('#search_txt')[0];st.onkeypress=function(e){if(!e)e=window.event;if(e.keyCode==13)
sdo();};myrit(st,hint);$('#search_btn').click(sdo);liveli('#sB_Ul').delegate('a.play','click',function(){var pId=~~this['name'];playList.addSong([pId],0,1);playHistory.addSong(pId);return false;});},limit:function(num){var _t=this;if(!_t.it&&((num==1&&_t.page[0]<_t.page[1]-1)||(num==-1&&_t.page[0]>0))){$('#sB_AllSel').attr('checked',0);_t.it=num;var lim=(_t.page[0]+num)*_t.page[2]+','+_t.page[2];Req.so('searchbox',{key:Req.oldO.key,limit:lim,type:Req.oldO.type});}},turnback:function(){$('#_searchBox').fadeOut();$('#sB_AllSel').attr('checked',0);}};var Tips={tip:[$('#tipLayer'),[$('#winLayer'),$('#tipsWin')]],type:null,isT:null,loginWin:function(){parent.showLoginWindow('<font style="color:red;">请先登录后再使用收藏功能：</font>');},getPId:function(E){var _t=this,arr=[];$('#'+E+' input').each(function(){if(this.checked)arr.push(~~this['name']);});return arr.length?arr:_t.ok('请先勾选歌曲！');},hide:function(txt,fn,keepShow){var _t=Tips;typeof(txt)=='function'&&(fn=txt,txt='');clearTimeout(_t.isT);if(!arguments.length){return toHid();}
txt=txt||'操作成功!';[_t.tip[0],_t.tip[1][3]][_t.type].html(txt).show();if(!keepShow){_t.isT=setTimeout(toHid,1000);}
function toHid(){_t.type?$(_t.tip[1]).each(function(){this.hide();_t.tip[1].splice(2,1)}):$(_t.tip[0]).hide();fn&&fn.call(this);_t.type=null;}},ok:function(txt,fn){if(this.type!==null)return;this.type=0;this.tip[0].show();this.hide(txt,fn);},ing:function(txt){var _t=this;if(_t.type!==null)return;_t.type=0;_t.tip[0].html((txt||'操作中，请稍候...')).show();_t.isT=setTimeout(function(){clearTimeout(_t.isT);_t.ok('操作超时！');$.extend(getIns('music').__cfg,music.__cfg);},6000);},win:function(type,id,fn){var _t=this;if(_t.type!==null)return;if(fn&&!music.Uid){myFavorite.Queue={'L':id,'fn':fn};return _t.loginWin();}
if(type=='toDown'){var obj=playList.temp[id];if(obj.copyright){obj.name=navigator.userAgent.toLowerCase().indexOf('msie')==-1?obj.name:encodeURIComponent(obj.name);window.open('http://www.top100.cn/search/index.aspx?zid=48&keyword='+obj.name);return;}}
_t.type=1;_t.tip[1][2]=$('#'+type);$(_t.tip[1]).each(function(){this.show()});_t.tip[1][3]=_t.tip[1][2].find(".tips");var __x=(getWindowSize().width-_t.tip[1][1].width())/2+getScroll().left;_t.tip[1][1].css({'position':'absolute','z-index':'200','display':'block','left':__x,'top':50});Win[type](_t.tip[1][2],id,typeof(fn)=='function'?fn:null);},winTip:function(txt){var _t=this;_t.tip[1][3].html(txt||'操作中，请稍候...').show();txt||(_t.isT=setTimeout(function(){_t.hide('操作超时！');$.extend(getIns('music').__cfg,music.__cfg);},6000));}};var Win={addTab:function(D){var _t=this,st=myFavorite.selTab,cfg=getIns('music').__cfg;$('#favTabTitle').html('新建歌单');var txt=D.find('input.Txt').val('').unbind().keyup(function(e){if(e.keyCode!=13)return;var val=$(this).val();val==''?Tips.winTip('请输入歌单名！'):check(val);}).focus();D.find('.Sub').unbind().click(function(){var val=$.trim(txt.val());var re=/[^\w\-\u4e00-\u9fa5]/,t;if(!val){Tips.winTip('请输入歌单名！')}
else if(t=re.exec(val)){Tips.winTip('歌单名中含有非法字符: '+t+'！');}
else if(strLen(val)>8){Tips.winTip('歌单名称不能超过4个汉字或8个字符！');}
else{check(val);}});function check(str){if(str in cfg){return Tips.winTip('已存在同名歌单！');}
var msg=_t.checkTabName(str);if(msg){return Tips.winTip(msg)}
if(_t.getTabCount()<5){cfg[str]=[];Tips.winTip();myFavorite.saveFav(function(){myFavorite.selTab=str;myFavorite.upTab().upFav();});}else Tips.winTip('最多只能建5个歌单！');}},delTab:function(D){var _t=this,st=myFavorite.selTab,cfg=getIns('music').__cfg;$('#favTabTitle').html('删除歌单');D.find('.Name').html(st);D.find('.Sub').unbind().click(function(){if(_t.getTabCount()==1){Tips.winTip('至少得保留一个歌单!');}else{delete cfg[st];Tips.winTip();myFavorite.saveFav(function(){myFavorite.upTab().upFav();});}});},reTab:function(D){var _t=this,st=myFavorite.selTab,cfg=getIns('music').__cfg;$('#favTabTitle').html('歌单改名');var txt=D.find('input.Txt').val('').unbind().keyup(function(e){if(e.keyCode!=13)return;var val=$(this).val();val==''?Tips.winTip('请输入歌单名！'):check(val);}).val(st).select();D.find('.Sub').unbind().click(function(){var val=txt.val();val==''?Tips.winTip('请输入歌单名！'):strLen(val)>8?Tips.winTip('歌单名称不能超过4个汉字或8个字符！'):check(val);});function check(str){if(str in cfg){return Tips.winTip('已存在同名歌单！');}
var msg=_t.checkTabName(str);if(msg){return Tips.winTip(msg)}
cfg[str]=cfg[st];delete cfg[st];Tips.winTip();myFavorite.saveFav(function(){myFavorite.selTab=str;myFavorite.upTab();});}},toFav:function(D,L,fn){var _t=this,st=myFavorite.selTab,arr=[],cfg=getIns('music').__cfg;$('#favTabTitle').html('收藏歌曲');for(var i in cfg){i==='__version'||arr.push({'name':i})}
Req.Temp('mn-select-ul',arr);var txt=D.find('input.Txt').val('').unbind().keyup(function(e){if(e.keyCode!=13)return;var val=$(this).val();val==''?Tips.winTip('请输入歌单名！'):check(val);}).focus();D.find('.Sub').unbind().click(function(){var val=txt.val();val==''?Tips.winTip('请输入歌单名！'):check(val);});var selUl=$('#mn-select-ul');$('#mn-select').unbind().bind('mouseleave',function(){selUl.hide();});D.find('.btn').unbind().click(function(){selUl.show();});selUl.delegate('li','click',function(){txt.val(this['id']).focus();selUl.hide();return false;});function check(str){var s='';for(var i in cfg)s+=i+'\n';if(str in cfg){var newCFG=[];$.each(cfg[str],function(i,n){newCFG.push(n)});$.each(L,function(i,n){var num=newCFG.indexOf(n);num===-1||newCFG.splice(num,1);newCFG.unshift(n);});if(newCFG.length>200){return Tips.winTip('此歌单中现有'+cfg[str].length+'首歌，最多还能添加'+(200-cfg[str].length)+'首！');}
cfg[str]=newCFG;Tips.winTip();myFavorite.saveFav(str,function(){str==st&&myFavorite.upFav();fn&&fn.call(this);});}else{var msg=_t.checkTabName(str);if(msg){return Tips.winTip(msg)}
if(_t.getTabCount()<5){cfg[str]=L;Tips.winTip();myFavorite.saveFav(function(){myFavorite.upTab();fn&&fn.call(this);});}else Tips.winTip('最多只能建5个歌单！');}}},toErr:function(D,id){if(typeof(D)=='number'){return D?Tips.hide(0):Tips.winTip('提交失败，请稍候再试！');}
$('#favTabTitle').html('歌曲报错');var obj=playList.temp[id],iot=$('#errIptOtherTxt'),arrC=[];var url='http://ge.mp3cn.net/feedback.php?',arr={call:'Win.toErr',songid:obj.id,singername:obj.name,songname:obj.singer};clear();D.find('.info').html(obj.name+' - '+obj.singer);$('#errIptOther').unbind().click(function(){this.checked?iot.attr('disabled',0).focus():iot.attr('disabled',1);});iot.unbind().blur(function(){if(!this['value'].length){$('#errIptOther').attr('checked',0);this.disabled=true;}});D.find('.Sub').unbind().click(function(){D.find(':checkbox').each(function(){this.checked&&arrC.push(this['id']=='errIptOther'?$(this.parentNode).text():iot.val());});if(!arrC.length)return Tips.winTip('错误原因不能为空！');arr['error_reason']=arrC.join(',');Tips.winTip();$.getScript(url+$.param(arr));});function clear(){iot.val('').attr('disabled',1);D.find('input:checkbox').each(function(){this.checked=0});}},toShare:function(D,id){if(typeof(D)=='string'){return $('#'+D).val();}
$('#favTabTitle').html('分享歌曲');var obj=playList.temp[id];$('#shareSong').html(obj.name);$('#shareSinger').html(obj.singer);var sos=$('#shareOneSong'),s20s=$('#share20Singer');sos.val(sos.attr('defaultValue')+obj.id+' '+obj.name+' - '+obj.singer);s20s.val(s20s.attr('defaultValue')+encodeURIComponent(obj.singer));},toDown:function(D,id){var obj=playList.temp[id];var name=obj.name;$('#favTabTitle').html('下载歌曲');var gourl=encodeURIComponent('http://www.1616.net');$('#down2tel').attr('src','http://code.woairing.cn/mmscode/MusicSingleRing/03061431123873406097.htm?webownerId=11946&childid=10000&encode=utf-8&gourl='+gourl+'&songname='+encodeURIComponent(name));$('#downSong').attr('href','http://mp3.sogou.com/music.so?query='+playList.swf.$utf2gb(name)+'&pid=sogou-site-a37ebbec40176375');},toEdit:function(D,id){var lrcText=$('#lrcText'),ac=arguments.callee;if(typeof(D)=='string'){if(!D.length){lrcText.val('').attr('disabled',0);return Tips.winTip('当前歌曲没有歌词!');}else if(D=='s'){return Tips.hide('歌词保存成功！');}else if(D=='f'){return Tips.winTip('歌词保存失败！');}else check(ac.tId,D,ac.obj);}else{var obj=playList.temp[id];ac.tId=D;ac.obj=obj;$('#favTabTitle').html('编辑歌词');var downLrcUrl='http://ge.mp3cn.net/lrc.php';D.find('.info').html(obj.name+' - '+obj.singer);lrcText.attr('disabled',1);playList.swf.$request(downLrcUrl,'songid='+obj.id,'Win.toEdit');}
function check(D,lrc,obj){var uploadURL='http://ge.mp3cn.net/userlrc.php';lrcText.val(lrc).attr('disabled',0);D.find('.Sub').unbind().click(function(){var newLrc=lrcText.val();if(!newLrc.length)return Tips.winTip('歌词不能为空！');var data='songid='+obj.id+'&songname='+encodeURIComponent(obj.name)+'&singername='+encodeURIComponent(obj.singer)+'&lrc='+encodeURIComponent(newLrc);playList.swf.$request(uploadURL,data,'Win.toEdit');});}},getTabCount:function(){var count=0;var cfg=getIns('music').__cfg;for(var k in cfg){if(k!='__version'&&cfg.hasOwnProperty(k)){++count;}}
return count;},checkTabName:function(str){var num=0;var re=/[^\w\-\u4e00-\u9fa5]/,t;if(t=re.exec(str))
return'歌单名中含有非法字符: '+t;for(var i=0,len=str.length;i<len;++i){num=num+(str.charCodeAt(i)>127||str.charCodeAt(i)<0)?2:1;}
if(num>8){return'歌单名必要少于8个字符或4个汉字！';}}};var music={Uid:0,guessUrl:'http://ge.mp3cn.net/oso/getre.php?',__needLogin:1,__keepAlive:1,__stickAble:1,__cfg:{'默认歌单':[]},__login:function(){music.Uid=getCookie('Uid');this.__cfg;music.__cfg;music.__cfg={},$.extend(music.__cfg,this.__cfg);var mf=myFavorite,mq=mf.Queue;mf.L&&mf.L.length&&Tips.win('toFav',mf.L,mf.fn);mf.Queue={};Tab.hv!=='myFavorite'?(mf.selTab=''):mf.upTab().upFav();},__logout:function(){music.Uid=0;myFavorite.upTab().upFav();},init:function(){Tab($('#Lnav dd'),'on',function(app){if(app=='playList'){playList.hLight();}
$('#loadingC,#loadingL,#loadingR').hide();window[app]._active();searchBox.turnback();});playList.init();playHistory.init();myFavorite.init();sortRanking.init();singerRanking.init();searchBox.init();this.jsCallAs();},__todo:function(action){this.action=action?action.split('='):this.action;if(!playList.swf.$data||this.action===undefined)return;var a=this.action[0],b=this.action[1].match(/\d*/)[0];if(a==='song'){$.getScript('http://ge.mp3cn.net/songRequest.php?id='+b,function(){if(evaPlayerCallBack.length===0)return;b=~~b;playList.temp[evaPlayerCallBack[0].id]=evaPlayerCallBack[0];playList.addSong([b],0,1);playHistory.addSong(b);});}
if(a==='singer'){$.getScript('http://suggest.mp3cn.net/song/?q='+b+'&n=0,20&type=sengername&call=sharedAction');window.sharedAction=function(data){if(data.length==0)return;var tempArr=[];$.each(data,function(k,v){if(k==0)return true;playList.temp[v[3]]={'id':v[3],'path':v[5],'lrc':v[6],'name':v[4],'singer':v[7]};tempArr.push(~~v[3]);});playList.addSong(tempArr,0,1);playHistory.addSong(tempArr[0]);}}},__upgrade:function(fn){var T=this,def='默认歌单';parent.getCfg('music',function(e){if(e){var list=e.split(',').slice(0,200);music.__cfg[def]=T.__cfg[def]=T.__cfg[def].concat(list);T.__simpleSave(def,function(e){e&&myFavorite.upFav();fn();});}else{fn();}});},switchTab:function(app){$('#'+app).click();},jsCallAs:function(){var j=0,pl=playList,T=this;var timer=setInterval(function(){if(pl.swf.$Play||++j>800){clearInterval(timer);if(pl.swf.$Play){pl.dataLoad();playHistory.dataLoad();T.__todo();}else{var arr=[],browser=$.browser;for(var i in browser){arr.push(i+'__'+browser[i]);}
Req.Temp('pL_Ul',[],'<li class="chos"><a href="javascript:void((function(){$.getScript(\'http://ge.mp3cn.net/listFailed.php?browser='+arr.join('$$')+'\');location.reload();})())">歌曲列表加载失败，请点击这里重新加载！</a></li>');$('#loadingL').hide();}}},10);}};parent.J?parent.J.add('music',music,window):music.init();void function(){var searchValue='',index=-1,kc;$('#search_txt').keyup(function(e){var val=$.trim(this.value);kc=e.keyCode;if(val===''||kc==13){return $('#suggest').html('').hide();}
if($.inArray(kc,[37,38,39,40])!=-1){if(kc==40||kc==38){index+=kc==40?1:-1;index=index<-1?9:index>9?-1:index;showItem(index);}
return;}
if(kc==27){$('#suggest').html('').hide();return;}
$.getScript('http://suggest.mp3cn.net/song/?q='+encodeURIComponent(val)+'&n=0,10&type=songname&call=SUGGEST');}).blur(function(){setTimeout(function(){$('#suggest').html('').hide();},200);});window.SUGGEST=function(data){index=-1;searchValue=$.trim($('#search_txt')[0].value);if(searchValue!=data[0].split('|')[0]||!$.isArray(data)||data.length<=1||kc==13)return $('#suggest').hide();var html=[];var j=1;for(var i=0;i<data.length;i++){if(i==0)continue;var D=data[i];var n=D[2]=='sengername'?7:4;var inner=Req.highlight(D[n],D[0],D[1]);var same=false;for(var c=0;c<html.length;c++){if(D[n]==html[c].replace(/<[^>]+>/g,'')){same=true;break;}}
if(same){continue;}
html[html.length]='<li i="'+(j-1)+'">'+inner+'</li>';j++;}
$('#suggest').html(html.join('')).show().mouseout(function(){$('#search_txt').val(searchValue).focus();}).children('li').mouseover(function(){index=parseInt($(this).attr('i'));showItem(index);}).click(function(){$('#search_btn').click();})};function showItem(num){var input=$('#search_txt')[0];if(num!=-1){$('#suggest>li').removeClass('cur').eq(num).addClass('cur');input.value=$('#suggest>li').removeClass('cur').eq(num).addClass('cur').text();}else{$('#suggest>li').removeClass('cur');input.value=searchValue;}}}();