
function af_addfriend(a,c,b,e,d){d=typeof d=="undefined"||d==""?"":"&"+d;b="\u8bf7\u6c42\u52a0"+(b=="0"?"\u4ed6":"\u5979")+"\u4e3a\u597d\u53cb";if(c==2)b="\u8bf7\u6c42\u6210\u4e3a\u7c89\u4e1d";var f=460,g=280;if(e==1||e==3){f=330;g=150}else if(c>0){f=480;g=260}openWindow("/friend/new.php?touid="+a+d,f,g,b)}af_addfriend.doAfterClose=function(){typeof af_addfriend.callback_afterClose=="function"&&af_addfriend.callback_afterClose()};
function af_addverify_do(a,c,b,e,d,f){if(c.length==0){alert("\u8bf7\u8f93\u5165\u597d\u53cb\u8bf7\u6c42\u9644\u8a00\uff01");return false}if(b!=undefined&&b.length>0&&e.length==0){alert("\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801\uff01");return false}document.addverifyform.touid.value=a;document.addverifyform.content.value=c;document.addverifyform.rcode.value=b;document.addverifyform.code.value=e;document.addverifyform.usercode.value=d;document.addverifyform.email.value=f;document.addverifyform.submit()}
function af_delfriend(a,c,b,e){var d="\u5220\u9664\u597d\u53cb";if(b!=undefined&&b==2)d="\u65ad\u5f00\u7c89\u4e1d";af_delfriend_do.callback=e;openWindow("/friend/del_dialog.php?touid="+a+"&start="+c,440,230,d)}
function af_delfriend_do(a,c){if(typeof af_delfriend_do.callback!="function"){document.delfriendform.touid.value=a;document.delfriendform.start.value=c;document.delfriendform.ref.value=window.location;document.delfriendform.submit()}else{var b="touid="+encodeURIComponent(a)+"&start="+encodeURIComponent(c)+"&ref="+encodeURIComponent(window.location)+"&ajax=1";new Ajax.Request("/friend/del.php",{method:"post",parameters:b,onComplete:function(e){af_delfriend_do.callback(e)}})}}
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,350,350,"\u597d\u53cb\u5c5e\u6027")}function starfriends_add(a){new Ajax.Request("/friend/addverify.php",{method:"post",parameters:"touid="+a+"&quick=1",onComplete:function(c){ajax_show_starfriends_add_ok(c)}})}
function ajax_show_starfriends_add_ok(a){eval("result="+a.responseText);uid=(void 0).uid;rand=(void 0).rand;content=(void 0).content;typeid=(void 0).type;if(typeid==0)$("addfriend_"+uid).innerHTML='<div style="margin-right: 6px;" class="r"><span class="c9" >\u4f60\u5df2\u662f\u597d\u53cb</span></div>';else $("addfans_"+uid).innerHTML='<div style="margin-right: 6px;" class="r"><span class="c9" >\u4f60\u5df2\u662f\u7c89\u4e1d</span></div>';$("div_add_ok_"+uid).innerHTML='<img src="http://img1.kaixin001.com.cn/i/fzcg_dh.gif"class="l" /><div class="l ml10">'+
content+"</div>";s("div_add_ok_"+uid);starfriend_fade("div_add_ok_"+uid)}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=window.setTimeout("starfriend_fade_opacity()",100)}else starfriend_timer=window.setTimeout("starfriend_fade_opacity()",100)};

function a_appfriend_show(a,c,e){a_appfriend_hidden();if(-1==c.indexOf("?"))c+="?";$j.post("/interface/appfriend.php",{aid:a,appurl:c},function(b){a_appfriend_ajaxshow($j.parseJSON(b),a,c,e)})}
function a_appfriend_ajaxshow(a,c,e,b){b='<div style="border:1px solid #CFCFCF;padding:5px;*height:238px;"><div><div class="l">\u597d\u53cb\u7684'+b+'&nbsp\uff1a</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="\u5173\u95ed" align="absmiddle" /></a></div><br class="c" /></div>';b+='<div style="height:219px; overflow:scroll; overflow-x:hidden;">';for(var d=0;d<a.length;d++)b+='<div class="bb1d8"><a  style="cursor:pointer;" class="sl2_r" href="'+
e+"&uid="+a[d].uid+'"><div class="l" style="width:5em;">'+a[d].name+'</div><div class="l" style="width:42px;margin-right:7px;text-align:right;">('+a[d].index_num+')</div><div class="l" style="font-size:10px;font-family:\'\u5b8b\u4f53\';">&gt;&gt;</div><div class="c"></div></a></div>';if(a.length==0)b+='<div class="p5 c9">\u4f60\u7684\u597d\u53cb\u8fd8\u6ca1\u6709\u6dfb\u52a0\u8fc7\u8be5\u7ec4\u4ef6</div>';b+="</div></div>";a=getpos($j("#app_friend_"+c)[0]);$j("#app_friend_tip").html(b).show().css("left",
parseInt(a.left)).css("top",parseInt(a.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
{eval("r="+res);if($("postofficename1")&&$("postofficename2")&&$("postofficename3")&&$("postofficename4"))
{$("postofficename1").innerHTML=r.postoffice;$("postofficename2").innerHTML=r.postoffice;$("postofficename3").innerHTML=r.postoffice;$("postofficename4").innerHTML=r.postoffice;}
g_listcount=r.list.length;var html="<div style=\"width:500px;\"><div class=\"it_s\"><div class=\"it2 xzhy\" style=\"margin:0px\">";$("regusercount").innerHTML=r.reg.length;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="+v_gid+"';\" /></span></div><div class=\"c\"></div></div>";}
$("reguserhtml").innerHTML=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>";$("checkdiv").innerHTML=html;if(r.reg.length)
{s("listuser1");}
else
{s("listuser2");}
if(r.list.length)
{s("reguser1");}
else
{s("reguser2");}
if(r.reg.length)
{s("reguserdiv");}
else
{s("listdiv");}
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 myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){addallfriendShow(req);}});}
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);var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){checkinviteformShow(req);}});}
function checkinviteformShow(req)
{var r=req.responseText;r=parseInt(r);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 len=$("groupsel").options.length;var i;for(i=0;i<len;i++)
{if($("groupsel").options[i].value==v_group)
{break;}}
if(i<len)
{$("groupsel").options[i].selected=true;}
else
{var oOption=document.createElement("OPTION");$("groupsel").options.add(oOption);oOption.text=v_group;oOption.value=v_group;oOption.selected=true;}}