<?cs def:course_info(instructor, timestring, semester, title) ?>
<span class="center_msg">
   <span class="common_title"><?cs var:course_no ?> <?cs var:title ?> <?cs var:semester ?></span>
   <br /><span class="common_course"><?cs var:instructor ?><br /><?cs var:current_time ?></span>
</span>
<?cs /def ?>

<?cs def:print_heading() ?>
  <table width="100%">
   <tr><td>
    <a href="<?cs var:back_url ?>" title="<?cs var:lang.news_new_memo.goback ?>"><img src="<?cs var:image_path ?>/back_arrow.gif" width="50" height="34" alt="<?cs var:lang.news_new_memo.goback ?>" /></a>
    </td>
    <td>
     <table width="80%">
      <tr><td align="center">
      <?cs call:course_info(instructor, current_time, semester, course_title) ?>
      </td></tr>
     </table>
    </td>
   </tr>
  </table>
<?cs /def ?>

<?cs def:print_paste(paste) ?>
   <tr><td>
    <div><form method="post" action="news_new_memo">
    <div>
         <?cs each:this = hidden ?>
          <input type="hidden" name="<?cs var:this.name ?>" value="<?cs var:this.value ?>" />
         <?cs /each ?>

    <input type="hidden" name="paste" value="yes"  />
    </div>
    
    <input type="submit" value="<?cs var:paste.msg ?>" title="<?cs var:paste.help ?>" />
   </form></div>
  </td></tr>
<?cs /def ?>

<?cs def:print_mark_hide(mark) ?> 
  <tr>
    <td>
      <input type="checkbox" name="hide" title="<?cs var:mark.help ?>" /><?cs var:mark.msg ?>
    </td>
  </tr>
<?cs /def ?>

<?cs def:print_spell(spell) ?>
 <tr>
   <td align="right">
   <?cs if:content_clipboard ?>
    <input type="button" value="<?cs var:spell.msg ?>" title="<?cs var:spell.help ?>" onclick="openSpellChecker( document.forms[1].msg );" />
   <?cs else ?>
    <input type="button" value="<?cs var:spell.msg ?>" title="<?cs var:spell.help ?>" onclick="openSpellChecker( document.forms[0].msg );" />
   <?cs /if ?>
   </td>
 </tr>
<?cs /def ?>


<?cs def:print_subject(data, subject) ?>
  <tr>
     <td class="regheading">
     <input type="submit" value="<?cs var:data.send.msg ?>" title="<?cs var:data.send.help ?>" />
     <?cs var:data.topic[subject.topic].msg ?>
     <input type="text" name="subject" id="subject" size="<?cs if:subject.size ?><?cs var:subject.size ?><?cs else ?><?cs var:subject.max ?><?cs /if ?>" maxlength="<?cs var:subject.max ?>" title="<?cs var:data.topic[subject.topic].help ?>" value="<?cs if:subject.add_re ?><?cs var:data.topic.re_prompt ?><?cs /if ?> <?cs var:subject.value ?>" />
     </td>
  </tr>
<?cs /def ?>

<?cs def:print_textarea(data, textarea) ?>
  <tr>
     <td>
       <textarea title="<?cs var:data.help ?>" name="msg" cols="<?cs var:textarea.cols ?>" rows="12"><?cs if:textarea.feedback ?><?cs var:textarea.feedback ?> <?cs var:data.wrote ?><?cs var:textarea.feedback_newline ?><?cs /if ?><?cs var:textarea.body ?></textarea>
     </td>
  </tr>
<?cs /def ?>

