﻿//检查锚点
function checkAnchor()
{
    if (location.hash == "#login")
    {
        $("divTryout").style.display = "none";
        $("divLogin").style.display = "inline";
    }
}
//tab切换
function changeTab(tabId)
{
    if (tabId == "divLogin")
    {
        $("divTryout").style.display = "none";
        $("divLogin").style.display = "inline";
    }
    else if(tabId == "divTryout")
    {
        $("divTryout").style.display = "inline";
        $("divLogin").style.display = "none";
    }
}
//家族试用
function tryoutFamily()
{
    var fatherFamilyName = $("txtFatherFamilyName").value.trim();
    if (fatherFamilyName.length == 0)
    {
        AlertDialog("请填写您父亲的姓氏！");
        return;
    }
    var fatherGivenName = $("txtFatherGivenName").value.trim();
    if (fatherGivenName.length == 0)
    {
        AlertDialog("请填写您父亲的名字！");
        return;
    }

    var motherFamilyName = $("txtMotherFamilyName").value.trim();
    if (motherFamilyName.length == 0)
    {
        AlertDialog("请填写您母亲的姓氏！");
        return;
    }
    var motherGivenName = $("txtMotherGivenName").value.trim();
    if (motherGivenName.length == 0)
    {
        AlertDialog("请填写您母亲的名字！");
        return;
    }
    
    var familyName = $("txtFamilyName").value.trim();
    if (familyName.length == 0)
    {
        AlertDialog("请填写您的姓氏！");
        return;
    }
    var givenName = $("txtGivenName").value.trim();
    if (givenName.length == 0)
    {
        AlertDialog("请填写您的名字！");
        return;
    }
    var sex = "0";
    if ($("rdoMale").checked)
    {
        sex = "1";
    }
    else if ($("rdoFemale").checked)
    {
        sex = "2";
    }
    if (sex == "0")
    {
        AlertDialog("请选择您的性别！");
        return;
    }
    location = "/Family/Start.aspx?fatherFamilyName=" + encodeURIComponent(fatherFamilyName.escapeHTML()) + "&fatherGivenName=" + encodeURIComponent(fatherGivenName.escapeHTML()) + "&motherFamilyName=" + encodeURIComponent(motherFamilyName.escapeHTML()) + "&motherGivenName=" + encodeURIComponent(motherGivenName.escapeHTML()) + "&familyName=" + encodeURIComponent(familyName.escapeHTML()) + "&givenName=" + encodeURIComponent(givenName.escapeHTML()) + "&sex=" + encodeURIComponent(sex.escapeHTML());
}