<?php
	require_once 'admin/include/config.php';
	define("THIS_PAGE","product");
	$page = trim($_GET["page"]);
	$page = $page ? $page : 1;
	$max_per_page = 5;
	if(!$hm_arr = get_seo(3)){
		$hm_title = $hm_key = $hm_des = hmcss_default_config(1);
	}
	else{
		$hm_title = $hm_arr[0][2];
		$hm_key = $hm_arr[0][3];
		$hm_des = $hm_arr[0][4];
	}
	//取大分类
	$filter[0] = array("2",0,false);
	$type_b_arr = get_product_t($filter);
?>
<!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" />
<title><?php echo $hm_title; ?></title>
<meta name="description" content="<?php echo $hm_des; ?>" />
<meta name="keywords" content="<?php echo $hm_key; ?>" />
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
#out{width:1000px; overflow:hidden; min-height:600px; height:auto; background-image:url(pics/bg/left_bg.gif); background-repeat:repeat-y;}
#right{width:800px; height:auto!important; min-height:600px; height:auto; float:left;}
.img_span{display:inline-block; width:180px; height:130px; float:left; margin-right:10px;}
</style>
</head>

<body>
<?php require_once("top.php"); ?>
<div class="now_position"><span class="position_str">当前位置：<a href="index.php">首页</a>-><a href="product.php">产品展示</a>->产品列表</span><span class="im_notice">
<marquee direction="left" scrolldelay="100" onmouseout="this.start()" onmouseover="this.stop()" style="width:400px;">
<?php hmcss_notice(); ?>
</marquee></span></div>
<div id="out">
<div id="left">
<?php
	if(!$type_b_arr){
		echo "<div class=\"type_out\">\n\r";
		echo "<div class=\"big_type\"><span class=\"type_left_arr\"></span>系统中暂无分类</div>\n\r";
		echo "</div>\n\r";
	}
	else{
		foreach($type_b_arr as $key => $val){
			echo "<div class=\"type_out\">\n\r";
			echo "<div class=\"big_type\"><span class=\"type_left_arr\"></span><a href=\"product_type.php?t_id=$val[0]\">$val[2]</a></div>\n\r";
			echo "<ul>\r\n";
			//查该大分类下的小分类
			$filter[0] = array("2",$val[0],false);
			if(!$type_s_arr = get_product_t($filter)){
				echo "<li class=\"small_type\">暂无子类</li>\r\n";
			}
			else
			{
				foreach($type_s_arr as $key_s => $val_s)
					echo "<li class=\"small_type\"><a href=\"product_type.php?t_id=$val_s[0]\">$val_s[2]</a></li>\r\n";
			}
			echo "</ul>\r\n";
			echo "</div>\n\r";
		}
	}
?>
</div>
<div id="right">
<?php
	//计算总页数
	$all_page = ceil(count($hm_arr)/$max_per_page);
	if($page > $all_page)
		$page = $all_page;
	$start = $page ? (($page - 1) * $max_per_page) : 0;
	$filter_arr[0] = array("4","$start,$max_per_page",false);
	$hm_arr = get_product($filter_arr);
	foreach($hm_arr as $key => $val){
		echo "	<div class=\"product_list\">\r\n";
		$main_pic = trim($val[7]) ? $val[7] : "1.gif";
		echo "    	<span class=\"img_span\"><a href=\"product_show.php?p_id=$val[0]\" target=\"_blank\"><img src=\"product/small/$main_pic\" title=\"点击查看详情\" border=\"0\" /></a></span>\r\n";
		echo "        <ul>\r\n";
		echo "        	<li style=\"width:100px;\">产品名称：</li>\r\n";
		echo "            <li style=\"width:200px; color:#666;\"><a href=\"product_show.php?p_id=$val[0]\" target=\"_blank\">$val[3]</a></li>\r\n";
		echo "            <li style=\"width:100px;\">产品分类：</li>\r\n";
		$filter[0] = array("0",$val[1],false);
		if(!$hm_t = get_product_t($filter))
			$type_name = "此产品暂时没有分类";
		else
			$type_name = $hm_t[0][2];
		echo "            <li style=\"width:200px; color:#666;\"><a href=\"product_type.php?t_id=$val[1]\">$type_name</a></li>\r\n";
		echo "            <li style=\"width:600px; border-bottom:0px; height:100px; line-height:20px;\">产品简介：<br /><span style=\"color:#666; display:block; text-indent:2em;\">\r\n";
		echo stripslashes($val[6]),"</span>\r\n";
		echo "            </li>\r\n";
		echo "        </ul>\r\n";
		echo "    </div>\r\n";
	}
	if($all_page > 1){
		echo "<div id=\"page\" style=\"width:798px;\">\r\n";
		for($i = 1;$i <= $all_page;$i++)
			echo $i - $page == 0 ? "<a class=\"now_page\">$i</a>" : "<a class=\"page_span\" href=\"product.php?page=$i\">$i</a>";
		echo "</div>\r\n";
	}
?>
</div>
</div>
<div id="foot"><?php unset($hm_arr,$filter,$hm_t); hmcss_foot(); ?></div>
</body>
</html>