﻿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());
    
    $("#login_state").html("驗證中...");
    
    $.ajax({
       type: "post",
       cache: "false",
       url: "http://"+window.location.host+"/AjaxHandler/Login.ashx",
       data: "do=check&account="+account+"&password="+password,
       success: function(responseText){
            if(responseText!=null && responseText!="")
            {
                $("#clr_login").html(responseText);
            }
			else
			{
			    $("#login_state").html("登錄失敗！");
			}
       },
       error: function(){
            $("#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;
}
