<div class="row form-register">



	<div class="col-sm-6">

		<fieldset id="address">
			<legend><?php echo $text_your_address; ?></legend>
			<div class="form-group required" <?php if ($config_campo_pais == '0') { echo('style="display:none"'); } ?> >
				<label class="control-label" for="input-payment-country"><?php echo $entry_country; ?></label>
				<select name="country_id" id="input-payment-country" class="form-control input-country">
					<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>
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-postcode"><?php echo $entry_postcode; ?></label>
				<input type="tel" inputmode="numeric" name="postcode" maxlength="10" value="<?php echo $postcode; ?>" placeholder="<?php echo $entry_postcode; ?>" id="input-payment-postcode" class="form-control input-postcode mask-postcode" />
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-address-1"><?php echo $entry_address_1; ?></label>
				<input type="text" name="address_1" maxlength="128" value="" placeholder="<?php echo $entry_address_1; ?>" id="input-payment-address-1" class="form-control input-address-1" />
			</div>
			<div class="fieldset-brasil">
				<div class="form-group required">
					<label class="control-label" for="input-payment-numero"><?php echo $entry_numero; ?></label>
					<input type="text" inputmode="numeric" name="custom_field[address][numero]" maxlength="10" value="" placeholder="<?php echo $entry_numero; ?>" id="input-payment-numero" class="form-control input-numero" />
				</div>
				<div class="form-group">
					<label class="control-label" for="input-payment-complemento"><?php echo $entry_complemento; ?></label>
					<input type="text" name="custom_field[address][complemento]" maxlength="14" value="" placeholder="<?php echo $entry_complemento; ?>" id="input-payment-complemento" class="form-control input-complemento" />
				</div>
			</div>
			<div class="form-group">
				<label class="control-label" for="input-payment-address-2"><?php echo $entry_address_2; ?></label>
				<input type="text" name="address_2" maxlength="128" value="" placeholder="<?php echo $entry_address_2; ?>" id="input-payment-address-2" class="form-control input-address-2" />
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-city"><?php echo $entry_city; ?></label>
				<input type="text" name="city" maxlength="128" value="" placeholder="<?php echo $entry_city; ?>" id="input-payment-city" class="form-control input-city" />
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-zone"><?php echo $entry_zone; ?></label>
				<select name="zone_id" id="input-payment-zone" class="form-control input-zone">
				</select>
			</div>
			<div class="form-group">
				<label class="control-label" for="input-payment-company"><?php echo $entry_company; ?></label>
				<input type="text" name="company" maxlength="40" value="" placeholder="<?php echo $entry_company; ?>" id="input-payment-company" class="form-control input-company" />
			</div>

			<?php foreach ($custom_fields as $custom_field) { ?>
			<?php if ($custom_field['location'] == 'address') { ?>
			<?php if ($custom_field['type'] == 'select') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<select name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control">
					<option value=""><?php echo $text_select; ?></option>
					<?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
					<option value="<?php echo $custom_field_value['custom_field_value_id']; ?>"><?php echo $custom_field_value['name']; ?></option>
					<?php } ?>
				</select>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'radio') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label"><?php echo $custom_field['name']; ?></label>
				<div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>">
					<?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
					<div class="radio">
						<label>
							<input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" />
							<?php echo $custom_field_value['name']; ?></label>
					</div>
					<?php } ?>
				</div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'checkbox') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label"><?php echo $custom_field['name']; ?></label>
				<div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>">
					<?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
					<div class="checkbox">
						<label>
							<input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" />
							<?php echo $custom_field_value['name']; ?></label>
					</div>
					<?php } ?>
				</div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'text') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'textarea') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<textarea name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" rows="5" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control"><?php echo $custom_field['value']; ?></textarea>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'file') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label"><?php echo $custom_field['name']; ?></label>
				<br />
				<button type="button" id="button-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button>
				<input type="hidden" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" />
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'date') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<div class="input-group date">
					<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
					<span class="input-group-btn">
					<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
					</span></div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'time') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<div class="input-group time">
					<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
					<span class="input-group-btn">
					<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
					</span></div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'datetime') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<div class="input-group datetime">
					<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
					<span class="input-group-btn">
					<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
					</span></div>
			</div>
			<?php } ?>
			<?php } ?>
			<?php } ?>
		</fieldset>

	</div>



	<div class="col-sm-6">

		<fieldset id="account">
			<legend><?php echo $text_your_details; ?></legend>
			<div class="form-group" style="display: <?php echo (count($customer_groups) > 1 ? 'block' : 'none'); ?>;">
				<label class="control-label"><?php echo $entry_customer_group; ?></label>
				<div id="input-customer-group">
					<?php foreach ($customer_groups as $customer_group) { ?>
					<?php if ($customer_group['customer_group_id'] == $customer_group_id || count($customer_groups) == 1) { ?>
						<label class="radio-inline">
							<input type="radio" name="customer_group_id" class="input-customer-group" value="<?php echo $customer_group['customer_group_id']; ?>" checked="checked" />
							<?php echo $customer_group['name']; ?></label>
					<?php } else { ?>
						<label class="radio-inline">
							<input type="radio" name="customer_group_id" class="input-customer-group" value="<?php echo $customer_group['customer_group_id']; ?>" />
							<?php echo $customer_group['name']; ?></label>
					<?php } ?>
					<?php } ?>
				</div>
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-firstname"><?php echo $entry_firstname; ?></label>
				<input type="text" name="firstname" maxlength="32" value="" placeholder="<?php echo $entry_firstname; ?>" id="input-payment-firstname" class="form-control input-firstname" />
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-lastname"><?php echo $entry_lastname; ?></label>
				<input type="text" name="lastname" maxlength="32" value="" placeholder="<?php echo $entry_lastname; ?>" id="input-payment-lastname" class="form-control input-lastname" />
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-email"><?php echo $entry_email; ?></label>
				<input type="email" name="email" value="" placeholder="<?php echo $entry_email; ?>" id="input-payment-email" class="form-control input-email" />
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-telephone"><?php echo $entry_telephone; ?></label>
				<input type="tel" name="telephone" maxlength="32" value="" placeholder="<?php echo $entry_telephone; ?>" id="input-payment-telephone" class="form-control input-telephone mask-phone" />
			</div>
			<?php if ($config_campo_celular > 0) { ?>
			<div class="form-group <?php if ($config_campo_celular == 1) { echo('required'); } ?>">
				<label class="control-label" for="input-payment-celular"><?php echo $entry_celular; ?></label>
				<input type="tel" name="custom_field[account][celular]" maxlength="32" value="" placeholder="<?php echo $entry_celular; ?>" id="input-payment-celular" class="form-control input-celular mask-phone" />
			</div>
			<?php } ?>

			<?php /* ?>
			<div class="form-group">
				<label class="control-label" for="input-payment-fax"><?php echo $entry_fax; ?></label>
				<input type="tel" name="fax" maxlength="32" value="" placeholder="<?php echo $entry_fax; ?>" id="input-payment-fax" class="form-control input-fax mask-phone" />
			</div>
			<?php */ ?>
			<input type="hidden" name="fax" value="" />

			<?php if ($config_campo_sexo > 0) { ?>
			<div class="form-group <?php if ($config_campo_sexo == 1) { echo('required'); } ?>">
				<label class="control-label"><?php echo $entry_sexo; ?></label>
				<div id="input-payment-sexo">
					<label class="radio-inline">
						<input type="radio" name="custom_field[account][sexo]" value="f" class="input-sexo" />
						<?php echo $entry_sexo_f; ?></label>
					<label class="radio-inline">
						<input type="radio" name="custom_field[account][sexo]" value="m" class="input-sexo" />
						<?php echo $entry_sexo_m; ?></label>
				</div>
			</div>
			<?php } ?>
			<?php if ($config_campo_nascimento > 0) { ?>
			<div class="form-group <?php if ($config_campo_nascimento == 1) { echo('required'); } ?>">
				<label class="control-label" for="input-payment-nascimento"><?php echo $entry_nascimento; ?></label>
				<div class="input-group birth">
					<input type="text" inputmode="numeric" name="custom_field[account][nascimento]" value="" placeholder="<?php echo $entry_nascimento; ?>" data-date-format="YYYY-MM-DD" id="input-payment-nascimento" class="form-control input-nascimento" />
					<span class="input-group-btn">
					<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
					</span></div>
			</div>
			<?php } ?>
			<div class="fieldset-brasil">
				<div class="form-group required" style="display: <?php echo ($config_campo_pessoa == 'fj' ? 'block' : 'none'); ?>;">
					<label class="control-label"><?php echo $entry_tipo; ?></label>
					<div id="input-payment-tipo">
						<label class="radio-inline">
							<input type="radio" name="custom_field[account][tipo]" value="f" class="input-tipo" <?php if ($config_campo_pessoa == 'f') { echo('checked'); } ?> />
							<?php echo $entry_tipo_fisica; ?></label>
						<label class="radio-inline">
							<input type="radio" name="custom_field[account][tipo]" value="j" class="input-tipo" <?php if ($config_campo_pessoa == 'j') { echo('checked'); } ?> />
							<?php echo $entry_tipo_juridica; ?></label>
					</div>
				</div>
				<?php if ($config_campo_pessoa == 'fj' || $config_campo_pessoa == 'f') { ?>
				<div class="fieldset-pessoa-fisica">
					<div class="form-group required">
						<label class="control-label" for="input-payment-cpf"><?php echo $entry_cpf; ?></label>
						<input type="tel" inputmode="numeric" name="custom_field[account][cpf]" value="" placeholder="<?php echo $entry_cpf; ?>" id="input-payment-cpf" class="form-control input-cpf mask-cpf" />
					</div>
					<?php if ($config_campo_rg > 0) { ?>
					<div class="form-group <?php if ($config_campo_rg == 1) { echo('required'); } ?>">
						<label class="control-label" for="input-payment-rg"><?php echo $entry_rg; ?></label>
						<input type="tel" inputmode="numeric" name="custom_field[account][rg]" maxlength="20" value="" placeholder="<?php echo $entry_rg; ?>" id="input-payment-rg" class="form-control input-rg" />
					</div>
					<?php } ?>
				</div>
				<?php } ?>
				<?php if ($config_campo_pessoa == 'fj' || $config_campo_pessoa == 'j') { ?>
				<div class="fieldset-pessoa-juridica">
					<div class="form-group required">
						<label class="control-label" for="input-payment-razao"><?php echo $entry_razao; ?></label>
						<input type="text" name="custom_field[account][razao]" maxlength="64" value="" placeholder="<?php echo $entry_razao; ?>" id="input-payment-razao" class="form-control input-razao" />
					</div>
					<div class="form-group required">
						<label class="control-label" for="input-payment-cnpj"><?php echo $entry_cnpj; ?></label>
						<input type="tel" inputmode="numeric" name="custom_field[account][cnpj]" value="" placeholder="<?php echo $entry_cnpj; ?>" id="input-payment-cnpj" class="form-control input-cnpj mask-cnpj" />
					</div>
					<?php if ($config_campo_ie > 0) { ?>
					<div class="form-group <?php if ($config_campo_ie == 1) { echo('required'); } ?>">
						<label class="control-label" for="input-payment-ie"><?php echo $entry_ie; ?></label>
						<input type="tel" inputmode="numeric" name="custom_field[account][ie]" maxlength="20" value="" placeholder="<?php echo $entry_ie; ?>" id="input-payment-ie" class="form-control input-ie" />
					</div>
					<?php } ?>
					<?php if ($config_campo_im > 0) { ?>
					<div class="form-group <?php if ($config_campo_im == 1) { echo('required'); } ?>">
						<label class="control-label" for="input-payment-im"><?php echo $entry_im; ?></label>
						<input type="tel" inputmode="numeric" name="custom_field[account][im]" maxlength="20" value="" placeholder="<?php echo $entry_im; ?>" id="input-payment-im" class="form-control input-im" />
					</div>
					<?php } ?>
				</div>
				<?php } ?>
			</div>

			<?php foreach ($custom_fields as $custom_field) { ?>
			<?php if ($custom_field['location'] == 'account') { ?>
			<?php if ($custom_field['type'] == 'select') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<select name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control">
					<option value=""><?php echo $text_select; ?></option>
					<?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
					<option value="<?php echo $custom_field_value['custom_field_value_id']; ?>"><?php echo $custom_field_value['name']; ?></option>
					<?php } ?>
				</select>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'radio') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label"><?php echo $custom_field['name']; ?></label>
				<div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>">
					<?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
					<div class="radio">
						<label>
							<input type="radio" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" />
							<?php echo $custom_field_value['name']; ?></label>
					</div>
					<?php } ?>
				</div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'checkbox') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label"><?php echo $custom_field['name']; ?></label>
				<div id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>">
					<?php foreach ($custom_field['custom_field_value'] as $custom_field_value) { ?>
					<div class="checkbox">
						<label>
							<input type="checkbox" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>][]" value="<?php echo $custom_field_value['custom_field_value_id']; ?>" />
							<?php echo $custom_field_value['name']; ?></label>
					</div>
					<?php } ?>
				</div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'text') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'textarea') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<textarea name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" rows="5" placeholder="<?php echo $custom_field['name']; ?>" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control"><?php echo $custom_field['value']; ?></textarea>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'file') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label"><?php echo $custom_field['name']; ?></label>
				<br />
				<button type="button" id="button-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button>
				<input type="hidden" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" />
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'date') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<div class="input-group date">
					<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
					<span class="input-group-btn">
					<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
					</span></div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'time') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<div class="input-group time">
					<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
					<span class="input-group-btn">
					<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
					</span></div>
			</div>
			<?php } ?>
			<?php if ($custom_field['type'] == 'datetime') { ?>
			<div id="payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-group custom-field" data-sort="<?php echo $custom_field['sort_order']; ?>">
				<label class="control-label" for="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>"><?php echo $custom_field['name']; ?></label>
				<div class="input-group datetime">
					<input type="text" name="custom_field[<?php echo $custom_field['location']; ?>][<?php echo $custom_field['custom_field_id']; ?>]" value="<?php echo $custom_field['value']; ?>" placeholder="<?php echo $custom_field['name']; ?>" data-date-format="YYYY-MM-DD HH:mm" id="input-payment-custom-field<?php echo $custom_field['custom_field_id']; ?>" class="form-control" />
					<span class="input-group-btn">
					<button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
					</span></div>
			</div>
			<?php } ?>
			<?php } ?>
			<?php } ?>
		</fieldset>

		<fieldset>
			<legend><?php echo $text_your_password; ?></legend>
			<div class="form-group required">
				<label class="control-label" for="input-payment-password"><?php echo $entry_password; ?></label>
				<input type="password" name="password" value="" placeholder="<?php echo $entry_password; ?>" id="input-payment-password" class="form-control" />
			</div>
			<div class="form-group required">
				<label class="control-label" for="input-payment-confirm"><?php echo $entry_confirm; ?></label>
				<input type="password" name="confirm" value="" placeholder="<?php echo $entry_confirm; ?>" id="input-payment-confirm" class="form-control" />
			</div>
		</fieldset>

	</div>



