﻿function doLogin() {
    var RememberMe;
    if (document.getElementById("cbRememberMeLog").checked) {
        RememberMe = 1;
    }
    else {
        RememberMe = 0;
    }
    var inAccount = $("#txtAccountLog").val();
    if (inAccount == "" || inAccount == "UserName") {
        alert("Please enter username!");
        $("#txtAccountLog").focus();
        return false;
    }
    var inPwd = $("#txtPwdLog").val();
    if (inPwd == "" || inPwd == "Password") {
        alert("Please enter password!");
        $("#txtPwdLog").focus();
        return false;
    }
    $.post("/jAjax/Logining.ashx", { Account: inAccount, Pwd: inPwd, Days: RememberMe }, function (res) {
        var URL = getQueryStringRegExp("URL");
        if (URL == "") {
            URL = encodeURIComponent(document.URL);
            //URL = "%2FForums%2Findex.aspx";
        }
        var arrRes = res.split("|");
        if (arrRes[0] == "succeed") {
            //var url = document.URL;
            //if(url.toLocaleLowerCase().indexOf("/login.aspx") != -1){SetSkipUrl(document.referrer);}else{SetSkipUrl(document.URL);}
            tb_show("Login", "/WinModer/MsgInfo.aspx?URL=" + URL + "&width=600&height=300&modal=true&MsgType=1&State=" + arrRes[1] + "&Msg=" + arrRes[2], "thickbox");
        }
        else {
            if (arrRes[1] != "-1") {
                tb_show("Login", "/Forums/MsgInfo.aspx?URL=" + URL + "mode=logininfo&MsgID=" + arrRes[1], "thickbox");
            } else {
                //SetSkipUrl("/Forums/Login.aspx");
                tb_show("User Login", "/WinModer/Login.aspx?URL=" + URL + "&width=600&height=225&modal=true&erty=1", "thickbox"); //调用thickbox之必需
            }
        }
    });
}