<?cs def:print_attach(data) ?>
 <?cs if:has_attach ?>
   <tr>
     <td class="regheading"><?cs var:data.pasted.msg ?>
     <?cs if:attach.website == #1 ?> 
      <br /><input type="checkbox" name="f1" value="<?cs var:attach.file[0].value ?>" title="<?cs var:data.pasted.help ?>" checked="checked" /><?cs var:lang.news_new_memo.attachedwebsite ?>
     <?cs else ?>
     <?cs set:file_num = #1 ?>
     <?cs each:this = attach.file ?>
      <br /><input type="checkbox" name="f<?cs var:file_num ?>" value="<?cs var:this.value ?>" title="<?cs var:data.pasted.help ?>" checked="checked" /><?cs var:this.orig ?>
     <?cs set:file_num = file_num + #1 ?>
     <?cs /each ?>
     <?cs /if ?>
     <input type="hidden" name="<?cs var:attach.type ?>" value="<?cs var:attach.value ?>" />
     </td>
   </tr>
 <?cs /if ?>

 <tr>
    <td class="regheading">
     <?cs var:data.msg ?>
     <?cs if:attach.website == #1 ?>
     <br /><span class="error"><?cs var:lang.news_new_memo.pasted_note ?></span>
     <?cs /if ?>
    </td>
 </tr>
 <?cs if:attach.allow_hotpot_exam == #1 ?>
   <?cs set:num = #0 ?>
   <?cs each:this = data.child ?>
   <tr>
     <td>
       <table>
        <tr>
         <td valign="middle">
         <input type="radio" name="website" value="<?cs var:num ?>" title="<?cs var:this.help ?>" />
        </td>
        <td class="attach"><?cs var:this.msg ?></td>
        </tr>
      </table> 
     </td>
   </tr>
   <?cs set:num = num + #1 ?>
  <?cs /each ?>
  <?cs else ?>
   <tr><td>
    <table>
     <tr>
         <td valign="middle">
         <input type="checkbox" name="website" value="1" title="<?cs var:data.child[1].help ?>" />
        </td>
        <td class="attach"><?cs var:data.child[1].msg ?></td>
     </tr>
    </table>
   </td></tr>
 <?cs /if ?>
<?cs /def ?>

<?cs def:print_upload_form(file) ?>
  <?cs loop:x = #0, attach.max_files - #1, #1 ?>
  <?cs set:file_num =  x + #1 ?>
  <?cs set:name = "file" + file_num ?>
  <?cs if:x  == #0 ?>
   <tr><td>
  <?cs elif:x % 2 == #0  ?>
   </td></tr><tr><td>
  <?cs /if ?>
   <input type="file" name="<?cs var:name ?>" title="<?cs var:file.help ?>" />
  <?cs /loop ?>  
<?cs /def ?>

<?cs def:print_submit(data) ?>
 <tr>
   <td align="center">
    <input type="submit" value="<?cs var:data.msg ?>" title="<?cs var:data.help ?>" />
   </td>
 </tr>
<?cs /def ?>

<?cs def:print_testing_hotpot() ?>
  <body onload="openwindow('<?cs var:hotpot_url ?>', 'Quiz_check')">
  </body></html>
<?cs /def ?>

<?cs def:print_ask_which(data) ?>
  <body>
  <?cs call:print_heading() ?>
  <div class="center_msg">
  <span class="alert_color"><?cs var:lang.news_new_memo.grp[grp].msg ?></span> 
  </div>
  <div class="center_msg">
   <span class="regheading"><?cs var:data.html.instruction ?></span>
  </div>
  <table width="100%">
   <tr><td align="center">
     <div><form method="post" action="web_page_link">
      <div>
        <?cs each:this = hidden ?>
         <input type="hidden" name="<?cs var:this.name ?>" value="<?cs var:this.value ?>" /> 
        <?cs /each ?>
      </div>
     <table cellspacing="0" cellpadding="4" border="1">
      <?cs each:html = file ?>
       <tr>
         <td>
            <?cs if:html.checked ?>
              <input type="radio" name="<?cs var:html.name ?>" value="<?cs var:html.value ?>" checked="checked" title="<?cs var:data.html.help ?>" /> 
            <?cs else ?>
              <input type="radio" name="<?cs var:html.name ?>" value="<?cs var:html.value ?>"  title="<?cs var:data.html.help ?>" /> 
            <?cs /if ?>
          </td>
          <td>
             <?cs var:html.value ?>
          </td>
       </tr>
      <?cs /each ?>
      <tr><td colspan="2"><input type="submit" value="<?cs var:data.click ?>" title="<?cs var:data.click_help ?>" /></td></tr>
     </table>
    </form></div>
   </td></tr>
  </table>
  </body></html>
