//选项卡
function LoginSelect(n) {
    var tli = document.getElementById("Login_menu").getElementsByTagName("li");
    var mli = document.getElementById("Login_main").getElementsByTagName("ul");
    //alert(tli.innerHTML)
    for (i = 0; i < tli.length; i++) {
        tli[i].className = i == n ? "hover" : "";
        mli[i].style.display = i == n ? "block" : "none";
    }
}
function LoginClose() {
    document.getElementById("LoginBox").style.display = "none";
}
function LoginShow(ishow) {
    document.getElementById("LoginBox").style.display = "block";
    if (ishow == "1") {
        LoginSelect(1);
    }
}
function MinCheckUserDataValid() {
    if (!LoginBtn()) {
        return false;
    }
    else {
        var userName = $("#txtUserNames").val();
        var userPwd = $("#txtUserPwds").val();
        var txtCode = $("#txtCodes").val();
        var parm = 'action=login&user_Account=' + escape(userName) + '&userPwd=' + escape(userPwd) + '&code=' + escape(txtCode);
        $.get('/Frame/Frame.ashx', parm, function (rs) {
            if (parseInt(rs) == 1) {
                $("#txtCodes").focus();
                $("#errorMsg1").html("验证码输入不正确");
                ToggleCode("Verify_codeImag", '/Ajax/Verify_code.ashx');
                return false;
            } else if (parseInt(rs) == 2) {
                $("#txtUserNames").focus();
                $("#errorMsg1").html("账户被锁,联系管理员");
                return false;
            } else if (parseInt(rs) == 4) {
                $("#txtUserNames").focus();
                $("#errorMsg1").html("账户或密码有错误");
                return false;
            } else if (parseInt(rs) == 6) {
                $("#errorMsg1").focus();
                $("#errorMsg1").html("该用户已经登录");
                return false;
            } else if (parseInt(rs) == 3) {
                setTimeout(Load, 1000);
            } else {
                CheckingLogin(0);
                alert('服务器连接不上,联系管理员！');
                window.location.href = window.location.href.replace('#', '');
                return false;
            }
        });
    }
}
function LoginBtn() {
    var name = $("#txtUserNames").val();
    var pwd = $("#txtUserPwds").val();
    var code = $("#txtCodes").val();
    $("#errorMsg1").html("");
    if (name == "") {
        $("#txtUserNames").focus();
        $("#errorMsg1").html("账户不能为空");
        return false;
    } else if (pwd == "") {
        $("#txtUserPwds").focus();
        $("#errorMsg1").html("密码不能为空");
        return false;
    } else if (code == "") {
        $("#txtCodes").focus();
        $("#errorMsg1").html("验证码不能为空");
        return false;
    } else {
        return true;
    }
}
function Load() {
    LoginClose();
    return false;
}