<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_Admin_add, LebiMall" %>
<!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 runat="server">
    <title>添加管理员</title>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/checked.js"></script>
    <script type="text/javascript" src="js/Ajax.js"></script>
    <script type="text/javascript" src="js/checked.js"></script>
    <link href="css/tipswindown.css" type="text/css" rel="stylesheet" />
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script src="js/topHead.js" type="text/javascript"></script>
    <script type="text/javascript">
        function validate(){
            var flag = true;
            if(!checkname()){
                 flag = false;
            }
            if(!checkPwd()){
                 flag = false;
            } if(!checkrepeatpwd()){
                flag = false;
            }
            return flag;
        }
        function checkname(){
            search(document.getElementById("txt_adminname").value);
            if(document.getElementById("txt_adminname").value==""){
                 return false;
            }else
            {
                if(document.getElementById("serverResponse").innerHTML==""){
                    return true;
                }else{
                    return false;
                }  
            }
            
        }
        
        function checkPwd(){
             if(document.getElementById("txt_adminPwd").value==""){
                 document.getElementById("msg_cm").innerHTML="<span class='msg_submit'>密码不能为空！</span>";
                 return false;
            }
            else if(document.getElementById("txt_adminPwd").value.length>6){
                document.getElementById("msg_cm").innerHTML="<span class='msg_submit'>密码长度不能大于6！</span>";
            }else{ 
                  document.getElementById("msg_cm").innerHTML="<em>密码长度不能大于6</em>";
                   return true;
            }
        }
        
        function checkrepeatpwd(){
            if(document.getElementById("txt_repeatpwd").value==""){
                document.getElementById("msg_rpwd").innerHTML="<span class='msg_submit'>确认密码不能为空！</span>";
                return false;
            }else if(document.getElementById("txt_repeatpwd").value!=document.getElementById("txt_adminPwd").value){
                 document.getElementById("msg_rpwd").innerHTML="<span class='msg_submit'>两次密码输入不一致</span>";
                 document.getElementById("msg_cm").innerHTML= "<span class='msg_submit'>两次密码输入不一致</span>";
                return false;
            }else{
                document.getElementById("msg_rpwd").innerHTML="";
                return true;
            }
        }
        
        function search(name){
             doRequest("Admin_search.ashx?name="+name);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server" onsubmit="return validate()">
   <div class="list">
             <script>header(6,1,"images/");</script>
   
    <!--面包屑-->
    <div class="blank clearfix"></div>
    
    <!--功能区-->
    <div class="tabmenus mainwidth">
        <ul>
            <li><a href="AdminList.aspx"><span>管理员列表</span></a></li>
            <li class="current"><a href="Admin_Add.aspx"><span>添加管理员</span></a></li>
        </ul>
    </div>
    <div class="tab-mainbody">
        <div class="tab-mainbody2">
        <div class="functionHandleArea clearfix">
            <input id="Button2" type="button"  runat="server" class="btn-app" onserverclick="Button1_ServerClick" />
            <input type="image" name="Submit" title=" 重填 " onClick="reset();return false;" src="images/bt_res.gif" align="absmiddle" />
            <input type="image" border="0" title=" 返回 " onclick="history.back();return false;" src="images/bt_bak.gif" align="absmiddle" />
        </div>
        <div id="datalist">
            <table cellpadding="0" cellspacing="0" width="100%" border="0" id="list">
                <tr>
                    <th>添加管理员</th><th><span class="title_r" id="msg_sub"></span></th>
                     <script type="text/javascript">
                      var $=jQuery;
                        var i = 2;
                        var f="<%=Session["returnValue"] %>";
                        if(f=="true"){
                            tipsWindown('操作结果','text:操作成功！','250','60','true','2000','true','text');
                            <% Session["returnValue"]= null; %>
                            setInterval("fun()", 1000);
                        }
                        if(f=="false"){
                             tipsWindown('操作结果','text:操作失败！','250','60','true','2000','true','text');
                             <% Session["returnValue"]= null; %>
                        }
                        function fun() {
                            if (i == 1) {
                                window.location.href="AdminPower.aspx?uid="+'<%=id %>';
                            }
                            i--;
                        }
                    </script>
                </tr>
                <tr>
                    <td width="15%" style="height: 26px">
                        管理员账号：
                    </td>
                    <td style="height: 26px">
                        <input type="text" runat="server" id="txt_adminname"  class="input" onblur="checkname()"  style="width:150px;"  />&nbsp;<span id="serverResponse"></span>
                    </td>
                </tr>
                <tr>
                    <td>
                        管理员密码：
                    </td>
                    <td>
                        <input type="password" runat="server" id="txt_adminPwd" class="input" style="width:150px;" onblur="checkPwd()" />&nbsp;<span id="msg_cm"><em>密码长度不能大于6</em></span>
                    </td>
                </tr>
                <tr>
                    <td>
                        请确认密码：
                    </td>
                    <td>
                        <input type="password" runat="server" id="txt_repeatpwd" class="input" style="width:150px;"  onblur="checkrepeatpwd()" /><span id="msg_rpwd"></span>
                    </td>
                </tr>
                <tr>
                    <td>
                        管理员状态：
                    </td>
                    <td>
                        <input type="radio" id="rdo0" name="states" value="1" runat="server" checked/>开启<input type="radio" id="rdo1" name="states" value="0" runat="server" />关闭
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="list-foot">
                        <input id="Button1" type="button"  runat="server" class="btn-app" onserverclick="Button1_ServerClick" />
                    </td>
                </tr>
            </table>
            <script type="text/javascript">tdshowm("list");</script>
            </div></div></div>
        </div>
    </form>
</body>
</html>
