<?php

$help->print_help_js(); /* Setup a help instance */

?>

<table border="0" align="center" cellpadding="3" cellspacing="2">
<tr bgcolor="<?php echo $default->dark_bg; ?>">
  <td colspan="3">
    <?php $default->text_on_dark->start(); ?><b><?php echo $ACTION_TEXT ?></b> - <i><?php echo strftime('%c') ?></i></font>
  </td>
</tr>
<form method="post" 
      name="compose" 
      enctype="multipart/form-data"
      onSubmit="return submit_and_sign(this)">

<input type="hidden" name="mailbox" value="<?php echo $mailbox ?>">
<?php if (isset($actionID) && (($actionID == REPLY) || ($actionID == REPLY_ALL))): ?>
<input type="hidden" name="is_reply" value="1">
<input type="hidden" name="in_reply_to" value="<?php echo $in_reply_to ?>">
<input type="hidden" name="references" value="<?php echo $references ?>">
<input type="hidden" name="index" value="<?php echo $index ?>">
<?php endif; ?>

<?php if ($default->user_change_from): ?>
<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg; ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->from_string ?></FONT></td>
  <td bgcolor="<?php echo $default->item_bg ?>"><input type="text" size="70" tabindex="1" name="from" value="<?php echo $from ?>"></td>
  <td align="right"><?php $help->link(COMPOSE_HELP_FROM, $help_file, 'imp') ?></td>
</tr>
<?php endif; ?>

<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg; ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->to_string ?></FONT></td>
  <td bgcolor="<?php echo $default->item_bg ?>"><input type="text" size="70" tabindex="2" name="to" onBlur="expand_to()" value="<?php echo $to ?>"></td>
  <td align="right"><?php $help->link(COMPOSE_HELP_TO, $help_file, 'imp') ?></td>
</tr>

<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg; ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->cc_string ?></FONT></td>
  <td bgcolor="<?php echo $default->item_bg; ?>"><input type="text" size="70" tabindex="3" name="cc" onBlur="expand_cc()" value="<?php echo $cc ?>"></td>
  <td align="right"><?php $help->link(COMPOSE_HELP_CC, $help_file, 'imp') ?></td>
</tr>

<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg; ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->bcc_string ?></FONT></td>
  <td bgcolor="<?php echo $default->item_bg; ?>"><input type="text" size="70" tabindex="3" name="bcc" onBlur="expand_bcc()" value="<?php echo $bcc ?>"></td>
  <td align="right"><?php $help->link(COMPOSE_HELP_BCC, $help_file, 'imp') ?></td>
</tr>


<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg; ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->subject_string ?></FONT></td>
  <td bgcolor="<?php echo $default->item_bg ?>"><input type="text" tabindex="4" name="subject" value="<?php echo $subject ?>" size="70"></td>
  <td align="right"><?php $help->link(COMPOSE_HELP_SUBJECT, $help_file, 'imp') ?></td>
</tr>

  <input notab type="hidden" name="actionID" value="">
  <input type="hidden" name="attachmentAction" value="">
<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->attach_string ?></font></td>
  <td valign="middle" bgcolor="<?php echo $default->item_bg ?>"><input name="file_upload" type="file" size=48>&nbsp;&nbsp;
  <input notab type="submit" name="actionID" value="<?php echo $lang->button_attach ?>" onClick="attachmentAction.value = 'add';return attachment_check(document.compose);"></td>
  <td align="right"><?php $help->link(COMPOSE_HELP_ATTACH, $help_file, 'imp') ?></td>
</tr>

<?php if (count($attachments_name) > 0): ?>

<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->attach_string_plural ?></font></td>
  <td align="center" bgcolor="<?php echo $default->item_bg ?>">
  <div align="center">
  <table border="0" cellpadding="1" cellspacing="2" width="100%">
  <tr>
     <td bgcolor="#ddddaa" align="center"><input type="submit" name="actionID" value="<?php echo $lang->button_delete_attach ?>" onClick="attachmentAction.value = 'delete'; return attachment_check(document.compose);"></td>
     <td bgcolor="#ddddaa" width="50%" align="left"><?php echo $lang->file_name ?></td>
     <td bgcolor="#ddddaa" width="50%" align="left"><?php echo $lang->file_size ?></td>
  </tr>
  <?php for ($i = 0; $i < count($attachments_name); $i++) { ?>
     <input type="hidden" name="attachments_name[]" value="<?php echo $attachments_name[$i] ?>">
     <input type="hidden" name="attachments_size[]" value="<?php echo $attachments_size[$i] ?>">
     <input type="hidden" name="attachments_file[]" value="<?php echo $attachments_file[$i] ?>">
     <input type="hidden" name="attachments_type[]" value="<?php echo $attachments_type[$i] ?>">
     <tr>
       <td align="center" bgcolor="#ddddaa"><?php $default->text_on_light->start(); ?>
         <input type="checkbox" name="delattachments[]" value="<?php echo $attachments_file[$i] ?>">
       </td>
       <td align="left" bgcolor="#ddddaa"><?php $default->text_on_light->start(); ?><?php echo $attachments_name[$i] ?></td>
       <td align="left" bgcolor="#ddddaa"><?php $default->text_on_light->start(); ?><?php echo $attachments_size[$i] ?></td>
     </tr>
  <?php } ?>
  <tr><td>&nbsp;</td><td align="right"><?php echo $lang->total_size ?></td><td><?php echo $total_size ?></td></tr>
  </table>
  </div>
  </td>
  <td align="right"><?php $help->link(COMPOSE_HELP_ATTACH, $help_file, 'imp') ?></td>
