<?php 

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
?>
<table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB; ?>">
<?php if(!isset($hide_row_top)) { ?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php } ?>	  
<?php if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_top(false, true, HEADING_TITLE);
} 
if (tep_db_num_rows($reservations_query)>0){
  $cnt=0;
?>
      <tr>
        <td><table border="0" width=100% cellpadding="2" align=center class=formArea>
	      <tr><td class="main"><?php echo '<b>' . TEXT_SESSION_DATE . '</b>'; ?><td class="main"><?php echo '<b>' . TEXT_NEW_DATE . '</b>';?></td></tr>
<?php
  echo tep_draw_form('move_reserve',tep_href_link(FILENAME_MOVE_RESERVATIONS_PROCESS)); 
  echo tep_draw_hidden_field('events_id',$events_id);
  while($reserve_result=tep_db_fetch_array($reservations_query))
  {
?>
              <tr><td class="main"><?php echo $reserve_result['start_date']; ?></td>
	      <?php 
	          echo tep_draw_hidden_field('orders_products_id[]',$reserve_result['orders_products_id']);
		  echo tep_draw_hidden_field('session_ids[]',$reserve_result['sessions_id']);
	          if (sizeof($dates_array)>0) {?>
	          <td class="main"><?php echo tep_draw_pull_down_menu('new_session_ids[]',$dates_array,(isset($new_ids[$cnt])?$new_ids[$cnt]:'')); 
		                     if (isset($error[$cnt])){
				         echo '<br><font color=red>';
				         if ($error[$cnt]=='W')
					    echo INFO_PLACE_IN_WAITLIST;
					 else if ($error[$cnt]=='M')
					    echo INFO_NO_MORE_SEATS;
					 else if ($error[$cnt]=='A')
					    echo INFO_ALREADY_REGISTER;
					 else
					    echo '</font>';
				     }
		                   ?></td></tr>
	      <?php } else { ?>
                   <td class="main"><?php echo NO_SESSION_DATES ;?><td></tr>	      
	      <?php } ?>
<?php  $cnt++;
       }
       echo '<tr><td class=main>' . tep_draw_checkbox_field('process_wait','Y') . '&nbsp' . TEXT_MOVE_WAITLIST . '</td></tr>';
?>
      </table></td></tr>
<?php     } else  { ?>

      <tr><td><table border="0" width=100% cellpadding="2" align=center class=formArea>
      
                 <tr><td><?php echo TEXT_NO_RESERVATIONS_FOUND; ?></td></tr>
	       </table>
      </td></tr>
<?php } ?>
      <tr><td align=right>
      <?php if ($cnt>0) echo tep_template_image_submit('button_move.gif',IMAGE_BUTTON_MOVE) . '&nbsp;'; 
            echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_RESERVATIONS,'','SSL') .'">' . tep_template_image_button('button_back.gif',IMAGE_BACK) . "</a>";
	    echo '</form>';
      ?></td></tr>
<?php 
 if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
} ?>       
</table>