	<?php
	
	
// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
		$isblocked=(isset($HTTP_GET_VARS['isblocked'])?$HTTP_GET_VARS['isblocked']:'');
		$suspended=(isset($HTTP_GET_VARS['suspended'])?$HTTP_GET_VARS['suspended']:'');
		if($isblocked=='yes')
			$messageStack->add('account', ERROR_BLOCKED_CUSTOMER);
		if($suspended=='yes')
			$messageStack->add('account', ERROR_SUSPENDED_CUSTOMER);
				
     ?>
	<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="left"><?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(!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
	?>
	<?php
	  if ($messageStack->size('account') > 0) {
	?>
	<tr>
		<td><?php echo $messageStack->output('account'); ?></td>
	</tr>
	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
	<?php
	}
	$renewal_events=tep_get_renewal_events();
	if (sizeof($renewal_events)>0){
	?>
	<tr>
		<td>
			<table border="0" cellspacing="1" cellpadding="2" class="infoBox" width="100%">
				<tr class="infoBoxContents">
					<td>
						<table border="0" cellspacing="0" cellpadding="2" width="100%" bgcolor="lightyellow">
							<tr>
								<td class="main"><b><?php echo tep_image(DIR_WS_ICONS . 'warning.gif') . '&nbsp;' . RENEWAL_TITLE; ?></b></td>
							<tr>
							<?php 
								for ($icnt=0;$icnt<sizeof($renewal_events);$icnt++){
							?>
								<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_SESSION_DETAILS,'events_id=' . $renewal_events[$icnt]['events_id'],'SSL');?>'">
									<td class="main" valign="middle"><?php echo sprintf(TEXT_RENEWAL_REMINDER,$renewal_events[$icnt]['no_days'],$renewal_events[$icnt]['events_name']) . tep_image(DIR_WS_IMAGES . "payment_reminder.gif",TEXT_RENEWAL_NOW,16,15,'align=absmiddle');?></td>
								</tr>
							<?php
								}
							?>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
	<?php
	}
	$reminder_events=tep_get_all_reminder_fees();
	if (sizeof($reminder_events)>0){
	?>
	<tr>
		<td>
			<table border="0" cellspacing="1" cellpadding="2" class="infoBox" width="100%">
				<tr class="infoBoxContents">
					<td>
						<table border="0" cellspacing="0" cellpadding="2" width="100%" bgcolor="lightyellow">
							<tr>
								<td class="main"><b><?php echo tep_image(DIR_WS_ICONS . 'warning.gif') . '&nbsp;' . REMINDER_FEE_TITLE; ?></b></td>
							<tr>
							<?php 
								for ($icnt=0;$icnt<sizeof($reminder_events);$icnt++){
									if ($reminder_events[$icnt]['amount']>0){
							?>
								<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_SESSION_DETAILS,'events_id=' . $reminder_events[$icnt]['events_id'] . '&mode=remind&oID=' . $reminder_events[$icnt]['orders_id'],'SSL');?>'">
									<td class="main" valign="middle"><?php echo sprintf(TEXT_REMINDER_FEE,$currencies->format($reminder_events[$icnt]['amount']),$reminder_events[$icnt]['events_name'],$reminder_events[$icnt]['orders_id']) . tep_image(DIR_WS_IMAGES . "payment_reminder.gif",TEXT_PAY_NOW,16,15,'align=absmiddle') ;?></td>
								</tr>
							<?php
									} else {
							?>
								<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_EVENTS_COMPLETE_REMAINDER,'events_id=' . $reminder_events[$icnt]['events_id'] . '&oID=' . $reminder_events[$icnt]['orders_id'],'SSL');?>'">
									<td class="main" valign="middle"><?php echo sprintf(TEXT_REMINDER_COMPLETE,$reminder_events[$icnt]['count'],$reminder_events[$icnt]['events_name'],$reminder_events[$icnt]['orders_id']) . tep_image(DIR_WS_IMAGES . "payment_reminder.gif",TEXT_COMPLETE_NOW,16,15,'align=absmiddle');?></td>
								</tr>
							<?php	}
								}
							?>
        				</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr>
	<?php
	}
	?>
	<!-- current  -->
	<tr>
		<td>
			<table border="0" cellspacing="2" cellpadding="2">
				<tr>
					<td width="6"></td>
					<td class="main"><b><?php echo MY_ACCOUNT_CURRENT_PURCHASES; ?></b></td>
				</tr>
			</table>
		</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 width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
								<td width="50"><?php echo tep_image(DIR_WS_IMAGES . 'account_reservations.gif');//echo tep_image(DIR_WS_IMAGES . 'account_orders.gif'); ?></td>
								<td width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
								<td>
									<table border="0" width="100%" cellspacing="0" cellpadding="2">
								
