<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="JuSNS.Web.home.friend.index" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title id="ptitle" runat="server">朋友列表</title>
<script language="javascript" type="text/javascript" src="../../js/ajax.js"></script>
<script language="javascript" type="text/javascript" src="../../js/public.js"></script>
<link href="../../template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/css/base.css" id="skinpath" type="text/css" rel="stylesheet" />
<script src="../../js/friend.js" charset="gb2312" type="text/javascript" language="javascript"></script>
<script language="javascript" type="text/javascript">
<!--
function search(uid)
{
    var s = document.getElementById('friendname').value.trim();
    if(s != '')
    {
        location.href = 'index.aspx?r='+ uid +'&a=search&n='+ escape(s);
    }
    else
    {
        location.href = 'index.aspx';
    }
}
function showdetail(fid,nm)
{
    document.getElementById('spn_name').innerHTML = nm;
    document.getElementById('detailbox').style.display = '';
}
function DeleteFriend(uid,uname,upic)
{
    ShowDlg(464,194,'将'+ uname +'删除好友？','<div class=\"nl w100\"><img src="'+ upic +'" alt="'+ uname +'" align="absmiddle" /></div><div  class=\"nr w320 paddings10\">你确定要删除吗？<span class="reshow">删除好友不会通知任何人</span></div>','OnDeleteFriend('+ uid +')');
}
function OnDeleteFriend(uid)
{
    var  options={
        method:'post',
        parameters:'Option=Delete&FriendID='+ uid,
        onComplete:
            function(transport)
	        {
	            var retv =transport.responseText;
	            if(retv == '1')
	            {
	                document.getElementById('ol_list').removeChild(document.getElementById('li_'+ uid));
	            }
	            HideAlertBox();
	            //OnRcvMsg(retv);
	        }
	}
	new  Ajax.Request('../../inc/ajax/friend/friendAjax.aspx',options);
}
    //-->
    </script>
</head>
<body>
<!--头部-->
<%=this.GetHtmlShort()%>
<div id="divhead">
    <%=this.GetHtmlHead()%>
</div>

