﻿/// <reference path="jquery/jquery-1.4.1-vsdoc.js" />
function getlogin() {
    /// <summary>
    /// 登录验证检查
    /// </summary>
    var username = document.getElementById(registerprofix + "email_address").value;
    var userpwd = document.getElementById(registerprofix + "password").value;
    Verification(username, userpwd);
}
function GetRegister() {

    var username = document.getElementById(registerprofix + "loginUserName").value;
    var userpwd = document.getElementById(registerprofix + "loginPassword").value;
    Verification(username, userpwd);
}
function Verification(username, userpwd) {
    if (username == "") {
        alert("Please fill in the E_Mail Address.");
        return false;
    }
    var EmailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    if (!EmailReg.test(username)) {
        alert("Your E_Mail Address is invalid.");
        return false;
    }
    if (userpwd == "") {
        alert("Please fill in the password");
        return false;
    }

    var returnstr = AjaxMethod.GetLogin(username, userpwd);

    if (!returnstr.value) {
        alert("Your account is invalid,please contact us");
        return false;
    }
    var tempid;
    if (registerprofix != "") {
        if (document.getElementById(registerprofix + "hdTempId")!= null) {
            tempid = document.getElementById(registerprofix + "hdTempId").value;
        }
    }
    if (tempid != "" && tempid != undefined) {
        //window.location.reload();
        window.location.href = "/Register-" + tempid + ".html"; ;
       // window.location = "/GoldCart-" + tempid + ".html";
    }
    else {
        window.location = "/Default.html";
    }
    //    else {

    //        if (document.referrer == "") {
    //            window.location.reload();
    //        }
    //        else {

    //            window.location = "/Default.html";
    //        }

    //    }
}
function logout() {
    /// <summary>
    /// 客户登出或注销
    /// </summary>
    AjaxMethod.Logout(function(reslut) {
        if (reslut.value)
        { window.location.href = "/Default.html"; }
    });

}
