<?php

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

  $error = false;
  if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
    $name = tep_db_prepare_input($_POST['ct_name']);
    $email_address = tep_db_prepare_input($_POST['ct_email']);
    $tel = tep_db_prepare_input($_POST['ct_telefon']);

if (tep_session_is_registered('customer_id')) {
$account_query = tep_db_query("select customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");$account = tep_db_fetch_array($account_query);
$account_query = tep_db_query("select entry_company from address_book where address_book_id = '" . (int)$account['customers_default_address_id'] . "'");$account = tep_db_fetch_array($account_query); $account = $account['entry_company'];
	$enquiry .= "Companie: " . $account . "\n";
} else $enquiry = '';

	$enquiry .= "Nume: " . $name . "\n";
	$enquiry .= "Adresa de e-mail: " . $email_address . "\n";
	$enquiry .= "Telefon: " . $tel . "\n\n";
    $enquiry .= "Reclamatie:\n" . tep_db_prepare_input($_POST['ct_enquiry']);

    if (tep_validate_email($email_address)) {
      tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
      tep_mail(STORE_OWNER, $email_address, EMAIL_SUBJECT, $enquiry, $name, $email_address);

if (tep_session_is_registered('customer_id')) {
$emailuri = tep_db_query("select companie from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");$emailuri = tep_db_fetch_array($emailuri);
$emailuri = tep_db_query("select reclamatii from firme where id = '" . $emailuri['companie'] . "'");$emailuri = tep_db_fetch_array($emailuri);
$emailuri = $emailuri['emailuri']; 
if ( strlen($emailuri) != 0 ) { $emailuri = explode(",", $emailuri);
for ($i = 0; $i <= count($emailuri); $i++) {
tep_mail(STORE_OWNER, $emailuri[$i], EMAIL_SUBJECT, $enquiry, $name, $email_address);
}
}
}
	  
	  tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
    } else {
      $error = true;

      $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    }
  }

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link rel="stylesheet" type="text/css" href="contentslider.css" />

<script type="text/javascript" src="contentslider.js">

/***********************************************
* Featured Content Slider- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php');
$_SESSION['this_page'] = 'contact_us.php'; ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="1" cellpadding="1" align="center">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    
	<td width="100%" valign="top"><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
      
	  
	  <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         
		  <tr>
<?php
if(!isset($_GET['catid'])){
?>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
          </tr>
		 <!--<tr>
		
		 
			<td width="100%" height="417" rowspan="2" align="center" bgcolor="#cccccc" >
             <img src="../images/theme/3amap.jpg" width="467" height="417"/></td>
			<br>	  
		  
		  </tr>-->
		 
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?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($_GET['action']) && ($_GET['action'] == 'success')) {
?>
      <tr>
        <td class="main" align="center"><?php echo 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_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 {
?>
<tr>
<td class="textzone">
<strong>Intrebare:</strong>Cum va pot contacta<br />
<strong>Raspuns:</strong> Simplu, cum preferi:<br /><br />

<strong>e-mail</strong><br />
<p>Ne poti contacta trimitandu-ne un mesaj pe adresa <b>office@aaabirotica.ro</b> sau <b>comenzi@aaabirotica.ro</b> si te asiguram ca vei primi un raspuns in cel mai scurt timp.  De obicei, clientii nostri folosesc prima adresa pentru informatii generale, iar a doua adresa pentru comenzi.  Poti trimite comenzi si pe prima adresa, atata timp cat specifici ca este o comanda si noi stim sa o tratam ca atare, pentru a te servi cat mai bine.  De asemenea, mai exista adresa <b>aaabirotica@aaabirotica.ro</b>.  Aici il poti contacta pe directorul general al companiei noastre.  Orice tip de mesaj este binevenit, chiar si critic, deoarece ne ajuta sa ne imbunatatim serviciul fata de tine, clientul nostru.</p>
<br /><br />
<strong>Telefon</strong><br />
Celalalt mijloc uzual de contact este telefonul.  In acest sens stau la dispozitia clientilor nostri urmatoarele numere de telefon: <b>021421 08 43</b>, <b>021 420 20 61</b> si <b>0740 55 00 00</b>, oricand intre orele <b>7:30</b> si <b>19:00</b>.  De obicei numerele de telefon sunt mai des folosite pentru intrebari referitoare la stocuri, caracteristici ale produselor (culoare, ambalare, unitate de vanzare, timp de livrare, etc).
<br /><br />
Tu ce mijloc de contact preferi?<br /><br />


<strong>Pentru sugestii si reclamatii va rugam sa folositi formularul de mai jos.</strong><br>
</td>
<?php
if (tep_session_is_registered('customer_id')) {
$account_query = tep_db_query("select * from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
$account = tep_db_fetch_array($account_query);
$ct_name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
$ct_email = $account['customers_email_address'] ;
$ct_telefon = $account['customers_telephone'] ;
} else { $ct_name = ''; $ct_email = ''; $ct_telefon = ''; }
?>
</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 class="main"><?php echo ENTRY_NAME; ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo tep_draw_input_field('ct_name'); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo ENTRY_EMAIL; ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo tep_draw_input_field('ct_email'); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo 'Telefon contact:'; ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo tep_draw_input_field('ct_telefon'); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo 'Continut:'; ?></td>
              </tr>
              <tr>
                <td><?php echo tep_draw_textarea_field('ct_enquiry', 'soft', 50, 15); ?></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="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
<?php
  }
} else {
?>
<div class="categoriesShow">
<?php
include "includes/categories_menu.php";
?>
</div>
<?php	
}
 ?>
        </table></td>
      </tr>

    </table></form></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
