function af_addfriend(a,b,c,e,d){if(window.g_im_vuid){d=typeof d=="undefined"||d==""?"":"&"+d;c="\u8bf7\u6c42\u52a0"+(c=="0"?"\u4ed6":"\u5979")+"\u4e3a\u597d\u53cb";if(b==2)c="\u8bf7\u6c42\u6210\u4e3a\u7c89\u4e1d";var f=420,g=280;if(e==1||e==3){f=330;g=150}else if(b>0){f=480;g=290}openWindow("/friend/new.php?touid="+a+d,f,g,c)}else window.location="/login/?flag=1&url="+encodeURIComponent(window.location.pathname+window.location.search)}
af_addfriend.doAfterClose=function(){typeof af_addfriend.callback_afterClose=="function"&&af_addfriend.callback_afterClose()};
function af_addverify_do(a,b,c,e,d,f){if(b.length==0){alert("\u8bf7\u8f93\u5165\u597d\u53cb\u8bf7\u6c42\u9644\u8a00\uff01");return false}if(c!=undefined&&c.length>0&&e.length==0){alert("\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801\uff01");return false}document.addverifyform.touid.value=a;document.addverifyform.content.value=b;document.addverifyform.rcode.value=c;document.addverifyform.code.value=e;document.addverifyform.usercode.value=d;document.addverifyform.email.value=f;document.addverifyform.submit()}
function af_delfriend(a,b,c,e){var d="\u5220\u9664\u597d\u53cb";if(c!=undefined&&c==2)d="\u65ad\u5f00\u7c89\u4e1d";af_delfriend_do.callback=e;openWindow("/friend/del_dialog.php?touid="+a+"&start="+b,440,200,d)}
function af_delfriend_do(a,b,c,e){Kx.LocalStorage&&Kx.LocalStorage.support()&&Kx.LocalStorage.del("suggestiondata");if(typeof af_delfriend_do.callback!="function"){document.delfriendform.touid.value=a;document.delfriendform.start.value=b;document.delfriendform.ref.value=window.location;document.delfriendform.submit()}else{a="touid="+encodeURIComponent(a)+"&start="+encodeURIComponent(b)+"&ref="+encodeURIComponent(window.location)+"&ajax=1&rcode="+encodeURIComponent(c)+"&code="+encodeURIComponent(e);
var d=$j.ajax({url:"/friend/del.php",type:"post",data:a,success:function(){af_delfriend_do.callback(d)}})}}
function af_addform(a){document.write("<div>");document.write('<form name=addverifyform action="/friend/addverify.php" method=post>');document.write('<input type=hidden name=from value="'+a+'">');document.write('<input type=hidden name=touid value="">');document.write('<input type=hidden name=content value="">');document.write('<input type=hidden name=rcode value="">');document.write('<input type=hidden name=code value="">');document.write('<input type=hidden name=usercode value="">');document.write('<input type=hidden name=email value="">');
document.write('<input type=hidden name=bidirection value="">');document.write("</form>");document.write("</div>")}function af_editFriend(a){openWindow("/friend/editfriend_dialog.php?from=self&fuid="+a,390,301,"\u597d\u53cb\u5c5e\u6027")}function starfriends_add(a,b){var c="touid="+a+"&quick=1";if(typeof b!="undefined")c+="&from="+b;$j.ajax({url:"/friend/addverify.php",type:"post",data:c,success:function(e){ajax_show_starfriends_add_ok(e)}})}
function ajax_show_starfriends_add_ok(a){a=$j.parseJSON(a);var b=a.uid,c=a.content;a.type==0?$j("#addfriend_"+b).html('<div style="margin-right: 6px;" class="r"><span class="c9" >\u4f60\u5df2\u662f\u597d\u53cb</span></div>'):$j("#addfans_"+b).html('<div style="margin-right: 6px;" class="r"><span class="c9" >\u4f60\u5df2\u662f\u7c89\u4e1d</span></div>');$j("#div_add_ok_"+b).html('<img src="http://img1.kaixin001.com.cn/i/fzcg_dh.gif"class="l" /><div class="l ml10">'+c+"</div>").show();starfriend_fade("div_add_ok_"+
b)}var starfriend_timer=null,starfriend_ele_a=starfriend_ele_b=null,starfriend_wait=0;function starfriend_fade(a){if(starfriend_ele_a=document.getElementById(a)){if(document.all)starfriend_ele_a.filters.alpha.opacity=100;else starfriend_ele_a.style.opacity=1;starfriend_ele_a.style.zIndex=1;starfriend_fade_opacity()}}
function starfriend_fade_opacity(){starfriend_wait+=1;if(starfriend_wait>20){var a=false;if(document.all)if(starfriend_ele_a.filters.alpha.opacity>0)starfriend_ele_a.filters.alpha.opacity-=5;else a=true;else if(starfriend_ele_a.style.opacity>0)starfriend_ele_a.style.opacity-=0.05;else a=true;if(a==true)window.clearTimeout(starfriend_timer);else starfriend_timer=setTimeout(function(){starfriend_fade_opacity()},100)}else starfriend_timer=setTimeout(function(){starfriend_fade_opacity()},100)};


