///向好友打招呼
//uid,用户ID
//uname,用户姓名
//upic,用户头像完整url
function Greet(uid,uname,upic)
{
    SendPoke(uid,uname,upic,'');
    //ShowDlg(464,220,'向'+ uname +'打招呼？','<div class=\"nl w100\"><img src="'+ upic +'" alt="'+ uname +'" /></div><div class=\"nr w320 paddings10\">'+ uname +'下次登录后将会收到通知。</div>','OnGreet('+ uid +')');
}
function OnGreet(uid)
{
    var  options={
        method:'post',
        parameters: 'Option=Greet&FriendID='+ uid,
        onComplete:
            function(transport)
	        {
	            var retv =transport.responseText;
	            HideAlertBox();
	        }
	}
	new  Ajax.Request(RootDir+'/inc/ajax/friend/friendajax.aspx',options);
}
//加为好友
function AddFriend(uid,uname,upic,objid)
{
    ShowDlg(464,220,'将'+ uname +'加为好友？','<div class=\"nl w100\"><img src="'+ upic +'" alt="'+ uname +'" align="absmiddle" /></div><div class=\"nr w300 paddings10\">你的请求会发送给'+ uname +'，确认后你们将成为好友。</div>','OnAddFriend('+ uid +',\''+ objid +'\')');
}


//加为好友空间
function AddFriend_home(uid,uname,upic,objid)
{
    ShowDlg(464,220,'将'+ uname +'加为好友？','<div class=\"nl w100\"><img src="'+ upic +'" alt="'+ uname +'" align="absmiddle" /></div><div class=\"nr w300 paddings10\">你的请求会发送给'+ uname +'，确认后你们将成为好友。</div>','OnAddFriend_home('+ uid +',\''+ objid +'\')');
}

//加好友
function AddFrd(uid,uname,upic)
{
    ShowDlg(464,220,'将'+ uname +'加为好友？','<div class=\"nl w100\"><img src="'+ upic +'" alt="'+ uname +'" align="absmiddle" /></div><div class=\"nr w300 paddings10\">你的请求会发送给'+ uname +'，确认后你们将成为好友。</div>','OnAddFrd('+ uid +')');
}

function OnAddFrd(uid)
{
    var  options={
        method:'post',
        parameters:"Option=ApplyFrd&FriendID="+ uid,
        onComplete:
            function(transport)
	        {
	            var retv =transport.responseText;
	               if(retv == 'err')
	               {
	                    alert("请登录后进行操作");
	                    HideAlertBox();
	               } 
	              else
	              { 
	                if (retv.indexOf("??")<=-1)
		            {
		                 window.location.reload();
                    }
                } 
	        } 
	}
	new  Ajax.Request(RootDir+'/inc/ajax/friend/friendajax.aspx',options);
	HideAlertBox();
}

function OnAddFriend(uid,objid)
{
    var  options={
        method:'post',
        parameters:'Option=ApplyFrd&FriendID='+ uid,
        onComplete:
            function(transport)
	        {
	            var retv =transport.responseText;
	            if(retv == '1')
	            { 
	                document.getElementById(objid).innerHTML = '等待验证';
	            }
	           else if(retv == 'err')
	           {
	                alert("请登录后进行操作");
	           } 
	           else
	           {
	                alert("添加朋友失败");
	           }
	           HideAlertBox();
	        }
	}
	new  Ajax.Request(RootDir+'/inc/ajax/friend/friendAjax.aspx',options);
}

function OnAddFriend_home(uid,objid)
{
    var  options={
        method:'post',
        parameters:'Option=ApplyFrd&FriendID='+ uid,
        onComplete:
            function(transport)
	        {
	            var retv =transport.responseText;
	            if(retv == '1')
	            { 
	                document.getElementById(objid).value = '请求已发送，等待对方验证';
	                document.getElementById(objid).disabled=true;
	            }
	           else if(retv == 'err')
	           {
	                alert("请登录后进行操作");
	           } 
	           else
	           {
	                alert("添加朋友失败");
	           }
	            HideAlertBox();
	        }
	}
	new  Ajax.Request(RootDir+'/inc/ajax/friend/friendAjax.aspx',options);
}