<?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['house-title4'];
  $helppage = $TEXT['house-help4'];
  require_once "../config.php";
  require_once "../util/top.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['house-add-new']; ?>" src= "../img/insert.png" height="15" align="top" /><a class="boldit" href="addform.php" title="<?php echo $TEXT['house-add-new-tit']; ?>"><?php echo $TEXT['house-add-new']; ?></a>
 <br />
 <br />
 <span class="tabledata"><?php echo $TEXT['house-text1']; ?></span>
<table class="table" border="1" cellpadding="3" cellspacing="0" width="40%">
<?php
     $query = "SELECT * FROM `tbl_house` ORDER BY `house`";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl4']);
       if(mysql_num_rows($result)>0);
         {
           echo "<tr class='tableheadercat'>
            <td>".$TEXT['tbl-house']."</td>
            <td colspan=3>".$TEXT['tbl-action']."</td>
                 </tr>";
             while($result_houses = mysql_fetch_array($result,MYSQL_ASSOC))
               {
              $edit = "<a href=editform.php?house_id=".$result_houses['house_id']." title='".$TEXT['tbl-edit-tit-house']."'>".$TEXT['tbl-edit']."</a>";
              $delete = "<a href=deleteform.php?house_id=".$result_houses['house_id']." title='".$TEXT['tbl-delete-tit-house']."'>".$TEXT['tbl-delete']."</a>";
           ?>
           <tr class='tabledata' onmouseover="this.style.backgroundColor='#cccccc';" onmouseout="this.style.backgroundColor='#ffffff';">
              <td><?php echo $result_houses['house']; ?></td>
              <td><?php echo $edit; ?></td>
              <td><?php echo $delete; ?></td>
           </tr>
           <?php
               }
         }
?>
</table>
<?php
  require_once "../util/bottom.php";
?>