<?php
/**
 * @version		$Id: view.feed.php 10381 2008-06-01 03:35:53Z pasamio $
* @package		Contact_Enhanced
 * @subpackage	Contact
 * @copyright	Copyright (C) 2006 - 2010 Ideal Custom Software Development
 * @author     Douglas Machado {@link http://ideal.fok.com.br}
 * @author     Created on 28-Jul-09
 * @license		GNU/GPL, see license.txt
 * Contact Enhanced  is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses. 
 */defined( '_JEXEC' ) or die( 'Restricted access' );

$cparams = JComponentHelper::getParams ('com_media');

if ( isset($this->msgs[0]) ) {
	if( count($this->msgs) > 1 ){
		$this->msgs = implode("\n",$this->msgs);
	}else{
		$this->msgs	= $this->msgs[0];
	}
	?>
	<script type="text/javascript">
		window.addEvent('domready', function(){
			alert('<?php echo $this->msgs;  ?>');
		});
	</script>
<?php
}

?>
<div id="component-contact-enhanced" 
	class="ce-container<?php echo $this->params->get( 'pageclass_sfx' ) 
		. (JRequest::getVar('tmpl') ? ' ce-modal-container' : ''); ?>">

<div class="contentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
		<?php echo $this->author->name; ?>
</div>

	<?php if ( $this->contact->params->get( 'show_customfields',0 ) AND ( $this->contact->params->get( 'access_details' ) <= $this->user->aid )	) : ?>
		<div class="ce-contact-extra-fields">
			<?php echo $this->loadTemplate('contactcustomfields'); ?>
		</div>
	<?php endif; ?>
	
	<?php if ( $this->contact->misc && $this->contact->params->get( 'show_misc' ) ) : ?>
		<div class="ce-contact-misc">
			<?php echo $this->contact->misc; ?>
		</div>
	<?php endif; ?>
	
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="contentpaneopen<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
<?php 
$sidebarWidth	= (int) $this->contact->params->get( 'sidebar_width','30' );
$formWidth		= 99-$sidebarWidth;
$show_sidebar	= $this->contact->params->get( 'show_sidebar',false );
?>
<tr>
	<td colspan="2">
	<table id="ce-form-container">
		<tr>
	<?php //endif;
		
		if ( ($show_sidebar == 'left' AND $this->params->get( 'show_map') == 'sidebar') OR $show_sidebar == 'left' ){
			echo $this->loadTemplate('sidebar');
		}
		
		if ( $this->contact->params->get('email_form_access_level',0) <= $this->user->aid && ($this->contact->email_to || $this->contact->user_id)){
			echo $this->loadTemplate('form');
		}else if(!$this->contact->email_to AND !$this->contact->user_id){
			echo JText::_('Please either set an email to this contact or link it to a registered user');
		}
		if ( ( $show_sidebar == 'right' AND $this->params->get( 'show_map') == 'sidebar') OR $show_sidebar == 'right' ){
			echo $this->loadTemplate('sidebar');
		}
		
		
	?>
		</tr>
	</table>
	</td>
</tr>
</table>
</div>