
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);}
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,'好友属性');}