<?php echo $header; ?>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <h1><?php echo $heading_title; ?></h1>
  <p><?php echo $text_account_already; ?></p>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
    <h2><?php echo $text_your_details; ?></h2>
    <div class="content">
      <table class="form">
        <tr>
          <td><span class="required">*</span> <?php echo $entry_firstname; ?></td>
          <td><input type="text" name="firstname" value="<?php echo $firstname; ?>" />
            <?php if ($error_firstname) { ?>
            <span class="error"><?php echo $error_firstname; ?></span>
            <?php } ?></td>
        </tr>

				<?php if ($this->config->get('fields_register_brazil_status_sobrenome')){ ?>
          <tr>
            <td><span class="required">*</span> <?php echo $entry_lastname; ?></td>
            <td><input type="text" name="lastname" value="<?php echo $lastname; ?>" />
              <?php if ($error_lastname) { ?>
              <span class="error"><?php echo $error_lastname; ?></span>
              <?php } ?></td>
          </tr>
        <?php } ?>

        <tr>
          <td><span class="required">*</span> <?php echo $entry_email; ?></td>
          <td><input type="text" name="email" value="<?php echo $email; ?>" />
            <?php if ($error_email) { ?>
            <span class="error"><?php echo $error_email; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
          <td>
				<input type="text" name="telephone" value="<?php echo $telephone; ?>" class="phone" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span>

            <?php if ($error_telephone) { ?>
            <span class="error"><?php echo $error_telephone; ?></span>
            <?php } ?></td>
        </tr>

				<?php if ($this->config->get('fields_register_brazil_status_fax')){ ?>
        <tr>
          <td><?php echo $entry_fax; ?></td>
          <td><input type="text" name="fax" value="<?php echo $fax; ?>" class="phone" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span></td>
        </tr>
        <?php } ?>

				<?php if ($this->config->get('fields_register_brazil_status')){ ?>
				<tr>
				  <td>Celular:</td>
				  <td><input type="text" name="celular" id="celular" value="<?php echo $celular ?>" /> <span class="field-info"><br>(apenas números, sem pontos ou traços)</span>	 </td>
				</tr>

        <?php if ($this->config->get('fields_register_brazil_status_sexo')){ ?>
				<tr>
				  <td>Sexo:</td>
				  <td>
				    <?php if ($sexo == 'm'){ ?>
					<input type="radio" name="sexo" checked value="m">Masculino
					<input type="radio" name="sexo" value="f">Feminino
					<?php }else if($sexo == 'f'){ ?>
					<input type="radio" name="sexo" value="m">Masculino
					<input type="radio" name="sexo" checked value="f">Feminino
					<?php }else{ ?>
					<input type="radio" name="sexo" checked value="m">Masculino
					<input type="radio" name="sexo" value="f">Feminino
					<?php } ?>
				  </td>
				</tr>
        <?php } ?>

				<?php if ($this->config->get('fields_register_brazil_status_data')){ ?>
				<tr>
				  <td>Data de Nascimento:</td>
				  <td>
				    <input type="text" name="data_nascimento" value="<?php echo $data_nascimento; ?>" class="date" />
					<?php if ($error_data_nascimento) { ?>
					<span class="error"><?php echo $error_data_nascimento; ?></span>
					<?php } ?>
				  </td>
				</tr>
        <?php } ?>

				<!-- Lista o tipo de pessoas referente ao modulo - por Henrique R. Pohl-->
				<?php if ($fields_register_brazil_tipo_de_pessoa == 'F') { ?>
					<tr class="pessoa_fisica">
				  <td><span class="required">*</span> CPF:</td>
				  <td>
				    <input type="hidden" name="pessoa" id="fisica" checked value="fisica">
				    <input type="text" name="cpf" id="cpf" value="<?php echo $cpf; ?>" class="cpf" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span>
					<?php if ($error_cpf) { ?>
					<span class="error"><?php echo $error_cpf; ?></span>
					<?php } ?>
				  </td>
				</tr>
				<tr class="pessoa_fisica">
				  <td>RG:</td>
				  <td><input type="text" name="rg" id="rg" value="<?php echo $rg; ?>" class="numeric" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span></td>
				</tr>
				<?php } ?>

				<?php if ($fields_register_brazil_tipo_de_pessoa == 'J') { ?>

				<tr class="pessoa_juridica">
				  <td><span class="required">*</span> CNPJ:</td>
				  <td>
				    <input type="hidden" id="juridica" name="pessoa" value="juridica">
				    <input type="text" name="cnpj" id="cnpj" value="<?php echo $cnpj; ?>" class="cnpj" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span>
					<?php if($error_cnpj){ ?>
					<span class="error"><?php echo $error_cnpj; ?></span>
					<?php } ?>
				  </td>

          <?php if ($this->config->get('fields_register_brazil_status_regime')) { ?>
            <tr class="pessoa_juridica">
  				  <td>Perfil:</td>
  				  <td>
  				    <?php if($perfil == '0'){ ?>
    					<input type="radio" name="perfil" id="nenhum" checked value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php }else if($perfil == '1'){ ?>
    					<input type="radio" name="perfil" id="nenhum"  value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA" checked value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php }else if($perfil == '2'){ ?>
    					<input type="radio" name="perfil" id="nenhum"  value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional" checked value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php }else if($perfil == '3'){ ?>
    					<input type="radio" name="perfil" id="nenhum"  value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal" checked value="3">Lucro Real
    					<?php }else{ ?>
    					<input type="radio" name="perfil" id="nenhum" checked value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php } ?>
  				  </td>
            </tr>
            <?php }else{ ?>
              <tr class="pessoa_juridica">
                <td style="display: none;"><input type="radio" name="perfil" id="simplesnacional" checked value="2" >Simples Nacional</td>
              </tr>
            <?php } ?>
				</tr>
				<tr class="pessoa_juridica">
				  <td><span class="required">*</span>Razão Social:</td>
				  <td><input type="text" name="razao_social" id="razao_social" value="<?php echo $razao_social; ?>">
				  <?php if ($error_razao_social) { ?>
				  <span class="error"><?php echo $error_razao_social; ?></span>
				  <?php } ?>
				  </td>
				</tr>
				<tr class="pessoa_juridica">
				  <td>Inscrição Estadual:</td>
				  <td><input type="text" name="inscricao_estadual" MaxLength="20" id="inscricao_estadual" value="<?php echo $inscricao_estadual; ?>" class="alphanumeric" maxlength="20" />
            <label>
              <div class="tm-checkbox"><input type="checkbox" id="isento" name="isento" <?php if ($inscricao_estadual == 'ISENTO'){ echo ' checked="checked" readonly';};?>></div>
              <span><b>Isento</b></span>
            </label>   
            <script>
              $('#isento').on('change', function() {
                if($(this).prop('checked')) {
                  $('#inscricao_estadual').val('ISENTO').prop('readonly', true);
                } else {
                  $('#inscricao_estadual').prop('readonly', false).val('');
                }
              });
            </script>   
            <span class="field-info">(apenas números, sem pontos ou traços)</span>
            <?php if ($error_inscricao_estadual) { ?>
            <span class="error"><?php echo $error_inscricao_estadual; ?></span>
            <?php } ?>                               
          </td>      
        </tr>

				<?php } ?>
				<?php if ($fields_register_brazil_tipo_de_pessoa == 'A') { ?>
				<tr>
				  <td>Tipo:</td>
				  <td>
				    <?php if($pessoa == 'fisica'){ ?>
					<input type="radio" name="pessoa" id="fisica" checked value="fisica">Pessoa Física
					<input type="radio" id="juridica" name="pessoa" value="juridica">Pessoa Jurídica
					<?php }else if($pessoa == 'juridica'){ ?>
					<input type="radio" name="pessoa" id="fisica" value="fisica">Pessoa Física
					<input type="radio" id="juridica" name="pessoa" checked value="juridica">Pessoa Jurídica
					<?php }else{ ?>
					<input type="radio" name="pessoa" id="fisica" checked value="fisica">Pessoa Física
					<input type="radio" id="juridica" name="pessoa" value="juridica">Pessoa Jurídica
					<?php } ?>
				  </td>
				</tr>
				<tr class="pessoa_fisica">
				  <td><span class="required">*</span> CPF:</td>
				  <td>
				    <input type="text" name="cpf" id="cpf" value="<?php echo $cpf; ?>" class="cpf" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span>
					<?php if ($error_cpf) { ?>
					<span class="error"><?php echo $error_cpf; ?></span>
					<?php } ?>
				  </td>
				</tr>
				<tr class="pessoa_fisica">
				  <td>RG:</td>
				  <td><input type="text" name="rg" id="rg" value="<?php echo $rg; ?>" class="numeric" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span></td>
				</tr>
				<tr class="pessoa_juridica">
				  <td><span class="required">*</span> CNPJ:</td>
				  <td>
				    <input type="text" name="cnpj" id="cnpj" value="<?php echo $cnpj; ?>" class="cnpj" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span>
					<?php if($error_cnpj){ ?>
					<span class="error"><?php echo $error_cnpj; ?></span>
					<?php } ?>
				  </td>

          <?php if ($this->config->get('fields_register_brazil_status_regime')) { ?>
  				  <tr class="pessoa_juridica">
    				  <td>Perfil:</td>
    				  <td>
    				    <?php if($perfil == '0'){ ?>
    					<input type="radio" name="perfil" id="nenhum" checked value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php }else if($perfil == '1'){ ?>
    					<input type="radio" name="perfil" id="nenhum"  value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA" checked value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php }else if($perfil == '2'){ ?>
    					<input type="radio" name="perfil" id="nenhum"  value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional" checked value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php }else if($perfil == '3'){ ?>
    					<input type="radio" name="perfil" id="nenhum"  value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal" checked value="3">Lucro Real
    					<?php }else{ ?>
    					<input type="radio" name="perfil" id="nenhum" checked value="0">Nenhum
    					<input type="radio" name="perfil" id="lucropresumidoRPA"  value="1">Lucro Presumido/RPA
    					<input type="radio" name="perfil" id="simplesnacional"  value="2">Simples Nacional
    					<input type="radio" name="perfil" id="lucroreal"  value="3">Lucro Real
    					<?php } ?>
    				  </td>
  				  </tr>
          <?php }else{ ?>
						<tr class="pessoa_juridica">
							<td style="display: none;"><input type="radio" name="perfil" id="simplesnacional" checked value="2" >Simple Nacional</td>
						</tr>
          <?php } ?>
				</tr>
				<tr class="pessoa_juridica">
				  <td><span class="required">*</span>Razão Social:</td>
				  <td><input type="text" name="razao_social" id="razao_social" value="<?php echo $razao_social; ?>">
				  <?php if ($error_razao_social) { ?>
				  <span class="error"><?php echo $error_razao_social; ?></span>
				  <?php } ?>
				  </td>
				</tr>
        <tr class="pessoa_juridica">
				  <td>Inscrição Estadual:</td>
				  <td><input type="text" name="inscricao_estadual" MaxLength="20" id="inscricao_estadual" value="<?php echo $inscricao_estadual; ?>" class="alphanumeric" maxlength="20" />
            <label>
              <div class="tm-checkbox"><input type="checkbox" id="isento" name="isento" <?php if ($inscricao_estadual == 'ISENTO'){ echo ' checked="checked" readonly';};?>></div>
              <span><b>Isento</b></span>
            </label>   
            <script>
              $('#isento').on('change', function() {
                if($(this).prop('checked')) {
                  $('#inscricao_estadual').val('ISENTO').prop('readonly', true);
                } else {
                  $('#inscricao_estadual').prop('readonly', false).val('');
                }
              });
            </script>   
            <span class="field-info">(apenas números, sem pontos ou traços)</span>
            <?php if ($error_inscricao_estadual) { ?>
            <span class="error"><?php echo $error_inscricao_estadual; ?></span>
            <?php } ?>                               
          </td>      
        </tr>
				<?php } ?>
				<?php } ?>


      </table>
    </div>
    <h2><?php echo $text_your_address; ?></h2>
    <div class="content">
      <table class="form">

				<?php if ($this->config->get('fields_register_brazil_status')){ ?>
				<tr>
				  <td>Local:</td>
				  <td><input type="text" name="apelido" value="<?php echo $apelido; ?>" /><span class="field-info"><br>(Ex: Casa, Trabalho, etc)</span></td>
				</tr>
				<?php } ?>

        <tr>


			  <?php echo ''; ?>



			  <input type="hidden" name="company" value="<?php echo $company; ?>" />

        </tr>
        <tr style="display: <?php echo (count($customer_groups) > 1 ? 'table-row' : 'none'); ?>;">
          <td><?php echo $entry_customer_group; ?></td>
          <td><?php foreach ($customer_groups as $customer_group) { ?>
            <?php if ($customer_group['customer_group_id'] == $customer_group_id) { ?>
            <input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" id="customer_group_id<?php echo $customer_group['customer_group_id']; ?>" checked="checked" />
            <label for="customer_group_id<?php echo $customer_group['customer_group_id']; ?>"><?php echo $customer_group['name']; ?></label>
            <br />
            <?php } else { ?>
            <input type="radio" name="customer_group_id" value="<?php echo $customer_group['customer_group_id']; ?>" id="customer_group_id<?php echo $customer_group['customer_group_id']; ?>" />
            <label for="customer_group_id<?php echo $customer_group['customer_group_id']; ?>"><?php echo $customer_group['name']; ?></label>
            <br />
            <?php } ?>
            <?php } ?></td>
        </tr>
        <tr id="company-id-display">


			  <?php echo ''; ?>



			  <input type="hidden" name="company_id" value="<?php echo $company_id; ?>" />





        <tr id="tax-id-display">
          <td><span id="tax-id-required" class="required">*</span> <?php echo $entry_tax_id; ?></td>
          <td><input type="text" name="tax_id" value="<?php echo $tax_id; ?>" />
            <?php if ($error_tax_id) { ?>
            <span class="error"><?php echo $error_tax_id; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><span class="required">*</span> <?php echo $entry_address_1; ?></td>
          <td><input type="text" name="address_1" value="<?php echo $address_1; ?>"  maxlength="70"/>
            <?php if ($error_address_1) { ?>
            <span class="error"><?php echo $error_address_1; ?></span>
            <?php } ?></td>
        </tr>

				<?php if ($this->config->get('fields_register_brazil_status')){ ?>
				<tr>
				  <td><span class="required">*</span> Número:</td>
				  <td><input type="text" name="numero" value="<?php echo $numero; ?>" class="numeric" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span>
					<?php if ($error_numero) { ?>
					<span class="error"><?php echo $error_numero; ?></span>
					<?php } ?></td>
				</tr>
				<?php } ?>

        <tr>
          <td><?php echo $entry_address_2; ?></td>
          <td><input type="text" name="address_2" value="<?php echo $address_2; ?>" /></td>
        </tr>

				<?php if ($this->config->get('fields_register_brazil_status')){ ?>
				<tr>
				  <td>Complemento:</td>
				  <td><input type="text" name="complemento" value="<?php echo $complemento; ?>" /><span class="field-info"><br>(Ex: Ap. 105)</span></td>
				</tr>
				<?php } ?>

        <tr>
          <td><span class="required">*</span> <?php echo $entry_city; ?></td>
          <td><input type="text" name="city" value="<?php echo $city; ?>" maxlength="50"/>
            <?php if ($error_city) { ?>
            <span class="error"><?php echo $error_city; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><span id="postcode-required" class="required">*</span> <?php echo $entry_postcode; ?></td>
          <td>
				<input type="text" name="postcode" MaxLength="10" value="<?php echo $postcode; ?>" class="js-mask-postcode" /><span class="field-info"><br>(apenas números, sem pontos ou traços)</span>

            <?php if ($error_postcode) { ?>
            <span class="error"><?php echo $error_postcode; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><span class="required">*</span> <?php echo $entry_country; ?></td>
          <td><select name="country_id">
              <option value=""><?php echo $text_select; ?></option>
              <?php foreach ($countries as $country) { ?>
              <?php if ($country['country_id'] == $country_id) { ?>
              <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
              <?php } ?>
              <?php } ?>
            </select>
            <?php if ($error_country) { ?>
            <span class="error"><?php echo $error_country; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><span class="required">*</span> <?php echo $entry_zone; ?></td>
          <td><select name="zone_id">
            </select>
            <?php if ($error_zone) { ?>
            <span class="error"><?php echo $error_zone; ?></span>
            <?php } ?></td>
        </tr>
      </table>
    </div>
    <h2><?php echo $text_your_password; ?></h2>
    <div class="content">
      <table class="form">
        <tr>
          <td><span class="required">*</span> <?php echo $entry_password; ?></td>
          <td><input type="password" name="password" value="<?php echo $password; ?>" />
            <?php if ($error_password) { ?>
            <span class="error"><?php echo $error_password; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><span class="required">*</span> <?php echo $entry_confirm; ?></td>
          <td><input type="password" name="confirm" value="<?php echo $confirm; ?>" />
            <?php if ($error_confirm) { ?>
            <span class="error"><?php echo $error_confirm; ?></span>
            <?php } ?></td>
        </tr>
      </table>
    </div>
    <?php if ($customer_interests_remember) { ?>
      <h2><?php echo $text_interests; ?></h2>
      <div class="content">
        <div class="form">
          <?php echo $interests_categories ?>
        </div>
      </div>
    <?php } ?>

    <h2><?php echo $text_newsletter; ?></h2>
    <div class="content">
      <table class="form">
        <tr>
          <td><?php echo $entry_newsletter; ?></td>
          <td><?php if ($newsletter) { ?>
            <input type="radio" name="newsletter" value="1" checked="checked" />
            <?php echo $text_yes; ?>
            <input type="radio" name="newsletter" value="0" />
            <?php echo $text_no; ?>
            <?php } else { ?>
            <input type="radio" name="newsletter" value="1" />
            <?php echo $text_yes; ?>
            <input type="radio" name="newsletter" value="0" checked="checked" />
            <?php echo $text_no; ?>
            <?php } ?></td>
        </tr>
      </table>
    </div>
  <input type="hidden" name="remember" value="0">
  <?php if ($text_agree) { ?>
  <div class="buttons">
    <div class="right"><?php echo $text_agree; ?>
      <?php if ($agree) { ?>
      <input type="checkbox" name="agree" value="1" checked="checked" />
      <?php } else { ?>
      <input type="checkbox" name="agree" value="1" />
      <?php } ?>
      <input type="submit" value="<?php echo $button_continue; ?>" class="button" />
    </div>
  </div>
  <?php } else { ?>
  <div class="buttons">
    <div class="right">
      <input type="submit" value="<?php echo $button_continue; ?>" class="button" />
    </div>
  </div>
  <?php } ?>
</form>
<?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
$('input[name=\'customer_group_id\']:checked').live('change', function() {
	var customer_group = [];

<?php foreach ($customer_groups as $customer_group) { ?>
	customer_group[<?php echo $customer_group['customer_group_id']; ?>] = [];
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['company_id_display'] = '<?php echo $customer_group['company_id_display']; ?>';
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['company_id_required'] = '<?php echo $customer_group['company_id_required']; ?>';
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['tax_id_display'] = '<?php echo $customer_group['tax_id_display']; ?>';
	customer_group[<?php echo $customer_group['customer_group_id']; ?>]['tax_id_required'] = '<?php echo $customer_group['tax_id_required']; ?>';
<?php } ?>

	if (customer_group[this.value]) {
		if (customer_group[this.value]['company_id_display'] == '1') {
			$('#company-id-display').show();
		} else {
			$('#company-id-display').hide();
		}

		if (customer_group[this.value]['company_id_required'] == '1') {
			$('#company-id-required').show();
		} else {
			$('#company-id-required').hide();
		}

		if (customer_group[this.value]['tax_id_display'] == '1') {
			$('#tax-id-display').show();
		} else {
			$('#tax-id-display').hide();
		}

		if (customer_group[this.value]['tax_id_required'] == '1') {
			$('#tax-id-required').show();
		} else {
			$('#tax-id-required').hide();
		}
	}
});

$('input[name=\'customer_group_id\']:checked').trigger('change');
//--></script>
<script type="text/javascript"><!--
$('select[name=\'country_id\']').bind('change', function() {
	$.ajax({
		url: 'index.php?route=account/register/country&country_id=' + this.value,
		dataType: 'json',
		beforeSend: function() {
			$('select[name=\'country_id\']').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
		},
		complete: function() {
			$('.wait').remove();
		},
		success: function(json) {
			if (json['postcode_required'] == '1') {
				$('#postcode-required').show();
			} else {
				$('#postcode-required').hide();
			}

			html = '<option value=""><?php echo $text_select; ?></option>';

			if (json['zone'] != '') {
				for (i = 0; i < json['zone'].length; i++) {
        			html += '<option value="' + json['zone'][i]['zone_id'] + '"';

					if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') {
	      				html += ' selected="selected"';
	    			}

	    			html += '>' + json['zone'][i]['name'] + '</option>';
				}
			} else {
				html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
			}

			$('select[name=\'zone_id\']').html(html);
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});

$('select[name=\'country_id\']').trigger('change');
//--></script>
<script type="text/javascript"><!--
$(document).ready(function() {

   $('.politica').live('click',function(){
		var url= '<?php echo $agree_Politica_privacidade; ?>';

		$.ajax({
			url : url ,
			dataType: 'HTML',
			success : function(html){
				$.fancybox({
				    maxheigh    : '90%',
					maxWidth    : '90%',
					height      : '50%',
					width       : '50%',
					opacity     : 0.5,
					fitToView   : false,
					autoSize    : true,
					closeClick  : false,
					openEffect  : 'none',
					closeEffect : 'none',
					href		: false,
					loop		: false,
					scrolling   : true,
					content     : html
				});
			},
            error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
            }
	    });
    });

});
//--></script>
<?php echo $footer; ?>
