<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Dialog/DialogMaster.Master"
    CodeBehind="FollowUser.aspx.cs" Inherits="OAWeb.Dialog.FollowUser" EnableViewState="true" %>
    <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<style>
.widget-bd ul li a:hover{text-decoration:none;}
</style>
    <div class="widget-bd" style="float: left; width: 600px; height: 500px;">
        <table class="data_title">
            <tr>
                <td class="data-field">
                    同事姓名：<asp:TextBox ID="txtUserName" runat="server" Width="142px"></asp:TextBox>
                    <asp:Button ID="btnSearch" runat="server" Text="查询" CssClass="btn_77px" 
                        onclick="btnSearch_Click" />
                </td>
                <td class="data-field">
                <input type="button" class="btn_77px" value="确定" onclick="CloseReload();" />
                <input type="button" class="btn_77px" value="取消" onclick="art.dialog.close();" />
                </td>
            </tr>
        </table>
        <div style=" width:100%; float:left">
        <ul>
            <asp:Repeater ID="rptEmployData" runat="server" 
                onitemdatabound="rptEmployData_ItemDataBound">
                <ItemTemplate>
                    <li class="employ_li" style="height: 90px; width: 60px; text-align:left ">
                        <div style=" text-align:center">
                            <img width="40px" height="40px" src='<%#base.GetUserImg(Convert.ToInt32(Eval("Id")), "/images/default_small.jpg") %>' /></div>
                        <div style=" text-align:center">
                            <%# getStr1( Eval("RealName").ToString(),6) %></div>

                        <div id="divFollow" runat="server" style=" text-align:left; padding-left:5px;" >
                        </div>
                    </li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
        </div>
        <div class="pager-bar" style="margin-top: 10px;">
            <webdiyer:aspnetpager id="pager" runat="server" width="100%" pagesize="36" onpagechanged="pager_PageChanged"
                horizontalalign="Right" direction="LeftToRight" showcustominfosection="Never"
                pagingbuttonspacing="10px" cssclass="anpager" currentpagebuttonclass="cpb" alwaysshow="true"
                firstpagetext="首页" nextpagetext="下一页" prevpagetext="上一页" lastpagetext="末尾">
    </webdiyer:aspnetpager>
        </div>
    </div>
    <script>

        function AddFollow(link, AddFollowId) {

            if ($(link).html().indexOf("+") >= 0) {
                $.ajax({
                    type: "POST",
                    url: "/NewProject/ProjectAjax.aspx",
                    data: "AddFollowId=" + AddFollowId,
                    //ajax提交成功回调事件
                    success: function (returnMsg) {
                        if (returnMsg != "ok") {
                            alert("操作错误");
                            return;
                        }

                        $("a[name='LinkFollow" + AddFollowId + "']").each(function (i) {
                            $(this).removeClass("addattention");
                            $(this).addClass("attention");
                            $(this).html("<i>已关注</i>");
                        });

                        alert("你已经关注了该用户");
                        InitLink();

                    }
                });
            } else {

                $.ajax({
                    type: "POST",
                    url: "/NewProject/ProjectAjax.aspx",
                    data: "DelFollowId=" + AddFollowId,
                    //ajax提交成功回调事件
                    success: function (returnMsg) {
                        if (returnMsg != "ok") {
                            alert("操作错误");
                            return;
                        }

                        $("a[name='LinkFollow" + AddFollowId + "']").each(function (i) {
                            $(this).unbind("mouseover");
                            $(this).unbind("mouseout");
                            $(this).removeClass("attention");
                            $(this).removeClass("delattention");
                            $(this).addClass("addattention");
                            $(this).html("<i><b>+</b> 关注</i>");
                        });

                        alert("你已经取消了该用户的关注");

                    }
                });

            }

        }

        function InitLink() {
            $(".attention").each(function (i) {
                $(this).mouseover(function () {

                    $(this).removeClass("attention");
                    $(this).addClass("delattention");
                    $(this).html("&nbsp;&nbsp;&nbsp;取 消 ");
                });

                $(this).mouseout(function () {
                    $(this).removeClass("delattention");
                    $(this).addClass("attention");
                    $(this).html("<i>已关注</i>");
                });

            });
        }

        InitLink();
    
    </script>
</asp:Content>