<?php  
	$amount=0;
	$products_query = tep_db_query("select op.products_type,op.products_name,o.orders_id,op.final_price ,op.products_tax,products_quantity from " .
	 	TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op where o.customers_id = '" . (int)$customer_id . "' and o.orders_id=op.orders_id  order by o.date_purchased desc limit 3");
	if(tep_db_num_rows($products_query)>0){
	while($products=tep_db_fetch_array($products_query)){
	if($products['products_type']=='E'){
		$type=TEXT_EVENT;
	}else if($products['products_type']=='S') {
		$type=TEXT_SUBSCRIPTION;
	}else if($products['products_type']=='P') {
		$type=TEXT_PRODUCT;
	}else if($products['products_type']=='V') {
		$type=TEXT_SERVICE;	
	}
	?>
		<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $products['orders_id'].'&return=ma', 'SSL'); ?>'">
                    <td class="main" valign="top"><?php echo $type; ?></td>
                    <td class="main" valign="top" width="80"></td>
                    <td class="main" valign="top"><?php echo $products["products_name"];?></td>
                    <td class="main" valign="top" align="right"><?php echo $currencies->format(tep_add_tax($products["final_price"],$products['products_tax'])* $products["products_quantity"]); ?></td>
                    <td class="main" valign="top" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $products['orders_id'].'&return=ma', 'SSL') . '">' . tep_template_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td>
                  </tr>		
	<?php } 
	}?>
  			<tr>
				<td class="main" colspan="6"><?php echo ((tep_db_num_rows($products_query)==0)?TEXT_NO_ITEMS:'<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '" name="subscribe"><u>' . 'Show All' . '</u></a>');?></td>
					</tr>	
					</table>	
							</td>
							<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</td>
    </tr>
<?php
 
 // }

?>

<!-- end current -->
 <!-- Start for wallet payment is installed-->
      <?php if(tep_payment_installed('wallet.php')) { ?>
	  <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
		  		<td width="10"></td>
            <td class="main"><b><?php echo MY_ACCOUNT_WALLET; ?></b></td>
          </tr>
        </table></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 width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
                <td width="50"><?php echo tep_image(DIR_WS_IMAGES . 'account_wallet.gif'); ?></td>
              <td width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td> 
				<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="main">
						<?php
						
						
						
						//echo "select wu.payment_method,wu.amount,c.customers_firstname,c.customers_lastname,c.customers_id from " . TABLE_WALLET_UPLOADS . " wu,  "  . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_STATUS . " o  where c.customers_id=" . (int)$customer_id . " and wu.customers_id=c.customers_id and wu.payment_status='1' and o.orders_status_id=wu.payment_status ";
						$wallet_upload_query=tep_db_query("select wu.payment_method,o.orders_status_name,wu.amount,c.customers_firstname,c.customers_lastname,c.customers_id from " . TABLE_WALLET_UPLOADS . " wu,  "  . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_STATUS . " o  where c.customers_id=" . (int)$customer_id . " and wu.customers_id=c.customers_id and wu.payment_status='1' and o.orders_status_id=wu.payment_status order by payment_date desc limit 3 ");

						$wallet_count=tep_db_num_rows($wallet_upload_query);
						while($wallet_upload=tep_db_fetch_array($wallet_upload_query))
						{
						?>					
						<table width="100%" cellpadding="2" cellspacing="0" border="0">
							<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" >
							<td width="20%" class="main"><?php echo $wallet_upload['customers_firstname'] . ' ' . $wallet_upload['customers_lastname'] ; ?></td>
							<td width="15%" class="main"><?php echo format_date($wallet_upload['payment_date']) ; ?></td>
							<td width="35%" class="main"><?php echo $wallet_upload['payment_method'] ; ?></td>
							<td width="15%" class="main"><?php echo $wallet_upload['orders_status_name'] ; ?></td>
							<td width="20%" class="main" align="right"><?php echo$currencies->format($wallet_upload['amount']) ; ?></td>
							</tr>
						</table>
						<?php
						}
						?>
					</td>
                  </tr>
				   	<tr>
					 <table cellpadding="2" cellspacing="0" border="0" width="100%">
					 	<tr>
							<td class="main" width="30%">
								<?php 
									if ($wallet_count>0) {
										echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_WALLET_UPLOADS, '', 'SSL') . '">' .  MY_ACCOUNT_SHOW_ALL_UPLOADS . '</a>'; 
									}
								?>
							</td>
						</tr>
					    	<td class="main"><?php echo  tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_WALLET_CHECKOUT_PAYMENT, '', 'SSL') . '">' . MY_ACCOUNT_WALLET_UPLOADS . '</a>'; ?></td>
						</tr>
						<tr>
							<td class="main"><?php 
							$balance=tep_get_wallet_balance($customer_id);
							if ($balance>0){
								echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') .  " " .sprintf(TEXT_CURRENT_WALLET_BALANCE,$currencies->format($balance));
							} else {
								echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') .'&nbsp;'. TEXT_WALLET_EMPTY;
							}	
							?>
							</td>
						</tr>
					</table>	
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
	   <?php }?>
	  <!-- End for wallet payment is installed-->
	  <!-- invite friend -->
	  <?php // get event names for the user has reserved
		if(tep_db_num_rows($products_query)>0){ ?>
	<tr>
		<td>
			<table border="0" width="100%" cellspacing="0" cellpadding="2">
				<tr>
					<td width="10"></td>
					<td class="main"><b><?php echo INVITE_TITLE; ?></b></td>
				</tr>
			</table>
		</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 width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
							<td width="50" valign="middle"><?php echo tep_image(DIR_WS_IMAGES . 'account_invite.gif'); ?></td>
							<td width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
							<td>
								<table border="0" width="100%" cellspacing="0" cellpadding="2">
									<?php
									$type=TEXT_INVITE_INFO_PRODUCT;
									$filename=FILENAME_TELL_A_FRIEND;
									$ic=1; 
									$query=TABLE_ORDERS_PRODUCTS . " op ";
									while($ic<=4){
									if($ic=="2"){
										$query=TABLE_ORDERS_PRODUCTS . " op, " . TABLE_EVENTS_SESSIONS . " s ";
										$type=TEXT_INVITE_INFO_EVENT;			
										$filename=FILENAME_EVENTS_INVITE_FRIEND;						
									}else if($ic=="3"){
										$type=TEXT_INVITE_INFO_SUBSCRIPTION;
										$filename=FILENAME_SUBSCRIPTION_INVITE_FRIEND;
									}else if($ic=="4"){
										$type=TEXT_INVITE_INFO_SERVICE;
										$filename=FILENAME_SERVICES_INVITE_FRIEND;
									}
									$products_query = tep_db_query("SELECT ".(($ic=="2")?'s.events_id,':'')."op.products_name,op.products_id from " . TABLE_ORDERS . " o, " . $query .
										"where o.customers_id='" . (int)$customer_id . "' and o.orders_id=op.orders_id  ".(($ic=="2")?' and op.products_id=s.sessions_id ':'')." and ".(($ic=="1")?'op.products_type="P"':(($ic=="2")?'op.products_type="E" and (op.events_type="R" or op.events_type="W")':(($ic=="3")?'op.products_type="S"':'op.products_type="V"'))) . "   order by o.date_purchased desc limit 1");
									$products=tep_db_fetch_array($products_query);
									if(tep_db_num_rows($products_query)){
										
									?>
									<tr>
										<td class="main" nowrap="true"><?php echo sprintf($type,STORE_NAME) .'<br>';
										$ids_array=array('1'=>'return=ma&products_id=','2'=>'eID=','3'=>'suID=','4'=>'sID=');
										echo  tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link($filename,tep_get_all_get_params() . $ids_array[$ic].$products['products_id'] . '&path=ACC','SSL') . '">' .  $products["products_name"] . '</a><br>';?></td>
									</tr>
							      <?php }
									$ic++;
								 }
								 ?> 	
								</table>
							</td>
							<td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		</td>
		</tr>
	<!-- end invite -->
	<!-- order-->
	<?php  } 
	if (tep_count_customer_orders() > 0) {
	?>
	<tr>
		<td>
			<table border="0" cellspacing="0" cellpadding="2">
				<tr>
					<td width="3"></td>
					<td class="main"><b><?php echo MY_ORDERS_TITLE; ?></b></td>
				</tr>
			</table>
		</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 width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
								<td width="50" align="middle"><?php echo tep_image(DIR_WS_IMAGES . 'account_orders.gif'); ?></td>
								<td width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
								<td>
									<table border="0" width="100%" cellspacing="0" cellpadding="2">
									<?php
									$orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, "  .  TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 3");
									while ($orders = tep_db_fetch_array($orders_query)) {
										if (tep_not_null($orders['delivery_name'])) {
											$order_name = $orders['delivery_name'];
											$order_country = $orders['delivery_country'];
										} else {
											$order_name = $orders['billing_name'];
											$order_country = $orders['billing_country'];
										}
									?>
							
							<tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'].'&return=hinfo', 'SSL'); ?>'">
										<td class="main" valign="top" width="80"><?php echo format_date($orders['date_purchased']); ?></td>
										<td class="main" valign="top"><?php echo '#' . $orders['orders_id']; ?></td>
										<td class="main" valign="top"><?php echo tep_output_string_protected($order_name) . ', ' . $order_country; ?></td>
										<td class="main" valign="top"><?php echo $orders['orders_status_name']; ?></td>
										<td class="main" valign="top" align="right"><?php echo $orders['order_total']; ?></td>
										<td class="main" valign="top" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'].'&return=hinfo', 'SSL') . '">' . tep_template_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td>
									</tr> 
									<?php
									}
									?>
									<tr>
										<td class="main" colspan="6"><?php 
										echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '"><u>' . OVERVIEW_SHOW_ALL_ORDERS . '</u></a>'; ?></td>
									</tr>
									</table>
							</td>
							<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</td>
    </tr>
