<?php
	require_once 'admin/include/config.php';
	define("THIS_PAGE","product");
	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];
	}
	$p_id = is_numeric(trim($_GET["p_id"])) ? trim($_GET["p_id"]) : 1;
	$filter[0] = array("0",$p_id,false);
	if(!$hm_arr = get_product($filter))
		show_err("系统中找不到该产品");
	//查该产品的分类名
	$filter[0] = array("0",$hm_arr[0][1],false);
	if(!$t_arr = get_product_t($filter))
		$p_type = "错误的产品分类";
	else
		$p_type = $t_arr[0][2];
	$md_str = "";
	$md_str = trim($hm_arr[0][5]) ? $hm_arr[0][4] . "[" . $hm_arr[0][5] . "]" : $hm_arr[0][4];
	//配置产品图片
	$img_str = trim($hm_arr[0][7]) ? $hm_arr[0][7] : "1.gif";
	//查该产品下所有图
	$img_arr = explode("|",$hm_arr[0][8]);
	//取大分类
	$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" />
<script language = "javascript" src="admin/include/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	for(i=0;i<$(".p_img").length;i++)
		resize_img($(".p_img:eq(" + i + ")"));
});
function resize_img(hmcss_img)
{
 var Img = new Image();
 var max_width = 780;
 Img.src = hmcss_img.attr("src");
 if(max_width > Img.width)
 	return;
 else{
	 hmcss_img.css("width",max_width);
	 hmcss_img.css("height",Math.round(Img.height/(Img.width/max_width)));
 }
}
</script>
<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;}
.product_list{border:0px; height:auto;}
.product_list li{border-bottom:1px #CCC solid;}
.product_list img{margin:10px auto; float:none;}

/*滚动产品CSS样式*/
.rollBox{width:798px;overflow:hidden; margin:0px; padding:0px; float:left;}
.rollBox .LeftBotton{height:130px;width:8px;background:url(pics/job_mj_069.gif) no-repeat; margin:40px 2px 0px 0px;overflow:hidden;float:left;display:inline; cursor:pointer;}
.rollBox .RightBotton{height:130px;width:10px;background:url(pics/job_mj_069.gif) no-repeat -8px 0;overflow:hidden;float:left;display:inline;margin:40px 0px 0px 4px;cursor:pointer;}
.rollBox .Cont{width:774px;overflow:hidden;float:left;}
.rollBox .ScrCont{width:10000000px;}
.rollBox .Cont .pic{width:194px;float:left;text-align:center;}
.rollBox .Cont .pic img{padding:4px;background:#fff;border:1px solid #ccc;display:block;margin:0 auto;}
.rollBox .Cont .pic p{line-height:25px;color:#505050; margin:0px; padding:0px;}
.rollBox .Cont a:link,.rollBox .Cont a:visited{color:#626466;text-decoration:none;}
.rollBox .Cont a:hover{color:#f00;text-decoration:underline;}
.rollBox #List1,.rollBox #List2{float:left;}
/*滚动产品CSS样式结束*/
</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">
	<div class="product_list">
        <ul>
        	<li style="width:100px;">产品名称：</li>
            <li style="width:338px; color:#666;"><?php echo $hm_arr[0][3]; ?></li>
            <li style="width:100px;">产品分类：</li>
            <li style="width:260px; color:#666;"><a href="product_type.php?t_id=<?php echo $hm_arr[0][1]; ?>"><?php echo $p_type; ?></a></li>
            <li style="width:100px;">规格型号：</li>
            <li style="width:698px; color:#666;"><?php echo $md_str; ?></li>
            <?php
            	foreach($img_arr as $key => $val){
					!trim($val) && $val = "1.gif";
					echo "<li style=\"width:798px; text-align:center; height:auto;\"><a href=\"product/big/$val\" target=\"_blank\"><img class=\"p_img\" src=\"product/big/$val\" border=\"0\" title=\"点击看大图\" /></a></li>";
				}
			?>
        </ul>
    </div>
</div>
</div>
<div id="foot"><?php unset($hm_arr,$filter,$t_arr); hmcss_foot(); ?></div>
</body>
</html>