﻿// JScript 文件

function Ajax_Enter(){
    var _UserName = Trim(GetE("txtUser_Name").value);
    if(_UserName == "")
    {
        alert("请输入您的登录帐号");
        GetE("txtUser_Name").focus();
        return;
    }
    var _Email = Trim(GetE("txtEmail").value);
    if(_Email == "")
    {
        alert("请输入您注册时填写的邮箱");
        GetE("txtEmail").focus();
        return;
    }
    if(!IsMail(_Email) )
    {
        alert("邮箱格式错误");
        GetE("txtEmail").focus();
        return;
    }
    
    if(!confirm("确认信息无误，找回登录密码？"))
    {
        EventHalt();
        return;
    }
    
    MainLoading();

    GetE("ibEnter").style.display = "none";
    
    AjaxUrl = "AjaxService.koc?AjaxType=PasswordReset_Enter&UserName=" + escape(_UserName) + "&Email=" + escape(_Email) + "&time=" + new Date();
    //window.open(AjaxUrl);
    xmlHttp = CreateAjaxObj(AjaxUrl,"GET");
    xmlHttp.onreadystatechange = function(){
        if(xmlHttp.readyState == 4)
        {
            ChildDialogHide();
            GetE("ibEnter").style.display = "";
            if(xmlHttp.status == 200)
            {
                if(xmlHttp.responseText.substring(0,1) != "0")
                {
                    alert(xmlHttp.responseText);
                }
                else
                {
                    alert("密码找回成功，新密码已经发到您的注册邮箱，请查收后进行登录。");
                    location.href = "UserLogin.aspx";
                }
            }
        }
    };
    xmlHttp.send(null);
}