<?cs /def ?>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
   <head>
      <title><?cs var:course_no ?> <?cs var:lang.news_new_memo.grp[grp].msg ?> <?cs var:lang.news_new_memo.grp[grp].title ?></title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   <link rel="StyleSheet" href="<?cs var:image_path ?>common.css" type="text/css" media="screen" />
   <link rel="StyleSheet" href="<?cs var:image_path ?>manhattan.css" type="text/css" media="screen" />
    <?cs if:check_spelling ?>
    <script type="text/javascript" src="<?cs var:server_name ?><?cs var:image_path ?>spellChecker.js"></script>
  <script type="text/javascript">
   function openSpellChecker(txt) {
    var speller = new spellChecker( txt,'<?cs var:server_name ?><?cs var:image_path ?>spellchecker.html','<?cs var:server_name ?>/<?cs var:alias ?>/spellchecker' );
     speller.openChecker();
   }
  </script>

   <?cs /if ?>
   <?cs if:hotpot_testing ?>
  <script type="text/javascript">
  function openwindow(some_url,winname)
  {
      var new_window = window.open(some_url, winname,'menubar=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=760,height=500');
      new_window.focus();
  }
  </script>
 <?cs /if ?>
  </head>
<?cs if:hotpot_testing ?>
<?cs call:print_testing_hotpot() ?>
<?cs elif:ask_which ?>
<?cs call:print_ask_which(lang.news_new_memo) ?>
<?cs else ?>
<body onload="document.getElementById('subject').focus()">
 <?cs call:print_heading() ?>
 <div class="center_msg">
  <span class="alert_color"><?cs var:lang.news_new_memo.grp[grp].msg ?> 
   <?cs if:msg.subject.add_re ?>
     <?cs var:msg.subject.value ?>
   <?cs else ?>
   <?cs var:lang.news_new_memo.grp[grp].title ?>
   <?cs if:Query.team ?>
    <i>(<?cs var:lang.news_new_memo.team ?> <?cs var:Query.team ?>)</i> 
   <?cs /if ?>
   </span>
   <?cs /if ?>
 </div>
<div class="news_new_memo">
  <table width="60%" cellspacing="0" cellpadding="4">
   <?cs if:content_clipboard == #1 ?>
      <?cs call:print_paste(lang.news_new_memo.paste) ?>
   <?cs /if ?>
   <div><form method="post" enctype="multipart/form-data" action="news_send_mail">
    <div>
     <?cs each:this = hidden ?>
      <input type="hidden" name="<?cs var:this.name ?>" value="<?cs var:this.value ?>" />
     <?cs /each ?>
    </div>
   <?cs if:mark_hide == #1 ?>
     <?cs call:print_mark_hide(lang.news_new_memo.mark) ?> 
   <?cs /if ?>
   <?cs call:print_subject(lang.news_new_memo, msg.subject) ?>
   <?cs if:check_spelling ?>
     <?cs call:print_spell(lang.news_new_memo.spell) ?>
   <?cs /if ?>
   <?cs call:print_textarea(lang.news_new_memo.body, msg.textarea) ?>
   <?cs call:print_attach(lang.news_new_memo.attachment ) ?>
   <?cs call:print_upload_form(lang.news_new_memo.file) ?>
   <?cs call:print_submit(lang.news_new_memo.send) ?>
   </form></div>
  </table>
</div>
</body>
</html>
<?cs /if ?>
