﻿// JScript 文件
function chkinput()
{
    var FirstName=document.getElementById("ctl00_ContentPlaceHolder1_txtFirstName");
    var LastName=document.getElementById("ctl00_ContentPlaceHolder1_txtLastName");
    var Mail=document.getElementById("ctl00_ContentPlaceHolder1_txtMail");
    var PPAccountMail=document.getElementById("ctl00_ContentPlaceHolder1_txtPPAccountmail");
    var Address=document.getElementById("ctl00_ContentPlaceHolder1_txtAddress");
    var City=document.getElementById("ctl00_ContentPlaceHolder1_txtCity");
    var Zip=document.getElementById("ctl00_ContentPlaceHolder1_txtZip");    
    var country=document.getElementById("country");
    var Tel=document.getElementById("ctl00_ContentPlaceHolder1_txtTel");    
    var Fax=document.getElementById("ctl00_ContentPlaceHolder1_txtFax");
    var HomePage=document.getElementById("ctl00_ContentPlaceHolder1_txtHomePage");
    var Passconfirm=document.getElementById("ctl00_ContentPlaceHolder1_txtPassconfirm");
    var cbsletter=document.getElementById("ctl00_ContentPlaceHolder1_cbsletter");
    var cbchk=document.getElementById("ctl00_ContentPlaceHolder1_cbchk");
    var TestMail=/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
    var TestHomePage=/^http:\/\/([\w-]+\.)+[\w-]+([\w- ./?%&=]*)?$/;
    var testZip=/^[0-9]*$/;
   // var testTel=/^(\d{2,4}[-_－—]?)?\d{3,8}([-_－—]?\d{3,8})?([-_－—]?\d{1,7})?$)|(^0?1[35]\d{9}$/;
    
    var Pass=document.getElementById("ctl00_ContentPlaceHolder1_txtPass");
    var IsTrue=document.getElementById("ctl00_ContentPlaceHolder1_lblChecks");
    
    var bankname=document.getElementById("ctl00_ContentPlaceHolder1_txtBankName");
    var bankAccountname=document.getElementById("ctl00_ContentPlaceHolder1_txtBankAccountName");
    var bankAccountid=document.getElementById("ctl00_ContentPlaceHolder1_txtBankAccountNumber");
    var PPAccountmail=document.getElementById("ctl00_ContentPlaceHolder1_txtPPAccountmail");
    
    var errorstr="";
    var errorDiv=document.getElementById("Div-ErrorOutPut");
    errorDiv.style.display="none";
    errorDiv.innerHTML="";
    if(FirstName.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the FirstName!";
        }
        else
        {
            errorstr="Please input the FirstName!";
        }
    }
   
    if(LastName.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the LastName!";
        }
        else
        {
            errorstr="Please input the LastName!";
        }
    }
    
    if(Mail.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Email!";
        }
        else
        {
            errorstr="Please input the Email!";
        }
    }
    else
    {
        if(!TestMail.test(Mail.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>You input the mailbox form is not correct!";
            }
            else
            {
                errorstr="You input the mailbox form is not correct!";
            }
        }
    }
    
    if(PPAccountmail.value.length>0)
    {
        if(!TestMail.test(Mail.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>The PayPal Account Email input is not correct!";
            }
            else
            {
                errorstr="The PayPal Account Email input is not correct!";
            }
        }
    }
    else if(bankname.value.length<=0||bankAccountname.value.length<=0||bankAccountid.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the payment!";
        }
        else
        {
            errorstr="Please input the payment!";
        }
    }
    



    if(Address.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Address!";
        }
        else
        {
            errorstr="Please input the Address!";
        }
    }
    if(City.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the City!";
        }
        else
        {
            errorstr="Please input the City!";
        }
    }
    if(Zip.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Zip!";
        }
        else
        {
            errorstr="Please input the Zip!";
        }
    }else
    {
     if(!testZip.test(Zip.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>You input the Post Code is not correct!";
            }
            else
            {
                errorstr="You input the Post Code is not correct!";
            }
        }
    }
    if(country.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please choose the country!";
        }
        else
        {
            errorstr="Please choose the country!";
        }
    }
    if(Tel.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Tel!";
        }
        else
        {
            errorstr="Please input the Tel!";
        }
        
    }else{
    
        if(!testZip.test(Tel.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>You input the Tel is not correct!";
            }
            else
            {
                errorstr="You input the Tel is not correct!";
            }
        }
        }
    if(HomePage.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the HomePage!";
        }
        else
        {
            errorstr="Please input the HomePage!";
        }
    }
    else
    {
        if(!TestHomePage.test(HomePage.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>You input the HomePage is not correct!";
            }
            else
            {
                errorstr="You input the HomePage is not correct!";
            }
        }
    }

    if(Pass.value.length<3||Pass.value.length>=30)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the PassWord!";
        }
        else
        {
            errorstr="Please input the PassWord!";
        }
    }
    if(Passconfirm.value!=Pass.value)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>You input the Password Confirmation is not correct!";
        }
        else
        {
            errorstr="You input the Password Confirmation is not correct!";
        }
    }
    if(cbchk.checked==false)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please checked the Affiliate Program Terms and Conditions!";
        }
        else
        {
            errorstr="Please checked the Affiliate Program Terms and Conditions!";
        }
    }
    if(errorstr.length>0)
    {
        errorDiv.style.display="block";
        errorDiv.innerHTML=errorstr;
        return false;
    }
    IsTrue.value="true";
    return true;
}


