  <ol class="one-page-checkout" id="checkoutSteps">
  <li id="opc-billing" class="section allow active custom_login_input_box">
    <div class="step-title">
        <?php echo $text_your_details; ?>
    </div>
    <div id="checkout-step-billing" class="step a-item" style="">
  <table class="form">
  <tr>
    <td><span class="required">*</span> <?php echo $entry_firstname; ?></td>
    <td><input type="text" name="firstname" value="<?php echo $firstname; ?>" class="large-field" /></td>
  </tr>
  <tr>
    <td><span class="required">*</span> <?php echo $entry_lastname; ?></td>
    <td><input type="text" name="lastname" value="<?php echo $lastname; ?>" class="large-field" /></td>

				<tr>
				  <td>Complemento</td>
				  <td><input type="text" name="complemento" value="<?php echo $complemento; ?>" class="large-field" /><br><span class="field-info">&nbsp;(Ex: Ap. 105)</span></td>
				</tr>


				<tr>
				  <td>Local</td>
				  <td><input type="text" name="apelido" value="<?php echo $apelido; ?>" class="large-field" /><br><span class="field-info">&nbsp;(Ex: Casa, Trabalho, etc)</span></td></td>
				</tr>

  </tr>
  <tr>
    <td><?php echo $entry_company; ?></td>
    <td><input type="text" name="company" value="<?php echo $company; ?>" class="large-field" /></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; ?>" class="large-field" /></td>

				<tr>
				  <td><span class="required">*</span> Número</td>
				  <td><input type="text" name="numero" value="<?php echo $numero; ?>" class="large-field numeric" /><br><span class="field-info">&nbsp;(apenas números, sem pontos ou traços)</span></td>
				</tr>

  </tr>
  <tr>
    <td><?php echo $entry_address_2; ?></td>
    <td><input type="text" name="address_2" value="<?php echo $address_2; ?>" class="large-field" /></td>
  </tr>
  <tr>
    <td><span class="required">*</span> <?php echo $entry_city; ?></td>
    <td><input type="text" name="city" value="<?php echo $city; ?>" class="large-field" /></td>
  </tr>
  <tr>
    <td><span id="shipping-postcode-required" class="required">*</span> <?php echo $entry_postcode; ?></td>
    <td>
				<input type="text" name="postcode" maxlength="8" value="<?php echo $postcode; ?>" class="large-field numeric" /><br><span class="field-info">&nbsp;(apenas números, sem pontos ou traços)</span>
			</td>
  </tr>
  <tr>
    <td><span class="required">*</span> <?php echo $entry_country; ?></td>
    <td><select name="country_id" class="large-field">
        <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></td>
  </tr>
  <tr>
    <td><span class="required">*</span> <?php echo $entry_zone; ?></td>
    <td><select name="zone_id" class="large-field">
      </select></td>
  </tr>
</table>
<br />
 <div class="buttons">
      <div>
          <button type="button" value="<?php echo $button_continue; ?>" id="button-guest-shipping" class="button btn-continue" ><span><?php echo $button_continue; ?></span></button>
      </div>
    </div>
    </div>
  </li>

</ol>





<script type="text/javascript">
window.waitEvent('scripts_document', function() {
$('#shipping-address select[name=\'country_id\']').bind('change', function() {
	if (this.value == '') return;
	$.ajax({
		url: 'index.php?route=checkout/checkout/country&country_id=' + this.value,
		dataType: 'json',
		beforeSend: function() {
			$('#shipping-address select[name=\'country_id\']').after('<span class="wait">&nbsp;<img src="assets/img/loading-black.svg" alt="" /></span>');
		},
		complete: function() {
			$('.wait').remove();
		},
		success: function(json) {
			if (json['postcode_required'] == '1') {
				$('#shipping-postcode-required').show();
			} else {
				$('#shipping-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>';
			}

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

$('#shipping-address select[name=\'country_id\']').trigger('change');
});
</script>