<!DOCTYPE html>
<html lang="en">
<?php
	include('include/session.php');
	include('include/function.php');
	include('include/db.php');
	include('include/pagination.php');
	$slide=7;
	

?>
<head>
	<meta charset="UTF-8">
	<title><?php if($lang==1){ show_web(26,"site_title");} else{ echo show_web(27,"site_title"); } ?></title>
	<meta name="description" content="<?php if($lang==1){ show_web(26,"site_description");} else{ echo show_web(27,"site_description"); } ?>" />
    <meta name="keywords" content="<?php if($lang==1){ show_web(26,"site_keyword");} else{ echo show_web(27,"site_keyword"); } ?>" />6
	
	<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" style="padding: 0 39px;">
							<tr align="left">
								<td><form>
								<?php if($lang==1){ ?>
									<select  class="search" style="width: 770px;" onChange="window.location.href=this.value">
			                        	<option class="combobox combobox_title" value="all">PREFER BY COUNTRY</option>
			                            <option class="combobox" value="tour.php?coutry=1">CAMBODIA</option>
			                            <option class="combobox" value="tour.php?country=2">VIETNAM</option>
			                            <option class="combobox" value="tour.php?country=3">LAOS</option>
			                            <option class="combobox" value="tour.php?country=4">THAILAND</option>
			                            <option class="combobox" value="tour.php?country=5">MYANMAR</option>
			                        </select>
			                     <?php }else{ ?>
			                     	<select  class="search" style="width: 770px;" onChange="window.location.href=this.value">
			                        	<option class="combobox combobox_title" value="all">LIEBER NACH LÄNDERN</option>
			                            <option class="combobox" value="tour.php?coutry=1">KAMBODHA</option>
			                            <option class="combobox" value="tour.php?country=2">VIETNAM</option>
			                            <option class="combobox" value="tour.php?country=3">LAOS</option>
			                            <option class="combobox" value="tour.php?country=4">THAILAND</option>
			                            <option class="combobox" value="tour.php?country=5">MYANMAR</option>
			                        </select>
			                     <?php } ?>
								</form></td>
								<!--<td width="260px">
									<select class="search" style="width: 250px;">
			                        	<option class="combobox combobox_title">FIND BY DESTINATION</option>
			                            <option class="combobox" value="#">ALL DESTINATION</option>
			                            <option class="combobox" value="#">Angkor Journeys</option>
			                            <option class="combobox" value="#">Family Holidays</option>
			                            <option class="combobox" value="#">Beach Journeys</option>
			                            <option class="combobox" value="#">Angkor Journeys</option>
			                            <option class="combobox" value="#">Family Holidays</option>
			                            <option class="combobox" value="#">Beach Journeys</option>
			                            <option class="combobox" value="#">Family Holidays</option>
			                            <option class="combobox" value="#">Beach Journeys</option>
			                            <option class="combobox" value="#">Angkor Journeys</option>
			                            <option class="combobox" value="#">Family Holidays</option>
			                        </select>
								</td>
								<td width="260px">
									<select class="search" style="width: 250px;">
			                        	<option selected="selected" value="%">FIND BY DAY</option>
	                                    <option value="2-4">2 to 4 days</option>
	                                    <option value="5-7">5 to 7 days</option>
	                                    <option value="8-10">8 to 10days</option>
	                                    <option value="11">11 and more days</option>
			                        </select>
								</td>-->
							</tr>
						</table>
						<span class="b-down"></span>
					</div>
					<div class="main-right-body">
						<div class="tour clearfix" id="tour">

						<?php
							if(isset($_GET['country'])){								
							$page = (int) (!isset($_GET["page"]) ? 1  : $_GET["page"]); 
							$limit=16;
				            $startpoint = ($page * $limit) - $limit;
				            $statement="tbl_tour";
							$result=$Con->query("SELECT * FROM tbl_tour WHERE language_id={$lang} AND country_id={$_GET['country']} ORDER BY country_id LIMIT {$startpoint},{$limit} ");
							while($row=mysqli_fetch_object($result)){
								$tour=$row->tour_name_id;
								$country=$row->country_id;
						?>
							<div class="tour-block">
						        <div class="tour-title" >
							         <a href="tour-detail.php?detail=<?php echo $tour.'&country='.$country;?>" rel="tooltip" title="<?php echo $row->tour_name;?>">
							          <span class="tour-title"  >
							          	<?php
							          		$title=$row->tour_name;
							          		$leng=strlen($title);
							          		if($leng>=37){
							          			$trim=substr($title,0,35);
							          			$space=explode(" ",$trim);
							          			$word=$space[count($space)-1];
							          			echo rtrim($trim,$word);
							          			echo"...";
							          		}
							          		else{
							          			echo $title;
							          		}							          		
							          	?>
							          </span>							          
							         </a>
						        </div>
						        <div class="tour-img">
						         	<a href="tour-detail.php?detail=<?php echo $tour.'&country='.$country;?>"><img src="userfiles/tour/<?php echo $row->photo;?>"  height="120" width="180" alt="<?php echo $title; ?>"></a>
						        </div>
						    </div>
						<?php
							}
							}else{
							$page = (int) (!isset($_GET["page"]) ? 1  : $_GET["page"]); 
							$limit=16;
				            $startpoint = ($page * $limit) - $limit;
				            $statement="tbl_tour";
							$result=$Con->query("SELECT * FROM tbl_tour WHERE language_id={$lang} ORDER BY country_id ASC, order_by ASC LIMIT {$startpoint},{$limit} ");
							while($row=mysqli_fetch_object($result)){
								$tour=$row->tour_name_id;
								$country=$row->country_id;	
						?>	
							<div class="tour-block">
						        <div class="tour-title" >
						        <?php 
						        	$title=$row->tour_name;
							        $leng=strlen($title);
						        	if($leng>=37){
						        ?>
							         <a href="tour-detail.php?detail=<?php echo $tour.'&country='.$country;?>" rel="tooltip" title="<?php echo $row->tour_name;?>">
							          <span class="tour-title"  >
							          	<?php							          									          		
							          			$trim=substr($title,0,35);
							          			$space=explode(" ",$trim);
							          			$word=$space[count($space)-1];
							          			echo rtrim($trim,$word);
							          			echo"...";							          		
							          	?>
							          </span>							          
							         </a>
							         <?php
							         	}else{
							         ?>
							         <a href="tour-detail.php?detail=<?php echo $tour.'&country='.$country;?>" >
							          <span class="tour-title"  >
							          	<?php							          		
							          			echo $title;							          		
							          	?>
							          </span>							          
							         </a>
							        <?php } ?>
						        </div>
						        <div class="tour-img">
						         	<a href="tour-detail.php?detail=<?php echo $tour.'&country='.$country;?>" ><img src="userfiles/tour/<?php echo $row->photo;?>"  height="120" width="180" alt="<?php echo $title; ?>"></a>
						        </div>
						    </div>
						    <?php } }  ?>					 
						</div><!--/tour-->
						<?php  echo pagination($statement,$limit,$page); ?>
					</div>

					<!--<div class="titile-welcome relate">Prefer_hotel</div>-->
					
				</div>
			</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>