<?cs include:"util.cs" ?>
<?cs include:"add_smile.cs" ?>


<?cs def:print_paste(paste) ?>
   <tr><td align="center">
    <div><form method="post" action="link_new_memo" onsubmit="return discard_confirm('<?cs var:lang.link_new_memo.replace_confirm ?>' )" >
    <div>
          <input type="hidden" name="crs" value="<?cs var:crs ?>" />
          <input type="hidden" name="id" value="<?cs var:id ?>" />
          <input type="hidden" name="paste" value="yes" />
          <input type="hidden" name="from" value="<?cs var:from ?>" />
         <input type="submit" value="<?cs var:paste.msg ?>" title="<?cs var:paste.help ?>" />
    </div>
   </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:paste ?>
    <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><td>&nbsp;</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.subject.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.subject.help ?>" value="<?cs var:subject.value ?>" />
     </td>
  </tr>
<?cs /def ?>

<?cs def:print_textarea(data, textarea) ?>
  <tr>
     <td>
       <table>
       <?cs if:check_spelling ?>
       <?cs call:print_spell(lang.link_new_memo.spell) ?>
       <?cs /if ?>
       <tr>
       <td> 
       <textarea id="msg" title="<?cs var:data.help ?>" name="msg" id="msg" cols="<?cs var:textarea.cols ?>" rows="12" wrap=<?cs if:textarea.wrap ?>"hard"<?cs else ?>"virtual"<?cs /if ?>><?cs if:textarea.feedback ?>[<?cs var:textarea.feedback ?> <?cs var:data.wrote ?>]<?cs /if ?><?cs var:textarea.body ?></textarea>
       </td>
        <?cs if:!emoticons_disabled ?><td><?cs call:add_smile_faces() ?><?cs /if ?></td>
       </tr>
       </table>
     </td>
  </tr>
<?cs /def ?>

<?cs def:print_url(data, url) ?>
  <tr>
    <td class="regheading">
     <?cs var:data.msg ?>
     <input type="text" name="url" id="url" size="60"  value="<?cs var:url.value ?>" title="<?cs var:data.help ?>" />
    </td>
  </tr>
<?cs /def ?>

<?cs call:html_heading() ?>
   <head>
      <title><?cs var:course_no ?> <?cs var:lang.link_new_memo.module_name ?></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"  />
   <link rel="StyleSheet" href="<?cs var:image_path ?>manhattan.css" type="text/css"  />
    <script type="text/javascript" src="<?cs var:image_path ?>form_validation.js"></script>
    <script type="text/javascript" src="<?cs var:image_path ?>xp_progress.js"></script>
    <?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 ?>
  <script type="text/javascript">
 function alerturl()
 {
   var s_value = document.getElementById('subject').value;
   var u_value = document.getElementById('url').value;

 if(is_whitespace(s_value) || is_whitespace(u_value))
    {
       window.alert('<?cs var:lang.link_new_memo.su_url_must_filled ?>');
        return false;
    }
    else
     {
       var answer=window.confirm('<?cs var:lang.link_new_memo.confirm ?>');
       if(answer)
       {
         bar1.showBar();
         scroll(0,0);
         return true;
       }
      else 
        return false;
     }
}
 function discard_confirm(warn_msg)
 {
   var s_value = document.getElementById('subject').value;
   var u_value = document.getElementById('url').value;
   var m_value = document.getElementById('msg').value;
   if(s_value != "" || u_value != "" || m_value != "")
   {
       var answer=window.confirm(warn_msg);
       if(answer)
         return true;
       else 
        return false;
   }
 }
</script>
</head>
<?cs call:define_onload_onunload_body("subject") ?>
 <?cs call:print_course_heading(back_url, lang.link_new_memo.goback) ?>

 <div class="center_msg">
  <span class="alert_color"><?cs var:lang.link_new_memo.title ?></span>
 </div>

 <table width="100%">
 <tr><td align="center">
  <table width="20%" cellspacing="0" cellpadding="4">
   <?cs if:paste == #1 ?>
      <?cs call:print_paste(lang.link_new_memo.paste) ?>
   <?cs /if ?>
   <tr><td>
   <div><form method="post" action="link_send_mail" onsubmit="return alerturl()" >
    <div>
          <input type="hidden" name="crs" value="<?cs var:crs ?>" />
          <input type="hidden" name="id" value="<?cs var:id ?>" />
          <input type="hidden" name="from" value="<?cs var:from ?>" />
          <input type="hidden" name="width" value="<?cs var:msg.textarea.cols ?>" />
    </div>
    <table>
   <?cs call:print_mark_hide(lang.link_new_memo.mark) ?> 
   <?cs call:print_subject(lang.link_new_memo, msg.subject) ?>
   <?cs call:print_url(lang.link_new_memo.url, msg.url) ?>
   <?cs call:print_textarea(lang.link_new_memo.body, msg.textarea) ?>
   <tr><td align="center">
     <input type="submit" value="<?cs var:lang.link_new_memo.send.msg ?>" title="<?cs var:lang.link_new_memo.send.help ?>" />
   </td></tr>
    </table>
   </form></div>
   </td></tr>
  </table>
  </td></tr>
</table>
<script type="text/javascript">
     var bar1 = createBar( 'white', 1, 'black', 'blue', 85, 7, 3, "");
</script>

</body>
</html>
<?cs call:runtime() ?>