function a_appfriend_show(aid,appurl,appname)
{a_appfriend_hidden();var url="/interface/appfriend.php";if(-1==appurl.indexOf('?'))
{appurl=appurl+'?';}
$j.post(url,{aid:aid,appurl:appurl},function(data){a_appfriend_ajaxshow($j.parseJSON(data),aid,appurl,appname);});}
function a_appfriend_ajaxshow(r,aid,appurl,appname)
{var html='<div style="border:1px solid #CFCFCF;padding:5px;*height:238px;"><div><div class="l">好友的'+appname+'&nbsp：</div><div class="r"><a href="javascript:a_appfriend_hidden();"><img src="http://img1.kaixin001.com.cn/i2/shut.gif" width="8" height="7" alt="关闭" align="absmiddle" /></a></div><br class="c" /></div>';html+='<div style="height:219px; overflow:scroll; overflow-x:hidden;">';for(var i=0;i<r.length;i++)
{html+='<div class="bb1d8"><a  style="cursor:pointer;" class="sl2_r" href="'+appurl+'&uid='+r[i].uid+'"><div class="l" style="width:5em;">'+r[i].name+'</div><div class="l" style="width:42px;margin-right:7px;text-align:right;">'+'('+r[i].index_num+')</div><div class="l" style="font-size:10px;font-family:\'宋体\';">'+'&gt;&gt;</div><div class="c"></div></a>'+'</div>';}
if(r.length==0)
{html+='<div class="p5 c9">你的好友还没有添加过该组件</div>';}
html+='</div></div>';var pos=getpos($j("#app_friend_"+aid)[0]);$j("#app_friend_tip").html(html).show().css("left",parseInt(pos.left)).css("top",parseInt(pos.bottom+2));}
function a_appfriend_hidden()
{$j("#app_friend_tip").html("").hide();}