</tr>

<?php endif; ?>

<tr>
  <td align="right" bgcolor="<?php echo $default->light_bg ?>"><?php $default->text_on_light->start(); ?><?php echo $lang->options ?></font></td>
  <td bgcolor="<?php echo $default->item_bg ?>">
    <table cellspacing="2" border="0">
    <tr>
<?php if ($default->use_db): ?>
  <?php if ($default->user_use_addressbook == true): ?>
    <?php if ($default->use_ldap_search): ?>
      <td bgcolor="#ddddaa"><a href="javascript:open_contacts_ldap_win()"><img border="0" valign="middle" src="<?php echo $default->graphics_url ?>/addressbook.gif" hspace="2" alt="<?php echo $lang->contacts ?>" height="18" width="18"></a><?php echo $lang->contacts ?></td>
    <?php else: ?>
      <td bgcolor="#ddddaa"><a href="javascript:open_contacts_win()"><img border="0" valign="middle" src="<?php echo $default->graphics_url ?>/addressbook.gif" hspace="2" alt="<?php echo $lang->contacts ?>" height="18" width="18"></a><?php echo $lang->contacts ?></td>
    <?php endif; ?>
  <?php else: ?>
    <?php if ($default->use_ldap_search): ?>
    <td bgcolor="#ddddaa"><a href="javascript:open_contacts_ldap_noaddy_win()"><img border="0" valign="middle" src="<?php echo $default->graphics_url ?>/addressbook.gif" hspace="2" alt="<?php echo $lang->contacts ?>" height="18" width="18"></a><?php echo $lang->contacts ?></td>
    <?php endif; ?>
  <?php endif; ?>
<?php else: ?>
  <?php if ($default->use_ldap_search): ?>
    <td bgcolor="#ddddaa"><a href="javascript:open_contacts_ldap_noaddy_win()"><img border="0" valign="middle" src="<?php echo $default->graphics_url ?>/addressbook.gif" hspace="2" alt="<?php echo $lang->contacts ?>" height="18" width="18"></a><?php echo $lang->contacts ?></td>
  <?php endif; ?>
<?php endif; ?>

	</tr>
      </table>
  <td align="right"><?php $help->link(COMPOSE_HELP_OPTIONS, $help_file, 'imp') ?></td>
  </td>
</tr>
<tr>
  <td colspan="3" align="center"><textarea tabindex="5" name="message" rows="20" cols="80" wrap="hard"><?php echo $msg ?></textarea></td>
</tr>

<tr>
<td nowrap align="center" colspan="3">
<?php
if (isset($default->path_to_ispell)) {
  echo "<a href=\"javascript:spellcheck()\">" . $lang->button_spellcheck;
  
  if (isset($default->ispell_lang)) {
     echo "$lang->spell_in</a>\n";
     echo "<select name=\"spell_lang\">\n";
     
     reset($default->ispell_lang);
     while (list($key, $val) = each($default->ispell_lang)) {
	 echo "<option value=\"$key\">" . $lang->lang[$key] . "</option>\n";
     }
     echo "</select>\n";
  } else {
      echo "</a>\n";
  }
}
?>

    <input type="button" value="<?php echo $lang->button_cancel ?>" onClick="self.close();">
    <input notab type="submit" name="actionID" value="<?php echo $lang->button_send ?>">
  </td>
</tr>

</form>

<?php if (isset($default->path_to_ispell)): ?>
<form action="<?php echo $default->root_url ?>/spelling.php3" method="post" name="spelling" target="impspelling">
  <input type=hidden name="message" value="">
  <input type=hidden name="spell_lang" value="">
</form>
<?php endif; ?>
</table>