<!--	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	</tr> -->
<?php
  }
  
?>
<!-- end order -->

      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
          	<td width="3"></td>
          	<td class="main"><b><?php echo MY_ACCOUNT_TITLE; ?></b></td>
			 </tr>
        </table></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 width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
                <td width="50"><?php echo tep_image(DIR_WS_IMAGES . 'account_personal.gif'); ?></td>
                <td width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL') . '">' . MY_ACCOUNT_INFORMATION . '</a>'; ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . MY_ACCOUNT_ADDRESS_BOOK . '</a>'; ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_PASSWORD, '', 'SSL') . '">' . MY_ACCOUNT_PASSWORD . '</a>'; ?></td>
                  </tr>
				  
                </table></td>
                <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
     <!-- <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr> -->
	  
<?php
  // $reserve_query = tep_db_query("select min(s.start_date) as start_date,s.events_id,s.sessions_id,o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, sum(op.final_price) as session_rate,op.products_tax from " . TABLE_ORDERS . " o, " . TABLE_EVENTS_SESSIONS . " s, " . TABLE_ORDERS_PRODUCTS . " op where o.customers_id = '" . (int)$customer_id . "' and op.products_type='E' and op.events_type!='' and op.events_type!='C' and op.products_id=s.sessions_id and o.orders_id=op.orders_id group by o.orders_id order by o.date_purchased desc limit 3");
  //  if (tep_db_num_rows($reserve_query)>0){
