<?php
function flash_cats() {
global  $htmlorphp,$flash_catsloop,$lang_t16;

if($flash_catsloop=="1"){$width = "100%";}
elseif($flash_catsloop=="2"){$width = "50%";}
elseif($flash_catsloop=="3"){$width = "33%";}
elseif($flash_catsloop=="4"){$width = "25%";}
elseif($flash_catsloop=="5"){$width = "20%";}
elseif($flash_catsloop=="6"){$width = "16%";}
else{$width = "";}

$sql = @mysql_query("SELECT * FROM  flash_cat where sub='0' AND active='1' order by order_cat");
$nux = mysql_num_rows($sql);
if($nux == 0){
$printcats = $LANGAUGE[91];
}else{
$printcats = "<table border='0' width='100%' id='AutoNumber2' style='border-collapse: collapse'>";

$tslsls = '0';
while ($Row2 = @mysql_fetch_array($sql))
{
$sql2 = @mysql_query("SELECT id FROM flash where cat='".$Row2['id']."'") or die ("Query failed");
$nu = mysql_num_rows($sql2);

++$tslsls;
if($tslsls=="$flash_catsloop"){
$tslslats = "</tr><tr>";
$tslsls="0";
}else{
$tslslats = "";
}

$Row2[name_cat] = text(3,$Row2[name_cat]);

if ($htmlorphp=="1"){
$printcats .= "<td width='$width' class='category'><div><a href='flash_cat-$Row2[id].html'>$Row2[name_cat]</a></div></td>
$tslslats";
}else{
$printcats .= "<td width='$width' class='category'><div><a href='flash.php?action=flash&id=$Row2[id]'>$Row2[name_cat]</a></div></td>
$tslslats";
}
}
$printcats .= "</table>";
}
return $printcats;
}


function flashat() {
global $id,$htmlorphp,$folder,$flash_catsloop,$flash_loop,$LANGAUGE;

if($flash_catsloop=="1"){$width = "100%";}
elseif($flash_catsloop=="2"){$width = "50%";}
elseif($flash_catsloop=="3"){$width = "33%";}
elseif($flash_catsloop=="4"){$width = "25%";}
elseif($flash_catsloop=="5"){$width = "20%";}
elseif($flash_catsloop=="6"){$width = "16%";}
else{$width = "";}

$sqle = @mysql_query("SELECT * FROM flash_cat where sub='$id' AND active='1' order by order_cat");
$nux = mysql_num_rows($sqle);
if($nux == 0){
$printcats = "";
}else{
$printcats = "<table border='0' width='100%' id='AutoNumber2' style='border-collapse: collapse'>";
$tslsls = '0';
while ($Row2 = @mysql_fetch_array($sqle))
{
$sql2 = @mysql_query("SELECT id FROM flash where cat='".$Row2['id']."'") or die ("Query failed");
$nu = mysql_num_rows($sql2);

++$tslsls;
if($tslsls=="$flash_catsloop"){
$tslslats = "</tr><tr>";
$tslsls="0";
}else{
$tslslats = "";
}

$Row2[name_cat] = text(3,$Row2[name_cat]);

if ($htmlorphp=="1"){
$printcats .= "<td width='$width' class='category'><div><a href='flash_cat-$Row2[id].html'>$Row2[name_cat]</a></div></td>
$tslslats";
}else{
$printcats .= "<td width='$width' class='category'><div><a href='flash.php?action=flash&id=$Row2[id]'>$Row2[name_cat]</a></div></td>
$tslslats";
}
}
$printcats .= "</table>";
}



$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
$page = ($page == 0 ? 1 : $page);
$perpage = $flash_loop;
$startpoint = ($page * $perpage) - $perpage;

$sql = @mysql_query("SELECT id,name_flash,cat,desin_flash,vis FROM flash where cat='$id' AND active='1' order by id desc limit $startpoint,$perpage");
$nu = mysql_num_rows($sql);

if($nu != 0 AND $nux != 0){
$printcats .= "<br />";
}

if($nu == 0){
if($nux==0){
$printcats .= $LANGAUGE[123];
}else{
$printcats .= "";
}
}else{
$printcats .= "<table class='xtable' width='100%' id='AutoNumber15'>
    <tr>
      <td width='90%' class='xtr' align='center'>".$LANGAUGE[121]."</td>
      <td width='10%' class='xtr' align='center'>".$LANGAUGE[84]."</td>
    </tr>";
while ($Row = @mysql_fetch_array($sql))
{
$Row[name_flash] = text(3,$Row[name_flash]);

if ($htmlorphp=="1"){
$printcats .= "<tr>
<td width='90%' class='xtd'><a href='flash_show-$Row[id].html'>$Row[name_flash]</a></td>
<td width='10%' class='xtd' align='center'>$Row[vis]</td>
</tr>";
}else{
$printcats .= "<tr>
<td width='90%' class='xtd'><a href='flash.php?action=flash_show&id=$Row[id]'>$Row[name_flash]</a></td>
<td width='10%' class='xtd' align='center'>$Row[vis]</td>
</tr>";
}
}

$printcats .= "</table>";

$pagesnum = @ceil(mysql_num_rows(mysql_query("select `id` from `flash` where cat='$id' AND active='1'")) / $perpage);

if($pagesnum > 1){
$printcats .= "<div class='multipage'>";
for ($i=1; $i<=$pagesnum; $i++) {
if ($i != $page) {

if ($htmlorphp=="1"){
$z = "<span><a href='flashpage-$id-$i.html'>$i</a></span>";
}else{
$z = "<span><a href='flash.php?action=flash&id=$id&page=$i'>$i</a></span>";
}

} else {
$z = "<span class='act'>$i</span>";
}
$printcats .= "$z";

}
$printcats .= "</div>";
}
}
return $printcats;
}
?>