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

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

  $title=$titlepage=$TEXT['support36'];
  require_once "../config.php";
  require_once "top.php";
  ?>
  <title><?php echo $title; ?></title>
  <link rel="StyleSheet" type="text/css" href="../utils/reader.css" />
  </head>
  <body leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" bottommargin="0" topmargin="0" >
  <?php
  if($result2['user'] == 1) puterror2($TEXT['error-supp11']);
  if($result2['master'] == 1) puterror2($TEXT['error-supp11']);

  if(empty($_GET['organizaciya'])) $_GET['organizaciya'] = "";
  if(strlen($_GET['organizaciya'])>255) puterror2($TEXT['error-usr2']);
  $_GET['organizaciya'] = rep($_GET['organizaciya']);

  if(!empty($_GET['organizaciya'])) $organizaciya = " AND organizaciya = '".$_GET['organizaciya']."'";
   else $organizaciya = "";

  if(!empty($_GET['organizaciya'])) $big = $TEXT['support75']."<span class='grn'>".$_GET['organizaciya']."</span>";
   else $big = $TEXT['support76'];
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr align="center"><td class="supp_iniz">&nbsp;<?php echo $big; ?></td></tr>
<tr>
    <td align="center">
      <table class="table" border="1" width="60%" cellpadding="1" cellspacing="1">
       <tr class="tableheadercat">
        <td><?php echo $TEXT['support13']; ?></td>
        <td><?php echo $TEXT['support65']; ?></td>
       </tr>
       <?php
       $query_total = "SELECT DISTINCT `tema` FROM `tbl_supp_archive` WHERE `arch_id` != '0' ".$organizaciya." ORDER BY tema ";
        $tot_tmp = mysql_query($query_total);
         if(!$tot_tmp) puterror2($TEXT['error-tbl25']);
           while($sost2 = mysql_fetch_array($tot_tmp,MYSQL_ASSOC))
           {
             $query_total2 = mysql_query("SELECT COUNT(arch_id) FROM tbl_supp_archive WHERE tema = '".$sost2['tema']."' ".$organizaciya."");
              $tema = mysql_result($query_total2, 0);

            echo "<tr class='texttable'>
              <td><a href='rpt_user.php?organizaciya=".$_GET['organizaciya']."&tema=".$sost2['tema']."' title='".$TEXT['support14']."'>".$sost2['tema']."</a></td>
              <td>".$tema."</td>
            </tr>";

            }
            ?>
        </table>
      </td>
   </tr>
</table>
</body>
</html>