﻿// JScript 文件

function GetFriend9Ajax9(userid,type,divName,lan)
{
    var divObj = jq('#'+divName);
    
    jq.ajax({
	       type:'POST',
	       url:'ajaxservice/UserFriendInfoes.ashx',
	       data:'userid='+userid+'&type='+type+'&lan='+lan,
	       beforeSend:function(){
	        ShowLoading();
        },
	       success:function(xml){
	            HiddenLoading();
	   		    InitFriendData(xml,divObj);
	       }
	    });
    
}

function InitFriendData(xml,divObj)
{
    var root = jq(xml).find("root");
    var body="";
    var friends;
    var  NoFriend=root.attr("NoFriend");
    var type = root.attr("type");
    if(root.find("friend").size()>0)
    {
        body+='<div style="width:220px; margin-left:30px;">';
        body+='<ul style="width:220px;margin-top:10px; float:left">';
        root.find("friend").each(function(){
                                                friend=jq(this);
                                                body+='<li style="width:70px; float:left; height:77px; padding-top:5px; padding-bottom:2px;">';
                                                //body+='<div style="height:55px; width:55px;"><img src="'+friend.attr("uface")+'" onmouseout="javascript:document.getElementById(\'UserCard\').style.display=\'none\';" onmouseover="javascript:userto(\''+friend.attr("uid")+'\',this,event);"  onclick="javascript:window.open(\'userinfo.aspx?userid='+friend.attr("uid")+'\');" style="height:50px;width:50px;border-width:0px;cursor:pointer;" /></div>';
                                                body+='<div style="height:55px; width:55px;"><img src="'+friend.attr("uface")+'"  onclick="javascript:window.open(\'userinfo.aspx?userid='+friend.attr("uid")+'\');" style="height:50px;width:50px;border-width:0px;cursor:pointer;" /></div>';
                                                body+='<a title="'+friend.attr("ufname")+'" onclick="javascript:window.open(\'userinfo.aspx?userid='+friend.attr("uid")+'\');return false;"  href="#">'+friend.attr("uname")+'</a>';
                                                body+='</li>';
                                            });
        body+='</ul></div>';
        body+='<span style="float:right;margin-right:20px;">';
        body+='<a  href="morefriends.aspx?iType='+root.attr("type")+'&amp;uid='+root.attr("uid")+'" class="span_q_blue">'+root.attr("mores")+'  </a><img src="App_Themes/White/default/images/more.gif">';
        body+='</span>';
    }
    else{
//    if(type=="1")
//    {
//        //我家
//    }else if(type=="2")
//    {
//        //他家
//    }
        body+='<div id="Div1" runat="server" style="width:220px; margin-left:auto; margin-right:auto;">';
        body+='<ul style="width:220px; float:left">';
        body+='<li style="width:220px; float:left; padding-top:5px; padding-bottom:2px;">';
        body+='<div style=" float:left;  text-align:left; vertical-align:middle; "><span >';
        body+= NoFriend;
        body+='</span></div>';
        body+=' </li>';

        body+='</ul>';
        body+='</div>';
    }
    divObj.html(body);
}
