<?php

 /**
 * @package		Joomla.Site
 * @subpackage	com_contact
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.tooltip');
 if (isset($this->error)) : ?>
	<div class="contact-error">
		<?php echo $this->error; ?>
	</div>
<?php endif; ?>

<div class="contact-form">
	<form id="contact-form" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="form-validate">
		<table cellpadding="0" cellspacing="0" width="100%">
			<tr valign="top">
				<td class="contact-title"><?php echo $this->form->getLabel('contact_name'); ?></td>
				<td class="contact-value"><?php echo $this->form->getInput('contact_name'); ?></td>
			</tr>
			<tr valign="top">
				<td class="contact-title"><?php echo $this->form->getLabel('contact_email'); ?></td>
				<td class="contact-value"><?php echo $this->form->getInput('contact_email'); ?></td>
			</tr>
			<tr valign="top">
				<td class="contact-title"><?php echo $this->form->getLabel('contact_subject'); ?></td>
				<td class="contact-value"><?php echo $this->form->getInput('contact_subject'); ?></td>
			</tr>
			<tr valign="top">
				<td class="contact-title"><?php echo $this->form->getLabel('contact_message'); ?></td>
				<td class="contact-value"><?php echo $this->form->getInput('contact_message'); ?></td>
			</tr>
			<?php //Dynamically load any additional fields from plugins. ?>
			     <?php foreach ($this->form->getFieldsets() as $fieldset): ?>
			          <?php if ($fieldset->name != 'contact'):?>
			               <?php $fields = $this->form->getFieldset($fieldset->name);?>
			               <?php foreach($fields as $field): ?>
			                    <?php if ($field->hidden): ?>
			                         <?php echo $field->input;?>
			                    <?php else:?>
			                         <td class="contact-title">
			                            <?php echo $field->label; ?>
			                            <?php if (!$field->required && $field->type != "Spacer"): ?>
			                               <span class="optional"><?php echo JText::_('COM_CONTACT_OPTIONAL');?></span>
			                            <?php endif; ?>
			                         </td>
			                         <td class="contact-value"><?php echo $field->input;?></td>
			                    <?php endif;?>
			               <?php endforeach;?>
			          <?php endif ?>
			     <?php endforeach;?>
			    <tr>
			    	<td colspan="2">
						<?php echo $this->form->getInput('contact_email_copy'); ?><?php echo $this->form->getLabel('contact_email_copy'); ?>
			    		<input class="button validate" type="submit" value="<?php echo JText::_('COM_CONTACT_CONTACT_SEND'); ?>" />
			    	</td>
			    </tr>
		</table>
		
		<input type="hidden" name="option" value="com_contact" />
		<input type="hidden" name="task" value="contact.submit" />
		<input type="hidden" name="return" value="<?php echo $this->return_page;?>" />
		<input type="hidden" name="id" value="<?php echo $this->contact->slug; ?>" />
		<?php echo JHtml::_( 'form.token' ); ?>
	</form>
</div>
