<!DOCTYPE html>
<html lang="en">
<?php
	include('include/session.php');
	include('include/function.php');
	include('include/db.php');
	include('include/pagination-hotels.php');
	$slide=8;
?>
<head>
	<meta charset="UTF-8">
	<title><?php if($lang==1){ show_web(10,"site_title");} else{ echo show_web(11,"site_title"); } ?></title>
	<meta name="description" content="<?php if($lang==1){ show_web(10,"site_description");} else{ echo show_web(11,"site_description"); } ?>" />
    <meta name="keywords" content="<?php if($lang==1){ show_web(10,"site_keyword");} else{ echo show_web(11,"site_keyword"); } ?>" />
	
	<meta name="description" content="" />
    <meta name="keywords" content="" />

	<?php include('include/head.php'); ?>
	<?php include('include/script-scroll.php'); ?>
</head>
<body>
		<?php include('include/slide.php'); ?>
	<div id="main">
		<div class="container">
			<?php
				if($lang==1){
			 		include('include/left-en.php'); 
			 	}else{
			 		include('include/left-gm.php');
			 	}
			 ?>

			<div class="main-right">
				<?php include('include/top-place.php'); ?>
				<div class="main-right-content c-d">
					<div class="titile-welcome">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td>
									<?php
										if($lang==1){
											include('include/search-hotel-en.php');
										}else{
											include('include/search-hotel-gm.php');
										}
									?>
								</td>
								<td>
									<?php 
										if($lang==1){
									 include('include/category-en.php'); 
									}else{
										include('include/category-gm.php');
									}
									 ?>
									
								</td>
							</tr>
						</table>
						<span class="b-down"></span>
					</div><!--title welcome-->
					<div class="main-right-body">
					<?php
						$result1=$Con->query("SELECT DISTINCT tbl_country.country_id,tbl_country.lagnuage_id,tbl_country.country_name,tbl_hotel.country_id FROM tbl_country INNER JOIN tbl_hotel ON tbl_country.country_id=tbl_hotel.country_id  WHERE language_id={$lang}");
						while($row1=mysqli_fetch_object($result1)){
							$id=$row1->country_id;
					?>
					<h2><?php echo $row1->country_name;?></h2>
					
						<div class="tour clearfix">											
						<?php
							$page = (int) (!isset($_GET["page"]) ? 1  : $_GET["page"]); 
							$limit=16;
				            $startpoint = ($page * $limit) - $limit;
				            $statement="tbl_hotel";
							$result=$Con->query("SELECT * FROM tbl_hotel WHERE language_id={$lang} AND country_id={$id}  LIMIT {$startpoint},{$limit}");
							while($row=mysqli_fetch_object($result)){
									$id=$row->hotel_or_id;
									$idc=$row->country_id;
						?>
							<div class="tour-block">							
								<div class="tour-title" >
								<?php
									$title=$row->hotel_name;
									$leng=strlen($title);
									if($leng<21){
								?>					
									<a href="hotel-detail.php?detail=<?php echo $id."&country=".$idc;?>"><span class="tour-title">
									<?php echo $row->hotel_name ?>
									</span></a>									

								<?php
									}else{
									$cut=substr($title,0,21);
									$space=explode(" ",$cut);
									$word=$space[count($space)-1];
									$last=rtrim($cut,$word);
								?>
								<a href="hotel-detail.php?detail=<?php echo $id."&country=".$idc;?>" rel="tooltip" title="<?php echo $title;?>"><span class="tour-title"><?php echo $last;?></span></a>
								<?php } ?>									
								</div>
								<div class="tour-img">
						         	<a href="hotel-detail.php?detail=<?php echo $id."&country=".$idc;?>"><img src="userfiles/hotel/<?php echo $row->photo;?>"  height="120" width="180" alt="<?php echo $row->hotel_name ?>"></a>
						         	<span class="star">
						         		<?php
						         			$num=$row->category;
						         			if(is_numeric($num)){
						         				$num_leng=strlen($num);	
						         				if($num_leng<2){					         				
						         					for($i=1;$i<=$num;$i++){
						         						echo '<i class="fa fa-star"></i>';
						         					}
						         				}else{
						         					if($num==34){						         						
						         						for($j=1;$j<=3;$j++){
						         							echo '<i class="fa fa-star"></i>';
						         						}
						         					}else{
						         						for($k=1;$k<=4;$k++){
						         							echo'<i class="fa fa-star"></i>';
						         						}
						         					}
						         				}
						         		?>
											
										<?php									
										}else{ echo ""; }
										?>
									</span>
						        </div>
							</div><!--/tour block-->
							<?php }  ?>
																		
						</div><!--/tour-->
						<?php }?>
							<?php echo pagination($statement,$limit,$page);  ?>
						</div><!--main right body-->
					</div><!--main right cd-->

				
			</div><!--/main-right-->
			<?php include ('include/destination.php'); ?>
			<?php include('include/travel-style.php'); ?>
		</div><!--/container-->
	</div><!--/main-->
	
	<?php include('include/script.php'); ?>
</body>
</html>