<?=$javascript->link('email_frame'); ?>

<div id="emailHeaders">
    <dl>


	<dt><?php __('From'); ?></dt>
	<dd>
	    <?php echo $html->link($email['User']['first_name'].' '.$email['User']['last_name'],
	    array('controller'=>'users', 'action'=>'view', $email['User']['id'])); ?>
	    &nbsp;
	    <?php echo $html->link($email['User']['email'], array('controller'=>'users','action'=>'view',$email['User']['id'])); ?>
	</dd>


	<?php
	if(isset($recipients['to'])): ?>

	<dt>To</dt>
	    <?
	    $ddCount = 0;
	    foreach($recipients['to'] as $recipient):
		$ddCount++;
		if($ddCount > 1) {
		    $class="additionalDD";
		}
		else {
		    $class= "";
		}
		?>
	<dd class="<?=$class?>">
		    <?php
		    if(!empty($recipient['first_name']) && !empty($recipient['last_name'])) {
			  echo $html->link($recipient['first_name'].' '.$recipient['last_name'],
		    array('controller'=>'users', 'action'=>'view', $recipient['id']));
		    } ?>
		  
		    <?php echo $html->link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?>
	</dd>
	    <? endforeach;?>
	<? endif;?>


	<?php
	if(isset($recipients['cc'])): ?>
	<dt>cc</dt>
	    <?
	    $ddCount = 0;
	    foreach($recipients['cc'] as $recipient):
		$ddCount++;
		if($ddCount > 1) {
		    $class="additionalDD";
		}
		else {
		    $class= "";
		}
		?>
	<dd class="<?=$class?>">
		     <?php
		    if(!empty($recipient['first_name']) && !empty($recipient['last_name'])) {
			  echo $html->link($recipient['first_name'].' '.$recipient['last_name'],
		    array('controller'=>'users', 'action'=>'view', $recipient['id']));
		    } ?>
		    <?php echo $html->link($recipient['email'], array('controller'=>'users','action'=>'view',$recipient['id'])); ?>
	</dd>
	    <? endforeach;?>
	<? endif;?>

	<dt><?php __('Date'); ?></dt>
	<dd>
	    <?php echo date('j M Y @ G:i', $email['Email']['udate']); ?>

	    &nbsp;
	</dd>
	<dt><?php __('Subject'); ?></dt>
	<dd>
	    <?php echo $email['Email']['subject']; ?>
	    &nbsp;
	</dd>
    </dl>
</div>


<div id="emailframeDiv">
    <iframe id="emailFrame" src="/email_attachments/view/<?=$body_ID?>" width="100%" height="500px">
	<p>This function only works with a Modern Browser that uses Iframes. Sorry.</p>
    </iframe>
</div>
<div id="emailattachments">
    <?php echo $this->element('email_attachments', array('attachments' => $email['EmailAttachment'])); ?>
</div>


<? //print_r($email); ?>