<?php
  ///////////////////////////////////////////////////
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  $title=$titlepage = $TEXT['supp-mar'];
  $helppage = $TEXT['supp-mar-help'];
  require_once "../config.php";
  require_once "../util/top.php";

  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);
?>
 <img alt="<?php echo $TEXT['mar-add-new']; ?>" src= "../img/insert.png" height="15" align="top" /><a class="boldit" href="addform.php" title="<?php echo $TEXT['mar-add-new-tit']; ?>"><?php echo $TEXT['mar-add-new']; ?></a>
 <br />
 <br />
 <span class="tabledata"><?php echo $TEXT['supp-mar-text1']; ?></span>
<table class="table" border="1" cellpadding="4" cellspacing="0" width="60%">
<?php
     $query = "SELECT * FROM `tbl_marsh` ORDER BY `position`";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl42']);
       if(mysql_num_rows($result)>0);
         {
           echo "<tr class='tableheadercat'>
            <td>".$TEXT['supp-mar2']."</td>
            <td>".$TEXT['tbl-position']."</td>
            <td>".$TEXT['tbl-visible']."</td>
            <td colspan=3>".$TEXT['tbl-action']."</td>
                 </tr>";
             while($result_mar = mysql_fetch_array($result,MYSQL_ASSOC))
              {
              if($result_mar['visible']=='show') $mar_vis="<a href=hide.php?mar_id=".$result_mar['mar_id']." title='".$TEXT['tbl-hide-tit3']."'><img alt='".$TEXT['tbl-show']."' src='../img/show.png' height='16' width='16' align='top' /></a>";
                else $mar_vis="<a href=show.php?mar_id=".$result_mar['mar_id']." title='".$TEXT['tbl-show-tit3']."'><img alt='".$TEXT['tbl-hide']."' src='../img/hide.png' height='16' width='16' align='top' /></a>";

                $edit = "<a href=editform.php?mar_id=".$result_mar['mar_id']." title='".$TEXT['supp-mar-edit-title']."'>".$TEXT['tbl-edit']."</a>";
                $delete = "<a href=deleteform.php?mar_id=".$result_mar['mar_id']." title='".$TEXT['supp-mar-del-title']."'>".$TEXT['tbl-delete']."</a>";
                $mar = "<a href=marshindex.php?mar_id=".$result_mar['mar_id']." title='".$TEXT['supp-mar-many-title']."'>".$result_mar['mar_name']."</a>";
                $move_up = "<a href=up-down.php?mar_id=".$result_mar['mar_id']."&amp;position=".$result_mar['position']."&amp;moving=up title='".$TEXT['global-up-down-tit']."'><img alt='up' src='../img/up.png' height='16' width='16' align='top' /></a>";
                $move_down = "<a href=up-down.php?mar_id=".$result_mar['mar_id']."&amp;position=".$result_mar['position']."&amp;moving=down title='".$TEXT['global-up-down-tit']."'><img alt='down' src='../img/down.png' height='16' width='16' align='top' /></a>";
                ?>
                <tr class='tabledata' onmouseover="this.style.backgroundColor='#cccccc';" onmouseout="this.style.backgroundColor='#ffffff';">
                      <td><?php echo $mar; ?></td>
                      <td><?php echo $result_mar['position']; ?></td>
                      <td><?php echo $mar_vis; ?></td>
                      <td><?php echo $move_up; ?> <?php echo $move_down; ?></td>
                      <td><?php echo $edit; ?></td>
                      <td><?php echo $delete; ?></td>
                </tr>
                <?php
              }
         }
?>
</table>
<?php
  require_once "../util/bottom.php";
?>