<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Project25175.LoginNew" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title><%=LocalSiteName%>-系统登陆</title>
    <link rel="shortcut icon" href="Images/favicon.ico" >


    <link href="assets/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="assets/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/css/jquery-ui-1.10.3.custom.min.css" />
    <link rel="stylesheet" href="assets/css/jquery.gritter.css" />
    <link rel="stylesheet" href="assets/css/ace.min.css" /> 
    <link rel="stylesheet" href="assets/css/ace-rtl.min.css" />
    <link rel="stylesheet" href="assets/css/ace-skins.min.css" /> 
    <link type="text/css" rel="stylesheet" href="25175_files1/login.css">
    <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"1","bdMiniList":["sqq","copy","mshare","qzone","tsina","weixin","tqq","douban"],"bdPic":"","bdStyle":"0","bdSize":"16"},"slide":{"type":"slide","bdImg":"2","bdPos":"right","bdTop":"100"}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
</head>
<body class="login-layout-loginNew">

    <div class="" style="display: none; position: absolute;">
      <div class="aui_outer">
        <table class="aui_border">
          <tbody>
            <tr>
              <td class="aui_nw"></td>
              <td class="aui_n"></td>
              <td class="aui_ne"></td>
            </tr>
            <tr>
              <td class="aui_w"></td>
              <td class="aui_c">
                <div class="aui_inner">
                  <table class="aui_dialog">
                    <tbody>
                      <tr>
                        <td colspan="2" class="aui_header">
                          <div class="aui_titleBar">
                            <div class="aui_title" style="cursor: move;"></div>
                            <a class="aui_close" href="javascript:/*artDialog*/;">×</a></div>
                        </td>
                      </tr>
                      <tr>
                        <td class="aui_icon" style="display: none;">
                          <div class="aui_iconBg" style="background: none;"></div>
                        </td>
                        <td class="aui_main" style="width: auto; height: auto;">
                          <div class="aui_content" style="padding: 20px 25px;"></div>
                        </td>
                      </tr>
                      <tr>
                        <td colspan="2" class="aui_footer">
                          <div class="aui_buttons" style="display: none;"></div>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </td>
              <td class="aui_e"></td>
            </tr>
            <tr>
              <td class="aui_sw"></td>
              <td class="aui_s"></td>
              <td class="aui_se" style="cursor: se-resize;"></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <div class="topbar"></div>
    <div class="loginbox widget-box" style="background:url(25175_files1/loginbg_sutdent.png) no-repeat;">
      <form action="inPage.action#" name="login_form" id="login_form">
        <div class="inputbox">
          <p>用户名：
            <input id="name" type="text" name="name" class="username" data-rel="tooltip" title="登陆用户的账号"></p>
          <p>密&nbsp;&nbsp;&nbsp;码：
            <input id="password" type="password" name="password" class="password" data-rel="tooltip" title="登陆用户的密码"></p>
          <p>
          </p>
          <div class="code_input">
            <p class="c_input">
              <span>验证码：</span>
              <input id="vaildateCode" name="code" type="text" class="code" size="4" data-rel="tooltip" title="右边的验证码">&nbsp;</p>
            <p>
            </p>
          </div>
          <div class="code_pic">
            <p>
              <%--<img id="imgObj" src="ValidateCode.aspx" alt="点击刷新" onclick="javascript:reloadcodeold(); " />--%>
              <img id="icode" src="code.aspx" data-rel="tooltip" title="点击刷新验证码" onclick="javascript:reloadcode(); " />
              </p>
              <p>
            </p>
          </div>
          <p>
          </p>
          <p class="btn_login">
            <input id="btnLogin" class="btn_login" type="button" value="学生登录" data-rel="tooltip" title="以学生的身份登陆" data-action="reload">
            <input id="btnTLogin" class="btn_login" type="button" value="教师登录" data-rel="tooltip" title="以教师的身份登陆" data-action="reload">
            <input id="btnALogin" class="btn_login" type="button" value="管理登录" data-rel="tooltip" title="以管理员的身份登陆" data-action="reload">
          </p>
            <p style="font-size:12px;">版权所有:顺通网络 &nbsp;&nbsp;&nbsp;&nbsp;Powered by
            <a href="http://www.25175.net" target="_blank">25175</a></p>            
        </div>
      </form>
    </div>

    <script src="assets/js/jquery-2.0.3.min.js"></script>
    <script type="text/javascript">
        window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
    </script>

    <script type="text/javascript">
        if ("ontouchend" in document) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
    </script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery-ui-1.10.3.custom.min.js"></script>
    <script src="assets/js/jquery.ui.touch-punch.min.js"></script>
    <script src="assets/js/bootbox.min.js"></script>
    <script src="assets/js/ace-elements.min.js"></script>


	<script type="text/javascript" src="assets/js/ace.min.js"></script>


    <script language="JavaScript" type="text/javascript">
　　    function reloadcode() {
            var verify = document.getElementById('icode');
            verify.setAttribute('src', 'code.aspx?id=' + Math.random());
        };

        function reloadcodeold() {
            var verifyold = document.getElementById('imgObj');
            verifyold.setAttribute('src', 'ValidateCode.aspx?id=' + Math.random());
        };

        var systemId = 0;
        $(function () {
            if (self != top) {
                //如果不是顶层页面，将其设为顶层页面
                top.location = self.location;
            }
            //学生登陆
            $("#btnLogin").click(function () {
                user_Login("student");
            });
//            //Enter键
//            $(document).keydown(function (event) {
//                if (event.keyCode == 13) {
//                    user_Login();
//                }
//            });
            //重置按钮
            $("#btnReSet").click(function () {
                $("#login_form")[0].reset();
            });

            //教师登录
            $("#btnTLogin").click(function () {
                user_Login("teacher");
            });

            //管理员登录
            $("#btnALogin").click(function () {
                user_Login("admin");
            });
        });

        //登录
        function user_Login(loginUser) {
            // 准备参数
            var param = new Object();
            param.studentNo = $.trim($("#name").val());
            if (param.studentNo == "") {
                showMessageBox('请输入登录用户名!');
                return false;
            }
            param.password = $.trim($("#password").val());
            if (param.password == "") {
                showMessageBox('请输入登录密码!');
                return false;
            }
            param.code = $.trim($("#vaildateCode").val().toLowerCase());
            if (param.code == "") {
                showMessageBox('请输入验证码!');
                return false;
            }

            param.loginUser = loginUser;

            var urlStr = "CheckLoginInfo.aspx";
            $.ajax({
                type: "POST",
                async: true,  //默认true,异步
                data: param,
                dataType: 'text',
                url: urlStr,
                success: function (d) {
                    if (d == "OK_student") {
                        window.location.href = "Student/index.aspx";
                    }
                    else if (d == "OK_teacher") {
                        window.location.href = "Teacher/index.aspx";
                    }
                    else if (d == "OK_admin") {
                        window.location.href = "Admin/index.aspx";
                    }
                    else {
                        showMessageBox(d);
                    }
                }
            });
        }

        function showMessageBox(str) {
            bootbox.dialog({
                message: "<span class='bigger-110'>"+str+"</span>",
                buttons:
						{
						    "click":
							{
							    "label": "確定",
							    "className": "btn-sm btn-primary",
							    "callback": function () {
//							        Example.show("Primary button");
							    }
							}
						}
            });
         }


        $('[data-rel=tooltip]').tooltip();

    </script>
</body>
</html>
