<?cs def:print_spelling() ?>
   <?cs if: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:bin_alias ?>/spellchecker' );
    speller.openChecker();
    }
  </script>
 <?cs /if ?>
<?cs /def ?>


<?cs def:print_text_value(data) ?>
  <?cs if:modify ?>
   <textarea name="caption" id="caption" cols="40" rows="4"><?cs var:data.caption ?></textarea>
  <?cs else ?>
   <textarea name="caption" id="caption" cols="40" rows="4"></textarea>
  <?cs /if ?>
<?cs /def ?>


<?cs def:print_action(m_action, s_action) ?>
  <?cs if:modify ?>
    <form  method="post" action="<?cs var:m_action ?>"  onsubmit="return alertfunc('<?cs var:lang.survey_form_include.warning_msg ?>')">
   <?cs else ?>
    <form  method="post" action="<?cs var:s_action ?>"  onsubmit="return alertfunc('<?cs var:lang.survey_form_include.warning_msg ?>')">
    <?cs /if ?>
<?cs /def ?>

<?cs def:print_back() ?> 
 <div>
  <a href="javascript:history.back()" title="lang.survey_form_include.back"><img src="<?cs var:image_path ?>back_arrow.gif" width="50" height="34" alt="lang.survey_form_include.back" /></a>
</div>
<?cs /def ?>

<?cs def:print_fade_button(tag) ?>
  [<span class="button_fade"><?cs var:tag ?></span>]
<?cs /def ?>

<?cs def:print_real_button(tag_name, action) ?> 
  <form method="post" action="<?cs var:action ?>">
     <input type="hidden" name="crs" value="<?cs var:Query.crs ?>" /> 
      <input type="hidden" name="id" value="<?cs var:Query.id ?>" /> 
      <input type="hidden" name="count" value="<?cs var:Query.count ?>" /> 
      <input type="hidden" name="pre_id" value="<?cs var:Query.pre_id ?>" /> 
      <input type="submit" name="submit" value="<?cs var:tag_name ?>" />
  </form>
<?cs /def ?>

<?cs def:print_button() ?>
  <div class="center_msg"><?cs var:lang.survey_custom_form.select ?></div>
  <table width="100%">
  <tr><td align="center">
  <div class="button_block">
  <table><tr>
    <td><?cs call:print_fade_button(lang.survey_custom_form.custom) ?></td>
    <td><?cs call:print_real_button(lang.survey_custom_form.likert, "survey_likert_form") ?></td>
    <td><?cs call:print_real_button(lang.survey_custom_form.choice, "survey_choice_form") ?></td> 
    <td><?cs call:print_real_button(lang.survey_custom_form.text, "survey_text_form") ?></td> 
    <td><?cs call:print_real_button(lang.survey_custom_form.memo, "survey_memo_form") ?></td> 
  </tr></table>
  </div>
 </td></tr>
 </table>
<?cs /def ?>

<?cs def:print_submit_button ?> 
 <?cs if:modify ?>
      <input type="submit" value="<?cs var:lang.survey_form_include.modify ?>" />
 <?cs else ?>
      <input type="submit" value="<?cs var:lang.survey_form_include.submit ?>" />
    <?cs /if ?>
<?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:lang.survey_new_form.create_new_survey ?></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 ?>survey.css" type="text/css" media="screen" />
   <script type="text/javascript" src="<?cs var:image_path ?>form_validation.js"></script>
   <script type="text/javascript">
   function alertfunc(alertstring)
   {
     var value = document.getElementById('caption').value;
     if( is_whitespace(value) )
     {
         window.alert(alertstring);
            return false;
     }
    else 
       return true;
   }
   </script>
   <?cs call:print_spelling() ?>
  </head>

<body onload="document.getElementById('caption').focus()">
 <?cs call:print_back() ?> 

<div class="center_msg">
  <?cs call:print_button() ?>
</div>

<div class="center_msg">
  <div class="description" >
    <?cs var:lang.survey_custom_form.description ?>
  </div>
</div>

<table width="100%">
 <tr><td align="center">
   <?cs call:print_action("survey_custom_modify", "survey_custom_save") ?>  
   <div>
       <input type="hidden" name="crs" value="<?cs var:Query.crs ?>" />
       <input type="hidden" name="id" value="<?cs var:Query.id ?>" />
       <input type="hidden" name="count" value="<?cs var:Query.count ?>" />
       <input type="hidden" name="pre_id" value="<?cs var:Query.pre_id ?>" />
   </div>
   <table cellpadding="5" cellspacing="3">
   <tr><td>
     <table>
     <tr><td>&nbsp;&nbsp;&nbsp;</td>
     <?cs if:spelling ?>
     <td align="right">
      <input type="button" value="Check Spelling" onclick="openSpellChecker( document.forms[0].title );" />
     </td>
     <?cs else ?>
      <td>&nbsp;</td>
     <?cs /if ?>
     </tr>
     <tr><td colspan="2">
      <?cs call:print_text_value(data) ?>
     </td></tr>
     </table>
  </td>
 </tr>
 <tr><td align="center">
     <?cs call:print_submit_button ?> 
   </td></tr>
  </table>
  </form>
 </td></tr>
</table>
</body></html>
