<?php 

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
require(DIR_WS_INCLUDES.'http.js'); ?>
<?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB;?>">
<?php // BOF: Lango Added for template MOD
if (SHOW_HEADING_TITLE_ORIGINAL == 'yes') {
$header_text = '&nbsp;'
//EOF: Lango Added for template MOD
?>
      <tr>
        <td>
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table>
		</td>
      </tr>
<?php
// BOF: Lango Added for template MOD
}else{
$header_text = HEADING_TITLE;
}
// EOF: Lango Added for template MOD
  if ($messageStack->size('checkout_success') > 0) {
?>
	<tr>
		<td>
			<?php echo $messageStack->output('checkout_success');?>
		</td>
	</tr>
	<?php }if(!isset($hide_row_top)) {     ?>
	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
<?php	}

// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_top(false, false, $header_text);
}
// EOF: Lango Added for template MOD
?>
<tr>
	<td>
	<table border="0" width="100%" cellspacing="4" cellpadding="2">
		<tr>
			<td valign="top"><?php echo tep_image(DIR_WS_TEMPLATES.DEFAULT_TEMPLATE.'/images/' . COMPANY_LOGO , $HEADING_TITLE); ?></td>
			<td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo $HEADING_TITLE; ?></div><br><?php echo $TEXT_SUCCESS; ?><br><br>
			<?php
				if ($payment=="commbank"){
					echo '<b>' . TEXT_RECEIPT_NO . '</b> ' . $orders_result["payment_return1"] . '<br>';
					echo '<b>' . TEXT_TRANSACTION_NO . '</b> ' . $orders_result["payment_return2"] . '<br>';
				}
				if ($global['global_product_notifications'] != '1') {
					echo '<br>' . TEXT_NOTIFY_PRODUCTS .'<br><br>';
					if (sizeof($products_array)>0){
						echo '<b>' . TEXT_PRODUCTS . '</b><br><div class="productsNotifications">';
						$products_displayed = array();
						for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {
							if (!in_array($products_array[$i]['id'], $products_displayed)) {
								echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';
						}
						$products_displayed[] = $products_array[$i]['id'];
						echo '</div>';
					}
				}
				if (sizeof($events_array)>0){
					echo '<br><b>' . TEXT_EVENTS . '</b><br><span class="productsNotifications"><table border="0" cellspacing="0" cellpadding="2" width="100%"';
					reset($events_array);
					$icnt=0;
					while(list($id,)=each($events_array)){
						echo '<tr>';
						echo '<td valign="top" class="main" width="10">' . tep_draw_checkbox_field('notify[]', $events_array[$id]['id']) . '<td class="main" nowrap> ' . $events_array[$id]['text'] . '<br><span class="productListing-data">' . substr($events_array[$id]['dates'],4) . '</span></td>';
						$icnt++;
					}
					echo '</table></span>';
				}
				if (sizeof($subscription_array)>0){
					echo '<br><b>' . TEXT_SUBSCRIPTIONS . '</b><br><span class="productsNotifications"><table border="0" cellspacing="0" cellpadding="2" width="100%"';
					reset($subscription_array);
					$icnt=0;
					while(list($id,)=each($subscription_array)){
						echo '<tr>';
						echo '<td valign="top" class="main" width="10">' . tep_draw_checkbox_field('notify[]', $subscription_array[$id]['id']) . '<td class="main" nowrap> ' . $subscription_array[$id]['text'] .  '</span></td>';
						$icnt++;
					}
					echo '</table></span>';
				}
		} else {
			echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
		}
?>
				<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td></tr>
			</table>
		</td>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
<?php

// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
}
// EOF: Lango Added for template MOD
?>
		<?php 
		  $order_status_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . $HTTP_GET_VARS['order_id'] . "'");
		  $order_status = tep_db_fetch_array($order_status_query); 	
		  if(($order_status['orders_status'])>1){
			  if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); 
		  }?>
	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
	  <tr>
		<td>
		<table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
		  <tr class="infoBoxContents">
		  <td>
		  <table border="0" width="100%" cellspacing="0" cellpadding="2">
			<tr> 
				<td align="left" class="main">
					<?php
						if ($joomla_include==1){
							echo '<a href="javascript:popupWindow(\'' . (ENABLE_SSL == 'true' || ENABLE_SSL==true?HTTPS_SERVER . DIR_WS_HTTPS_CATALOG:HTTP_SERVER . DIR_WS_HTTP_CATALOG) .'freeway/' .  FILENAME_ORDERS_PRINTABLE . '?' . (tep_get_all_get_params(array('order_id','openfile')) . 'order_id=' . $HTTP_GET_VARS['order_id']) .'&joomla_include_yes=1\');">' . tep_template_image_button('button_printorder.gif', IMAGE_BUTTON_PRINT_ORDER) . '</a>';
						} else {
							echo '<a href="javascript:popupWindow(\'' .  (ENABLE_SSL == 'true' || ENABLE_SSL==true?HTTPS_SERVER . DIR_WS_HTTPS_CATALOG:HTTP_SERVER . DIR_WS_HTTP_CATALOG) . FILENAME_ORDERS_PRINTABLE . '?' . (tep_get_all_get_params(array('order_id')) . 'order_id=' . $HTTP_GET_VARS['order_id']) .'&joomla_include_yes=\');">' . tep_template_image_button('button_printorder.gif', IMAGE_BUTTON_PRINT_ORDER) . '</a>'; 
						}
					?>
				
				</td>
				<td align="right" class="main"><?php echo tep_template_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
			</tr>
		</table>
		</td>
		</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
	<tr>
		<td>
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
			<td width="25%">
			<table border="0" width="100%" cellspacing="0" cellpadding="0">
				<tr>
					<td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
					<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
				</tr>
            </table>
			</td>
            <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
            <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
            <td width="25%">
				<table border="0" width="100%" cellspacing="0" cellpadding="0">
				<tr>
					<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
					<td width="50%"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
				</tr>
            	</table>
			</td>
			</tr>
			<tr>
				<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
				<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
				<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
				<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
			</tr>
			</table>
		</td>
      </tr>
	</table>
</td>
</tr>
<?php if(AFFILIATE_COMMISSION_JUNCTION=='true'){
		$order = new order($order_id);
		$amount=substr($order->info['total'],1);
		$amount=str_replace(',','',$amount);
?>
		<!-- BEGIN COMMISSION JUNCTION TRACING CODE -->
		<img src="https://www.emjcd.com/u?AMOUNT=<?php echo $amount;?>&CID=<?php echo AFFILIATE_ENTERPRISE_ID;?>&OID=<?php echo (int)$HTTP_GET_VARS['order_id'];?>&TYPE=<?php echo AFFILIATE_ACTION_ID;?>&CURRENCY=<?php echo $currency;?>&METHOD=IMG" height="1" width="20">
		<!-- END COMMISSION JUNCTION TRACING CODE -->
<?php } ?>
	</form>
