﻿function doLogin() {
    if($("#txtAccount").val()=="")
    {
        alert("會員帳號不能為空!");
        $("#txtAccount").focus();
        return false;
    }
    if($("#txtPassword").val()=="")
    {
        alert("會員密碼不能為空！");
        $("#txtPassword").focus();
        return false;
    }
    if (!md5_vm_test())
    {
        alert("模块加载失败!");
        return false;
    }
    
    var account = $("#txtAccount").val();
    var password = hex_md5($("#txtPassword").val());
    //var password =$("#txtPassword").val();
    var usettype = $("#slType").val();

    $("#login_state").html("驗證中...");
    
    $.ajax({
        type: "post",
        cache: "false",
        url: "http://" + window.location.host + "/AjaxHandler/Login.ashx",
        data: "do=check&account=" + account + "&password=" + password + "&ut=" + usettype,
        success: function (responseText) {
            if (responseText != null && responseText != "") {
                $("#clr_login").html(responseText);
                if(usettype==1)
                    location.href ="http://" + window.location.host + "/Proxy/Proxy_Room_List.aspx";
            }
            else {
                $("#login_state").html("登錄失敗！");
            }
        },
        error: function (err) {
            $("#login_state").html("程序出錯！");
        }
    });
}
function doLoginOut()
{
    if(confirm("確認登出嗎？"))
    {
        window.location.href = "http://" + window.location.host + "/Login.aspx?do=logout";
    }
}
function doReset()
{
    this.form.reset();
    return false;
}

