<?php
echo ' <div class="menu"><a href="/"><img src="/ico/home.png"></a> &raquo; <a href="/library/i.php">Yoqimli kutubxona</a></div>';
echo '<div class="phdr"><center><b>Bo\'limlar</b></center></div>';
echo '<style>.catsTd a {color: #0D0F11;padding-left:22px; background:url(/ico/dir.png)no-repeat left center}</style>';
echo '<div class="menu"><table border="0" cellspacing="1" cellpadding="0" width="100%" class="catsTable">';
$sql = mysql_query("SELECT `id`, `name`, `dir`, `description` FROM `library_cats` WHERE `parent`=0 ORDER BY `pos` ASC");
        $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `library_cats` WHERE `parent`=0"), 0);
        $y = 0;
        if ($total) {
            while ($row = mysql_fetch_assoc($sql)) {
                $y++;

echo '<tr><td style="width:100%" class="catsTd" valign="top" id="cid19"><a href="/library/index.php?do=dir&amp;id=' . $row['id'] . '">' . functions::checkout($row['name']) . '</a> <span class="catNumData" style="unicode-bidi:embed;">['         . mysql_result(mysql_query("SELECT COUNT(*) FROM `" . ($row['dir'] ? 'library_cats' : 'library_texts') . "` WHERE " . ($row['dir'] ? '`parent`=' . $row['id'] : '`cat_id`=' . $row['id'])), 0) . ']</span></td></tr>';

            }
        }
	 
echo '</table></div>';
	 
 ?>