﻿//获取密码
function getpwd() {
    var mobile = document.getElementById("txtMobileNo").value;
     //var myreg = /^(((13[0-9]{1})|159|157|152|151|150|158)+\d{8})$/;

    var myreg = /^1(34|35|36|37|38|39|50|51|52|58|59|88)[0-9]{8}$/
    if (mobile.length != 11) {
        alert('手机号长度必须为11位');
        return false;       
    }

    else if (!myreg.test(mobile)) {
        alert('请输入合法的手机号码！');
        return false;
        
    }
    else {
        var resultMsg = _login.GetPassword(mobile).value;
        switch (resultMsg) {
            case "11001":
                alert('获取密码成功,请注意查收');
                break;
            case "11002":
                alert('网络繁忙,请稍后再试');
                break;
            case "11003":
                alert('用户没有订购');
                break;
            case "11004":
                alert('相同的手机号，不能连续获取密码,\r\n间隔时间为60秒');
                break;
            default:
                alert(resultMsg);
                break;
            
        }
    }    
}

//登陆
function mmsLogin() {
    var mobile = document.getElementById("txtMobileNo").value;
    var pwd = document.getElementById("txtPassword").value;
    //var myreg = /^(((13[4-9]{1})|159|157|152|151|150|158)+\d{8})$/;
    var myreg = /^1(34|35|36|37|38|39|50|51|52|58|59|88)[0-9]{8}$/
    var ValidateCode = document.getElementById("txtCode").value;
    
    if (mobile.length != 11) {
        alert('手机号长度必须为11位');
        return false;
    }


    else if (!myreg.test(mobile)) {
        alert('请输入合法的手机号码！');

        return false;
    }
        else if (pwd.length < 6) {
    alert('密码不能小于6位');

        return false;
    }

    else {
        var resultMsg = _login.btnSubmit(pwd, ValidateCode,mobile).value;
        switch (resultMsg) {
            case "10006":
                closebox1();
                break;
            case "10007":
                alert('验证码错误');
                break;
            case "11001":
                alert('验证码过期请重新获取');
                break;
            case "10009":
                alert("密码错误");
                break;
            case "11000":
                alert("还没有获取密码吗?");
                break;
            case "11103":
                alert('您是体验用户,\r\n请发KT到106588688,成为正式会员');
                closebox1();
                break;
            default:
                alert('数据错误,请稍后再试...');
                break;
        }
    }

    return;
}


function ShowError() {
    var pop = new Popup({ contentType: 1, scrollType: 'no', isReloadOnClose: false, width: 500, height: 500 });
    pop.setContent("contentUrl", "Error.htm");
    pop.setContent("title", "提示信息");
    pop.build();
    pop.show();
}

function CloseBox() {
    window.parent.document.body.removeChild(window.parent.document.getElementById("dialogCase"));
    //不会刷新父页面
}
function closebox1() {
    this.parent.Popup.prototype.reset_m(); //会刷新父页面
}

///弹出登陆框
function ShowLogin() {
    var pop = new Popup({ contentType: 1, scrollType: 'no', isReloadOnClose: false, width: 350, height: 300 });
    pop.setContent("contentUrl", "login.aspx");
    pop.setContent("title", "用户登陆");
    pop.build();
    pop.show();
}