<%@ Page Language="c#" CodeBehind="reg.aspx.cs" AutoEventWireup="True" Inherits="Webdisk.reg" %>
<%@ Register TagPrefix="uc" TagName="uc1" Src="~/Top.ascx" %>
<%@ Register TagPrefix="uc" TagName="uc2"  Src="bottom.ascx" %>
<%@ Register TagPrefix="uc" TagName="uc3" Src="~/template/Regist.ascx" %>
<!DOCTYPE html>
<html>
<head>
    <link href="css/common.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="js/artDialog/css/ui-dialog.css" />
    <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="js/artDialog/dist/dialog-plus.js" type="text/javascript"></script>
    <title>用户注册</title>
</head>
<body>
    <div id="loading" style="border-right: #dbdce3 1px solid; border-top: #dbdce3 1px solid;
        display: none; border-left: #dbdce3 1px solid; border-bottom: #dbdce3 1px solid;
        position: absolute; background-color: #ffffae">
        <img src="pics/loading.gif" width="32" height="32" align="absMiddle">
        <b>正在处理，请稍候……</b>
    </div>
   <!-- <script type="text/javascript" language="javascript" src="js/dialog.js"></script>-->
    <script language="javascript" type="text/javascript">
        function getRbGroupValue(rbGroup) {
            var objs = document.getElementsByName(rbGroup);
            for (var i = 0; i < objs.length; i++) {
                if (objs[i].checked) return objs[i].value;
            }
            return "";
        }
        function RegUser() {
            if (checkValue()) {
                Init();
                try {
                    Webdisk.reg.RegUser(getRbGroupValue('team'), document.all.content_txtUserName1.value, document.all.content_txtPassWord1.value, document.all.content_txtEmail.value, getRbGroupValue('sex'), document.all.content_realname.value, document.all.content_phone.value, '0', '0', '0', IsRegUser_callback);
                    
                }
                catch (e) {
                    alert('IIS缺少默认的ashx扩展名支持！无法启用ajax，请在网站属性->目录->配置里，添加.ashx的扩展名，路径要设定到c:\\windows\\microsoft.net\\framework\\v1.1.4322\\aspnet_isapi.dll，若为.net2.0版本，中间的版本号要改为v2.0.50727，添加时一定要把\“确认文件是否存在\”的对勾去掉!' + e);
                } 
            }
        }
        function IsRegUser_callback(res) {
            document.all.loading.style.display = 'none';
            var bRet = res.value;
            if (bRet == "0") {
                window.parent.location = 'reg_success.aspx';
				var d = dialog({content:"注册成功！"}).showModal();
				setTimeout(function(){d.close().remove();window.top.location.href="reg_success.aspx";},2000);
            }
            else {
				var d = dialog({
						title:"系统提示信息",
						content:'<img src="'+'pics/dlgico_excal.gif'+'" style="width: 28px;vertical-align: middle;"/>'+bRet,			
						cancel: false,
						okValue: '确定',		
						ok: function () {}
						}).showModal();
            }
        }
        function VerifyUsername(name) {
            try {
                Webdisk.reg.check(name, IsUsernameExist_callback);
            }
            catch (e) {
                alert('IIS缺少默认的ashx扩展名支持！无法启用ajax，请在网站属性->目录->配置里，添加.ashx的扩展名，路径要设定到c:\\windows\\microsoft.net\\framework\\v1.1.4322\\aspnet_isapi.dll，若为.net2.0版本，中间的版本号要改为v2.0.50727，添加时一定要把\“确认文件是否存在\”的对勾去掉!');
            }
        }
        function IsUsernameExist_callback(res) {
//            var msg = document.getElementById('chkinfo');
//            var bRet = res.value;

//            if (bRet == "") msg.style.display = 'none';
//            else {
//                msg.style.display = '';
//                msg.innerHTML = res.value;
//                msg.style.color = 'red';
//            }
        }
        function Init() {
            document.all.loading.style.top = Math.round((document.body.clientHeight - 100) / 2) + document.body.scrollTop - 50;
            document.all.loading.style.left = Math.round((document.body.clientWidth - 100) / 2) - 100;
            document.all.loading.style.display = '';
        }
        function pass() {
            showerror("&nbsp;<font color='#FD1004'><b>用户名</b></font>不能为空！！：）", "pics/err.gif");
            return false;

        }
        function showerror(title, id) {
			var d = dialog({
					title:"系统提示信息",
					content:'<img src="'+id+'" style="width: 28px;vertical-align: middle;"/>'+title,			
					cancel: false,
					okValue: '确定',		
					ok: function () {}
					}).showModal();
			
			
        }
        function Result() {
            Webdisk.reg.GetBmAll(document.all.vcompany.value, get_Result_CallBack);
        }
        function get_Result_CallBack(response) {
            if (response.value != null) {
                document.all("vdept").length = 0;
                var ds = response.value;
                if (ds != null && typeof (ds) == "object") {
                    for (var i = 0; i < ds.Rows.length; i++) {
                        var name = ds.Rows[i].knamem;
                        var id = ds.Rows[i].id;
                        document.all("vdept").options.add(new Option(name, id));
                    }
                }
            }
            return
        }

        function checkValue() {
            if ($("#content_txtPassWord1").val() != $("#content_txtPassWord2").val()) {
                alert("两次输入密码不一致,请重新输入！");
                return false;
            }
            var exp = new RegExp(/^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w+$/);
            var result = exp.test($("#content_txtEmail").val());
            if (result == false) {
                alert("错误的电子邮件地址!");
                return false;
            } 
            return true;
        }

    </script>
    <div></div>
   <!-- Header Start -->
    <div>
        <uc:uc1 ID="top" runat="server" />
    </div>
    <!-- Header End -->

    <!-- Content Start -->
    <uc:uc3 ID="content" runat="server" />

    <!-- Content End -->
    <!-- Footer Start -->
<div id="foot">
	<div class="foot">
        <uc:uc2 ID="bootom" runat="server" />
    </div>
</div>
<!-- Footer End -->
<input id="curr" type="hidden" size="6" name="curr" runat="server" />
</body>
</html>

