<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>เบญจพรกรุ๊ป  Benjabhorn Group</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-image:url(images/bg-inside.jpg); background-position:top; background-repeat:repeat-x;
}
#apDiv1 {
	position:absolute;
	left:422px;
	top:136px;
	width:822px;
	height:310px;
	z-index:1;
}
#apDiv2 {
	position:absolute;
	left:130px;
	top:160px;
	width:1000px;
	height:50px;
	z-index:1;
}
-->
</style></head>
<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--<div id="apDiv1">
<iframe src="slide-project/index.html" width="800" height="300" frameborder="0" scrolling="no"></iframe></div>
 -->
<center>
<?php include("header.php"); ?>

		<?php
	 $rowPerPage=8;
		if((!$_GET['page'])||($_GET['page']==1)){
						$_GET['page']=1;
						$startRow=0;
		}else{
					$startRow=($_GET['page']-1)*$rowPerPage;
			}	
			 //------------------------------------------------------SELECT DEFAULT CATEGORY		
		 	 if($_GET['CateID']==''){ 
				 $query="SELECT * FROM  tbl_act_category  ORDER BY id  ASC  LIMIT 0, 1";
				 $resultCategory=mysql_query($query);	
				 $dataCategory=mysql_fetch_assoc($resultCategory);		
				  	$_GET['CateID']=$dataCategory['id'];
			 }
			 //------------------------------------------------------SELECT CATEGORY
		 	 $query="SELECT * FROM  tbl_act_category  ORDER BY id  ASC ";
   			 $resultCategory=mysql_query($query);
			//------------------------------------------------------------SELECT DATA
					$queryAct="SELECT a.*, b.category_name  FROM tbl_act3_data a  LEFT JOIN  tbl_act_category b ON a.cate_id=b.id  WHERE a.first_page='1'     AND a.cate_id= '".$_GET['CateID']."' ";
					
				$queryActLm=$queryAct." ORDER BY a.date_post DESC LIMIT $startRow, $rowPerPage"; 
				$resultAct=mysql_query($queryActLm);
	
?>

<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1000" height="420"  align="left" valign="top"><iframe src="Slideshow2/slide/index_slide.php" width="994" height="430" scrolling="no" frameborder="0" style="background:transparent;"></iframe></td>
  </tr>
  <tr>
    <td  align="left" valign="top">
    <table width="100%" border="0">
  <tr>
    <td height="11" colspan="2" align="right" class="h-search LR20">
      </p></td>
    </tr>
  <tr>
    <td width="36%" height="12"><div id="showCategory">&nbsp;</div></td>
    <td width="64%" align="right"><span class="h-search">หมวด&nbsp;
        <?php $n=1; while($cate=mysql_fetch_assoc($resultCategory)){?>
&nbsp;&nbsp; <img src="images/icon/Service.png" alt="" width="32" height="32" hspace="3" vspace="3" align="absmiddle" /><a href="news.php?CateID=<?php echo $cate['id']?>"> <?php echo $cate['category_name']?></a>
<?php if($n > 4){ echo "<br>"; $n=0;}?>
<?php $n++; }?>
    </span></td>
  </tr>
    </table>

 
            
            
      <hr size="2" noshade="noshade" />      </td>
    </tr>
    <?php while($act=mysql_fetch_assoc($resultAct)){ 
					$cateName=$act['category_name'];
	?>
  <tr>
    <td height="35" align="left" valign="top" class="txt30"><p>&nbsp;</p>
    <table width="94%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="290" valign="top"><?php $query="SELECT * FROM tbl_act3_pic WHERE model_data_id = '".$act['id']."' LIMIT 0,1 ";
							$resultPix=mysql_query($query);
							$pix=mysql_fetch_assoc($resultPix);
				?>
                    <img src="<?php echo $path_product."thb/".$pix['pic_name']?>" alt="news" hspace="5" vspace="5"  class="border"></td>
        <td width="655" valign="top"><a href="news_detail.php?NewsID=<?php echo $act['id']?>&page=<?php echo $_GET['page']?>&CateID=<?php echo $_GET['CateID']?>"><strong><?php echo $act['topic']?></strong></a>&nbsp;<?php $icon=" <img src='images/ico-4408.gif'  width='30' height='10' border='0'/>"; GetNewIcon($act['date_start'],$icon)?>
          <br />
          <br />
          <?php $act['detail']=strip_tags($act['detail'], '<*>');  echo substr($act['detail'],0,1000);?>
            <br />
            [<?php echo GetThaiDate2($act['date_post'])?>]</td>
      </tr>
      <tr>
        <td height="10" colspan="2" class="line"></td>
      </tr>
    
    </table>
    </td>
    </tr>  <?php } ?>
  <tr>
    <td align="right" valign="top"><map name="Map" id="Map2">
        <area shape="rect" coords="229,2,299,30" href="#" alt="" />
        <area shape="rect" coords="306,2,383,30" href="type.php" alt="" />
      </map></td>
    </tr>
  <tr>
    <td align="center" valign="top"> Page : <?php $self="news.php?CateID=".$_GET['CateID']; PageDisplay($queryAct,$rowPerPage,$_GET['page'],$self,$word)?></td>
  </tr>
  <tr>
    <td align="left" valign="top" class="txt30">&nbsp;</td>
  </tr>
</table>
<script language="javascript">
		document.getElementById('showCategory').innerHTML = '<p class="txt30"><?php echo $cateName?></p>';
</script>
<p>&nbsp;</p>
</center>
<?php include("footer.php"); ?>
</body>
</html>