<?php
function telawat_cats() {
global  $htmlorphp,$telawat_catsloop,$LANGAUGE;

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

$sql = @mysql_query("SELECT * FROM telawat_cat where sub='0' AND active='1' order by order_cat");
$nu = mysql_num_rows($sql);
if($nu==0){
$printcats = $LANGAUGE[16];
}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 telawat where cat='".$Row2['id']."'") or die ("Query failed");
$nu = mysql_num_rows($sql2);

++$tslsls;
if($tslsls=="$telawat_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='telawat_cat-$Row2[id].html'>$Row2[name_cat]</a></div></td>
$tslslats";
}else{
$printcats .= "<td width='$width' class='category'><div><a href='quran.php?action=telawat&id=$Row2[id]'>$Row2[name_cat]</a></div></td>
$tslslats";
}
}
$printcats .= "</table>";
}
return $printcats;
}


function telawats() {
global $id,$htmlorphp,$folder,$telawat_catsloop,$LANGAUGE,$q;

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

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

++$tslsls;
if($tslsls=="$telawat_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='telawat_cat-$Row2[id].html'>$Row2[name_cat]</a></div></td>
$tslslats";
}else{
$printcats .= "<td width='$width' class='category'><div><a href='quran.php?action=telawat&id=$Row2[id]'>$Row2[name_cat]</a></div></td>
$tslslats";
}
}
$printcats .= "</table>";
}


$sql = @mysql_query("SELECT * FROM telawat where cat='$id' AND active='1' order by name");
$nu = mysql_num_rows($sql);
if($nu==0){
if($nuq==0){
$printcats .= $LANGAUGE[150];
}else{
$printcats .= "";
}
}else{
$printcats .= "<table class='xtable' width='100%' id='AutoNumber15'>
    <tr>
      <td width='5%' class='xtr' align='center'>".$LANGAUGE[147]."</td>
      <td width='65%' class='xtr' align='center'>".$LANGAUGE[148]."</td>
      <td width='10%' class='xtr' align='center'>".$LANGAUGE[149]."</td>
      <td width='10%' class='xtr' align='center'>".$LANGAUGE[192]."</td>
      <td width='10%' class='xtr' align='center'>".$LANGAUGE[193]."</td>
    </tr>";
while ($Row = @mysql_fetch_array($sql))
{
$n = "$Row[name]";
$numbercharurl = strlen($n);
if($numbercharurl==1){
$xxz = "00".$n;
}elseif($numbercharurl==2){
$xxz = "0".$n;
}elseif($numbercharurl==3){
$xxz = $n;
}

if ($htmlorphp=="1"){
$printcats .= "<tr>
<td width='5%' class='xtd' align='center'>$n</td>
<td width='65%' class='xtd'><a onclick=\"NewWindow(this.href,'mywin','400','200','no','center');return false\" onfocus=\"this.blur()\" href='telawat_show-$Row[id].html'>$q[$n]</a></td>
<td width='10%' class='xtd' align='center'><a onclick=\"NewWindow(this.href,'mywin','400','200','no','center');return false\" onfocus=\"this.blur()\" href='telawat_show-$Row[id].html'><img src='$folder/icons/audios.gif' alt='".$q[$n]."' border='0' /></a></td>
<td width='10%' class='xtd' align='center'><a target='_blank' href='http://quran.al-islam.com/Tafseer/DispTafsser.asp?nType=1&bm=&nSeg=0&l=arb&nSora=".$xxz."&nAya=1&taf=TABARY&tashkeel=0'><img src='$folder/icons/books.gif' alt='".$q[$n]."' border='0' /></a></td>
<td width='10%' class='xtd' align='center'><a target='_blank' href='http://quran.al-islam.com/Targama/dispTargam.asp?l=arb&t=eng&nType=1&nSora=".$xxz."&nAya=1'><img src='$folder/icons/slink.gif' alt='".$q[$n]."' border='0' /></a></td>
</tr>";
}else{
$printcats .= "<tr>
<td width='5%' class='xtd' align='center'>$n</td>
<td width='65%' class='xtd'><a onclick=\"NewWindow(this.href,'mywin','400','200','no','center');return false\" onfocus=\"this.blur()\" href='quran.php?action=telawat_show&id=$Row[id]'>$q[$n]</a></td>
<td width='10%' class='xtd' align='center'><a onclick=\"NewWindow(this.href,'mywin','400','200','no','center');return false\" onfocus=\"this.blur()\" href='quran.php?action=telawat_show&id=$Row[id]'><img src='$folder/icons/audios.gif' alt='".$q[$n]."' border='0' /></a></td>
<td width='10%' class='xtd' align='center'><a target='_blank' href='http://quran.al-islam.com/Tafseer/DispTafsser.asp?nType=1&bm=&nSeg=0&l=arb&nSora=".$xxz."&nAya=1&taf=TABARY&tashkeel=0'><img src='$folder/icons/books.gif' alt='".$q[$n]."' border='0' /></a></td>
<td width='10%' class='xtd' align='center'><a target='_blank' href='http://quran.al-islam.com/Targama/dispTargam.asp?l=arb&t=eng&nType=1&nSora=".$xxz."&nAya=1'><img src='$folder/icons/slink.gif' alt='".$q[$n]."' border='0' /></a></td>
</tr>";
}
}

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