<?php
  ///////////////////////////////////////////////////
  //2007 (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-sost-title'];
  $helppage = $TEXT['supp-sost-help'];
  require_once "../config.php";
  require_once "../util/top_layer1.php";

  if($result2['user'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);
?>
 <img alt="<?php echo $TEXT['supp-sost-add-new']; ?>" src= "../img/insert.png" height="15" align="top" /><a class="boldit" href="addform-sost.php" title="<?php echo $TEXT['supp-sost-add-new-tit']; ?>"><?php echo $TEXT['supp-sost-add-new']; ?></a>
 <br />
 <br />
 <span class="tabledata"><?php echo $TEXT['supp-sost-text1']; ?></span>
<table class="table" border="1" cellpadding="4" cellspacing="0" width="60%">
<?php
     $query = "SELECT * FROM `tbl_supp_sostoyanie` ORDER BY `position`";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl23']);
       if(mysql_num_rows($result)>0);
         {
           echo "<tr class='tableheadercat'>
            <td>".$TEXT['inst-field1']."</td>
            <td>".$TEXT['analiz-msg-text']."</td>
            <td>".$TEXT['tbl-position']."</td>
            <td colspan=3>".$TEXT['tbl-action']."</td>
                 </tr>";
             while($result_sost = mysql_fetch_array($result,MYSQL_ASSOC))
              {
                $edit = "<a href=editform-sost.php?sost_id=".$result_sost['sost_id']." title='".$TEXT['supp-sost-edit-tit']."'>".$TEXT['tbl-edit']."</a>";
                $delete = "<a href=deleteform-sost.php?sost_id=".$result_sost['sost_id']." title='".$TEXT['supp-sost-del-tit']."'>".$TEXT['tbl-delete']."</a>";

		if(!empty($result_sost['pic_sost'])) $picture = "<img alt='picture' width='16' height='16' align='absmiddle' src='../".$result_sost['pic_sost']."' />";
		 else $picture = $TEXT['res-field17'];

                $move_up = "<a href=up-down-sost.php?sost_id=".$result_sost['sost_id']."&amp;position=".$result_sost['position']."&amp;moving=up title='".$TEXT['global-up-down-tit']."'><img alt='picture' src='../img/up.png' height='16' width='16' align='top' /></a>";
                $move_down = "<a href=up-down-sost.php?sost_id=".$result_sost['sost_id']."&amp;position=".$result_sost['position']."&amp;moving=down title='".$TEXT['global-up-down-tit']."'><img alt='picture' 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 $picture; ?></td>
                      <td><?php echo $result_sost['sostoyanie']; ?></td>
                      <td><?php echo $result_sost['position']; ?></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";
?>