<div id="divbody">
    <div id="body_first">
        <div class="body_menu"> 
        <%=this.GetHtmlLeft()%>
        </div>
    </div>
    <div id="body_sec">
            <div id="body_mid"> 
                <div class="body_frame"> 
                 <!--主题内容中-->    
                   <div class="body_frame_otherinfo">
	                        <div class="title">
                                <div class="l"><img src="../../template/<%Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/images/site/friend.gif" align="absmiddle" /> <span class="shenlan bold font14 ocolor"><%=userName %>朋友列表</span></div>
                                <div class="r"><a href="javascript:window.history.back();" title="返回上一页">返回上一页</a></div>
                                <div class="c"></div>
                            </div>
            		       
                            <div class="nav-menu">
                                <ul>
                                 <li class="current"><a href="../friend">朋友列表</a></li>
                                 <li><a href="../friend/group.aspx">朋友分组管理</a></li>
                                 <li><a href="../friend/online.aspx">在线好友</a></li>
                                 <li><a href="../friend/myrelationperson.aspx">可能认识的人</a></li>
                                 <li><a href="../friend/in.aspx">谁来看过我</a></li>
                                 <li><a href="../friend/out.aspx">我去看过谁</a></li>
                                 <li><a href="../friend/find-friend.aspx">找朋友</a></li>
                                 <li><a href="../friend/invite.aspx">邀请朋友</a></li>
                                 </ul>
                            </div>        
                     </div>     
                    <div class="body_sec_left">
                       
                       <div class="recordnumber"><span id="friendclass" runat="server">loading...</span> &nbsp;    共<asp:Literal runat="server" ID="LtrCount" Text="0"></asp:Literal>个好友</div>
                       <div class="content nl w530">
                                <div class="line1"></div>
                                <asp:Repeater runat="server" ID="RptData">
                                    <HeaderTemplate>
                                        <ol  id="ol_list">
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <li id="li_<%# DataBinder.Eval(Container.DataItem, "UserId")%>">
                                            <div  class="nl body-mb-left image">
                                                <a href="../../user/<%# JuSNS.Common.Public.URLWrite("","r",""+DataBinder.Eval(Container.DataItem, "UserId")+"")%>"><img src="<%# GetHeadImage(DataBinder.Eval(Container.DataItem, "UserID"),2)%>" alt="<%# DataBinder.Eval(Container.DataItem, "UserName")%>" /></a>
                                            </div> 
                                            <div class="nr body-mb-right">
                                                    <div class="cpstr"> 
                                                        <a href="../../user/<%# JuSNS.Common.Public.URLWrite("","r",""+DataBinder.Eval(Container.DataItem, "UserId")+"")%>"  class="font14 bold"><%# DataBinder.Eval(Container.DataItem, "UserName")%></a>
                                                     </div> 
                                                      <span class="cpstr c999" style="display:none;">关系：<%# ShowFDegree(DataBinder.Eval(Container.DataItem, "FDegree"))%> </span>
                                                    <div class="cpstr"> 
                                                        <span class="mood"><%# ShowLastMiniBlog(DataBinder.Eval(Container.DataItem, "LastMiniBlog"), DataBinder.Eval(Container.DataItem, "LastMiniBlogTime"))%></span> 
                                                     </div> 
                                                    <div class="cpstr">   
                                                        <span class="actions"><a href="javascript:void(0);" onclick="mailto('<%# DataBinder.Eval(Container.DataItem, "UserId")%>','');">发短消息</a>
                                                        <span class="pipe">|</span>
                                                        <a href="javascript:Greet(<%# DataBinder.Eval(Container.DataItem, "UserId")%>,'<%# DataBinder.Eval(Container.DataItem, "UserName")%>','<%# GetHeadImage(DataBinder.Eval(Container.DataItem, "UserID"),2)%>');">打招呼</a>
                                                                    <%if (myid == this.GetUserID()){%>
                                                                    <span class="pipe">|</span>
                                                                    <a href="javascript:DeleteFriend('<%# DataBinder.Eval(Container.DataItem, "UserId")%>','<%# DataBinder.Eval(Container.DataItem, "UserName")%>','<%# GetHeadImage(DataBinder.Eval(Container.DataItem, "UserID"),2)%>');">解除关系</a>
                                                                    <span class="pipe">|</span>
                                                                    <a href="javascript:editFriend(<%# DataBinder.Eval(Container.DataItem, "ID")%>,<%=this.GetUserID() %>);">属性</a>
                                                                        <%} %>
                                                                    </span>
                                                    </div> 
                                            </div>
                                            <div class="line1"></div>
                                        </li>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </ol>
                                    </FooterTemplate>
                                </asp:Repeater>
                                <div class="pagination" runat="server" id="DivPage"></div>
                            </div>
                    </div>
                    
                       <!--中间分隔-->
                        <div class="line_mid">
                          <div class="line_01"></div>
                          <div class="line_02" id="midline"></div>
                          <div class="line_03"></div>
                        </div>
                        <!--中间分隔结束-->
                                            
                    <div class="body_sec_right">
                        <div class="adscss">
                            <script type="text/javascript" src="../../js/ads/body_top.js"></script>
                        </div>
                        <div class="cpstr">
                            <div class="ctitle">快速查找朋友</div>
                            <div class="cpstr">
                                    <form action="" method="post" id="searchForm" name="searchForm" class="cpstr">
                                        <input name="friendname" maxlength="20" id="friendname" type="text" class="f-text s80" />
                                         <p class="pstr">
                                         <input type="button" name="toSearchButton" id="toSearchButton" onclick="search('<% =GetUserID() %>');" value="查找朋友..." class="f-button" /> 
                                         </p> 
                                    </form>
                            </div> 
                        </div>
                        <div class="line s90"></div>
                        <div id="friends_filter" runat="server">
                                <div class="font14 bold">&nbsp;我的好友分组</div>
                                <ul runat="server" id="FriendcName" class="acbg s90">
                                </ul>
                                <div class="font14 bold">&nbsp;<%=userName %>网络朋友</div>
                                <ul runat="server" id="UlStatNet" class="acbg s90">
                                </ul>
                        </div>
                        <div class="adscss">
                            <script type="text/javascript" src="../../js/ads/body.js"></script>
                        </div>
                    </div>
                     <div class="c"></div>
           </div>  
           <!--底部-->
             <div class="divbottom">
              <%=this.GetHtmlFoot()%>
              </div>
        </div>
   </div>
</div>
</body>
</html>
<script type="text/javascript">
   function getFValue(obj)
   {
        var v=obj.value;
        var r="<%=Request.QueryString["r"] %>";
        var rq="";
        var rq1="";
        if(r!="")
        {
            rq="&r="+r;
            rq1="?r="+r;
        }
        if(v!="")
        {
            location.href="../friend/?c="+v+""+rq;
        }
        else
        {
            location.href="../friend/"+rq1;
        }
   } 
   
   function showEdit(fid,n)
   {
        if(document.getElementById("edit_"+fid)!=null)
        {
            if(n==0)
            {
                document.getElementById("edit_"+fid).style.display="";
            }
            else
            {
                document.getElementById("edit_"+fid).style.display="none";
            }
        }
   }
   
   function aedit(fid,cname)
   {
     var objDiv =document.getElementById("li_list_"+fid); 
	 var  options={  
					   method:'get',  
					   parameters:"id="+fid+"&cname="+escape(cname)+"&a=show",
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    objDiv.innerHTML = "Error!";
                             }
							else
							{
								    objDiv.innerHTML = returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request('../../inc/ajax/friend/changeclass.aspx?no-cache='+Math.random(),options);     
  }
  
  function saveValue(fid)
  {
     var objDiv =document.getElementById("li_list_"+fid); 
     var values=document.getElementById("input_Name_"+fid).value; 
	 var  options={  
					   method:'get',  
					   parameters:"id="+fid+"&cname="+escape(values)+"&a=save",
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    objDiv.innerHTML = "Error!";
                             }
							else
							{
								    objDiv.innerHTML = returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request('../../inc/ajax/friend/changeclass.aspx?no-cache='+Math.random(),options);     
  }
</script>