<?php session_start(); 
	include('conn.php');
?>

<!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>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script src="jquery-2.1.1.js"></script>
	<title>MD computer</title>
    <script language="javascript">
		$(document).ready(function() {
			$("#quick_menu,#quick_menu").hide();
			$("#menu2").mouseenter(function(){
				$("#quick_menu,#quick_menu").show(100);
				$("#menu6").html("<font color='#F60'>สินค้า</font>");
				
			});
			$("#menu2").mouseleave(function(){
				$("#quick_menu,#quick_menu").hide(100);
				$("#menu6").html("<font color='#FFF'>สินค้า</font>");
			});
		});
	</script>
</head>
<body>
<div id="head">
<?php
	$user_chk = $_SESSION['user_chk'] ;
	$lv_chk = $_SESSION['level'] ;
	$sql = "select * from members where user ='".$user_chk."'";
	$result = mysql_query($sql);
	while ($user = mysql_fetch_array($result))
	{
		$chkuser=$user['user'];
		$fname=$user['fname'];
		$lname=$user['lname'];
		$lv = $user['lv'];
	}	
?>
	<table width="1200" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="right">
			<?php
			if($_SESSION['shopping']==""){
				$shopping_num_on=0;
			}else{
				$shopping_on=$_SESSION['shopping'];
				$number_shopping_on=$_SESSION['number_shopping'];
				$shopping_array_on = explode(",", $shopping_on);//แยกเครื่องหมาย
				$shopping_num_on=sizeof($shopping_array_on);
			}
			?>
        	<a href="sale.php">ตะกร้าสินค้า(<?=$shopping_num_on;?>)</a> |  
			<?php 
				if($user_chk=="")
				{	?>
					<a href="register.php">สมัครสมาชิก</a> | <a href="login.php">เข้าสู่ระบบ</a> 
		<?php 	}else{ ?>
						<a href="update_user.php?user=<?=$_SESSION['user_chk'];?>">คุณ<?php echo $fname." ".$lname; ?></a> | <a href="chk_login.php">ออกจากระบบ</a>
		<?php 	}	?>
    	</td>
      </tr>
      <tr>
        <td><img id="head_img" src="images/head.jpg" width="1200" height="200" /></td>
      </tr>
      <tr>
        <td>
        	<a  href="index.php"><div id="menu1">หน้าแรก</div></a>
            <div id="menu2">
            	<a  href="product_show.php"><div id="menu6"><font color="#FFF">สินค้า</font></div></a>
			<?php
				$sql2 = "select * from category";
				$result2 = mysql_query($sql2);
				while ($category = mysql_fetch_array($result2))
				{	?>
					<a href="product_show.php?id_category=<?=$category['id_category'];?>">
					<div id="quick_menu">
							<?=$category['name_category'];?>
					</div></a>
				<?php }	
			 ?>
			</div>
			
            <a href="search.php"> <div id="menu3">ค้นหา</div></a>
            <a href="sale.php"><div id="menu4">ชำระค่าสินค้า</div></a>
            <a href="contact.php"><div id="menu5">ติดต่อ</div></a>
        </td>
      </tr>
    </table>
</div><br/><br/>