<?php

ob_start();

session_start();

/******************INCLUDES**********************/

include('connection/connection.php');

include_once('index.fns.php');

include_once('lib/class.user.php');

include_once('lib/class.report_handler.php');

include_once('lib/class.validate.php');

include_once 'admin_end/config.php';

include_once 'admin_end/includes/mysql.inc.php';



$frontEnd= new frontEnd;

$user= new user;

/************************************************/



$action = isset($_POST['action'])?$_POST['action']:NULL;

$id = $_REQUEST['id'];

$level= $_REQUEST['level'];

$parent= $_REQUEST['parent'];





// Number of entries per page

$numentries=6;



// Get form data

if(!isset($_GET['page'])) {

	$page=0;

} else {

	$page=$_GET['page'];

}

if(!isset($_GET['sort'])) {

	$sort='name';

} else {

	$sort=$_GET['sort'];

}

if(!isset($_GET['order'])) {

	$order='ASC';

} else {

	$order=$_GET['order'];

}



// Set up vars, all default order ASC

$orderAddress='ASC';

$orderName='ASC';

$orderPhone='ASC';

$orderFax='ASC';

$orderLocation='ASC';

$orderLsent='ASC';

$orderList='ASC';

$orderWebsiteAddress='ASC';

$orderEmailAddress1='ASC';



// Change current sorted group order

switch($sort) {

	case 'Location':

		if($order=='ASC') {

			$orderLocation='DESC';

		} else {

			$orderLocation='ASC';

		}

		break;

	case 'name':

		if($order=='ASC') {

			$orderName='DESC';

		} else {

			$orderName='ASC';

		}

		break;

	case 'PhoneNo1':

		if($order=='ASC') {

			$orderPhone='DESC';

		} else {

			$orderPhone='ASC';

		}

		break;

	case 'WebsiteAddress':

		if($order=='ASC') {

			$orderWebsiteAddress='DESC';

		} else {

			$orderWebsiteAddress='ASC';

		}

		break;

	case 'EmailAddress1':

		if($order=='ASC') {

			$orderEmailAddress1='DESC';

		} else {

			$orderEmailAddress1='ASC';

		}

		break;

	case 'listid':

		if($order=='ASC') {

			$orderList='DESC';

		} else {

			$orderList='ASC';

		}

		break;

}





	

?>
<?php
		if(isset($_REQUEST['txt_product_list']) and $_REQUEST['txt_product_list']!='')
		{
		$txt_product_list=$_REQUEST['txt_product_list'];
		
	$_SESSION['get_product_list']=$txt_product_list;
		}
		else
		{
		unset($_SESSION['get_product_list']);
		}
		if(isset($_REQUEST['txt_location']) and $_REQUEST['txt_location']!='')
		{
		
		$get_location=$_REQUEST['txt_location'];
	$_SESSION['get_location_list']=$get_location;
		}
		else
		{
		unset($_SESSION['get_location_list']);
		}
		?>
		<script type="text/javascript">
		function frm_submit()
		{
		
		document.frm_product_location.submit();
		}
		</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script type="text/javascript">
if(document.location.protocol=='http:'){
 var Tynt=Tynt||[];Tynt.push('doNBuMQU8r36Z9adbi-bpO');Tynt.i={"st":true};
 (function(){var s=document.createElement('script');s.async="async";s.type="text/javascript";s.src='http://tcr.tynt.com/ti.js';var h=document.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h);})();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="css/style.css" type="text/css" rel="stylesheet" />

<link href="css/menu1.css" type="text/css" rel="stylesheet" />

<title>Kuwaitcommercials.com is the only leading web based business directory of Kuwait with online ordering features</title>
<meta name="keywords" content="Kuwait Commercials, online business directory, business directory kuwait, business directory of kuwait, kuwait business directory, kuwait online business directory, online purchase kuwait, kuwait companies, companies in kuwait, business, online shopping, online shopping kuwait">
<meta name="description" content="This website is a comprehensive list of information of leading business entities in kuwait with an emphasis on online shopping">

<!--<script type="text/javascript" src="js/jquery.min.js"></script>

<script type="text/javascript" src="js/ddaccordion.js"></script>

<script src="Scripts/scriptaculous/prototype.js" type="text/javascript"></script>

<script src="Scripts/scriptaculous/scriptaculous.js" type="text/javascript"></script>

