

function af_addfriend(v_uid,v_privacy,v_gender,v_isfriend,v_option)
{if(typeof(v_option)=="undefined"||v_option=="")
{v_option="";}
else
{v_option="&"+v_option;}
var ta=(v_gender=="0")?"他":"她";var title="请求加"+ta+"为好友";if(v_privacy==2)
{title="请求成为粉丝";}
var width=430;var height=280;if(v_isfriend==1||v_isfriend==3)
{width=330;height=150;}
else if(v_privacy>0)
{width=480;height=260;}
openWindow("/friend/new.php?touid="+v_uid+v_option,width,height,title);}
af_addfriend.doAfterClose=function(){if(typeof(af_addfriend.callback_afterClose)=="function"){af_addfriend.callback_afterClose();}}
function af_addverify_do(v_touid,v_content,v_rcode,v_code,v_usercode,v_email)
{if(v_content.length==0)
{alert("请输入好友请求附言！");return false;}
if(v_rcode!=undefined&&v_rcode.length>0&&v_code.length==0)
{alert("请输入验证码！");return false;}
document.addverifyform.touid.value=v_touid;document.addverifyform.content.value=v_content;document.addverifyform.rcode.value=v_rcode;document.addverifyform.code.value=v_code;document.addverifyform.usercode.value=v_usercode;document.addverifyform.email.value=v_email;document.addverifyform.submit();}
function af_delfriend(v_uid,v_start,v_privacy,v_callback)
{var title="删除好友";if(v_privacy!=undefined&&v_privacy==2)
{title="断开粉丝";}
af_delfriend_do.callback=v_callback;openWindow('/friend/del_dialog.php?touid='+v_uid+'&start='+v_start,440,230,title);}
function af_delfriend_do(v_uid,v_start)
{if(typeof(af_delfriend_do.callback)!="function")
{document.delfriendform.touid.value=v_uid;document.delfriendform.start.value=v_start;document.delfriendform.ref.value=window.location;document.delfriendform.submit();}
else
{var pars="touid="+encodeURIComponent(v_uid)+"&start="+encodeURIComponent(v_start)+"&ref="+encodeURIComponent(window.location)+"&ajax=1";var myAjax=new Ajax.Request("/friend/del.php",{method:"post",parameters:pars,onComplete:function(req){af_delfriend_do.callback(req);}});}}
function af_addform(uri)
{document.write('<div>');document.write('<form name=addverifyform action="/friend/addverify.php" method=post>');document.write('<input type=hidden name=from value="'+uri+'">');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(v_fuid)
{openWindow('/friend/editfriend_dialog.php?from=self&fuid='+v_fuid,350,350,'好友属性');}
function starfriends_add(uid)
{var url="/friend/addverify.php";var pars="touid="+uid+"&quick=1";var myAjax=new Ajax.Request(url,{method:"post",parameters:pars,onComplete:function(req){ajax_show_starfriends_add_ok(req);}});}
function ajax_show_starfriends_add_ok(req)
{var result;eval("result="+req.responseText);uid=result.uid;rand=result.rand;content=result.content;typeid=result.type;if(typeid==0)
{$("addfriend_"+uid).innerHTML='<div style="margin-right: 6px;" class="r"><span class="c9" >你已是好友</span></div>';}
else
{$("addfans_"+uid).innerHTML='<div style="margin-right: 6px;" class="r"><span class="c9" >你已是粉丝</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;var starfriend_ele_a=starfriend_ele_b=null;var starfriend_wait=0;function starfriend_fade(a)
{starfriend_ele_a=document.getElementById(a);if(!starfriend_ele_a){return;}
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=starfriend_wait+1;if(starfriend_wait>20)
{var ifstop=false;if(document.all)
{if(starfriend_ele_a.filters.alpha.opacity>0)
{starfriend_ele_a.filters.alpha.opacity-=5;}
else
{ifstop=true;}}
else
{if(starfriend_ele_a.style.opacity>0)
{starfriend_ele_a.style.opacity-=0.05;}
else
{ifstop=true;}}
if(ifstop==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;}}