﻿// JScript 文件

//访谈页 直播页

function checkEmail2()
{
    if($("txt_mail2").value=="Input your E-mail" || $("txt_mail2").value=="")
    {
        alert("Please let us know you personal email address if you want.!");
        $("txt_mail2").value="";
        $("txt_mail2").focus();
    }
    else if(!validateEmail($("txt_mail2").value))
    {
        alert("Sorry! The email address you entered is incorrect, please check and reenter。");
        $("txt_mail2").value="";
        $("txt_mail2").focus();
    }
    else
    {
         AddPuMailgroup($("txt_mail2").value);
    }
}

function checkEmail()
{
    if($("txt_mail").value=="Input your E-mail" || $("txt_mail").value=="")
    {
        alert("Please let us know you personal email address if you want.!");
        $("txt_mail").value="";
        $("txt_mail").focus();
    }
    else if(!validateEmail($("txt_mail").value))
    {
        alert("Sorry! The email address you entered is incorrect, please check and reenter。");
        $("txt_mail").value="";
        $("txt_mail").focus();
    }
    else
    {
         AddPuMailgroup($("txt_mail").value);
    }
}


//检测邮箱
function validateEmail(str)
{ 
     var patn = /^\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,6}$/;
    if(patn.test(str))
    {
        return true;
    }
    else
    {
        return false; //incorrect format
    }
}


function $(obj)
{
    return document.getElementById(obj);
}