<?php
	include_once("includes/paginator.php");
	include_once("includes/paginator_html.php");   
?>
<div class="cover_con" style="border: 0px solid #ff0000; width: 930px;">
<?php
      if(isset($_GET['a_id'])){
	     $a_id = $_GET['a_id'];
	  }
	  $row_all = mysql_fetch_array(mysql_query("Select * From tbl_all WHERE id='".mysql_real_escape_string($a_id)."'"));  
?>			
			<div id="box_beaty_detail">
				<div id="box_beaty_title" style="text-align: left; width: 914px; float: left; font-size: 16px;"><!--សម្ផស្ស និងសុខភាពស្រ្តី--><?php echo $row_all['title']; ?></div>
				<div class="clear" style="height: 10px;"></div>
				<img src="images/all/b/<?php echo $row_all['image']; ?>" />
				<div class="clear" style="height: 14px;"></div>
					<?php echo str_replace('~', '', $row_all['detail']); ?>
			</div>

	<div class="clear" style="height: 40px;"></div>
<div id="bar_title_all" style="text-align: left; width: 914px; float: left; font-size: 20px;">
					    មើលផ្សេងៗទៀត 
					</div>	
</div>

<?php
	    $achs=mysql_query("SELECT * FROM tbl_all WHERE id!='".mysql_real_escape_string($a_id)."'");
		  $num_rows = mysql_num_rows($achs);
			if(isset($_GET['page']))
				$s= $_GET['page'];
			else
		  $s="1";
		  $param ="p=all&a_id=".$a_id."";
		  $a = new Paginator_html($s,$num_rows, $param);
		  $a->set_Limit(8);
		  $a->set_Links(2);
		  $limit1 = $a->getRange1();
		  $limit2 = $a->getRange2();
		  //End Select Paging 
	   $sql_all = mysql_query("Select * From tbl_all WHERE id!='".mysql_real_escape_string($a_id)."' ORDER BY id DESC LIMIT $limit1, $limit2");
	   while($row_all = mysql_fetch_array($sql_all)){
	   $str=$row_all['title'];
	   $title=strlen($str);
	    if($title > 200){
			$sp=substr($str,0,200);
			$sp1=$sp.'...';
		}else{
			$sp1=$str;
		} 
	
	?>
	 <a href="?p=all&a_id=<?php echo $row_all['id']; ?>#txt" title="<?php echo $row_all['title']; ?>">
		 <div id="box_photo"><div id="bg_photo">
		 <?php echo'<div id="photo_img" style="background: url(\'images/all/'.$row_all['image'].'\') no-repeat center center;"></div>'; ?>
		 </div><div class="clear" style="height: 5px;"></div><?php echo $sp1; ?></div>
	  </a>
<?php } ?>
	<?php if($num_rows > 8){?>  
		<div class="clear" style="height: 5px;"></div>
		<div class="clear" style="height: 1px; width: 920px; background: #e6e7e8;"></div>
		<div class="clear" style="height: 20px;"></div>		
			<table><tr><td>
			  <span class="as" style="color: #ff0000; font-weight: bold; font-family: Arial; font-size: 12px;"><?php $a->first(); ?><?php $a->previousNext(); ?><?php $a->Last(); ?></span>                         
		   </td></tr></table>
		<div class="clear" style="height: 15px;"></div>
	<?php } ?>
<div class="clear"></div>
	
	
	<div class="clear" style="height: 20px;"></div> 