
<?php

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
 echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><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 . 'freeway.png', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          	<?php echo DIR_WS_IMAGES . 'freeway.png';?>
		  </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('contact') > 0) {
?>
      <tr>
        <td><?php echo $messageStack->output('contact'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
      <tr>
        <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_SUCCESS; ?></td>
      </tr>
      <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 width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_template_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  } else {
?>
<?php   // cms_contact starting
$query = "select * from email_messages where message_type = 'CON'";
$query = tep_db_query($query);
$result = tep_db_fetch_array($query);
$name = tep_draw_input_field('name','','class="inputNormal"').'<br>';
$mail = tep_draw_input_field('email','','class="inputNormal"') . '<br>';
$enquiry = tep_draw_textarea_field('enquiry', 'soft', 50, 15,'',' background-color:#000000;');
$continue = tep_template_image_submit('button_send.gif', IMAGE_BUTTON_SEND);
$reset = tep_template_image_button('button_reset.gif', IMAGE_BUTTON_RESET,' onclick="reset_form()" style="cursor:pointer;cursor:hand"');
//$replace_array = array('%%Name_Box%%'=>$name,'%%Email_Box%%'=>$mail,'%%Message_Box%%'=>$enquiry,'%%Continue_Button%%'=>$continue,'%%Reset_Button%%'=>$reset);
$replace_array = array(TEXT_TN1=>$name,TEXT_TN2=>$mail,TEXT_TN3=>$enquiry,TEXT_BT1=>$continue,TEXT_BT2=>$reset);
$body='<body>';
$body1='</body>';
$messages=html_entity_decode($result['message_text']);
if(strpos($messages,html_entity_decode($body),0)!==false){
	$pos1=strpos($messages,html_entity_decode($body),0)+6;
	$messages=substr($messages,$pos1);
	$pos2=strpos($messages,html_entity_decode($body1),$pos1);
	$messages=substr($messages,0,$pos2);
} else $messages=$result['message_text'];

foreach($replace_array as $key=>$value){ 
	$messages = str_replace('%%'.$key.'%%',$value,$messages);
}

?>
      <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" class="contact">
              <tr>
                <td class="main" align="right"><?php //echo ENTRY_NAME . '&nbsp;&nbsp;'; ?></td>
                <td class="main"><?php echo $messages; ?></td>
              </tr>
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
              <tr>
                <td class="main" align="right"><?php //echo ENTRY_EMAIL . '&nbsp;&nbsp;'; ?></td>
                <td class="main"><?php //echo tep_draw_input_field('email','',''); ?></td>
              </tr>
			  <tr>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
			  </tr>
              <tr>
                <td class="main" valign="top" align="right"><?php //echo ENTRY_MESSAGE . '&nbsp;&nbsp;'; ?></td>
                <td class="main"><?php //echo tep_draw_textarea_field('enquiry', 'soft', 50, 15,'',' background-color:#000000;'); ?></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="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="80"><?php //echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td align="left"><?php //echo tep_template_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
                <td align="right"><?php //echo tep_template_image_button('button_reset.gif', IMAGE_BUTTON_RESET,' onclick="reset_form()" style="cursor:pointer;cursor:hand"'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr> -->
<?php
  }
?>
<?php
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
}
// EOF: Lango Added for template MOD
?>

    </table></form>
	<script language="javascript" type="text/javascript">
		function reset_form(){
			document.contact_us.reset();
		}
	</script>