<script type="text/javascript" src="js/dropdown.js"></script>-->
<style type="text/css">
<!--
.style1 {
	font-size: 12px;
	color: #003366;
}
.style3 {
	font-size: 12px;
	color: #003366;
	font-weight: bold;
}
.style4 {
	font-size: 12px;
	color: #FF0000;
	font-weight: bold;
}
-->
</style>
<?php

				include("includes/jquery.php");

			?>
</head>

<body>

<div id="main_wrap">

  <div id="main_container">

   <?php
				include("includes/online_purchase_header.php");
			?>

    <div class="blue_line"> <?php

			include("includes/menu.php");

		?></div>

	

   <div class="top_content">

       <?php

				include("includes/top_bar_restaurants_online.php");

		?>

    </div>


	
    <div id="inner_content">

      <div class="left_side_content">

         
<form id="frm_product_location" name="frm_product_location" method="get" action="<?php echo $_SERVER['PHP_SELF'];?>">
		<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="35%"><span class="style3"><strong>Menu Items </strong></span></td>
    <td width="27%"><span class="style3"><strong>Location</strong></span></td>
    <td width="38%" rowspan="2" align="right"><a href="restaurants_resevation_list.php"><img src="images/reserve.gif" border="0" /></a></td>
  </tr>
  <tr>
    <td><select onChange="frm_submit();" name="txt_product_list" id="txt_product_list">
			    <?php
		if(isset($txt_product_list) and $txt_product_list!='')
		 {
		  echo '<option value="">All</option>';
		 echo "<option selected='selected' value='".$txt_product_list."'>";
		
		 $qury_product_id="SELECT * FROM categories where cat_id='$txt_product_list'";
			$select_product_id=mysqli_query($db, $qury_product_id);
			while($row6=mysqli_fetch_array($select_product_id))
			{			
			echo $row6['cat_name'];
			}
		 echo "</option>";
		 }
		 else
		 {
		  echo '<option selected="selected" value="">All</option>';
		 }
		 $query_loc="SELECT * FROM categories p,companies c where p.company_id=c.company_id and c.type in('D','E') and p.cat_id!='$txt_product_list' group by p.cat_name";
		
		$select_loc=mysqli_query($db, $query_loc);
		while($row5=mysqli_fetch_array($select_loc))
			{
	
			echo '<option value="'.$row5['cat_id'].'">';
			$qury_lo="SELECT * FROM categories where cat_id='$row5[cat_id]'";
			$select_location=mysqli_query($db, $qury_lo);
			while($row6=mysqli_fetch_array($select_location))
			{			
			echo $row6['cat_name'];
			}
			echo '</option>';   
			}
		?>
	        </select></td>
    <td><select onChange="frm_submit();" name="txt_location" id="txt_location">
                     <?php
		if(isset($get_location) and $get_location!='')
		 {
		 echo '<option value="">All</option>';
		 echo "<option selected='selected' value='".$get_location."'>".$get_location."</option>";
		  
		 }
		 else
		 {
		  echo '<option selected="selected" value="">All</option>';
		 }
		 $query_loc="SELECT * FROM location where location_name!='$get_location'";
		$select_loc=mysqli_query($db, $query_loc);
		while($row5=mysqli_fetch_array($select_loc))
			{
	
			echo '<option value="'.$row5['location_name'].'">'.$row5['location_name'].'</option>';   
			}
		?>
            </select></td>
    </tr>
</table> 
		</form>

     

        <div class="left_content">

          <?

		 if(is_object($user) && $user->getErr()){ 

		echo "<div class=\"error_msg\"><ul>".$user->getErr()."</ul></div>";

         } 

		?>

          <iframe class="companyframe" src="restaurants_listing.php?id=<?php echo $id; ?>&level=<?php echo $level; ?>&parent=<?php echo $parent; ?>" width="750" height="600" scrolling="yes" style="margin-left:2px;"></iframe>

        </div>

      </div>

       <div class="right_sidebar" align="center">
 <?php

				include("includes/top_bar_side_hotel_online.php");

		?>
      </div>

    </div>
	
	<div id="useful_links">

     <?

		echo $frontEnd->getUsefulLinks();

	?>

    </div>


    <div class="footer">
	<?php

				include("static/footer_statistics.php");

		?></div>

  </div>

</div>

</body>

</html>

