function uc_replycomment(_1,_2,_3,_4){
var ta=$("uc_contentarea");
var rp=$("uc_replyid");
var fu=$("uc_id");
var fr=$("uc_from");
if(ta&&rp){
rp.value=_1;
fu.value=_3;
fr.value=_4;
ta.value=MSG_REPLYMSG+_2+MSG_COLON;
up_commentonchange(ta);
}
}
function uc_onreplycomment(_9){
var ta=$("uc_contentarea");
if(ta){
if(ta.value.length==0){
alert(ERROR_NO_USERCOMMENT);
}else{
show_loading(_9);
return true;
}
}
return false;
}
function uc_showhistory(_b,_c){
var t=getPos(_b,"Top");
show_loading(_b);
new Ajax.Request("/comment/history/"+_c+"?from=comment&top=150",{asynchronous:true,evalScripts:true});
}
function uf_changelistfunc(_e){
var _f=$("uf_selectaction");
var txt=$("uf_texttmp1");
if(_f&&txt){
switch(_e.value){
case "add":
Element.show(_f);
Element.show(txt);
break;
case "move":
Element.show(_f);
Element.show(txt);
break;
default:
Element.hide(_f);
Element.hide(txt);
}
}
}
function uf_showgroupcreate(){
var dlg=$("uf_creategroupdialog");
var yb=$("userfriend");
if(dlg&&yb){
var wd=365;
var wy=yb.offsetWidth;
var yl=getPos(yb,"Left");
Element.show(dlg);
dlg.style.left=(Math.floor((wy-wd)/2)+yl)+"px";
}
}
function uf_hidegroupcreate(){
var dlg=$("uf_creategroupdialog");
if(dlg){
Element.hide(dlg);
}
}
function uf_oncreategroup(){
var nm=$("uf_creategroup_name");
var smt=$("uf_creategroup_submit");
if(nm&&smt){
if(nm.value.length==0||nm.value==ERROR_NO_FRIENDGROUPNAME){
nm.value="";
alert(ERROR_NO_FRIENDGROUPNAME);
return false;
}else{
show_loading(smt);
return true;
}
}else{
return false;
}
}
function uf_showrenamegroup(){
var dlg=$("uf_renamegroupdialog");
var yb=$("userfriend");
if(dlg&&yb){
var wd=365;
var wy=yb.offsetWidth;
var yl=getPos(yb,"Left");
Element.show(dlg);
dlg.style.left=(Math.floor((wy-wd)/2)+yl)+"px";
}
}
function uf_onsubmitifmail(){
var eml=$("uf_emailinvitetxt");
var cnt=$("uf_emailinvitearea");
var smt=$("uf_emailinvitesubmit");
if(eml&&cnt&&smt){
if(eml.value.length==0){
alert(ERROR_NO_EMAIL);
}else{
if(eml.value.length>1000){
alert(ERROR_EMAILMAX);
}else{
if(cnt.value.length==0){
alert(ERROR_NO_INVITECONTENT);
}else{
if(cnt.value.length>2000){
alert(ERROR_INVITECONTENTMAX);
}else{
show_loading(smt);
return true;
}
}
}
}
}
return false;
}
function uf_onrenamegroup(){
var nm=$("uf_renamegroup_name");
var smt=$("uf_renamegroup_submit");
if(nm&&smt){
if(nm.value.length==0||nm.value==ERROR_NO_FRIENDGROUPNAME){
nm.value="";
alert(ERROR_NO_FRIENDGROUPNAME);
return false;
}else{
show_loading(smt);
return true;
}
}else{
return false;
}
}
function uf_hidegrouprename(){
var dlg=$("uf_renamegroupdialog");
if(dlg){
Element.hide(dlg);
}
}
function uf_groupform_onsubmit(gid,_25){
var _26=$A(document.getElementsByName("list")).select(function(a){
return a.checked;
}).map(function(n){
return n.value;
}).join(",");
var _29=$("uf_selectfunc_hidden");
var did=$("uf_selectaction_hidden").value;
if(_29&&_26&&gid){
switch(_29.value){
case "add":
confirm(MSN_FRIEND_GROUP_ADD);
show_loading(_25);
new Ajax.Request("/friend/add_friends_to_group/"+did+"?ids="+_26,{asynchronous:true,evalScripts:true});
break;
case "move":
confirm(MSN_FRIEND_GROUP_SWAP);
show_loading(_25);
new Ajax.Request("/friend/swap_friends_to_group/"+gid+"?did="+did+"&ids="+_26,{asynchronous:true,evalScripts:true});
break;
default:
confirm(MSN_FRIEND_GROUP_REMOVE);
show_loading(_25);
new Ajax.Request("/friend/remove_friends_from_group/"+gid+"?ids="+_26,{asynchronous:true,evalScripts:true});
}
}else{
alert(ERROR_NO_SELECTED_FRIEND);
}
}
function uf_rd_oncheckitem(idx,cb){
var bd=$("uf_rd_body_"+idx);
if(bd){
if(cb.checked){
Element.show(bd);
}else{
Element.hide(bd);
}
}
}
function uf_onshowgrouplist(div,fid){
var top=getPos(div,"Top");
}
function uf_rd_oncheckitemlast(cb){
var _32=$("uf_rd_button_1");
var _33=$("uf_rd_button_2");
var _34=$("uf_rd_body_13");
if(_32&&_33&&_34){
if(cb.checked){
Element.show(_34);
Element.show(_32);
Element.hide(_33);
for(var i=1;i<13;i++){
var _36=$("uf_rd_checkbox_"+i);
var _37=$("uf_rd_body_"+i);
if(_36&&_37){
Element.hide(_37);
_36.disabled=true;
}
}
}else{
Element.hide(_34);
Element.hide(_32);
Element.show(_33);
for(var i=1;i<13;i++){
var _36=$("uf_rd_checkbox_"+i);
if(_36){
_36.disabled=false;
uf_rd_oncheckitem(i,_36);
}
}
}
}
}
function uf_rd_initdialog(str){
try{
var obj=str.evalJSON();
$("uf_rd_checkbox_1").checked=(obj&&obj.id1)?true:false;
$("uf_rd_value_1").value=(obj&&obj.id1&&obj.id1.v)?obj.id1.v:"";
$("uf_rd_more_1").value=(obj&&obj.id1&&obj.id1.m)?obj.id1.m:"";
$("uf_rd_checkbox_2").checked=(obj&&obj.id2)?true:false;
$("uf_rd_value_2").value=(obj&&obj.id2&&obj.id2.v)?obj.id2.v:"";
$("uf_rd_more_2").value=(obj&&obj.id2&&obj.id2.m)?obj.id2.m:"";
$("uf_rd_checkbox_3").checked=(obj&&obj.id3)?true:false;
$("uf_rd_value_3").value=(obj&&obj.id3&&obj.id3.v)?obj.id3.v:"";
$("uf_rd_checkbox_4").checked=(obj&&obj.id4)?true:false;
$("uf_rd_value_4").selectedIndex=(obj&&obj.id4&&obj.id4.v)?parseInt(obj.id4.v):0;
$("uf_rd_more_4").value=(obj&&obj.id4&&obj.id4.m)?obj.id4.m:"";
$("uf_rd_checkbox_5").checked=(obj&&obj.id5)?true:false;
$("uf_rd_value_5").value=(obj&&obj.id5&&obj.id5.v)?obj.id5.v:"";
if(obj&&obj.id5&&obj.id5.m){
uf_rd_oninitworktime(obj.id5.m);
}
$("uf_rd_checkbox_6").checked=(obj&&obj.id6)?true:false;
$("uf_rd_value_6").selectedIndex=(obj&&obj.id6&&obj.id6.v)?parseInt(obj.id6.v):0;
$("uf_rd_more_6").value=(obj&&obj.id6&&obj.id6.m)?obj.id6.m:"";
$("uf_rd_checkbox_7").checked=(obj&&obj.id7)?true:false;
$("uf_rd_value_7").selectedIndex=(obj&&obj.id7&&obj.id7.v)?parseInt(obj.id7.v):0;
$("uf_rd_more_7").value=(obj&&obj.id7&&obj.id7.m)?obj.id7.m:"";
$("uf_rd_checkbox_8").checked=(obj&&obj.id8)?true:false;
$("uf_rd_value_8").value=(obj&&obj.id8&&obj.id8.v)?obj.id8.v:"";
$("uf_rd_checkbox_9").checked=(obj&&obj.id9)?true:false;
$("uf_rd_value_9").value=(obj&&obj.id9&&obj.id9.v)?obj.id9.v:"";
$("uf_rd_more_9").value=(obj&&obj.id9&&obj.id9.m)?obj.id9.m:"";
$("uf_rd_checkbox_10").checked=(obj&&obj.id10)?true:false;
if(obj&&obj.id10&&obj.id10.v){
uf_rd_oninitlovertime(obj.id10.v);
}
$("uf_rd_more_10").value=(obj&&obj.id10&&obj.id10.m)?obj.id10.m:"";
$("uf_rd_checkbox_11").checked=(obj&&obj.id11)?true:false;
$("uf_rd_value_11").value=(obj&&obj.id11&&obj.id11.v)?obj.id11.v:"";
$("uf_rd_checkbox_12").checked=(obj&&obj.id12)?true:false;
$("uf_rd_value_12").value=(obj&&obj.id12&&obj.id12.v)?obj.id12.v:"";
$("uf_rd_checkbox_13").checked=false;
for(var i=1;i<13;i++){
var cki=$("uf_rd_checkbox_"+i);
var bdi=$("uf_rd_body_"+i);
if(cki){
if(cki.checked){
Element.show(bdi);
}
}
}
}
catch(e){
alert(e);
}
}
function uf_rd_oninitworktime(_3d){
var mt1=$("uf_rd_more_5_1");
var mt2=$("uf_rd_more_5_2");
if(mt1&&mt2&&_3d!=""){
var tmp=_3d.split("-");
var fv=parseInt(tmp[0]);
var tv=parseInt(tmp[1]);
var cd=new Date();
fv=cd.getFullYear()-fv+1;
tv=isNaN(tv)?0:tv;
tv=(tv==0)?0:cd.getFullYear()-tv+1;
mt1.selectedIndex=fv;
uf_rd_onchangeworktime();
mt2.selectedIndex=tv;
}
}
function uf_rd_oninitlovertime(_44){
var vt1=$("uf_rd_value_10_1");
var vt2=$("uf_rd_value_10_2");
var vt3=$("uf_rd_value_10_3");
if(vt1&&vt2&&vt3&&_44!=""){
var tmp=_44.split("-");
var yv=parseInt(tmp[0]);
var mv=parseInt(tmp[1]);
var dv=parseInt(tmp[2]);
var cd=new Date();
yv=cd.getFullYear()-yv+1;
vt1.selectedIndex=yv;
vt2.selectedIndex=mv-1;
uf_rd_onchangedate();
vt3.selectedIndex=dv-1;
}
}
function uf_rd_onchangeworktime(){
var ft=$("uf_rd_more_5_1");
var tt=$("uf_rd_more_5_2");
if(ft&&tt){
uf_rd_clearoption(tt);
if(ft.value.length==0){
tt.disabled=true;
}else{
var fv=parseInt(ft.value);
var cd=new Date();
uf_rd_addoption(tt,new Option(MSG_UF_RD_TODAY,MSG_UF_RD_TODAY));
for(var i=cd.getFullYear();i>=fv;i--){
uf_rd_addoption(tt,new Option(i,i));
}
tt.disabled=false;
}
}
}
function uf_rd_addoption(sel,opt){
try{
sel.add(opt);
}
catch(e){
sel.add(opt,null);
}
}
function uf_rd_clearoption(sel){
for(var i=sel.options.length-1;i>=0;i--){
sel.remove(0);
}
}
function uf_rd_getdatelen(y,m){
var da=[31,28,31,30,31,30,31,31,30,31,30,31];
var db=[31,29,31,30,31,30,31,31,30,31,30,31];
var rn=(y%400==0)||((y%100!=0)&&(y%4==0));
if(rn){
return db[m-1];
}else{
return da[m-1];
}
}
function uf_rd_onchangedate(){
var ys=$("uf_rd_value_10_1");
var ms=$("uf_rd_value_10_2");
var ds=$("uf_rd_value_10_3");
if(ys&&ms&&ds){
var dv=ds.value;
uf_rd_clearoption(ds);
if(ys.value.length==0||parseInt(ys.value)==0){
ms.disabled=true;
ds.disabled=true;
}else{
var yv=parseInt(ys.value);
var mv=parseInt(ms.value);
var dm=uf_rd_getdatelen(yv,mv);
for(var i=1;i<=dm;i++){
uf_rd_addoption(ds,new Option(i+MSG_FU_RD_DATE,i));
}
ms.disabled=false;
ds.disabled=false;
if(dv.length>0){
ds.selectedIndex=Math.min(dm-1,parseInt(dv)-1);
}
}
}
}
function uf_rd_onupdate(fid,div,rid){
try{
var _66=false;
for(var i=1;i<13;i++){
var cki=$("uf_rd_checkbox_"+i);
if(cki.checked){
_66=true;
if(i==10){
var vt=$("uf_rd_value_10_1");
if(vt.value.length==0){
alert(ERROR_UF_UPDATERELATIONSHIP[i-1]);
return false;
}
}else{
var vt=$("uf_rd_value_"+i);
if(vt.value.length==0){
alert(ERROR_UF_UPDATERELATIONSHIP[i-1]);
return false;
}
}
}
}
if(!_66){
alert(ERROR_NO_FRIENDRELATION);
return false;
}
relation=uf_rd_genjson();
show_loading(div);
new Ajax.Request("/friend/edit_relaship_do/"+fid+"?rid="+rid,{postBody:"relation="+relation,asynchronous:true,evalScripts:true,method:"post"});
}
catch(e){
alert(e);
return false;
}
return true;
}
function uf_rd_onupdate_profile(fid,div,_6c){
try{
var _6d=false;
for(var i=1;i<13;i++){
var cki=$("uf_rd_checkbox_"+i);
if(cki.checked){
_6d=true;
if(i==10){
var vt=$("uf_rd_value_10_1");
if(vt.value.length==0){
alert(ERROR_UF_UPDATERELATIONSHIP[i-1]);
return false;
}
}else{
var vt=$("uf_rd_value_"+i);
if(vt.value.length==0){
alert(ERROR_UF_UPDATERELATIONSHIP[i-1]);
return false;
}
}
}
}
if(!_6d){
alert(ERROR_NO_FRIENDRELATION);
return false;
}
relation=uf_rd_genjson();
show_loading(div);
new Ajax.Request("/friend/edit_relaship_do/"+fid+"?from="+_6c,{postBody:"relation="+relation,asynchronous:true,evalScripts:true,method:"post"});
}
catch(e){
alert(e);
return false;
}
return true;
}
function uf_rd_genjson(){
var obj={};
for(var i=1;i<13;i++){
var cki=$("uf_rd_checkbox_"+i);
if(cki.checked){
obj["id"+i]={};
switch(i){
case 5:
var vt=$("uf_rd_value_"+i);
var mt1=$("uf_rd_more_"+i+"_1");
var mt2=$("uf_rd_more_"+i+"_2");
if(vt){
obj["id"+i]["v"]=vt.value;
}
if(mt1&&mt2){
if(mt1.value.length==0){
obj["id"+i]["m"]="";
}else{
obj["id"+i]["m"]=mt1.value+"-"+mt2.value;
}
}
break;
case 10:
var vt1=$("uf_rd_value_"+i+"_1");
var vt2=$("uf_rd_value_"+i+"_2");
var vt3=$("uf_rd_value_"+i+"_3");
if(vt1&&vt2&&vt3){
obj["id"+i]["v"]=vt1.value+"-"+parseInt(vt2.value)+"-"+parseInt(vt3.value);
}
var mt=$("uf_rd_more_"+i);
if(mt){
obj["id"+i]["m"]=mt.value;
}
default:
var vt=$("uf_rd_value_"+i);
var mt=$("uf_rd_more_"+i);
if(vt){
obj["id"+i]["v"]=vt.value;
}
if(mt){
obj["id"+i]["m"]=mt.value;
}
}
}
}
var str=$H(obj).toJSON();
return encodeURIComponent(str);
}
function uf_rd_onskip(){
hide_floatdialog();
}
function uf_rd_onremove(fid,div){
if(confirm(MSG_FRIENDREMOVE)){
show_loading(div);
new Ajax.Request("/friend/remove/"+fid,{asynchronous:true,evalScripts:true,method:"post"});
}
}
function uf_editrelationship(fid,div){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/friend/edit_relaship/"+fid+"?top="+top,{asynchronous:true,evalScripts:true});
}
function uf_editrelationship_profile(fid,div){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/friend/edit_relaship/"+fid+"?top="+top+"&from=profile",{asynchronous:true,evalScripts:true});
}
function uf_showinviteitem(idx,btn){
var itm=$("uf_inviteitem_"+idx);
if(itm){
for(var i=1;i<6;i++){
var iti=$("uf_inviteitem_"+i);
var itb=$("uf_invitebutton_"+i);
if(iti){
Element.hide(iti);
}
if(itb){
Element.show(itb);
}
}
Element.show(itm);
Element.hide(btn);
}
}
function uf_showcsvhelp(){
var dlg=$("yobo_helpcsvdialog");
var yb=$("userfriend");
if(dlg&&yb){
var wd=500;
var wy=yb.offsetWidth;
var yl=getPos(yb,"Left");
dlg.style.left=(Math.floor((wy-wd)/2)+yl)+"px";
Element.show(dlg);
}
}
function uf_hidecsvhelp(){
var dlg=$("yobo_helpcsvdialog");
if(dlg){
Element.hide(dlg);
}
}
function ufs_onoveritem(idx){
var hd=$("ufs_headeritem_"+idx);
var tr=$("ufs_headerrow_"+idx);
var br=$("ufs_bodyrow_"+idx);
if(hd&&tr&&br&&!yobo_vSliderLock){
Element.show(hd);
tr.className="header_current";
br.className="body_current";
}
}
function ufs_onoutitem(idx){
var hd=$("ufs_headeritem_"+idx);
var tr=$("ufs_headerrow_"+idx);
var br=$("ufs_bodyrow_"+idx);
if(hd&&tr&&br&&!yobo_vSliderLock){
Element.hide(hd);
tr.className="";
br.className="";
}
}
function ufs_onchangeitem(_98,_99){
ufs_showsuccessinfo();
new Ajax.Request("/feed/update_mainfeed_do?category="+_98+"&value="+_99,{asynchronous:true,evalScripts:true,method:"post"});
}
function ufs_updatefeedfriends(_9a,div){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/feed/update_feed_friends?type="+_9a+"&top="+top+"&is_all=1",{asynchronous:true,evalScripts:true,method:"post"});
}
function ufs_onchangefriendlist(sel,_9e,top){
var gid=sel.value;
show_loading(sel);
new Ajax.Request("/feed/update_feed_friends?gid="+gid+"&type="+_9e+"&top="+top,{asynchronous:true,evalScripts:true,method:"post"});
}
function ufs_showhelpdialog(){
var dlg=$("yobo_helpmainfeedsetting");
var yb=$("userfeedsetting");
if(dlg&&yb){
var wd=500;
var wy=yb.offsetWidth;
var yl=getPos(yb,"Left");
dlg.style.left=(Math.floor((wy-wd)/2)+yl)+"px";
Element.show(dlg);
}
}
function ufs_hidehelpdialog(){
var dlg=$("yobo_helpmainfeedsetting");
if(dlg){
Element.hide(dlg);
}
}
var UFS_SUCCESSTIMER=null;
function ufs_showsuccessinfo(){
if(UFS_SUCCESSTIMER){
clearTimeout(UFS_SUCCESSTIMER);
}
var usd=$("ufs_savesuccess");
if(usd){
usd.innerHTML=MSG_UFSSUCCESSINFO;
Element.show(usd);
}
}
function ufs_showsuccess(){
if(UFS_SUCCESSTIMER){
clearTimeout(UFS_SUCCESSTIMER);
}
var usd=$("ufs_savesuccess");
if(usd){
usd.innerHTML=MSG_UFSSUCCESS;
Element.show(usd);
UFS_SUCCESSTIMER=setTimeout("ufs_hidesuccess()",2000);
}
}
function ufs_hidesuccess(){
var usd=$("ufs_savesuccess");
if(usd){
Element.hide(usd);
}
}
function ufs_resetall(){
ufs_showsuccessinfo();
new Ajax.Request("/feed/update_mainfeed_default",{asynchronous:true,evalScripts:true,method:"get"});
}
function us_pf_initbirth(y,m,d){
var ys=$("uf_rd_value_10_1");
var ms=$("uf_rd_value_10_2");
var ds=$("uf_rd_value_10_3");
if(ys&&ms&&ds){
var yv=parseInt(y);
var mv=parseInt(m);
var dv=parseInt(d);
yv=2006-yv;
try{
ys.selectedIndex=yv;
ms.selectedIndex=mv-1;
uf_rd_onchangedate();
ds.selectedIndex=dv-1;
}
catch(e){
alert(e);
}
}
}
function us_pf_onchangecountry(){
var cnt=$("us_profile_countryselect");
var prv=$("us_profile_provinceselect");
var cty=$("us_profile_cityselect");
var cin=$("us_profile_cityinput");
if(cnt&&prv&&cty&&cin){
switch(cnt.value){
case "1":
Element.show(prv);
Element.show(cty);
Element.hide(cin);
cin.value="";
break;
case "0":
Element.hide(prv);
Element.hide(cty);
Element.hide(cin);
prv.selectedIndex=0;
us_pf_onchangeprovince();
cty.selectedIndex=0;
cin.value="";
break;
default:
Element.hide(cty);
Element.hide(prv);
Element.show(cin);
prv.selectedIndex=0;
us_pf_onchangeprovince();
cty.selectedIndex=0;
if(cin.value.length==0){
cin.value=ERROR_NO_CITYNAME;
}
}
}
}
function us_pf_onchangeprovince(){
var prv=$("us_profile_provinceselect");
var cty=$("us_profile_cityselect");
if(prv&&cty){
var pv=parseInt(prv.value);
var _ba=YOBO_SETTING_CITY[pv];
var len=_ba.length;
uf_rd_clearoption(cty);
for(var i=0;i<len;i++){
uf_rd_addoption(cty,new Option(_ba[i].name,_ba[i].id));
}
}
}
function us_pf_initcountry(t,p,c){
var cnt=$("us_profile_countryselect");
var prv=$("us_profile_provinceselect");
var cty=$("us_profile_cityselect");
if(cnt&&prv&&cty){
try{
cnt.selectedIndex=t;
us_pf_onchangecountry();
prv.selectedIndex=p;
if(p==0){
c=0;
}
us_pf_onchangeprovince();
var cf=0;
if(cty.options.length>1&&c>0){
cf=cty.options[1].value-1;
}
cty.selectedIndex=c-cf;
}
catch(e){
alert(e);
}
}
}
function us_pf_onchangehomecountry(){
var cnt=$("us_profile_homecountryselect");
var prv=$("us_profile_homeprovinceselect");
var cty=$("us_profile_homecityselect");
var cin=$("us_profile_homecityinput");
var hin=$("us_profile_homeintro");
if(cnt&&prv&&cty&&cin&&hin){
switch(cnt.value){
case "1":
Element.show(prv);
Element.show(cty);
Element.hide(cin);
if(parseInt(prv.value)==0){
Element.hide(hin);
}else{
Element.show(hin);
}
break;
case "0":
Element.hide(prv);
Element.hide(cty);
Element.hide(cin);
Element.hide(hin);
prv.selectedIndex=0;
us_pf_onchangehomeprovince();
cty.selectedIndex=0;
break;
default:
Element.hide(cty);
Element.hide(prv);
Element.show(cin);
if(cin.value.length==0){
cin.value=ERROR_NO_CITYNAME;
}
prv.selectedIndex=0;
us_pf_onchangehomeprovince();
cty.selectedIndex=0;
}
}
}
function us_pf_onchangehomeprovince(){
var cnt=$("us_profile_homecountryselect");
var prv=$("us_profile_homeprovinceselect");
var cty=$("us_profile_homecityselect");
var hin=$("us_profile_homeintro");
if(cnt&&prv&&cty&&hin){
var pv=parseInt(prv.value);
var _ce=YOBO_SETTING_CITY[pv];
var len=_ce.length;
uf_rd_clearoption(cty);
for(var i=0;i<len;i++){
uf_rd_addoption(cty,new Option(_ce[i].name,_ce[i].id));
}
if(pv==0&&cnt.value<=1){
Element.hide(hin);
}else{
Element.show(hin);
}
}
}
function us_pf_inithomecountry(t,p,c){
var cnt=$("us_profile_homecountryselect");
var prv=$("us_profile_homeprovinceselect");
var cty=$("us_profile_homecityselect");
if(cnt&&prv&&cty){
try{
cnt.selectedIndex=t;
us_pf_onchangehomecountry();
prv.selectedIndex=p;
if(p==0){
c=0;
}
us_pf_onchangehomeprovince();
var cf=0;
if(cty.options.length>1&&c>0){
cf=cty.options[1].value-1;
}
cty.selectedIndex=c-cf;
}
catch(e){
alert(e);
}
}
}
function us_onsubmitprofile(){
var hhd=$("us_profile_homecityinput");
var hid=$("us_profile_cityinput");
if(hhd&&hid){
if(hhd.value==ERROR_NO_CITYNAME){
hhd.value="";
}
if(hid.value==ERROR_NO_CITYNAME){
hid.value="";
}
return true;
}
return false;
}
function uix_onsubmitform(_da,div){
ids=$A(document.getElementsByName("ids[]")).select(function(a){
return a.checked;
}).map(function(n){
return n.value;
});
if(ids.length>0){
switch(_da){
case "inbox":
if(confirm(MSG_INBOX_BATCH_REMOVE)){
show_loading(div);
new Ajax.Request("/message/batch_remove?from="+_da+"&ids="+ids,{asynchronous:true,evalScripts:true,method:"post"});
}
break;
case "outbox":
if(confirm(MSG_OUTBOX_BATCH_REMOVE)){
show_loading(div);
new Ajax.Request("/message/batch_remove?from="+_da+"&ids="+ids,{asynchronous:true,evalScripts:true,method:"post"});
}
break;
case "notification":
if(confirm(MSG_NOTIFI_BATCH_REMOVE)){
show_loading(div);
new Ajax.Request("/message/batch_remove?from="+_da+"&ids="+ids,{asynchronous:true,evalScripts:true,method:"post"});
}
}
}else{
alert(ERROR_NO_MESSAGE);
}
}
function uix_showsendmessage(_de,fid,rid,div){
var dlg=$("yobo_sendmessage_dialog");
var dtt=$("yobo_sendmessage_dialogtitle");
var dhi=$("yobo_sendmessage_dialoghiddenid");
var dri=$("yobo_sendmessage_dialoghiddenreplyid");
var yb=$("userinbox");
if(dlg&&dtt&&dhi&&yb&&dri){
Element.show(dlg);
dtt.innerHTML=MSG_REPLYMSG+_de;
dhi.value=fid;
dri.value=rid;
var wd=600;
var wy=yb.offsetWidth;
var yl=getPos(yb,"Left");
var top=getPos(div,"Top");
dlg.style.left=(Math.floor((wy-wd)/2)+yl)+"px";
dlg.style.top=top+"px";
}
}
function ub_showsettingdialog(div){
var dlg=$("ub_settingdialog");
var yb=$("yobo");
if(dlg&&yb){
Element.show(dlg);
var wd=365;
var wy=yb.offsetWidth;
var yl=getPos(yb,"Left");
var top=getPos(div,"Top");
dlg.style.left=(Math.floor((wy-wd)/2)+yl)+"px";
dlg.style.top=top+"px";
}
}
function ub_updatedlgtitle(_f2){
var tit=$("ub_dlgtitle");
if(tit){
tit.innerHTML=htmltag_escape(_f2.value);
}
}
function ub_updatedlgsubtitle(_f4){
var tit=$("ub_dlgsubtitle");
if(tit){
tit.innerHTML=htmltag_escape(_f4.value);
}
}
function ub_updatedlgpos(pos){
var pre=$("ub_dlgpreview");
if(pre){
if(pos==0){
pre.style.textAlign="left";
}else{
pre.style.textAlign="right";
}
}
}
function ub_comment_reply(_f8,id){
var cnt=$("ub_comment_area");
var hid=$("ub_comment_replyid");
if(cnt&&hid){
cnt.value=MSG_REPLYMSG+_f8+MSG_COLON;
hid.value=id;
ontextareachange($("ub_comment_area"),$("ub_commenttextlength"));
}
}
function ub_oncreatesubmit(){
var hid=$("ub_createhiddeninput");
if(hid){
hid.value=0;
}
}
function ub_oncreatepreview(){
var hid=$("ub_createhiddeninput");
if(hid){
hid.value=1;
}
}
function ub_onSearchSong(div){
var q=$("rsdialog_keyword");
if(q){
if(q.value.length==0){
alert(ERROR_EMPTY_SONG_NAME);
}else{
show_loading(div);
new Ajax.Request("/blog/search_song/",{method:"post",parameters:"q="+q.value,asynchronous:true,evalScripts:true});
}
}
}
function ug_onsubmitform(div){
var btn=$("ug_formsubmit");
var fm=$("ug_listform");
var chk=false;
if(fm){
try{
var cl=fm["ids[]"];
var ll=$A(cl);
if(ll.length>0){
ll.each(function(el,_107){
chk=chk||el.checked;
});
}else{
chk=cl.checked;
}
}
catch(e){
}
}
if(chk){
if(confirm(MSG_GIFT_BATCH_REMOVE)){
if(btn){
btn.click();
show_loading(div);
}
}
}else{
alert(ERROR_NO_GIFTITEM);
}
}
function ub_onInsertSong(div){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/blog/insert_song?top="+top,{method:"get",asynchronous:true,evalScripts:true});
}
function ubox_form_onsubmit(div,idx){
var sel=$("ubox_menu_funcsel"+idx);
var opt=$("ubox_menu_select"+idx);
var frm1=$("ubox_hidden_form_remove");
var frm2=$("ubox_hidden_form_swap");
if(sel&&opt&&frm1&&frm2){
switch(sel.value){
case "del":
if(confirm(MSG_UBOX_DELSONGS_CONFIRM)){
frm1["ids"].value=ubox_get_select();
frm1["submit"].click();
}else{
return;
}
break;
case "swap":
if(opt.length==0){
alert(MSG_UBOX_NOBOX);
return;
}
frm2["song_ids"].value=ubox_get_select();
frm2["is_copy"].value="0";
frm2["swapid"].value=opt.value;
frm2["submit"].click();
break;
case "add":
if(opt.length==0){
alert(MSG_UBOX_NOBOX);
return;
}
frm2["song_ids"].value=ubox_get_select();
frm2["is_copy"].value="1";
frm2["swapid"].value=opt.value;
frm2["submit"].click();
break;
}
show_loading(div);
}
}
function ubx_showboxrename(){
var lik=$("ubx_boxrenamelink");
var btn=$("ubx_boxrenamebtn");
var frm=$("ubx_boxrenameform");
if(lik&&btn&&frm){
Element.hide(lik);
Element.hide(btn);
Element.show(frm);
}
}
function ubx_hideboxrename(){
var lik=$("ubx_boxrenamelink");
var btn=$("ubx_boxrenamebtn");
var frm=$("ubx_boxrenameform");
if(lik&&btn&&frm){
Element.show(lik);
Element.show(btn);
Element.hide(frm);
}
}
function ubox_update_select(sel,idx){
var txt=$("ubox_menu_text"+idx);
var opt=$("ubox_menu_select"+idx);
if(txt&&opt){
switch(sel.value){
case "del":
Element.hide(txt);
Element.hide(opt);
break;
default:
Element.show(txt);
Element.show(opt);
}
}
}
function ubox_save_order(div){
var fm=$("user_boxitem_listorder_form");
if(fm){
show_loading(div);
fm["submit"].click();
}
}
function ubox_delsong_confirm(div,sid,_11e){
if(confirm(MSG_UBOX_DELSONG_CONFIRM)){
show_loading(div);
if(_11e){
new Ajax.Request("/box/remove_song/?ids="+sid+"&box_id="+_11e,{method:"post",asynchronous:true,evalScripts:true});
}else{
new Ajax.Request("/box/remove_song/?ids="+sid,{method:"post",asynchronous:true,evalScripts:true});
}
}
}
function ubx_listDragOver(list){
if(list&&list.length>0){
var len=list.length;
for(var i=0;i<len;i++){
for(var j=0;j<len-i-1;j++){
if((list[j].x>list[j+1].x)||(list[j].x==list[j+1].x&&list[j].y>list[j+1].y)){
var tmp=list[j].id;
list[j].id=list[j+1].id;
list[j+1].id=tmp;
tmp=list[j].x;
list[j].x=list[j+1].x;
list[j+1].x=tmp;
tmp=list[j].y;
list[j].y=list[j+1].y;
list[j+1].y=tmp;
}
}
}
str=list[0].id;
for(i=1;i<len;i++){
str+=","+list[i].id;
}
var ipt=$("user_box_listhidden");
var sbt=$("user_box_listsubmit");
if(ipt&&sbt){
ipt.value=str;
sbt.click();
}
}
}
function ubox_get_select(){
try{
var fm=$("ubx_songlistform");
var cl=fm["checkbox[]"];
if(cl&&fm){
var str=[];
var ll=$A(cl);
if(ll.length>0){
ll.each(function(el,_12b){
if(el.checked){
str.push(el.value);
}
});
}else{
if(cl.checked){
str.push(cl.value);
}
}
return str.join(",");
}
return "";
}
catch(e){
alert(e);
return "";
}
}
function recommend_delete_submit(div){
var frm=$("ubx_songlistform");
frm["ids"].value=ubox_get_select();
show_loading(div);
frm["submit"].click();
}
function ubox_removebox_confirm(){
try{
var frm=$("ubox_removebox_form");
if(frm){
if(confirm(MSG_UBOX_DELBOX_CONFIRM)){
if(confirm(MSG_UBOX_DELBOX_CONFIRM2)){
frm["include_lib"].value="0";
}else{
frm["include_lib"].value="1";
}
frm["submit"].click();
}
}
}
catch(e){
alert(e);
}
}
function show_create_dialog(div,type){
var dg=$("user_createbox_dialog");
if(dg){
Element.show(dg);
var left=getPos(div,"Left");
var top=getPos(div,"Top");
dg.style.top=top+"px";
if(type==0){
dg.style.left=left+"px";
}else{
dg.style.left=(left+div.offsetWidth-dg.offsetWidth)+"px";
}
}
}
function show_addfav_dialog(div,_135){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/box/box_add_fav/?boxid="+_135+"&top="+top,{method:"get",asynchronous:true,evalScripts:true});
}
function hide_addfav_dialog(){
var dg=$("tool_ubox_addfav_dialog");
if(dg){
Element.hide(dg);
setTimeout(function(){
if($("tool_ubox_addfav_dialog")){
$("tool_ubox_addfav_dialog").innerHTML="";
}
},10);
}
}
function up_dialogtoggle(id,type){
var mn=$("up_"+id+"min");
var mx=$("up_"+id+"max");
var bd=$("up_"+id+"body");
var hd=$("up_"+id+"header");
var st=$("up_"+id+"setting");
if(mn&&mx&&bd){
if(type){
Element.hide(mn);
Element.show(mx);
Element.hide(bd);
if(st){
Element.hide(st);
}
if(hd){
Element.hide(hd);
}
}else{
Element.show(mn);
Element.hide(mx);
Element.show(bd);
if(hd){
Element.show(hd);
}
}
}
}
var UP_TIPTIMER=null;
var UP_TIPENABLED=true;
function up_showtip(div,tip){
if(UP_TIPTIMER){
clearTimeout(UP_TIPTIMER);
up_hidetip();
}
var tpd=$("up_tipblock");
if(tpd&&UP_TIPENABLED&&MSG_USERPROFILETIPS[tip]){
Element.show(tpd);
tpd.innerHTML=MSG_USERPROFILETIPS[tip];
tpd.style.left=getPos(div,"Left")+div.offsetWidth+"px";
tpd.style.top=getPos(div,"Top")+div.offsetHeight+"px";
if(MSG_USERPROFILETIPS[tip].length>30){
tpd.style.width="300px";
}else{
tpd.style.width="auto";
}
UP_TIPTIMER=setTimeout("up_hidetip()",5*1000);
}
}
function up_hidetip(){
var tpd=$("up_tipblock");
if(tpd){
Element.hide(tpd);
tpd.innerHTML="";
}
}
function up_onreplaycomment(name,_144,cid,from){
var cnt=$("up_commentcontent");
var rpl=$("up_commentreplyid");
var cmt=$("up_uid");
var frm=$("up_commentfrom");
if(cnt&&rpl){
cnt.value=MSG_REPLYMSG+name+MSG_COLON;
rpl.value=_144;
cmt.value=cid;
frm.value=from;
up_commentonchange(cnt);
}
}
function up_onDragStart(){
if(UP_TIPTIMER){
clearTimeout(UP_TIPTIMER);
up_hidetip();
}
UP_TIPENABLED=false;
}
function up_onDragRelease(){
UP_TIPENABLED=true;
}
function up_leftDragOver(list,flag,_14d){
if(list&&list.length>0){
var len=list.length;
for(var i=0;i<len;i++){
for(var j=0;j<len-i-1;j++){
if((list[j].x>list[j+1].x)||(list[j].x==list[j+1].x&&list[j].y>list[j+1].y)){
var tmp=list[j].id;
list[j].id=list[j+1].id;
list[j+1].id=tmp;
tmp=list[j].x;
list[j].x=list[j+1].x;
list[j+1].x=tmp;
tmp=list[j].y;
list[j].y=list[j+1].y;
list[j+1].y=tmp;
}
}
}
str=list[0].id;
for(i=1;i<len;i++){
str+=","+list[i].id;
}
show_loading(_14d);
new Ajax.Request("/setting/module_order/",{method:"post",postBody:"order="+str,asynchronous:true,evalScripts:true});
}
}
function up_rightDragOver(list,flag,_154){
if(list&&list.length>0){
var len=list.length;
for(var i=0;i<len;i++){
for(var j=0;j<len-i-1;j++){
if((list[j].x>list[j+1].x)||(list[j].x==list[j+1].x&&list[j].y>list[j+1].y)){
var tmp=list[j].id;
list[j].id=list[j+1].id;
list[j+1].id=tmp;
tmp=list[j].x;
list[j].x=list[j+1].x;
list[j+1].x=tmp;
tmp=list[j].y;
list[j].y=list[j+1].y;
list[j+1].y=tmp;
}
}
}
str=list[0].id;
for(i=1;i<len;i++){
str+=","+list[i].id;
}
show_loading(_154);
new Ajax.Request("/setting/module_order/",{method:"post",postBody:"order="+str,asynchronous:true,evalScripts:true});
}
}
function up_onsubmitinvite(div){
var cont=$("uf_friendcontent");
var smt=$("uf_friendsubmit");
var txt=$("uf_friendtextinput");
if(cont&&smt&&txt){
input_onfocusclear(cont);
input_onfocusclear(txt);
if(txt.value.length==0){
alert(ERROR_NO_EMAIL);
return false;
}
if(cont.value.length==0){
alert(ERROR_NO_INVITECONTENT);
}else{
if(cont.value.length>2000){
alert(ERROR_INVITECONTENTMAX);
}else{
show_loading(smt);
return true;
}
}
}
return false;
}
function ubx_showCreateBox(){
var bar=$("ubx_createboxbar");
var dlg=$("ubx_createboxdialog");
if(bar&&dlg){
var top=Math.max(getPos(bar,"Top"),170);
dlg.style.left=getPos(bar,"Left")+"px";
dlg.style.top=top+"px";
before_showfloatdialog();
Element.show(dlg);
}
}
function ur_passfriendreq(rid,div){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/req/pass_friend/"+rid+"?top="+top,{asynchronous:true,evalScripts:true});
}
function ur_editrelationreq(rid,div){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/req/edit_relation/"+rid+"?top="+top,{asynchronous:true,evalScripts:true});
}
function rq_rd_onskip(rid,div){
var top=getPos(div,"Top");
show_loading(div);
new Ajax.Request("/req/skip_relation/"+rid+"?top="+top,{asynchronous:true,evalScripts:true});
}
function uf_editfriendgroup(fid,div){
var top=getPos(div,"Top");
top=0;
show_loading(div);
new Ajax.Request("/friend/edit_group/"+fid+"?top="+top,{asynchronous:true,evalScripts:true});
}
function ubx_showboxaddsong(){
var dlg=$("ubx_addsongboxdialog");
var yb=$("yobo");
if(dlg&&yb){
before_showfloatdialog();
var wd=480;
var wy=yb.offsetWidth;
var yl=getPos(yb,"Left");
dlg.style.left=(Math.floor((wy-wd)/2)+yl)+"px";
var top=getPageOffsetY()+170;
dlg.style.top=top+"px";
Element.show(dlg);
}
}
function usg_onsubmitcomment(div,fid){
var cmt=$("usg_commentarea_"+fid);
if(cmt){
if(cmt.value.length==0){
alert(ERROR_NO_SINGERREASON);
}else{
if(cmt.value.length>2000){
alert(ERROR_SINGERREASON_MAX);
}else{
show_loading(div);
return true;
}
}
}
return false;
}
function onsubmitusergift(frm,name){
var form=$(frm);
if(form){
var cl=form[name];
if(cl){
var chk=false;
var ll=$A(cl);
if(ll.length>0){
ll.each(function(el,_17c){
chk=chk||el.checked;
});
}else{
chk=cl.checked;
}
if(chk){
return true;
}else{
alert(ERROR_NO_USERGIFTSELECTED);
}
}
}
return false;
}
function ug_updateshowxml(uid){
new Ajax.Request("/ug/show/"+uid,{asynchronous:true,evalScripts:true,method:"get"});
}
function ug_fonditemupdate(div){
var itm=$(div);
if(itm){
itm.className="itembody itembodyfond";
}
}
function ug_unfonditemupdate(div){
var itm=$(div);
if(itm){
itm.className="itembody itembodyunfond";
}
}
function uft_showmenu(gid){
var sel=$("fti_sellbtn_"+gid);
var giv=$("fti_givebackbtn_"+gid);
if(sel){
Element.show(sel);
}
if(giv){
Element.show(giv);
}
}
function uft_hidemenu(gid){
var sel=$("fti_sellbtn_"+gid);
var giv=$("fti_givebackbtn_"+gid);
if(sel){
Element.hide(sel);
}
if(giv){
Element.hide(giv);
}
}
if(typeof (yobo_dragItem)!="function"){
var yobo_dragItem=Class.create();
yobo_dragItem.prototype={initialize:function(_188){
this.itemList=[];
this.curItem=null;
this.offsetX=0;
this.offsetY=0;
this.nearItem=-1;
this.curNext=null;
this.FIXED_OBJ=1;
this.DRAG_OBJ=2;
this.rnd=Math.floor(Math.random()*1000000).toString();
this.curHeight=0;
this.curWidth=0;
if(_188){
this.onOver=_188.onover||false;
this.onButtonDown=_188.onbuttondown||false;
this.onButtonUp=_188.onbuttonup||false;
this.dragContainer=$(_188.container)||false;
}
this.attevt();
this.createTmpDiv();
},attevt:function(){
Event.observe(document,"mousemove",this.dragMove.bindAsEventListener(this));
Event.observe(document,"mouseup",this.dragOver.bindAsEventListener(this));
},createTmpDiv:function(){
if($("tmp_dragitem_"+this.rnd)){
Element.remove("tmp_dragitem_"+this.rnd);
}
if($("tmp_insertitem_"+this.rnd)){
Element.remove("tmp_insertitem_"+this.rnd);
}
try{
var _189=document.createElement("div");
_189.id="tmp_dragitem_"+this.rnd;
_189.style.position="absolute";
_189.style.backgroundColor="#f3f3f3";
_189.style.border="2px dashed #999";
_189.style.zIndex=60000;
if(this.dragContainer){
this.dragContainer.appendChild(_189);
}else{
document.body.appendChild(_189);
}
this.tmpDiv=_189;
Element.hide(this.tmpDiv);
var _18a=document.createElement("div");
_18a.id="tmp_insertitem_"+this.rnd;
_18a.style.height="50px";
_18a.style.border="2px dashed #ff6600";
if(this.dragContainer){
this.dragContainer.appendChild(_18a);
}else{
document.body.appendChild(_18a);
}
this.intDiv=_18a;
Element.hide(this.intDiv);
}
catch(e){
alert(e);
}
},dragStart:function(e,idx){
stopDefaultAction(e);
setGAURL("/ajax/user_upload/drag_song_item");
if(this.itemList[idx]&&this.itemList[idx].type==this.DRAG_OBJ){
if(this.onButtonDown){
this.onButtonDown(this.itemList[idx].div);
}
this.curItem=this.itemList[idx];
document.body.onselectstart=function(){
return false;
};
e.cancelBubble=true;
document.body.className="noselect";
this.offsetX=Event.pointerX(e)-getPos(this.curItem.div,"Left");
this.offsetY=Event.pointerY(e)-getPos(this.curItem.div,"Top");
this.updateCoors();
this.nearItem=this.curItem.idx;
var ntd=findNextNode(this.curItem.div,this.curItem.div.nodeType);
while(ntd&&(ntd.id==this.intDiv.id||ntd.id==this.tmpDiv.id)){
ntd=findNextNode(ntd,ntd.nodeType);
}
this.curNext=ntd;
Element.show(this.tmpDiv);
Element.setOpacity(this.tmpDiv,0.5);
this.tmpDiv.className=this.curItem.div.className;
this.tmpDiv.style.left=this.curItem.x+"px";
this.tmpDiv.style.top=this.curItem.y+"px";
this.tmpDiv.innerHTML=this.curItem.div.innerHTML;
this.tmpDiv.style.width=this.curItem.div.offsetWidth+"px";
this.tmpDiv.style.height=this.curItem.div.offsetHeight+"px";
this.curHeight=this.curItem.div.offsetHeight;
}
},dragMove:function(e){
stopDefaultAction(e);
if(this.curItem!=null){
var x=Event.pointerX(e)-this.offsetX;
var y=Event.pointerY(e)-this.offsetY;
this.nearItem=this.calculateDist(x,y);
if(this.nearItem<0){
this.nearItem=this.curItem.idx;
}
if(this.nearItem!=this.curItem.idx){
var nitm=this.itemList[this.nearItem].div;
if(nitm!=this.curNext){
nitm.parentNode.insertBefore(this.intDiv,nitm);
Element.show(this.intDiv);
this.intDiv.style.height=this.curHeight+"px";
this.intDiv.style.marginBottom="11px";
}else{
Element.hide(this.intDiv);
}
}else{
Element.hide(this.intDiv);
}
this.tmpDiv.style.left=x+"px";
this.tmpDiv.style.top=y+"px";
}
},dragOver:function(e){
if(this.curItem!=null){
var x=Event.pointerX(e)-this.offsetX;
var y=Event.pointerY(e)-this.offsetY;
document.body.onselectstart=function(){
return true;
};
document.body.className="";
if(this.nearItem!=this.curItem.idx){
var nitm=this.itemList[this.nearItem].div;
if(nitm!=this.curNext){
nitm.parentNode.insertBefore(this.curItem.div,nitm);
this.updateCoors();
if(this.onOver){
var rt=[];
for(var i=this.itemList.length-1;i>=0;i--){
if(this.itemList[i]){
var tmp=this.itemList[i];
if(tmp.type==this.DRAG_OBJ){
rt.push({id:tmp.div.id,x:tmp.x,y:tmp.y});
}
delete (tmp);
}
}
this.onOver(rt,true,this.intDiv);
}
}
}
}
this.tmpDiv.innerHTML="";
Element.hide(this.tmpDiv);
Element.hide(this.intDiv);
delete (this.curItem);
this.curItem=null;
this.offsetX=0;
this.offsetY=0;
this.nearItem=-1;
this.curNext=null;
this.curHeight=0;
if(this.onButtonUp){
this.onButtonUp();
}
},updateCoors:function(){
for(var i=this.itemList.length-1;i>=0;i--){
if(this.itemList[i]){
var itm=this.itemList[i];
itm.x=getPos(itm.div,"Left");
itm.y=getPos(itm.div,"Top");
}
}
},calculateDist:function(x,y){
if(this.curItem!=null){
var dist=-1;
var idx=-1;
for(var i=this.itemList.length-1;i>=0;i--){
if(this.itemList[i]){
var itm=this.itemList[i];
var td=Math.pow((x-itm.x),2)+Math.pow((y-itm.y),2);
if(dist<0||td<dist){
dist=td;
idx=i;
}
delete (itm);
}
}
return idx;
}else{
return -1;
}
},addDragItem:function(id,_1a3){
if($(id)&&$(_1a3)){
var obj=new Object();
obj.div=$(id);
obj.dragdiv=$(_1a3);
obj.type=this.DRAG_OBJ;
obj.x=getPos(obj.div,"Left");
obj.y=getPos(obj.div,"Top");
this.itemList.push(obj);
obj.idx=this.itemList.length-1;
Event.observe(obj.dragdiv,"mousedown",this.dragStart.bindAsEventListener(this,obj.idx));
obj.dragdiv.style.cursor="move";
}
},addFixedItem:function(id){
if($(id)){
var obj=new Object();
obj.div=$(id);
obj.type=this.FIXED_OBJ;
obj.dragdiv=null;
obj.x=getPos(obj.div,"Left");
obj.y=getPos(obj.div,"Top");
this.itemList.push(obj);
obj.idx=this.itemList.length-1;
}
},removeItem:function(id){
if($(id)){
var i=0;
while(i<this.itemList.length){
if(this.itemList[i]&&this.itemList[i].div.id==id){
if(this.itemList[i].dragdiv){
this.itemList[i].dragdiv.style.cursor="default";
Event.stopObserving(this.itemList[i].dragdiv,"mousedown",this.dragStart.bindAsEventListener(this,this.itemList[i].idx));
}
this.itemList[i]=null;
}
i++;
}
}
}};
}
function stopDefaultAction(_1a9){
_1a9.returnValue=false;
if(typeof _1a9.preventDefault!="undefined"){
_1a9.preventDefault();
}
}
var hide_rfmenu=function(){
};
var show_rfmenu=function(){
};
function showhideInviteWrapper(_1aa){
var _1ab="none";
var dom=$(_1aa);
var op=$(_1aa+"_op");
if(dom){
if(dom.style.display!="block"){
_1ab="block";
}
}
$$(".invite_cont").each(function(cont){
cont.style.display="none";
});
$$(".op").each(function(op){
if(op){
op.innerHTML="\u663e\u793a";
}
});
if(dom){
if(_1ab=="none"){
dom.style.display="none";
if(op){
op.innerHTML="\u663e\u793a";
}
}else{
dom.style.display="block";
if(op){
op.innerHTML="\u5173\u95ed";
}
if(_1aa=="linker_invite"){
$("linker").focus();
$("linker").select();
}
if(_1aa=="msn_invite"){
$("msn_mail").focus();
$("msn_mail").select();
}
if(_1aa=="mail_invite"){
$("e_mail").focus();
$("e_mail").select();
}
if(_1aa=="send_mail_invite"){
$("friend_mail").focus();
$("friend_mail").select();
}
}
}
}
function selectEmailType(mail){
var _1b1=$("e_mail_type");
for(var i=0;i<_1b1.options.length;i++){
if(mail==_1b1.options[i].value){
_1b1.options[i].selected=true;
}
}
}
function copy_linker(){
var l=$("linker");
if(window.clipboardData){
window.clipboardData.setData("Text",l.value);
}else{
alert("\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u590d\u5236\u529f\u80fd\uff0c\u8bf7\u624b\u52a8Ctrl+C\u590d\u5236\u94fe\u63a5");
l.focus();
}
}
function checkboxAll(_1b4){
var _1b5=document.getElementsByTagName("input");
var _1b6=$("invite_check_all");
var _1b7=true;
for(var i=0;i<_1b5.length;i++){
if(_1b5[i].type=="checkbox"&&_1b5[i].className=="friend_checkbox"){
if(!_1b5[i].checked){
_1b7=false;
}
}
}
for(var i=0;i<_1b5.length;i++){
if(_1b5[i].type=="checkbox"&&_1b5[i].className=="friend_checkbox"){
if(!_1b7){
_1b5[i].checked=true;
_1b6.checked=true;
}else{
_1b5[i].checked=false;
_1b6.checked=false;
}
}
}
}
function checkboxRev(_1b9){
var _1ba=document.getElementsByTagName("input");
for(var i=0;i<_1ba.length;i++){
if(_1ba[i].type=="checkbox"&&_1ba[i].className=="friend_checkbox"){
_1ba[i].checked=!_1ba[i].checked;
}
}
}
function showDlg(_1bc){
var dlg=$(_1bc);
if(dlg){
showShadow();
setDivMiddle(dlg);
dlg.style.visibility="visible";
dlg.style.display="block";
dlg.style.zIndex="1000";
}
}
function showPopError(_1be){
var dlg=$("error_msg");
hideDlg();
if(dlg){
showShadow();
setDivMiddle(dlg);
dlg.select(".pop_title_border h1").each(function(h1){
h1.innerHTML=_1be.title;
});
dlg.select(".message_contant ul").each(function(oUl){
oUl.innerHTML="";
for(var i=0;i<_1be.li.length;i++){
var oLi=document.createElement("li");
oLi.innerHTML=_1be.li[i];
oUl.appendChild(oLi);
}
});
if(_1be.invite_type!=undefined){
dlg.select(".footer .o_button").each(function(_1c4){
Event.observe(_1c4,"click",function(){
if(_1be.invite_type=="msn"){
$("msn_pass").select();
}else{
if(_1be.invite_type!="msn"&&_1be.invite_type!="emails"&&_1be.invite_type!="msn"){
$("e_mail_pass").select();
}
}
});
});
}
dlg.style.visibility="visible";
dlg.style.display="block";
dlg.style.zIndex="1000";
}
}
function showPopLoading(_1c5){
if(!_1c5){
_1c5="pop_loading";
}
var dlg=$(_1c5);
if(dlg){
setDivMiddle(dlg);
showShadow();
dlg.style.visibility="visible";
dlg.style.display="block";
dlg.style.zIndex="1000";
}
}
function showMSNPopLoading(){
var _1c7="pop_loading";
var dlg=$(_1c7);
if(dlg){
setDivMiddle(dlg);
showShadow();
dlg.select(".pop_title_border h1").each(function(h1){
h1.innerHTML="\u8fde\u63a5MSN\u670d\u52a1\u5668";
});
dlg.style.visibility="visible";
dlg.style.display="block";
dlg.style.zIndex="1000";
setTimeout("showMSNPopLoading2()",2000);
}
}
function showMSNPopLoading2(){
var _1ca="pop_loading";
var dlg=$(_1ca);
if(dlg){
dlg.select(".pop_title_border h1").each(function(h1){
h1.innerHTML="MSN\u5e10\u53f7\u8ba4\u8bc1\uff0c\u6570\u636e\u901a\u8baf\u4e2d";
});
}
Event.observe(window,"unload",showPopSueccess);
}
function showMailPopLoading(){
var _1cd="pop_loading";
var _1ce=$("e_mail_type").value;
var dlg=$(_1cd);
if(dlg){
setDivMiddle(dlg);
showShadow();
dlg.select(".pop_title_border h1").each(function(h1){
h1.innerHTML="\u8fde\u63a5"+_1ce+"\u670d\u52a1\u5668";
});
dlg.style.visibility="visible";
dlg.style.display="block";
dlg.style.zIndex="1000";
setTimeout("showMailPopLoading2(\""+_1ce+"\")",2000);
}
}
function showMailPopLoading2(_1d1){
var _1d2="pop_loading";
var dlg=$(_1d2);
if(dlg){
dlg.select(".pop_title_border h1").each(function(h1){
h1.innerHTML=_1d1+"\u5e10\u53f7\u8ba4\u8bc1\uff0c\u6570\u636e\u901a\u8baf\u4e2d";
});
}
dlg.select(".pop_warpper").each(function(_1d5){
_1d5.style.width="220px";
});
Event.observe(window,"unload",showPopSueccess);
}
function showPopSueccess(){
var _1d6="pop_loading";
var dlg=$(_1d6);
if(dlg){
dlg.select(".pop_title_border h1").each(function(h1){
h1.innerHTML="\u6570\u636e\u8bfb\u53d6\u6210\u529f";
});
}
}
function hideDlg(_1d9){
if(_1d9&&$(_1d9)){
$(_1d9).style.display="none";
}else{
$$(".pop_dlg").each(function(dlg){
dlg.parentNode.style.visibility="hidden";
});
}
}
function inviteFriend(_1db){
var _1dc=$$("."+_1db);
var str="";
var num=0;
var _1df=$("hidden_friends");
_1df.innerHTML="";
_1dc.each(function(_1e0,_1e1){
if(_1e0.checked){
var _1e2=document.createElement("input");
_1e2.type="hidden";
_1e2.name="friends_mail[]";
_1e2.value=_1e0.value;
_1df.appendChild(_1e2);
num++;
}
});
if(num>0){
showDlg("send_song");
}else{
alert("\u60a8\u6ca1\u6709\u9009\u62e9\u8981\u9080\u8bf7\u7684\u597d\u53cb\u3002");
}
}
function inviteFriendWithMails(){
if($("friend_mail").value.length>0){
$("hidden_friends").innerHTML="";
var _1e3=document.createElement("input");
_1e3.type="hidden";
_1e3.name="mails";
_1e3.value=$("friend_mail").value;
$("hidden_friends").appendChild(_1e3);
$("uf_invitefriend_form").action="/friend/invite_by_emails/";
showDlg("send_song");
}else{
alert("\u60a8\u6ca1\u6709\u9009\u62e9\u8981\u9080\u8bf7\u7684\u597d\u53cb\u3002");
}
}
function inviteFriendWidthMail(mail){
var _1e5=$(mail);
if(!_1e5){
return false;
}
if(_1e5.value==""){
alert("\u60a8\u6ca1\u6709\u8f93\u5165\u90ae\u7bb1\u5730\u5740");
return false;
}
var _1e6=$("hidden_friends");
_1e6.innerHTML="";
var _1e7=document.createElement("input");
_1e7.type="hidden";
_1e7.name="friends_mail[]";
_1e7.value=_1e5.value;
_1e6.appendChild(_1e7);
showDlg("send_song");
}
function closePopDlg(_1e8){
var dom=$(_1e8);
while(dom){
if(dom.className=="pop_dlg"){
dom.parentNode.style.display="none";
hideShadow();
break;
}
if(dom.parentNode){
dom=dom.parentNode;
}else{
break;
}
}
}
function hidePopDlg(_1ea){
var dlg=$(_1ea);
if(dlg){
dlg.style.display="none";
}else{
$$(".pop_dlg").each(function(dlg){
dlg.parentNode.style.display="none";
});
}
}
function getPos(el,_1ee){
el=$(el);
var iPos=0;
while(el!=null){
iPos+=el["offset"+_1ee];
el=el.offsetParent;
}
return iPos;
}
function confirmSong(_1f0,_1f1){
}
function SongEditer(args){
var _1f3=args["id"];
this.id=_1f3;
var _1f4=args["state"];
var _1f5=args["callback"];
if(typeof args["song_file"]!="undefined"){
this.song_file=args["song_file"];
}else{
this.song_file=null;
}
y_setGlobal("SongEditer",_1f3,this);
this.dom=$(_1f3);
this.timeout=60000;
this.timer=null;
if(!this.checkStruct()){
return false;
}
this.state=SongEditer.STATE.EDIT;
if(typeof _1f4!="undefined"){
this.state=_1f4;
}
if(typeof _1f5!="undefined"){
if(typeof _1f5.noconfirm!="undefined"){
this.cb_noconfirm=_1f5.noconfirm;
}
if(typeof _1f5.confirm!="undefined"){
this.cb_confirm=_1f5.confirm;
}
}
Event.observe(this.song_bar_edit,"click",this.editSong.bindAsEventListener(this));
Event.observe(this.song_bar_submit,"click",this.confirmSong.bindAsEventListener(this));
Event.observe(this.song_bar_cancel,"click",this.cancel.bindAsEventListener(this));
Event.observe(this.simple_player,"click",this.play.bindAsEventListener(this));
Event.observe(this.confirm,"click",this.confirmAtAll.bindAsEventListener(this));
Event.observe(this.reset_a,"click",this.reset.bindAsEventListener(this));
}
SongEditer.STATE={EDIT:"EDIT",CONFIRM:"CONFIRM",PLAYER:"PLAYER",FINISH:"FINISH"};
SongEditer.prototype.checkStruct=function(){
if(!this.dom){
return false;
}
this.editer=this.dom.select(".song_bar_editer")[0];
this.player=this.dom.select(".song_bar_simple")[0];
this.editer_input=this.dom.select(".song_bar_input")[0];
this.simple_song=this.dom.select(".song_name")[0];
this.simple_artist=this.dom.select(".artist_name")[0];
this.simple_player=this.dom.select(".song_control a")[0];
this.song_bar_cancel=this.dom.select(".song_bar_cancel")[0];
this.song_bar_submit=this.dom.select(".song_bar_submit")[0];
this.song_bar_edit=this.dom.select(".song_bar_edit")[0];
this.editer_message=this.dom.select(".message")[0];
this.message=this.dom.select(".message")[0];
this.confirm=this.dom.select(".confirm")[0];
this.reset_a=this.dom.select(".reset")[0];
if(this.editer_input&&this.simple_song&&this.simple_artist&&this.simple_player&&this.song_bar_cancel&&this.song_bar_submit&&this.message&&this.song_bar_edit&&this.confirm&&this.reset){
return true;
}
return false;
};
SongEditer.prototype.editSong=function(){
this.state=SongEditer.STATE.EDIT;
this.editer_input.removeAttribute("readonly");
this.setDisplay();
this.editer_input.select();
if(typeof this.cb_noconfirm=="function"){
this.cb_noconfirm();
}
};
SongEditer.prototype.confirmSong=function(){
if(this.state==SongEditer.STATE.EDIT){
this.editer_input.setAttribute("readonly","readonly");
this.state=SongEditer.STATE.CONFIRM;
var time=new Date().toString();
var _1f7=this.editer_input.value;
new Ajax.Request("/ajaxapis/confirm_songs"+"?q="+_1f7+"&rnd="+time+"&song_editer="+this.id,{method:"get"});
this.song_file=null;
var _1f8=this;
this.timer=setTimeout(function(){
_1f8.confirmFail();
},this.timeout);
show_loading(this.song_bar_submit);
}
};
SongEditer.prototype.confirmFail=function(){
hide_loading();
this.editer_input.removeAttribute("readonly");
this.state=SongEditer.STATE.PLAYER;
var song=this.editer_input.value;
var _1fa=song.lastIndexOf("-");
var a="";
var _1fc="";
var _1fd="";
if(_1fa!=-1){
_1fc=song.slice(0,_1fa);
_1fd=song.slice(_1fa+1,song.length);
}
this.simple_song.innerHTML=string_trim(_1fc);
this.simple_artist.innerHTML=string_trim(_1fd);
this.song_file=null;
this.setDisplay();
clearTimeout(this.timer);
};
SongEditer.prototype.confirmSuccess=function(args){
hide_loading();
this.editer_input.removeAttribute("readonly");
this.state=SongEditer.STATE.PLAYER;
clearTimeout(this.timer);
this.simple_song.innerHTML=args.song_name;
this.simple_artist.innerHTML=args.artist_name;
this.song_file=args.song_file;
this.setDisplay();
if(typeof this.cb_confirm=="function"){
this.cb_confirm();
}
};
SongEditer.prototype.cancel=function(){
this.editer_input.removeAttribute("readonly");
this.state=SongEditer.STATE.PLAYER;
clearTimeout(this.timer);
this.setDisplay();
if(typeof this.cb_confirm=="function"){
this.cb_confirm();
}
};
SongEditer.prototype.reset=function(){
this.editer_input.removeAttribute("readonly");
this.state=SongEditer.STATE.EDIT;
this.setDisplay();
clearTimeout(this.timer);
if(typeof this.cb_noconfirm=="function"){
this.cb_noconfirm();
}
};
SongEditer.prototype.play=function(){
if(this.song_file!=null){
simplePlay(this.song_file,this.simple_player);
}
};
SongEditer.prototype.confirmAtAll=function(){
this.editer_input.removeAttribute("readonly");
this.state=SongEditer.STATE.PLAYER;
clearTimeout(this.timer);
this.simple_player.className="";
this.state=SongEditer.STATE.FINISH;
this.setDisplay();
this.song_file=null;
if(typeof this.cb_confirm=="function"){
this.cb_confirm();
}
};
SongEditer.prototype.setDisplay=function(){
var p_d="none";
var e_d="none";
var m_d="none";
if(this.state==SongEditer.STATE.EDIT){
e_d="block";
}
if(this.state==SongEditer.STATE.PLAYER){
p_d="block";
if(this.song_file==null){
m_d="block";
}
}
if(this.state==SongEditer.STATE.FINISH){
p_d="block";
}
var tip=$("invite_tip");
if(p_d=="block"){
if(tip){
tip.style.display="none";
}
}else{
if(tip){
tip.style.display="inline";
}
}
this.player.style.display=p_d;
this.editer.style.display=e_d;
this.message.style.display=m_d;
this.simple_player.className="";
};
function rj_confirmSong(args){
var id=args.song_editer;
var _205=y_getGlobal("SongEditer",id);
if(_205){
if(args.state=="-1"){
_205.confirmFail();
}else{
if(args.state=="1"){
_205.confirmSuccess(args);
}
}
}
}
