<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeBehind="Searchusers.aspx.cs" Inherits="Book.Book.Searchusers" %>

<!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>员工通讯薄</title>

        <script src="../Javascript/jquery-1.9.1.min.js" type="text/javascript"></script>
       
        <script src="../Javascript/jquery.cookie.js" type="text/javascript"></script>

        <link href="../Style/common.css" rel="stylesheet" type="text/css" />
  
  
   <script>

       var domain = "_www.dotnetcms.org_";
       function o(name, r) {
           SetHistory(name, r);
           document.getElementById("txt_emails").value += r+","
       }


       function ho(r) { 
           document.getElementById("txt_emails").value += r + ","
       }
     
  
    function SetHistory(name, email) {

      
        var wlink = name + "+" + email + domain; 
        var old_info = $.cookie("hisArt"); 
        var insert = true;


        if (old_info == null) {

            $.cookie("hisArt", wlink, { expires: 10 });
            $("#history").html("");
            InitHis();
            return;
            
        }
        else {
           
            try {
                var old_link = old_info.split(domain);
                    var c = old_link.length;
                    for (var j = 0; j < c; j++) {

                        if ((old_link[j] + domain).indexOf(wlink) != -1) {
                            insert = false;
                          
                        }
                    }
            }
            catch (e) { 
            }
        }

        if (insert) {
            
            $.cookie("hisArt", old_info + wlink, { expires: 10 });
              $("#history").html("");
            InitHis();
       }

    }




    function InitHis() {
      
        var old_info = $.cookie("hisArt");

        if (old_info!=null) {
            var cont = "";
            var old_link = old_info.split(domain);
            var c = old_link.length;
            for (var j = 0; j < 10; j++) {
                try {
                    var items = old_link[j];
                    var item = items.split("+");
                    var name = item[0];
                    var mail = item[1];
                     
                    cont = "<a href=# onclick=ho('" + mail + "') >" + name + "</a> "+cont;
                   
                }
                catch (e)
                   { }
               }

            $("#history").html(cont);
            

        }
        else {

        }

    }
        
    </script>
 


 
    <script>


        function clears() {
           $.cookie('hisArt', null);
           $("#history").html("");
        }



        $(document).ready(function () {
            InitHis();
          }
       );

</script>

	  
 </head>
	
	
 
<body style=" font-family:Courier New; font-size:11px;">
  
    <div>
     
    <form id="Form1" runat="server" >
    <asp:HiddenField runat="server" ID="hf_autoshow" Value="1" />
 
	 请输入用户名： 
    <asp:TextBox ID="txt_search" runat="server"></asp:TextBox>
    <asp:Button ID="btn_search" runat="server" Text="搜索" 
         onclick="btn_search_Click" /> 
	 <hr />
	  <div style=" width:580px; height:250px; overflow:scroll"> 
	 
	 
	 
	 <asp:Panel runat="server" ID="pnl_notad">
	 
	 
	 <asp:Repeater runat="server" ID="rpt_notad"
	  >
	 <ItemTemplate>
	
	 
 <table  > 
   <tr onclick="o('<%# Eval("displayname") %>','<%# Eval("email") %>')"  style=" cursor:pointer "> 
      
       <td width=200px align="left"><%#Eval("department") %></td>
       <td width=150px align="left"> <%#Eval("displayname") %>
       </td>   
       <td width=250px align="left"><%#Eval("email") %></td>
      
       
       
       </tr> 
        </table> 
	 
	 </ItemTemplate>
	 
	 </asp:Repeater>
	 
	 </asp:Panel>
	 
	 
	 
	 
	 
	 
	 	 <asp:Panel runat="server" ID="pnl_ad">
	 
	 
	 <asp:Repeater runat="server" ID="rpt_ad"
	  >
	 <ItemTemplate>
	
	 
 <table width=600px> 
    <tr  onclick="o('<%# ((ADUserInfo)Container.DataItem).DisplayName %>','<%# ((ADUserInfo)Container.DataItem).Email %>')"  style=" cursor:pointer; text-align:left "> 
     
      <td width=200px align="left"  >   <%# ((ADUserInfo)Container.DataItem).DisplayName %></td>
       <td width=150px align="left"  >   
       
          <%# ((ADUserInfo)Container.DataItem).Username %>
       </td>   
       <td width=250px align="left"  >    <%# ((ADUserInfo)Container.DataItem).Email %></td>
      
       </tr> 
        </table> 
	 
	 </ItemTemplate>
	 
	 </asp:Repeater>
	 
	 </asp:Panel>
	 </div>
     
  
      
    <asp:TextBox ID="txt_emails" TextMode="MultiLine"  style=" width:490px; height:50px" runat="server"></asp:TextBox>
      
      
      <br />
      
      
      
        <input id="Button1" type="button" value="提交" onclick="Ok()" />
        <input type="button" onclick="clears()"  value="清除记录"/>
        
        <div id="history"></div>
       <script>
           function Ok() {

               var c = document.getElementById('<%=txt_emails.ClientID%>').value;

               <%=Request.QueryString["t"]=="click"? "window.opener.SetValues(c); self.close(); " : " parent.SetValues(c); var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index); " %>
                
               
           }
       
       </script>
        
    </div>
 
 






  
 
 </form>
</body>


</html>