function addallfriendShowEx(req){if(g_listcount){s("addfrienddiv2");}else{s("addfrienddiv1");}
addfriendskip();}
function addfriendskip(){h("reguserdiv");if(g_listcount){s("listdiv");}}
function accountAjaxShow(res){h("gettingdiv");h("gettingdiv1");if(res=="error"){h("getempty");s("geterror");}else if(res=="empty"){h("geterror");s("getempty");}else{var r=$j.parseJSON(res),name1=$j('#postofficename1'),name2=$j('#postofficename2'),name3=$j('#postofficename3'),name4=$j('#postofficename4'),i,html;if(name1.length&&name2.length&&name3.length&&name4.length){name1.html(r.postoffice);name2.html(r.postoffice);name3.html(r.postoffice);name4.html(r.postoffice);}
g_listcount=r.list.length;$j("#regusercount").html(r.reg.length);html="<div style=\"width:500px;\"><div class=\"it_s\"><div class=\"it2 xzhy\" style=\"margin:0px\">";html+="<div class=\"xzhy_t\"><input type=checkbox onclick=\"javascript:selallreguid(this);\" checked>全选</div>";for(i=0;i<r.reg.length;i++){html+=getreguserhtml(r.reg[i],i);}
html+="</div></div></div>";html+="<div class=\"mt5 c\"><div class=\"l\"><span class=\"rbs1\"><input type=\"button\" value=\"加为好友\"  class=\"rb1-12\" onmouseover=\"this.className='rb2-12';\" onmouseout=\"this.className='rb1-12';\" onclick=\"javascript:addallfriend('"+g_gid+"');\" /></span></div><div class=\"flw5\">&nbsp;</div> ";if(r.list.length){html+="<div class=\"l\"><span class=\"gbs1\"><input type=\"button\"  value=\" 跳过 \" class=\"gb1-12\" onmouseover=\"this.className='gb2-12';\" onmouseout=\"this.className='gb1-12';\" onclick=\"javascript:addfriendskip();\" /></span></div><div class=\"c\"></div></div>";}else{html+="<div class=\"l\"><span class=\"gbs1\"><input type=\"button\"  value=\" 取消 \" class=\"gb1-12\" onmouseover=\"this.className='gb2-12';\" onmouseout=\"this.className='gb1-12';\" onclick=\"javascript:window.location='/friend/invite.php?group="+encodeURIComponent(g_groupname)+"&gid="+(typeof(v_gid)=='undefined'?0:v_gid)+"';\" /></span></div><div class=\"c\"></div></div>";}
$j("#reguserhtml").html(html);html="<div style=\"width:500px;\"><div class=\"it_s\"><div class=\"it2 xzhy\">";html+="<div class=\"xzhy_t\"><input type=checkbox onclick=\"javascript:selallemail(this);\" "+(g_checkemail?"checked":"")+">全选</div>";for(i=0;i<r.list.length;i++){if(i%2==0){html+="<div class=\"xzhy1\"><p class=\"yx_l\"><input type=checkbox name=email value='"+r.list[i].email+"' "+(g_checkemail?"checked":"")+"> "+r.list[i].nick+"</p><p class=\"l\">&lt;"+r.list[i].email+"&gt;</p><p class=\"c\"></p></div>";}else{html+="<div class=\"xzhy2\"><p class=\"yx_l\"><input type=checkbox name=email value='"+r.list[i].email+"' "+(g_checkemail?"checked":"")+"> "+r.list[i].nick+"</p><p class=\"l\">&lt;"+r.list[i].email+"&gt;</p><p class=\"c\"></p></div>";}}
html+="</div></div></div>";$j("#checkdiv").html(html);if(r.reg.length){s("listuser1");s("reguserdiv");}else{s("listuser2");s("listdiv");}
if(r.list.length){s("reguser1");}else{s("reguser2");}
h("getdiv");s("showdiv");}}
function getreguserhtml(reguser,i){var html='';if(i%2==0){html+='<div class="l xzhy1" style="width:590px;padding:10px 0;">';}else{html+='<div class="l xzhy2" style="width:590px;padding:10px 0;">';}
html+='<div class="l">'+'<div class=l><input type=checkbox name=reguid value="'+reguser.uid+'" checked></div>'+'<div class="l50_s"><a target="_blank" href="/home/?uid='+reguser.uid+'" title="'+reguser.real_name+'"><img src="'+reguser.icon+'" border=0></a></div>'+'</div>'+'<div class="l">'+'<div>'+'<p class="l">'+reguser.online+' '+' <a  target="_blank" href="/home/?uid='+reguser.uid+'" class="sl" title="'+reguser.real_name+'" >'+reguser.real_name+'</a><br /> '+(parseInt(reguser.gender)?'女&nbsp;':'男&nbsp;')+reguser.city+'</p>'+'<div class="c"></div>'+'</div>'+'</div>'+'<div class="c"></div>'+'</div>'+'<div class="c"></div>';return html;}
function addallfriend(v_gid){var uids="";if("undefined"!=typeof(document.reguidform.reguid)){if("undefined"!=typeof(document.reguidform.reguid.length)){for(i=0;i<document.reguidform.reguid.length;i++){if(document.reguidform.reguid[i].checked){uids+=document.reguidform.reguid[i].value+" ";}}}else{if(document.reguidform.reguid.checked){uids+=document.reguidform.reguid.value;}}}
if(uids.length==0){alert("请选择要添加的用户！");return;}
var url="/friend/addusers.php";var pars="uids="+uids+"&gid="+v_gid;var xhr=$j.post(url,pars,function(data){addallfriendShow(xhr);});}
function invite_do(){var emails="";if("undefined"!=typeof(document.listform.email)){if("undefined"!=typeof(document.listform.email.length)){for(i=0;i<document.listform.email.length;i++){if(document.listform.email[i].checked){emails+=document.listform.email[i].value+" ";}}}else{if(document.listform.email.checked){emails+=document.listform.email.value;}}}
document.inviteform.real_name.value=document.listform.real_name.value;document.inviteform.content.value=document.listform.content.value;document.inviteform.group.value=document.listform.group.options[document.listform.group.selectedIndex].value;document.inviteform.emails.value=emails;if(document.inviteform.emails.value.length==0){alert("请选择邀请对象");return;}
if(document.inviteform.group.value.length==0){alert("请选择好友分组！");return;}
if(document.inviteform.real_name.value.length==0){alert("请输入你的真实姓名！");document.listform.real_name.focus();return;}
var url="/interface/checkname.php";var pars="real_name="+encodeURIComponent(document.inviteform.real_name.value);$j.post(url,pars,function(req){checkinviteformShow(req);});}
function checkinviteformShow(req){var r=parseInt(req);if(r){document.inviteform.submit();}else{if(confirm("这个好像不是真实姓名吧？！\n 如果确认要使用这个姓名邀请，请点击确认按钮")){document.inviteform.submit();}else{if(document.listform){document.listform.real_name.focus();}else{document.inviteform.real_name.focus();}}}}
function selallemail(v_check){if("undefined"!=typeof(document.listform.email)){if("undefined"!=typeof(document.listform.email.length)){for(i=0;i<document.listform.email.length;i++){document.listform.email[i].checked=v_check.checked;}}else{document.listform.email.checked=v_check.checked;}}}
function selallreguid(v_check){if("undefined"!=typeof(document.reguidform.reguid)){if("undefined"!=typeof(document.reguidform.reguid.length)){for(i=0;i<document.reguidform.reguid.length;i++){document.reguidform.reguid[i].checked=v_check.checked;}}else{document.reguidform.reguid.checked=v_check.checked;}}}
function addgroup(v_from){openWindow('/friend/addgroup_dialog.php?from='+v_from,330,160,'添加好友分组');}
function addgroup_ok(v_group){var options=$j("#groupsel")[0].options,len=options.length,i;for(i=0;i<len;i++){if(options[i].value==v_group){break;}}
if(i<len){options[i].selected=true;}else{var oOption=document.createElement("OPTION");options.add(oOption);oOption.text=v_group;oOption.value=v_group;oOption.selected=true;}}