?>
  <!--   <tr>
        <td><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><b><?php //echo MY_RESERVE_TITLE; ?></b></td>
          </tr>
        </table></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 width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
                <td width="50"><?php echo tep_image(DIR_WS_IMAGES . 'account_reservations.gif'); ?></td>
                <td width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		
<?php
 /*  while ($reserve = tep_db_fetch_array($reserve_query)) {
      if (tep_not_null($reserve['delivery_name'])) {
        $reserve_name = $reserve['delivery_name'];
        $reserve_country = $reserve['delivery_country'];
      } else {
        $reserve_name = $reserve['billing_name'];
        $reserve_country = $reserve['billing_country'];
      }
 */	  
?>
                  <tr class="moduleRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $reserve['orders_id'], 'SSL'); ?>'">
                    <td class="main" valign="top"><?php echo tep_output_string_protected($reserve_name) . ', ' . $reserve_country; ?></td>
                    <td class="main" valign="top" width="80"><?php echo format_date($reserve['start_date']); ?></td>
                    <td class="main" valign="top"><?php echo tep_get_events_name($reserve['events_id']); ?></td>
                    <td class="main" valign="top" align="right"><?php echo $currencies->format(tep_add_tax($reserve[session_rate],$reserve['products_tax'])); ?></td>
                    <td class="main" valign="top" align="right"><?php //echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_template_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td>
                  </tr>
