﻿function infoSend() {
    if (!ValidForm("txtBlogUrl", "請輸入您的BLOG位址！"))
        return false;
    else if (!ValidURL("txtBlogUrl", "請輸入正確的BLOG位址！"))
        return false;
    if (!ValidForm("txtName", "請輸入您的姓名！"))
        return false;
    if (!ValidForm("txtPhone", "請輸入您的聯絡電話！"))
        return false;
    else if (!lengthRestriction("txtPhone", 8, 10, "聯絡電話"))
        return false;
    else if (!isNumeric("txtPhone", "請輸入正確的聯絡電話！"))
        return false;
    var x = getAddress(true);
    if (x.length < 1)
        return false;
    if (!ValidForm("txtEMail", "請輸入您的 E-Mail！"))
        return false;
    else if (!ValidEMail("txtEMail", "請輸入正確的 E-Mail！"))
        return false;
    if (!ValidSelect("ddlSkin", "請選擇您的膚質！"))
        return false;
    if (!ValidSelect("ddlAge", "請選擇您的年齡區間！"))
        return false;

    $.post("router/addMember.ashx", {
        address: x,
        age: $("#ddlAge option:selected").text(),
        blogurl: $("#txtBlogUrl").val(),
        email: $("#txtEMail").val(),
        isacceptinfo: $("#cbxYes").attr("checked"),
        name: $("#txtName").val(),
        skin: $("#ddlSkin option:selected").text(),
        tel: $("#txtPhone").val()
    }, function(data) {
        var dataObj = eval("(" + data + ")");
        if (dataObj.code) {
            location.href = dataObj.msg; return true;
        }
        else {
            alert(dataObj.msg);
            send = false;
        }
    }, "text");
    return false;
}