<?php
include("includes/function.php");

if(isset($_GET['l'])){
$languagecount = count($language);
if(intval($_GET['l']) > $languagecount){ $l = 1; }else{ $l = intval($_GET['l']); }

/* Start Books info */

if(isset($_GET['id']) AND intval($_GET['id']) != 0){
$id = intval($_GET['id']);

if($l==0 OR $l==16 OR $l==21 OR $l==30 OR $l==38){ $bookclass = 'books_ar'; }else{ $bookclass = 'books'; }
if(file_exists("includes/books/".$l.".php")){ include("includes/books/".$l.".php"); }else{ include("includes/books/1.php"); }
$bookscount = count($BOOKS);
if($id > $bookscount){ $id=1; }

$s = '<div class="'.$bookclass.'">';
$s .= '<ul>';

$bookinfo = $BOOKS[$id];

if($bookinfo[5] == ""){ $description = ''; $description_m = ''; }else{ $description = '<span class="description">'.$bookinfo[5].'</span>'; $description_m = $bookinfo[5].''; }
if($bookinfo[3] == ""){ $descriptionxx = ''; $descriptionxx_m = ''; $descriptionxx_m2 = ''; }else{ $descriptionxx = '<span class="description">'.$bookinfo[3].'</span>'; $descriptionxx_m = ','.str_replace(' ',', ',$bookinfo[3]).''; $descriptionxx_m2 = $bookinfo[3]; }
if($bookinfo[3] == ""){ $description_ar = ''; }else{ $description_ar = "\n".$bookinfo[3]; }
if($bookinfo[6] == ""){ $source = ''; $source_m = ''; }else{ $source = '<p>'.$Q_W[73].' <a target="_blank" href="'.$bookinfo[6].'">'.$bookinfo[6].'</a></p>'; $source_m = ','.$bookinfo[6].''; }
if($bookinfo[8] == ""){ $formation = ''; $formation_m = ''; }else{ $formation = '<p>'.$Q_W[74].' '.$bookinfo[8].'</p>'; $formation_m = ','.$bookinfo[8].''; $Template->headercode = '<meta name="author" content="'.$bookinfo[8].'" />'; }
if($bookinfo[9] == ""){ $translators = ''; $translators_m = ''; }else{ $translators = '<p>'.$Q_W[75].' '.$bookinfo[9].'</p>'; $translators_m = ','.$bookinfo[9].''; }
if($bookinfo[10] == ""){ $reveiwers = ''; $reveiwers_m = ''; }else{ $reveiwers = '<p>'.$Q_W[76].' '.$bookinfo[10].'</p>'; $reveiwers_m = ','.$bookinfo[10].''; }
if($bookinfo[11] == ""){ $fromissues = ''; $fromissues_m = ''; }else{ $fromissues = '<p>'.$Q_W[77].' '.$bookinfo[11].'</p>'; $fromissues_m = ','.$bookinfo[11].''; }

if($l == 0){
$navigation = '&raquo; <a href="'.url(12,$l,"").'">'.$Q_W[83].'</a> &raquo; '.$bookinfo[2].'';
$Template->description = $descriptionxx_m2;
$Template->keywords = ''.$bookinfo[2].''.$descriptionxx_m.''.$formation_m.''.$reveiwers_m.''.$fromissues_m.'';
$Template->title = $bookinfo[2];

$s .= '<li>';
$s .= '<h3>'.$bookinfo[2].'</h3>';
$s .= $descriptionxx;
$s .= $formation;
$s .= $reveiwers;
$s .= $translators;
$s .= $fromissues;
$s .= $source;
$s .= booksdownload($bookinfo[7],$bookinfo[4]);
$s .= '</li>';
}else{
$navigation = '&raquo; <a href="'.url(10,$l,"").'">'.$language[$l][2].'</a> &raquo; <a href="'.url(12,$l,"").'">'.$Q_W[83].'</a> &raquo; '.$bookinfo[4].'';
$Template->description = $description_m;
$Template->keywords = ''.$language[$l][2].','.$bookinfo[4].','.$description_m.''.$formation_m.''.$translators_m.''.$reveiwers_m.''.$fromissues_m.'';
$Template->title = $bookinfo[4];
if($bookinfo[4] != ""){
$s .= '<li>';
$s .= '<h3 title="'.$bookinfo[2].''.$description_ar.'">'.$bookinfo[4].'</h3>';
$s .= $description;
$s .= $formation;
$s .= $reveiwers;
$s .= $translators;
$s .= $fromissues;
$s .= $source;
$s .= booksdownload($bookinfo[7],$bookinfo[4]);
$s .= '</li>';
}
}
$s .= '</ul>';
$s .= '</div>';

/* End Books info */

$contentview = $s;
}else{
$languagecount = count($language);
if(intval($_GET['l']) > $languagecount){ $l = 1; }else{ $l = intval($_GET['l']); }
$contentview = view_all_books($l,0);

if($l==0){ $nav2 = ''; }else{ $nav2 = '&raquo; <a href="'.url(10,$l,"").'">'.$language[$l][2].'</a> '; }

$navigation = ''.$nav2.'&raquo; '.$Q_W[83].'';

$Template->description = $Q_W[83].' '.$language[$l][2];
$Template->keywords = $language[$l][2].', '.$Q_W[83];
$Template->title = $language[$l][2];
}

}else{
$navigation = '';
$titletag = $Q_W[0];
$languagecount = count($language);
if(intval($_GET['l']) > $languagecount){ $l = 1; }else{ $l = 0; }
}

$Template->TemplateType = 1;

if($l==0 OR $l==16 OR $l==21 OR $l==30 OR $l==38){
$content = $Template->tpl_content("<a href='".$siteurl."'>".$Q_W[0]."</a> ".$navigation."",$contentview);
if($booksview==1){
$content .= $Template->tpl_content($Q_W[78],books($l,$booksnumber));
}
$menu = $Template->tpl_menu_ar($Q_W[23],language_ul());
$menu .= $Template->tpl_menu_ar($Q_W[21],$function_sora_menu);
$menu .= $Template->tpl_menu_ar($Q_W[22],tafseer_ul($type));
if($addthis_allow==1){
$menu .= $Template->tpl_menu_ar($Q_W[24],addthis($addthis_style));
}
}else{
$content = $Template->tpl_content_en("<a href='".$siteurl."'>".$Q_W[0]."</a> ".$navigation."",$contentview);
if($booksview==1){
$content .= $Template->tpl_content_en($Q_W[78],books($l,$booksnumber));
}
$menu = $Template->tpl_menu_en($Q_W[23],language_ul());
$menu .= $Template->tpl_menu_en($Q_W[21],$function_sora_menu);
$menu .= $Template->tpl_menu_en($Q_W[22],tafseer_ul($type));
if($addthis_allow==1){
$menu .= $Template->tpl_menu_en($Q_W[24],addthis($addthis_style));
}
}
echo $Template->Template_view($content,$menu);
?>