</div>
<div class="checkbox">
	<label for="newsletter">
		<input type="checkbox" name="newsletter" value="1" id="newsletter" />
		<?php echo $entry_newsletter; ?></label>
</div>
<?php if ($shipping_required) { ?>
<div class="checkbox">
	<label>
		<input type="checkbox" name="shipping_address" value="1" checked="checked" />
		<?php echo $entry_shipping; ?></label>
</div>
<?php } ?>
<?php if ($text_agree) { ?>
<div class="buttons clearfix">
	<div class="pull-right"><?php echo $text_agree; ?> &nbsp;
		<input type="checkbox" name="agree" value="1" />
		<input type="button" value="<?php echo $button_continue; ?>" id="button-register" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary" />
	</div>
</div>
<?php } else { ?>
<div class="buttons clearfix">
	<div class="pull-right">
		<input type="button" value="<?php echo $button_continue; ?>" id="button-register" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary" />
	</div>
</div>
<?php } ?>
<script type="text/javascript"><!--
// Sort the custom fields
sortCustomFields( $('#account') );
sortCustomFields( $('#address') );

$('#collapse-payment-address input[name=\'customer_group_id\']').on('change', function() {
	$.ajax({
		url: 'index.php?route=checkout/checkout/customfield&customer_group_id=' + this.value,
		dataType: 'json',
		success: function(json) {
			$('#collapse-payment-address .custom-field').hide();
			$('#collapse-payment-address .custom-field').removeClass('required');

			for (i = 0; i < json.length; i++) {
				custom_field = json[i];

				$('#payment-custom-field' + custom_field['custom_field_id']).show();

				if (custom_field['required']) {
					$('#payment-custom-field' + custom_field['custom_field_id']).addClass('required');
				}
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});

$('#collapse-payment-address input[name=\'customer_group_id\']:checked').trigger('change');
//--></script>
<script type="text/javascript"><!--
$('#collapse-payment-address button[id^=\'button-payment-custom-field\']').on('click', function() {
	var node = this;

	$('#form-upload').remove();

	$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');

	$('#form-upload input[name=\'file\']').trigger('click');

	if (typeof timer != 'undefined') {
			clearInterval(timer);
	}

	timer = setInterval(function() {
		if ($('#form-upload input[name=\'file\']').val() != '') {
			clearInterval(timer);

			$.ajax({
				url: 'index.php?route=tool/upload',
				type: 'post',
				dataType: 'json',
				data: new FormData($('#form-upload')[0]),
				cache: false,
				contentType: false,
				processData: false,
				beforeSend: function() {
					$(node).button('loading');
				},
				complete: function() {
					$(node).button('reset');
				},
				success: function(json) {
					$('.text-danger').remove();

					if (json['error']) {
						$(node).parent().find('input[name^=\'custom_field\']').after('<div class="text-danger">' + json['error'] + '</div>');
					}

					if (json['success']) {
						alert(json['success']);

						$(node).parent().find('input[name^=\'custom_field\']').attr('value', json['code']);
					}
				},
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
				}
			});
		}
	}, 500);
});
//--></script>
<script type="text/javascript"><!--
$('#collapse-payment-address select[name=\'country_id\']').on('change', function() {
	$.ajax({
		url: 'index.php?route=checkout/checkout/country&country_id=' + this.value,
		dataType: 'json',
		beforeSend: function() {
			$('#collapse-payment-address select[name=\'country_id\']').after(' <i class="fa fa-circle-o-notch fa-spin"></i>');
		},
		complete: function() {
			$('.fa-spin').remove();
		},
		success: function(json) {
			if (json['postcode_required'] == '1') {
				$('#collapse-payment-address input[name=\'postcode\']').parents('.form-group').addClass('required');
			} else {
				$('#collapse-payment-address input[name=\'postcode\']').parents('.form-group').removeClass('required');
			}

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

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

					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>';
			}

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

$('#collapse-payment-address select[name=\'country_id\']').trigger('change');
//--></script>
<script type="text/javascript"><!--
triggerFormRegister();
//--></script>
<?php if ($postcode != '') { ?>
<script type="text/javascript"><!--
$('#address .input-postcode').trigger('keyup');
//--></script>
<?php } ?>