﻿function OfficeFocus()
{
    o('row-office').className='current';
}
function OfficeBlur()
{
    //o('row-office').className='';
}
function Next()
{
    var lb=o('dv-company-type-label');
    var lbe=o('dv-company-type-error');
    lbe.style.display='none';
    lb.style.display='';
    if(!IsEmpty(oa('selCompanyType')))
    {sld('dv-main');$.get('RegAgentForm.aspx',{id:oa('selCompanyType'),r:Math.random()},function(c){o('dv-main').style.height='550px';$('#dv-main').html(c);CloseMsgBox();o('Reg_CompanyName').focus();});}
    else
    {
        lbe.style.display='';
        lb.style.display='none';
    }
}
function Submit()
{
    if(ValidateTxt('dv-main') && CheckEmail() && CheckPhone() && CheckFax())
    {
        $.get('Callback.aspx',{type:2,pars:oa('Reg_Email'),r:Math.random()},function(c){
        if(c!='0')
        {o('dv-email-error').style.display='';FC(o('li-email'));o('Reg_Email').className='txtrq';}
        else {
            $.get('Callback.aspx', { type: 1, pars: oa('Reg_LicenseNo'), CompanyType: oa('Reg_CompanyType'), r: Math.random() }, function(c) {
        if(c!='0'){o('dv-license-error').style.display='';FC(o('li-license'));o('Reg_LicenseNo').className='txtrq';}
        else {CommonCall('Common/RegFinish.aspx',0,'dv-main','dv-main','dv-main','Reg_','&r='+Math.random(),'text',"o('dv-main').style.height='320px';");}});
        }});
    }
}
function FC(obj)//focus current
{
    $('li',"#dv-main").each(function (i)
    {
        this.className='';
        if(obj==this){this.className='current';}
    });
}
function CheckPhone()
{
    if(!IsPhone(oa('Reg_Phone'))){o('Reg_Phone').className='txtrq';FC(o('li-phone'));return false;}return true;
}
function CheckFax()
{
    if(IsEmpty(oa('Reg_Fax')))return true;
    if(!IsPhone(oa('Reg_Fax'))){o('Reg_Fax').className='txtrq';FC(o('li-fax'));return false;}return true;
}
function CheckEmail()
{
    if(!IsEmail(oa('Reg_Email'))){o('Reg_Email').className='txtrq';FC(o('li-email'));return false;}
    if(!IsEmpty(oa('Reg_Email')))$.get('Callback.aspx',{type:2,pars:oa('Reg_Email'),r:Math.random()},function(c){if(c!='0'){o('dv-email-tips').style.display='none';o('dv-email-error').style.display='';FC(o('li-email'));o('Reg_Email').className='txtrq';}else o('dv-email-error').style.display='none';o('dv-email-tips').style.display='';o('Reg_Email').className='txt';});
    return true;
}
function CheckLiNo()
{
    if (!IsEmpty(oa('Reg_LicenseNo')) && !IsEmpty(oa('Reg_CompanyType'))) $.get('Callback.aspx', { type: 1, pars: oa('Reg_LicenseNo'), CompanyType: oa('Reg_CompanyType'), r: Math.random() }, function(c) { if (c != '0') { o('dv-license-error').style.display = ''; FC(o('li-license')); o('Reg_LicenseNo').className = 'txtrq'; } else o('dv-license-error').style.display = 'none'; o('Reg_LicenseNo').className = 'txt'; });
}
function chgRead()
{
    var btn=o("btnSub");
    if(o('chkHasReaded').checked)
    {
        btn.style.color="";
        btn.style.cursor="pointer";
        btn.disabled=false;
    }
    else
    {
        btn.style.color="#BFBFBF";
        btn.style.cursor="default";
        btn.disabled=true;
    }
}