<?php //} ?>
				  <tr>
					<td class="main" colspan="5"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_RESERVATIONS, '', 'SSL') . '" name="reserve"><u>' . TEXT_ALL_RESERVATIONS . '</u></a>'; ?></td>
				  </tr>
                </table></td>
				<td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>  !-->
<?php //}  
?>       
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
          	<td width="5"></td>
            <td class="main"><b><?php echo EMAIL_NOTIFICATIONS_TITLE; ?></b></td>
          </tr>
        </table></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 width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
                <td width="50"><?php echo tep_image(DIR_WS_IMAGES . 'account_notifications.gif'); ?></td>
                <td width="5"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
                <td align="left"><table border="0" width="100%" cellspacing="0" cellpadding="2">
				<?php  if (ACCOUNT_NEWSLETTER=='true' || ACCOUNT_RESERVATION_OR_WAITLIST=='true' || ACCOUNT_SUBSCRIPTION_NEWSLETTER=='true') {
				?>
                  <tr>
                    <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_NEWSLETTERS, '', 'SSL') . '">' . EMAIL_NOTIFICATIONS_NEWSLETTERS . '</a>'; ?></td>
                  </tr>
				  <?php } ?>
                  <tr>
                    <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL') . '">' . EMAIL_NOTIFICATIONS_PRODUCTS . '</a>'; ?></td>
                  </tr>
				  <!-- Support Packs -->
                  <tr>
                    <td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_SUPPORT_PACKS_LIST, '', 'SSL') . '">' . SUPPORT_PACKS_PURCHASE_LIST . '</a>'; ?></td>
                  </tr>
                </table></td>
                <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
	


	
	
	 <?php // if rows found
// BOF: Lango Added for template MOD

if (MAIN_TABLE_BORDER == 'yes'){
	table_image_border_bottom();
}
// EOF: Lango Added for template MOD
?>
   </table>