$old_field = $old_fields[$i];
    $field_name = $old_field[0];
    if ($field_name) {
        if (strpos($field_name, 'PASSWORD') !== false) {
            $field = xtc_draw_password_field_installer($field_name, EMPTY_STRING);
        } else {
            $field = xtc_draw_input_field_installer($field_name, EMPTY_STRING, $text_text, $size40);
        }
        $post_data .= '
  <tr>' . $text_start . $old_field[3] . $text_end . $field_start . $field . $required_cell . '
  </tr>
';
        unset($hidden_fields[$field_name]);
    } else {
        $post_data .= '
  <tr>' . $text_start . TEXT_COUNTRY . $text_end . $field_start_2 . xtc_get_country_list($country_text, $country, 'onchange=" country_drop_down_change(this,\'' . CURRENT_SCRIPT . '\')"') . HTML_BR . $required_start . TEXT_COUNTRY_LONG . $font_strong_end . xtc_draw_hidden_field_installer($country_1_text) . '</td>
  </tr>
  <tr>' . $text_start . TEXT_STATE . $text_end . $field_start_2;
        if ($entry_state_has_zones) {
            $zones_array = array();
            $zones_query = xtc_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $country . "' order by zone_name");
            while ($zones_values = xtc_db_fetch_array($zones_query)) {
                $zone_name = $zones_values['zone_name'];
                $zones_array[] = array('id' => $zone_name, 'text' => $zone_name);
            }
            $post_data .= xtc_draw_pull_down_menu($state_text, $zones_array, $country);
        } else {
            $post_data .= xtc_draw_input_field_installer($state_text, EMPTY_STRING, $text_text, $size40);
        }
        $post_data .= $required_start . $text_end . '
	</tr>
        if ($entry_state_has_zones == true) {
            $zones_array = array();
            $zones_query = xtc_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . xtc_db_input($country) . "' order by zone_name");
            while ($zones_values = xtc_db_fetch_array($zones_query)) {
                $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            $state_input = xtc_draw_pull_down_menuNote(array('name' => 'state', 'text' => '&nbsp;' . (xtc_not_null(ENTRY_STATE_TEXT) ? '<span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>' : '')), $zones_array);
        } else {
            $state_input = xtc_draw_input_fieldNote(array('name' => 'state', 'text' => '&nbsp;' . (xtc_not_null(ENTRY_STATE_TEXT) ? '<span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>' : '')));
        }
    } else {
        $state_input = xtc_draw_input_fieldNote(array('name' => 'state', 'text' => '&nbsp;' . (xtc_not_null(ENTRY_STATE_TEXT) ? '<span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>' : '')), xtc_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']));
    }
    $module_smarty->assign('INPUT_STATE', $state_input);
}
if (isset($_POST['country'])) {
    $selected = $_POST['country'];
} elseif (isset($entry['entry_country_id'])) {
    $selected = $entry['entry_country_id'];
} else {
    $selected = STORE_COUNTRY;
}
$module_smarty->assign('SELECT_COUNTRY', xtc_get_country_list(array('name' => 'country', 'text' => '&nbsp;' . (xtc_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>' : '')), $selected));
if (isset($_GET['edit']) && $_SESSION['customer_default_address_id'] != $_GET['edit'] || isset($_GET['edit']) == false) {
    $module_smarty->assign('new', '1');
    $module_smarty->assign('CHECKBOX_PRIMARY', xtc_draw_checkbox_field('primary', 'on', false, 'id="primary"'));
}
$module_smarty->assign('language', $_SESSION['language']);
$module_smarty->caching = 0;
$main_content = $module_smarty->fetch(CURRENT_TEMPLATE . '/module/address_book_details.html');
$smarty->assign('MODULE_address_book_details', $main_content);
// http://www.xtc-modified.org/forum/topic.php?id=9883
if (!defined('SHOW_ALWAYS_LANG_DROPDOWN')) {
    define('SHOW_ALWAYS_LANG_DROPDOWN', true);
    // true: Zeigt immer das Länderauswahlfeld an - false: Zeigt Länderauswahlfeld nur bei nicht eingeloggten Kunden
}
require_once DIR_WS_CLASSES . 'order.php';
require_once DIR_FS_INC . 'xtc_get_country_list.inc.php';
$order = new order();
$total_weight = $_SESSION['cart']->show_weight();
$total_count = $_SESSION['cart']->count_contents();
$selected = isset($_SESSION['customer_country_id']) ? $_SESSION['customer_country_id'] : STORE_COUNTRY;
if (!isset($_SESSION['customer_id']) || SHOW_ALWAYS_LANG_DROPDOWN) {
    if (isset($_SESSION['country'])) {
        $selected = $_SESSION['country'];
    }
    $module_smarty->assign('SELECT_COUNTRY', _SHIPPING_TO . xtc_get_country_list(array('name' => 'country'), (int) $selected, 'onchange="this.form.submit()"'));
}
if (!isset($order->delivery['country']['iso_code_2']) || $order->delivery['country']['iso_code_2'] == '' || SHOW_ALWAYS_LANG_DROPDOWN) {
    unset($_SESSION['shipping']);
    $delivery_zone_query = xtc_db_query("SELECT countries_id, \n                                              countries_iso_code_2, \n                                              countries_name \n                                         FROM " . TABLE_COUNTRIES . " \n                                        WHERE countries_id = '" . (int) $selected . "'\n                                     ");
    $delivery_zone = xtc_db_fetch_array($delivery_zone_query);
    $order->delivery['country']['iso_code_2'] = $delivery_zone['countries_iso_code_2'];
    $order->delivery['country']['title'] = $delivery_zone['countries_name'];
    $order->delivery['country']['id'] = $delivery_zone['countries_id'];
    $order->delivery['country_id'] = $delivery_zone['countries_id'];
    $order->delivery['zone_id'] = 0;
}
if (!isset($order->info['total'])) {
    $order->info['total'] = $_SESSION['cart']->show_total();
}
$_SESSION['delivery_zone'] = $order->delivery['country']['iso_code_2'];
?>
* <br />
                            <b><?php 
echo TEXT_CITY;
?>
</b><br />
                            <?php 
echo xtc_draw_input_field_installer('CITY', '', 'text', 'style="width: 30%;" ');
?>
* <br />
                            <b><?php 
echo TEXT_COUNTRY;
?>
</b><br />
                            <?php 
echo xtc_get_country_list('COUNTRY', 81);
?>
* <?php 
echo TEXT_COUNTRY_LONG;
?>
<br />
                            <b><?php 
echo TEXT_TEL;
?>
</b><br />
                            <?php 
echo xtc_draw_input_field_installer('TELEPHONE', '', 'text', 'style="width: 30%;" ');
?>
* <br />
                        </p>
                    </div>
        $city_content = $a_city . xtc_draw_hidden_field('a_city');
    }
} else {
    $city_content = xtc_draw_input_fieldNote(array('name' => 'a_city', 'text' => '&nbsp;' . ENTRY_CITY_TEXT), $affiliate['affiliate_city']);
}
$module_smarty->assign('city_content', $city_content);
if ($is_read_only == true) {
    $country_id_content = xtc_get_country_name($affiliate['affiliate_country_id']);
} elseif ($error == true) {
    if ($entry_country_error == true) {
        $country_id_content = xtc_get_country_list(array('name' => 'a_country', 'text' => '&nbsp;' . ENTRY_COUNTRY_ERROR));
    } else {
        $country_id_content = xtc_get_country_name($a_country) . xtc_draw_hidden_field('a_country');
    }
} else {
    $country_id_content = xtc_get_country_list(array('name' => 'a_country', 'text' => '&nbsp;' . ENTRY_COUNTRY_TEXT), $affiliate['affiliate_country_id']);
}
$module_smarty->assign('country_id_content', $country_id_content);
if (ACCOUNT_STATE == 'true') {
    $module_smarty->assign('ACCOUNT_STATE', 'true');
    $state = xtc_get_zone_name($a_country, $a_zone_id, $a_state);
    if ($is_read_only == true) {
        $state_content = xtc_get_zone_name($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']);
    } elseif ($error == true) {
        if ($entry_state_error == true) {
            if ($entry_state_has_zones == true) {
                $zones_array = array();
                $zones_query = xtc_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . xtc_db_input($a_country) . "' order by zone_name");
                while ($zones_values = xtc_db_fetch_array($zones_query)) {
                    $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
                }
?>
* <br />
                            <b><?php 
echo TEXT_CITY;
?>
</b><br />
                            <?php 
echo xtc_draw_input_field_installer('CITY', '', 'text', 'style="width: 30%;" ');
?>
* <br />
                            <b><?php 
echo TEXT_COUNTRY;
?>
</b><br />
                            <?php 
echo xtc_get_country_list('COUNTRY', 81, 'style="width:30%"');
?>
* <?php 
echo TEXT_COUNTRY_LONG;
?>
<br />
                            <b><?php 
echo TEXT_TEL;
?>
</b><br />
                            <?php 
echo xtc_draw_input_field_installer('TELEPHONE', '', 'text', 'style="width: 30%;" ');
?>
* <br />
                            <b><?php 
echo TEXT_PASSWORD;