<?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['house-title'];

  require_once "../config_a.php";
  require_once "../utils/functions.php";
  require_once "../utils/top_adm.php";

if($result2['administrator'] == 0) {puterror($result2['skin'],$TEXT['error-loginform2']); require_once "../utils/bottom_adm.php"; exit();}
?>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="40%">
<tr align="right">
 <td><img alt="<?php echo $TEXT['add-new']; ?>" align="bottom" src="../skins/<?php echo $result2['skin']; ?>/add.png" /><a class="bold_it tooltip4" href="addform.php" ><?php echo $TEXT['add-new']; ?><span><?php echo $TEXT['add-new-tit']; ?><small></small></span></a></td>
</tr>
</table>
<table align="center" class="table" border="1" cellpadding="3" cellspacing="0" width="40%">
<?php
     $query10 = "SELECT * FROM `tbl_house` ORDER BY `house`";
     $result10 = mysql_query($query10);
     if(!$result10) {puterror($result2['skin'],$TEXT['error-tbl10']); require_once "../utils/bottom_adm.php"; exit();}
       if(mysql_num_rows($result10)>0);
         {
           echo " <thead>
              <tr class='tableheadercat'>
                 <td width='60%'>".$TEXT['tbl-house']."</td>
                 <td colspan=2>".$TEXT['tbl-action']."</td>
              </tr>
             </thead><tbody id='tab'>";
             while($result_houses = mysql_fetch_array($result10,MYSQL_ASSOC))
               {
              $edit_pic = "<img alt='картинка' src='../skins/".$result2['skin']."/edit.png' />";
              $edit = $edit_pic."&nbsp;<a class='tooltip4' href=editform.php?house_id=".$result_houses['house_id']." >".$TEXT['edit-new']."<span>".$TEXT['edit-tit']."<small></small></span></a>";

              $query_login_dom = mysql_query("SELECT COUNT(house_id) FROM tbl_podset WHERE house_id='".$result_houses['house_id']."'");
	            $coun_login_dom = mysql_result($query_login_dom, 0);
                  if($coun_login_dom > 0)
                     {
                       $delete_pic = "<img alt='картинка' src='../skins/".$result2['skin']."/nodelete.png' />";
                       $delete =$delete_pic."&nbsp;".$TEXT['delete-new'];
                     }
                      else
                    {
                       $delete_pic = "<img alt='картинка' src='../skins/".$result2['skin']."/delete.png' />";
                       $delete = $delete_pic."&nbsp;<a class='tooltip4' href=delete.php?house_id=".$result_houses['house_id']." >".$TEXT['delete-new']."<span>".$TEXT['delete-tit']."<small></small></span></a>";
                     }
           ?>
           <tr>
              <td><?php echo $result_houses['house']; ?></td>
              <td align="center"><?php echo $edit; ?></td>
              <td align="center"><?php echo $delete; ?></td>
            </tr>
           <?php
               }
         }
?>
</tbody>
</table>
<?php
require_once "../utils/bottom_adm.php";
?>