<?php
  include ('include_fns.php');


  session_start();

  function Show_Statements_Header()
  {

    if(!check_admin_user())
    {
     echo "You do not seem to be logged in.";
     exit;
    }
    
    $AdministratorFields  = ExecuteQuery("SELECT ADMINISTRATOR_KEY, ADMINISTRATOR
                                          FROM ADMINISTRATOR 
                                          ORDER BY ADMINISTRATOR;");

    ?>

    

    <style>
      .apptbtns.ui-button.ui-widget{
         width : 160;
      }

      .dialog { display: none; }
    </style>

    <script>

      $(function() {

        $('#Administrator').change(function () {
                                 Refresh();
                             });


        $('#btnSearch').button({ icons: { primary: 'ui-icon-trash'} }).click(function(event, ui) {
          
          Refresh();
        });

        function Refresh()
        {
          var administrator = $('#Administrator').val();

          if (!administrator)
           administrator = '-1';

          $('#divStatements').load("ViewStatements.php?administrator=" + administrator);
         };     

         Refresh();

      });
    </script>

    <p></p>


    <?php

    
    echo '<table cellspacing = 0 cellpadding = 3 border = 0 class="shadetable indented" >';
    echo '<tr>';
    echo '  <th colspan = "3" bgcolor="#184214">Statements</th>';
    echo '</tr>';

    
    echo '<tr>';
    echo '   <td >';

        
    echo '  <div id="toolbar" class="ui-widget-header ui-corner-all">';

    echo '   <div style="float:left;">';
    echo '     <label for="Administrator">Administrator</label>';
    echo '      <select size="1" name="Administrator" id="Administrator" class="roundedit">';
    echo '        <option value="-1">ALL ADMINISTRATORS</option>';
                       
                       for($i = 0; $i<(sizeof($AdministratorFields)); $i++)
                       {
                        
                         echo '<option value="'.$AdministratorFields[$i][0].'">'.$AdministratorFields[$i][1];
                         echo '</option>';
                       }
    echo '      </select>';
    echo '   </div>';

    echo '</div>';
         


    echo '   </td>';
    echo '</tr>';
    
    echo '</table>';
    


    ?>
    
    <p></p>
    <div id="divStatements"></div>

    <?php
  }


?>
