function osC_Account_Address_book()
 {
     global $osC_Services, $breadcrumb, $osC_Customer;
     if ($osC_Services->isStarted('breadcrumb')) {
         $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK, tep_href_link(FILENAME_ACCOUNT, $this->_module, 'SSL'));
     }
     if ($osC_Customer->hasDefaultAddress() === false) {
         $this->page_contents = 'address_book_process.php';
     } elseif (isset($_GET['new'])) {
         if ($osC_Services->isStarted('breadcrumb')) {
             $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK_ADD_ENTRY, tep_href_link(FILENAME_ACCOUNT, $this->_module . '&new', 'SSL'));
         }
         $this->page_contents = 'address_book_process.php';
     } elseif (isset($_GET['edit']) && is_numeric($_GET[$this->_module])) {
         if ($osC_Services->isStarted('breadcrumb')) {
             $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK_EDIT_ENTRY, tep_href_link(FILENAME_ACCOUNT, $this->_module . '=' . $_GET[$this->_module] . '&edit', 'SSL'));
         }
         $this->page_contents = 'address_book_process.php';
     } elseif (isset($_GET['delete']) && is_numeric($_GET[$this->_module])) {
         if ($osC_Services->isStarted('breadcrumb')) {
             $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK_DELETE_ENTRY, tep_href_link(FILENAME_ACCOUNT, $this->_module . '=' . $_GET[$this->_module] . '&delete', 'SSL'));
         }
         $this->page_contents = 'address_book_delete.php';
     }
     if (isset($_GET['new']) && $_GET['new'] == 'save') {
         if (tep_count_customer_address_book_entries() >= MAX_ADDRESS_BOOK_ENTRIES) {
             $messageStack->add('address_book', ERROR_ADDRESS_BOOK_FULL);
             $this->page_contents = 'address_book.php';
         } else {
             $this->_process();
         }
     } elseif (isset($_GET['edit']) && $_GET['edit'] == 'save') {
         $this->_process($_GET[$this->_module]);
     } elseif (isset($_GET['delete']) && $_GET['delete'] == 'confirm' && is_numeric($_GET[$this->_module])) {
         $this->_delete($_GET[$this->_module]);
     }
 }
        }
    } else {
        if (!tep_session_is_registered('sendto')) {
            tep_session_register('sendto');
        }
        $sendto = $customer_default_address_id;
        tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
    }
}
// if no shipping destination address was selected, use their own address as default
if (!tep_session_is_registered('sendto')) {
    $sendto = $customer_default_address_id;
}
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL'));
$addresses_count = tep_count_customer_address_book_entries();
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
<title><?php 
echo TITLE;
?>
</title>
echo tep_draw_input_field('telephone', $entry['entry_telephone'], 'size="20"');
?>
</td>
	  </tr>
	  <tr>
		<td width="50%"><?php 
echo (ENTRY_FAX_NUMBER_MIN_LENGTH == 'true' ? '<strong>' . ENTRY_FAX_NUMBER . '</strong>&nbsp;<span class="inputRequirement">*</span>' : ENTRY_FAX_NUMBER) . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '&nbsp;' . ENTRY_FAX_NUMBER_TEXT : '');
?>
</td>
		<td width="50%"><?php 
echo tep_draw_input_field('fax', $entry['entry_fax'], 'size="20"');
?>
</td>
	  </tr>
<?php 
if (tep_count_customer_address_book_entries() <= 1) {
    echo tep_draw_hidden_field('primary', 'on');
} elseif (isset($HTTP_GET_VARS['edit']) && $customer_default_address_id != $HTTP_GET_VARS['edit'] || isset($HTTP_GET_VARS['edit']) == false) {
    ?>
	  <tr>
		<td width="50%"></td>
		<td width="50%"><?php 
    echo tep_draw_checkbox_field('primary', 'on', false, 'id="primary"') . ' ' . SET_AS_PRIMARY;
    ?>
</td>
	  </tr>
<?php 
}
?>
	</table>
	</fieldset>
             // systemsmanager begin - Dec 1, 2005 security patch
             //          $customer_country_id = $country_id;
             $customer_country_id = $country;
             // systemsmanager end
             $customer_zone_id = $zone_id > 0 ? (int) $zone_id : '0';
             $customer_default_address_id = (int) $_GET['edit'];
             $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_default_address_id' => (int) $_GET['edit']);
             if (ACCOUNT_GENDER == 'true') {
                 $sql_data_array['customers_gender'] = $gender;
             }
             smn_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int) $customer_id . "'");
         }
         $messageStack->add_session('addressbook', SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED, 'success');
     }
 } else {
     if (tep_count_customer_address_book_entries() < MAX_ADDRESS_BOOK_ENTRIES) {
         $sql_data_array['customers_id'] = (int) $customer_id;
         smn_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
         $new_address_book_id = smn_db_insert_id();
         // reregister session variables
         if (isset($_POST['primary']) && $_POST['primary'] == 'on') {
             $customer_first_name = $firstname;
             // systemsmanager begin - Dec 1, 2005 security patch
             //          $customer_country_id = $country_id;
             $customer_country_id = $country;
             // systemsmanager end
             $customer_zone_id = $zone_id > 0 ? (int) $zone_id : '0';
             if (isset($_POST['primary']) && $_POST['primary'] == 'on') {
                 $customer_default_address_id = $new_address_book_id;
             }
             $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname);
  Copyright (c) 2005 osCommerce

  Released under the GNU General Public License
*/
if (isset($_GET['edit'])) {
    $Qentry = $osC_Database->query('select entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id, entry_telephone, entry_fax from :table_address_book where customers_id = :customers_id and address_book_id = :address_book_id');
    $Qentry->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
    $Qentry->bindInt(':customers_id', $osC_Customer->id);
    $Qentry->bindInt(':address_book_id', $_GET['address_book']);
    $Qentry->execute();
    if ($Qentry->numberOfRows() < 1) {
        $messageStack->add('address_book', ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY, 'error');
    }
    $page_heading_title = HEADING_TITLE_ADDRESS_BOOK_EDIT_ENTRY;
} else {
    if (($counter = tep_count_customer_address_book_entries()) >= MAX_ADDRESS_BOOK_ENTRIES) {
        $messageStack->add('address_book', ERROR_ADDRESS_BOOK_FULL);
    }
    $page_heading_title = HEADING_TITLE_ADDRESS_BOOK_ADD_ENTRY;
}
require 'includes/form_check.js.php';
?>

<div class="pageHeading">
  <span class="pageHeadingImage"><?php 
echo tep_image(DIR_WS_IMAGES . 'table_background_address_book.gif', $page_heading_title, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT);
?>
</span>

  <h1><?php 
echo $page_heading_title;