function chkeditinput()
{
    var FirstName=document.getElementById("ctl00_ContentPlaceHolder1_txtFirstName");
    var LastName=document.getElementById("ctl00_ContentPlaceHolder1_txtLastName");
    var Mail=document.getElementById("ctl00_ContentPlaceHolder1_txtMail");
    var PPAccountMail=document.getElementById("ctl00_ContentPlaceHolder1_txtPPAccountmail");
    var Address=document.getElementById("ctl00_ContentPlaceHolder1_txtAddress");
    var City=document.getElementById("ctl00_ContentPlaceHolder1_txtCity");
    var Zip=document.getElementById("ctl00_ContentPlaceHolder1_txtZip");
    var country=document.getElementById("country");
    var Tel=document.getElementById("ctl00_ContentPlaceHolder1_txtTel");
    var Fax=document.getElementById("ctl00_ContentPlaceHolder1_txtFax");
    var HomePage=document.getElementById("ctl00_ContentPlaceHolder1_txtHomePage");
    var Passconfirm=document.getElementById("ctl00_ContentPlaceHolder1_txtPassconfirm");
    var cbsletter=document.getElementById("ctl00_ContentPlaceHolder1_cbsletter");
    var TestMail=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
    var TestHomePage=/^http:\/\/([\w-]+\.)+[\w-]+([\w- ./?%&=]*)?$/;
      var testZip=/^[0-9]*$/;
    //var testTel=/^(\d{2,4}[-_－—]?)?\d{3,8}([-_－—]?\d{3,8})?([-_－—]?\d{1,7})?$)|(^0?1[35]\d{9}$/;
   
    var Pass=document.getElementById("ctl00_ContentPlaceHolder1_txtPass");
    var IsTrue=document.getElementById("ctl00_ContentPlaceHolder1_lblChecks");
    
    
    var bankname=document.getElementById("ctl00_ContentPlaceHolder1_txtBankName");
    var bankAccountname=document.getElementById("ctl00_ContentPlaceHolder1_txtBankAccountName");
    var bankAccountid=document.getElementById("ctl00_ContentPlaceHolder1_txtBankAccountNumber");
    var PPAccountmail=document.getElementById("ctl00_ContentPlaceHolder1_txtPPAccountmail");
    
    
    var errorstr="";
    var errorDiv=document.getElementById("Div-ErrorOutPut");
    errorDiv.style.display="none";
    errorDiv.innerHTML="";
    if(FirstName.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the FirstName!";
        }
        else
        {
            errorstr="Please input the FirstName!";
        }
    }
    if(LastName.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the LastName!";
        }
        else
        {
            errorstr="Please input the LastName!";
        }
    }
    
    if(Mail.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Email!";
        }
        else
        {
            errorstr="Please input the Email!";
        }
    }
    else
    {
        if(!TestMail.test(Mail.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>You input the mailbox form is not correc!";
            }
            else
            {
                errorstr="You input the mailbox form is not correc!";
            }
        }
    }
    
    if(PPAccountmail.value.length>0)
    {
        if(!TestMail.test(Mail.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>The PayPal Account Email input is not correct!";
            }
            else
            {
                errorstr="The PayPal Account Email input is not correct!";
            }
        }
    }
    else if(bankname.value.length<=0||bankAccountname.value.length<=0||bankAccountid.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the payment!";
        }
        else
        {
            errorstr="Please input the payment!";
        }
    }

    if(Address.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Address!";
        }
        else
        {
            errorstr="Please input the Address!";
        }
    }
    if(City.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the City!";
        }
        else
        {
            errorstr="Please input the City!";
        }
    }
    if(Zip.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Zip/PostCode!";
        }
        else
        {
            errorstr="Please input the Zip/PostCode!";
        }
    }else
    {
        if(!testZip.test(Zip.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>The Post Code input is not correct!";
            }
            else
            {
                errorstr="The Post Code input is not correct!";
            }
        }
    }
    
    
    if(country.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please choose the country!";
        }
        else
        {
            errorstr="Please choose the country!";
        }
    }
    if(Tel.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the Telphone No.!";
        }
        else
        {
            errorstr="Please input the Telphone No.!";
        }
        
    }else{
        if(!testZip.test(Tel.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>The Tel input is not correct!";
            }
            else
            {
                errorstr="The Tel input is not correct!";
            }
        }
    }
    if(HomePage.value.length<=0)
    {
        if(errorstr.length>0)
        {
            errorstr+="<br>Please input the HomePage!";
        }
        else
        {
            errorstr="Please input the HomePage!";
        }
    }
    else
    {
        if(!TestHomePage.test(HomePage.value))
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>You input the HomePage is not correct!";
            }
            else
            {
                errorstr="You input the HomePage is not correct!";
            }
        }
    }
    if(Pass.value.length>0){
        if(Pass.value.length<3||Pass.value.length>=30)
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>Please input the PassWord!";
            }
            else
            {
                errorstr="Please input the PassWord!";
            }
        }
        if(Passconfirm.value!=Pass.value)
        {
            if(errorstr.length>0)
            {
                errorstr+="<br>You input the Password Confirmation is not correct!";
            }
            else
            {
                errorstr="You input the Password Confirmation is not correct!";
            }
        }
    }

    if(errorstr.length>0)
    {
        errorDiv.style.display="block";
        errorDiv.innerHTML=errorstr;
        return false;
    }

    IsTrue.value="true";
    return true;
}


