<%@ Page Title="切换管理员身份" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" CodeBehind="ChangeManage.aspx.cs" Inherits="PowerEasy.Module.General.WebSite.Admin.Profile.ChangeManage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CphNavigation" runat="server">
<pe:ExtendedSiteMapPath ID="SmpNavigator" SiteMapProvider="AdminMapProvider" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphContent" runat="server">
    <asp:ScriptManager ID="SmgeRegion" runat="server" EnablePartialRendering="true">
    </asp:ScriptManager>
<style>
/*搜索*/
.Admin_Search
{
    margin-bottom:2px;
}
.Admin_Searchb, .Admin_Searcha
{
    background-image: url(../../Admin/Images/SearchN.gif);
    background-repeat: no-repeat;
    cursor: pointer;
    width: 15px;
    height: 15px;
    z-index: 9999;
    position:absolute;
    margin-left:-22px;
    margin-top:3px;
}
.Admin_Searcha
{
    background-image: url(../../Admin/Images/SearchX.gif);
}
.Admin_Search_UpAndDown
{
    position:absolute;
    margin-top:-2px;
    display:none;
}
</style>
<script language="javascript">
    var oldvalue;
    var selectobj;
    var index = 0;
    var count = 0;
  
    function beginsearch(obj) {
        if ($(obj).prop("value") == "快速搜索") {
            $("#Searchb").attr("className", "Admin_Searcha")
            $("#Searchb").bind("click", offsearch);
            $(obj).prop("value", "");
        }
        return true;
    }
    function outsearch(obj) {
        if ($(obj).prop("value") == "") {
            $("#Searchb").attr("className", "Admin_Searchb")
            $(obj).prop("value", "快速搜索");
            $("#Admin_Search_UpAndDown").hide();
            index = 0;
            count = 0;
        }
        return true;
    }
    function offsearch(obj) {
        $("#Searchb").attr("className", "Admin_Searchb")
        $("#Admin_Search").prop("value", "快速搜索");
        $("#Searchb").unbind();
        index = 0;
        count = 0;
        $("#Admin_Search_UpAndDown").hide();
        return true;
    }
    function Gosearch(obj,event) {
        var searchtext = $("#Admin_Search").val();
        if (searchtext != "") {
            if (searchtext != oldvalue) {
                var sobj = $("select option[value*='" + searchtext + "']");
                selectobj = sobj;
                count = sobj.length;
                if (count > 0) {
                    sobj.parent().val(sobj.eq(0).val());
                }
                if (count > 1) {
                    $("#Admin_Search_UpAndDown").show();
                } else {
                    $("#Admin_Search_UpAndDown").hide();
                }
                oldvalue = searchtext;
            }
        } else {
            oldvalue = "";
            $("#Admin_Search_UpAndDown").hide();
        }
        return true;
    }

    function searchpre() {
        if (count > 1) {
            index--;
            if (index < 0) {
                index = count - 1;
            }
            selectobj.parent().val(selectobj.eq(index).val());
        }
    }

    function searchnext() {
        if (count > 1) {
            index++;
            if (index >= count) {
                index = 0;
            }
            selectobj.parent().val(selectobj.eq(index).val());
        }
    }

    $(document).ready(function() {
        var o = $("#Admin_Search");
        o.bind("keyup", function(event) { Gosearch(this, event); });
        o.bind("blur", function() { outsearch(this); });
        o.bind("focus", function() { beginsearch(this); });
        o.bind("mouseover", function() { $(this).attr("className", 'inputtext_hover'); });
        o.bind("mouseout", function() { $(this).attr("className", 'inputtext'); });
        o.bind("focus", function() { $(this).attr("className", 'inputtext_focus'); });
    });
</script>
<div>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">        
     <tr align="center">
            <td class="spacingtitle" colspan="2">
        切换管理员身份
            </td>
     </tr>
     <tr class="tdbg" style="
         <pe:ExtendedLiteral ID="ExtendedLiteral1" runat="server"></pe:ExtendedLiteral>">
     <td align="right" style="width: 40%" class="tdbgleft" >    
       选择管理员：
    </td>
     <td align="left" >
        <div class="Admin_Search">
        <input ID="Admin_Search" value="快速搜索" class="inputtext"  style="width:198px;"/>
        <a id="Searchb" class="Admin_Searchb" ></a>
            <span id="Admin_Search_UpAndDown" class="Admin_Search_UpAndDown">
                <input ID="Button4" value="上一个" type="button" onclick="searchpre()" />
                <input ID="Button3" value="下一个" type="button" onclick="searchnext()" />
            </span>
        </div> 
         <asp:ListBox ID="ListBox1" runat="server" Width="200" Height="100"></asp:ListBox>
      </td>
    </tr>
    <tr class="tdbg" style="
        <pe:ExtendedLiteral ID="ELtr" runat="server"></pe:ExtendedLiteral>">
    <td align="right" style="width: 40%" class="tdbgleft">
         超级管理员（<span class="AdminName"><strong><%=Session["SuperAdminName"]%></strong></span>）的密码：
     </td>
    <td align="left" >
        <asp:TextBox ID="TxTPassWord" runat="server" TextMode="Password" CssClass="inputtext" AutoComplete="off"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="TxTPassWord" ErrorMessage="密码不能为空" ValidationGroup="changeuser"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr class="tdbgbottom">
    <td  colspan="2" align="center">
        <asp:Button ID="Button1" runat="server" Text="切换回原来的超级管理员身份" onclick="Button1_Click" ValidationGroup="changeuser" OnClientClick="return BeginClick();" />
        <asp:Button ID="Button2" runat="server" Text="切换到此管理员身份" onclick="Button2_Click" Visible="False" />
        </td>
   </tr>
</table>
<br />
</div>
    <script type="text/javascript" src="../../JS/Encrypt/BigInt.js"></script>
    <script type="text/javascript" src="../../JS/Encrypt/Encrypt.js"></script>
    <script type="text/javascript" src="../../JS/Encrypt/Barrett.js"></script>
    <script type="text/javascript" src="../../JS/Encrypt/Common.js"></script>
    <script type="text/javascript">
        var isClick = false;
        var BeginClick = function () {
            if (Page_ClientValidate("changeuser")) {
                if (!isClick) {
                    GetRsaEncrypt(3);
                    $("#<%=TxTPassWord.ClientID%>").val(rsaEncrypt($("#<%=TxTPassWord.ClientID%>").val()));
                    isClick = true;
                }
                return true;
            } else {
                return false;
            }
        }
    </script>
</asp:Content>
