/*
 *zhn
 *用于帖子页面添加好友
 */

function quxiao(){
    $('#hid_toUid').val('0');
    $('#hid_tousername').val('');
    $('#Div_x').hide();
}

var closediv=function(){
   $('#Div_x').hide();
}

var sub=function(){
$.ajax({
    url:'UserCenter/post/Default.ashx',
    type:'post',
    dataType:'json',
    data:{cmdName:'addFriend',param1:$('#hid_toUid').val(),param2:$('#friendselected').val(),param3:escape($('#hid_tousername').val())},
    success:function(json){
        alert(json.msg);
        $('#Div_x').hide();
    },
    error:function(){
        alert('系统繁忙');
    }            
});
}

//设置添加好友的信息
function addFriend(friendId,friendname,uid){
if (uid==0){alert('您还未登录，不能加TA为好友！');return;}
    $('#hid_toUid').val(friendId);
    $('#hid_tousername').val(friendname);
    $('#friendName').html(friendname);
    $('#Div_x').show();
}

//鼠标移动显示用户详情
function showUinfo(uid,row,e)
{
    var obj= document.getElementById('Uinfo'+row);
    var div_body=document.getElementById('xx_'+row);
    //设置弹出层位置
    var t=e.offsetTop;     
    var l=e.offsetLeft;     
    var w=e.offsetWidth;   
    var h=e.offsetHeight;   
    while(e=e.offsetParent)
    {     
        t+=e.offsetTop;     
        l+=e.offsetLeft;     
    }
	if (obj!=null)
	{
		obj.style.left=l+96;
    obj.style.top=t;
    $('#Uinfo'+row).show();
    $('#Umessage'+row).load('../GetUserInfo.ashx',{UserID:uid});
	}
}
//鼠标移开隐藏用户层
function Uinfohide(row)
{
    $('#Uinfo'+row).hide();
}

