<%@ Page Language="c#" Inherits="TopWinCMS.WebUI.Admin.Admin_Login" CodeBehind="Login.aspx.cs" %>

<%@ Register TagPrefix="cc2" Namespace="TopWinCMS.WebControls" Assembly="TopWinCMS.WebControls" %>
<!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>
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
    <link href="Style.css" type="text/css" rel="stylesheet" />
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <meta http-equiv="Pragma" content="No-cach" />
    <script language="javascript" type="text/javascript" src="TopWin.js"></script>
    <script language="javascript" type="text/javascript" src="../Images/skysoft.js"></script>
    <script src="../JS/JQ/jquery.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">

        document.onkeydown = function ()
        {
            var t1 = $('<%=TB_UserName.ClientID%>');
            var t2 = $('<%=TTB_Password.ClientID%>');
            var t3 = $('<%=NTB_ValidateCode.ClientID%>');
            var b = $('<%=BT_Login.ClientID%>');

            if (event.keyCode == 13 && (event.srcElement == t1 || event.srcElement == t2 || event.srcElement == t3))
            {
                window.event.cancelEvent = true;
                window.event.returnValue = false;
                b.click();
            }
        }
        function PassCodeInit()
        {
//            if ($('TR_ValidateCode'))
//            {
//                $('TR_ValidateCode').style.display = "block"
            //            }
              //firefox 和webkit 核心的浏览器都有这种bug
        }
        function CheckPassCode()
        {
//            if ($('TR_ValidateCode'))
//            {
//                if ($('TR_ValidateCode').style.display != "block")
//                {
//                    alert("请点击一下用户名输入框，使验证码显示。");
//                    return false;
//                }
//            }

            return true;
        }
//        window.onload = function ()
//        {
//            $("TB_UserName").onfocus = PassCodeInit;
//            $("TTB_Password").onfocus = PassCodeInit;
//        }
        jq = jQuery.noConflict();
        jq(function ()
        {
            jq("#TB_UserName").focus(function () { jq("#TR_ValidateCode").show(); })
            jq("#TTB_Password").focus(function () { jq("#TR_ValidateCode").show(); })
        });

         
    </script>
    <style type="text/css">
        body
        {
            background-color: #e8eff3;
        }
        #TB_UserName, #TTB_Password, #NTB_ValidateCode
        {
            color: #ff0000;
            border: 1px solid #006699;
        }
        #TR_ValidateCode
        {
            display: none;
        }
        .TR_ValidateCodeBlock
        {
            display:block;
        }
        table
        {
            position: absolute;
            width: 400px;
            left: 50%;
            top: 50%;
            margin-top: -100px;
            height: 200px;
            margin-left: -200px;
            border: 1px solid #999999;
            background-color: #FFFFFF;
        }
        Td
        {
            font-size: 12px;
            height: 30px;
        }
    </style>
</head>
<body>
    <form id="Login" method="post" runat="server">
    <table>
        <tr>
            <td>
                &nbsp;
            </td>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td width="114" align="right" valign="middle">
                用户名：
            </td>
            <td width="274" colspan="2">
                <asp:TextBox ID="TB_UserName" runat="server" Width="112px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TB_UserName"
                    ErrorMessage="请输入"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td align="right">
                密 码：
            </td>
            <td width="274" colspan="2">
                <cc2:TrimTextBox ID="TTB_Password" runat="server" Width="112px" TextMode="Password"></cc2:TrimTextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TTB_Password"
                    ErrorMessage="请输入"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr runat="server" id="TR_ValidateCode">
            <td align="right" valign="middle">
                验证码：
            </td>
            <td>
                <cc2:NumericTextBox ID="NTB_ValidateCode" runat="server" Width="112px"></cc2:NumericTextBox>
            </td>
            <td width="136">
                &nbsp;<asp:Image ID="PassCode" runat="server" onclick="this.src='../PassCode.ashx?Action=AdminLogin&n='+ Math.random();"
                    Style="cursor: pointer;" ImageUrl="../PassCode.ashx?Action=AdminLogin" ToolTip="点击刷新验证码。" />
            </td>
        </tr>
        <tr align="center">
            <td height="26" colspan="3">
                <asp:Button ID="BT_Login" CssClass="btn" runat="server" Text="登录" EnableViewState="False"
                    OnClick="BT_Login_Click" OnClientClick="return CheckPassCode();"></asp:Button>
            </td>
        </tr>
        <tr align="center">
            <td colspan="3">
                &nbsp;
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
