<?php

  ini_set('display_errors', 'On');
  error_reporting(E_ALL | E_STRICT);

  if ($_SERVER["REQUEST_METHOD"] == "GET")
  {
    if (!isset($_GET['rStratNum']))
    {die ("rStratNum is missing!");}
    else
    {$shStratNum=$_GET['rStratNum'];}

    if (empty($shStratNum) || ($shStratNum == null) || ($shStratNum == ""))
    {die ("No Strategy Number came through to show.html");}
  
    if ((include 'showget.php') == FALSE)
    {die("The showget.php file cannot be found.  Tell Baruch!");}
    shFormDataGet($shStratNum);

  }  // if ($_SERVER["REQUEST_METHOD"] == "GET")

?>

<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, intital-scale=1.0">
    <title>Sane Strategies: Show</title>
    <link rel="stylesheet" href="normalize.css">
    <link rel='stylesheet' href='SaneStrategies.css'>
    <link rel="stylesheet" href="responsive.css">
    <script type="text/javascript">cName="<?php echo implode(',', $cmterName);?>";</script>
    <script type="text/javascript">theCom="<?php echo implode(',', $thecomment);?>";</script>
    <script type="text/javascript">nCResult=(<?php echo $numCResult;?>);</script>
    <script type="text/javascript" src="funcs.js"></script>
  </head>

  <body id="showBody" onload="shSetup(<?php echo $shStratNum;?>,'<?php echo addslashes($shTitle);?>');">

    <header>
      <a href="index.html" id="logo">
        <h1>Sane Strategies for All of Us</h1>
      </a>
      <nav>
        <ul>
          <li><a href="index.html">Home</a></li>
          <li><a href="add.html">Add Strategy</a></li>
          <li><a href="view.html" class="selected">Find/Vote</a></li>
        </ul>
      </nav>
    </header>

    <section id="showStrategyWindow">

      <p>
        <span id="showTitle" class="showTitle">Title: </span>
        <span id="showTitleData" class="showTitleData"> <?php echo $shTitle;?></span>
      </p>

      <p>
        <br>
        <span id="showStrategy" class="showStrategy">Strategy</span>
        <br>
        <span id="showStrategyData" class="showStrategyData"><?php echo $shStrategy;?></span>
      </p>

      <p>
        <br>
        <span id="showAuthor" class="showAuthor">Author: </span>
        <span id="showAuthorData" class="showAuthorData"><?php echo $shAuthor;?></span>
      </p>

      <p>
        <br>
        <span id="showVotes" class="showVotes">#Votes: </span>
        <span id="showVotesData" class="showVotesData"><?php echo $shNumVotes;?></span>
      </p>

      <p>
        <span id="showComments" class="showComments">Comments</span>
        <br>
        <span id="shComentData" class="shComentData"></span>
        <br>
      </p>

      <div id="CommentInstructions" class='CommentInstructions'>
        <p>
          You may leave a comment below.  You will need to leave your name and email address in order to do so.<br>
          Clicking on the Submit button below will save your comments and information.<br>
          Only your name will be shown with your comment above.<br>
          If you click on the Close button before submitting your vote and/or comments, they will <strong>not</strong> be saved.<br>
          If you just want to Vote for this Strategy, you only need to check the Vote box and click the Submit button.
        </p>
      </div>  <!-- CommentInstructions -->

    </section>  <!-- showStrategyWindow -->

    <div class="aJxmsg" id="aJxmsg"> </div>	<!-- aJxmsg -->
    <span id="shSuccess" class="shSuccess"></span>

    <form name="shCommentForm">

      <table border='0' id='CommentChoices' bordercolor='#000000' cellpadding=1 cellspacing=0>
        <colgroup>
          <col width='13px'>
          <col width='10px'>
          <col width='7px'>
        </colgroup>
        <tr valign=top>
          <td><label for 'cmterName' id='lblcmterName'>Your name</label></td>
          <td></td>
          <td><label for 'votebox' id='lblvotebox'>Vote</label></td>
        </tr>
        <tr valign=top>
          <td><input type='text' id='cmterName' name='cmterName' size='30' value=''></td>
          <td><span class='shNameErr' id='shNameErr'></span></td>
          <td><input type="checkbox" id="votebox" name="votebox" value=<?php echo $shTitle;?></td>
          </td>
        </tr>
        <tr valign=top>
          <td></td>
          <td></td>
          <td></td>
        </tr>
        <tr valign=top>
          <td><label for 'cmterEmail' id='lblcmterEmail'>Your email address</label></td>
        </tr>
        <tr valign=top>
          <td><input type='text' id='cmterEmail' name='cmterEmail' size='50' value=''></td>
          <td><span class='shEmailErr' id='shEmailErr'></span></td>
        </tr>

        <tr valign=top>
          <td><label for 'thecomment' id='lblthecomment'>Your Comment</label></td>
          <td></td>
          <td></td>
        </tr>
        <tr valign=top>
          <td><textarea id='thecomment' name='thecomment' rows='10' cols='75'></textarea></td>
          <td><span class='shCommentErr' id='shCommentErr'></span></td>
          <td></td>
          </td>
        </tr>

      </table>

      <input type='hidden' EnableViewState = "true" id='shstratNumber' name='shstratNumber'>
      <input type='hidden' EnableViewState = "true" id='shcmterName' name='shcmterName'>
      <input type='hidden' EnableViewState = "true" id='shcmterEmail' name='shcmterEmail'>
      <input type='hidden' EnableViewState = "true" id='shthecomment' name='shthecomment'>
      <input type='hidden' EnableViewState = "true" id='shvotebox' name='shvotebox'>

      <table border='0' id='CommentButtons' bordercolor='#000000' cellpadding=1 cellspacing=0>
        <col width='10px'>
        <col width='10px'>
        <col width='10px'>
        <tr valign=top>
          <td>
            <input type="button" id="spsubmitbutton" name="spsubmitbutton" value="Submit" onclick="shFormGet(this.form, 'showpost.php');">
          </td>
          <td></td>
          <td>
            <input type="button" id="spclosebutton" name="spclosebutton" value="Close" onclick="showLeave();">
          </td>
        </tr>
      </table>

   </form>
 
</body>
</html>
