<?php
/**
 * @version $Id: check_out_success_guest.php 333 2008-04-03 02:07:00Z bigmouse-nfox $
 */
  $guest_to_user = $db->Execute("select c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob,
                                             c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb,
                                             ab.entry_postcode, ab.entry_city, ab.entry_state, ab.entry_country_id, ab.entry_zone_id,
                                             ab.entry_telephone, ab.entry_fax, ab.entry_firstname_kana, ab.entry_lastname_kana
                                             from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab
                                             where ab.address_book_id = c.customers_default_address_id
                                             and c.customers_id = '" . (int)$_SESSION['customer_id'] . "'");
  $guest_to_customer = '';
  if ($guest_to_user->fields['customers_email_address'] != '') {

  $guest_to_customer = '<fieldset id="csNotifications"><legend>' . TEXT_GUEST_TO_CUSTOMER . '</legend>';
  $guest_to_customer .= zen_draw_form('create_account', zen_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
  $guest_to_customer .= zen_draw_hidden_field('action', 'process') . zen_draw_hidden_field('email_pref_html', 'email_format');
  if (DISPLAY_PRIVACY_CONDITIONS == 'true') {
  $guest_to_customer .= '<fieldset>';
  $guest_to_customer .= '<legend>' . GUEST_TABLE_HEADING_PRIVACY_CONDITIONS . '</legend>';
  $guest_to_customer .= '<div class="information">' . GUEST_TEXT_PRIVACY_CONDITIONS_DESCRIPTION . '</div>';
  $guest_to_customer .= zen_draw_checkbox_field('privacy_conditions', '1', false, 'id="privacy"');
  $guest_to_customer .= '<label class="checkboxLabel" for="privacy">' . GUEST_TEXT_PRIVACY_CONDITIONS_CONFIRM . '</label></fieldset>';
  }
  $guest_to_customer .= '<fieldset><label class="inputLabel" for="password-new">' . ENTRY_PASSWORD . '</label>';
  $guest_to_customer .= zen_draw_password_field('password', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_password', '20') . ' id="password-new"') . (zen_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="alert">' . ENTRY_PASSWORD_TEXT . '</span>': '');
  $guest_to_customer .= '<br class="clearBoth" />';
  $guest_to_customer .= '<label class="inputLabel" for="password-confirm">' . ENTRY_PASSWORD_CONFIRMATION .'</label>';
  $guest_to_customer .= zen_draw_password_field('confirmation', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_password', '20') . ' id="password-confirm"') . (zen_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="alert">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': '');
  $guest_to_customer .= '<br class="clearBoth" /></fieldset>';
  $guest_to_customer .= zen_draw_hidden_field('gender', $guest_to_user->fields['customers_gender']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('company', $guest_to_user->fields['entry_company']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('firstname', $guest_to_user->fields['customers_firstname']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('lastname', $guest_to_user->fields['customers_lastname']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('dob', $guest_to_user->fields['customers_dob']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('email_address', $guest_to_user->fields['customers_email_address']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('zone_country_id', $guest_to_user->fields['entry_country_id']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('street_address', $guest_to_user->fields['entry_street_address']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('suburb', $guest_to_user->fields['entry_suburb']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('postcode', $guest_to_user->fields['entry_postcode']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('telephone', $guest_to_user->fields['entry_telephone']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('fax', $guest_to_user->fields['entry_fax']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('city', $guest_to_user->fields['entry_city']) . "\n";
  if ($guest_to_user->fields['entry_state'] != '') $guest_to_customer .= zen_draw_hidden_field('state', $guest_to_user->fields['entry_state']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('zone_id', $guest_to_user->fields['entry_zone_id']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('firstname_kana', $guest_to_user->fields['entry_firstname_kana']) . "\n";
  $guest_to_customer .= zen_draw_hidden_field('lastname_kana', $guest_to_user->fields['entry_lastname_kana']) . "\n";
  $guest_to_customer .= '<div class="buttonRow forward">' . zen_image_submit(BUTTON_IMAGE_SUBMIT, BUTTON_SUBMIT_ALT) . '</div></form></fieldset>';
  echo $guest_to_customer;
  zen_delete_guest_account_now();
  }
?>