<?php
// $ls="all" 生成全部，不包含产品页； $ls!="all_products" 生成全部，包含产品页；
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>
<!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="css/admin.css" rel="stylesheet" type="text/css">
<title>无标题文档</title>
</head>
<body>
<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
  <tr>
    <td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong><a href="" onclick="history.go(0);">模板管理</a></strong></font></div></td>
  </tr>
  <tr>
    <td height="213" valign="top" bgcolor="#dee7ff"><br />
      <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
        <tr bgcolor="#B9DAFF">
          <td style="padding-left:10px;" >
<?php
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/public.php'); //main menu & left menu
	require_once('inc/ls_syscode.php');
	require_once('inc/ls_m_syscode.php');
	
	$ls=$_GET['ls'];
	$cateid=$_GET['cateid'];
	$cateFolders=$_GET['cateFolders'];
	$midcateid=$_GET['midcateid'];
	$midcateFolders=$_GET['midcateFolders'];
	$subcateid=$_GET['subcateid'];
	$subcateFolders=$_GET['subcateFolders'];
	$menuListscateid=$_GET['menuListscateid'];	//global ver in ls_syscode
	//主菜单 start
	// public.php
	//主菜单 end
	
// 获得某类下第一个产品的记录 for get_allcatepics
function get_product_class_rows($classpro_rowsID)
{
			require_once('inc/conn.php');
			$opendb=new mydb();
			require_once('inc/char_set.php');

			$product_class_sql="select * from ls_products where branchID=0 and productID=".$classpro_rowsID." and AdditionalAttributesClassPro&1   order by Num ASC";	//定义 AdditionalAttributesClassPro 属性
			$product_class_query=$opendb->query($product_class_sql);
		  	$product_class_num=mysql_num_rows($product_class_query);
			if($product_class_num>=1) //已定义classpro 展示产品
			{
				$product_class_rows=mysql_fetch_assoc($product_class_query);
			}
			else  //未定义classpro 展示产品，直接选一个
			{
				$product_class_sql="select * from ls_products where  branchID=0 and productID=".$classpro_rowsID." and enable=1  order by ID desc";
				$product_class_query=$opendb->query($product_class_sql);
		  		$product_class_num=mysql_num_rows($product_class_query);
				if($product_class_num>=1) //已定义classpro 展示产品
				{
					$product_class_rows=mysql_fetch_assoc($product_class_query);
				}
			}
			return $product_class_rows;
}
	
// 获得某类下所有产品的图片及连接
function get_product_cate_pics($catepics_rowsID,$thisfolder)
{
			$s_catepics="";
			require_once('inc/conn.php');
			$opendb=new mydb();
			require_once('inc/char_set.php');
			global $ls_catepicsPicW;

				$catepics_sql="select * from ls_products where branchID=0 and  productID=".$catepics_rowsID." and enable=1  order by ID desc";
				$catepics_query=$opendb->query($catepics_sql);
		  		$catepics_num=mysql_num_rows($catepics_query);
				if($catepics_num>=1) //已定义catepics 展示产品
				{
					while($catepics_rows=mysql_fetch_assoc($catepics_query))
					{
						$catepics_piclink=getpiclink($catepics_rows['ID'],$catepics_rows['productPic']); //
						//echo $catepics_rows['ID']."--".$catepics_piclink['picsrc']; // /thumbnails/1361107436.jpg  带/
			
						$s_catepics.="<li class=\"class_dt\"><a href=\"../".$thisfolder.$catepics_piclink['piclink']."\"><img src='../".$thisfolder.$catepics_piclink['picsrc']."' width='".$ls_catepicsPicW."' border='0'></a> </li> \r\n";	//每类产品一行
						//echo $s_catepics;
						
					}
				}
				else
				{
					//$s_catepics="No products in cate ".$catepics_rowsID;
				}

			return $s_catepics;
}

// get_catepics 首页多类产品列表，每类一行图片
function get_allcatepics()
{
		require_once('inc/conn.php');
		$opendb=new mydb();
		require_once('inc/char_set.php');
		$s_catepics="";
		$catepics_sql="select * from ls_products where branchID=0 and midcateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 order by Num asc";
		$catepics_query=$opendb->query($catepics_sql);
		//$s_catepics="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		$s_catepics.="<ul class=\"catepics_list\">";
		while($catepics_rows=mysql_fetch_assoc($catepics_query))
		{
		  $pro_midcate_sql="select * from ls_products where branchID=0 and cateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and midcateID=".$catepics_rows['ID']." order by Num asc";
		  $pro_midcate_query=$opendb->query($pro_midcate_sql);
		  $pro_midcate_num=mysql_num_rows($pro_midcate_query);
	  
		  if($pro_midcate_num==0)//大类
		  {
			if($catepics_rows['ID']=="")continue; //没有跳过循环
			$s_catepics.=get_product_cate_pics($catepics_rows['ID'],$catepics_rows['cateFolders']).$catepics_rows['cateName'];
		  } 
		  else//大类中类
		  {
			//$s_catepics.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
			$detailsfile="../".$catepics_rows['cateFolders']."/indexdetails.html";
			if(file_exists($detailsfile))
			{$s_catepics.=" <dt><a href='".$detailsfile."'>".$catepics_rows['cateName']."</a></dt>\r\n";}
			else
			{
				//$s_catepics.="<li id=\"catepics_list_li_title\"> <strong>".$catepics_rows['cateName']."</strong></li> \r\n";	
			}

		
			while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
			{
				$pro_subcate_sql="select * from ls_products where branchID=0 and midcateName is null and cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and subcateID=".$pro_midcate_rows['ID']." order by Num asc";
				$pro_subcate_query=$opendb->query($pro_subcate_sql);
				$pro_subcate_num=mysql_num_rows($pro_subcate_query); 

				//$s_catepics.="<div class=\"midcate_list\">"; //中类菜单样式
	
				if($pro_subcate_num==0)//没小类
				{
					if($pro_midcate_rows['ID']=="")continue; //没有跳过循环
					$s_catepics.=get_product_cate_pics($pro_midcate_rows['ID'],$catepics_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']).$pro_midcate_rows['midcateName']; //$catepics_rows['cateName'].$pro_midcate_rows['midcateName']
				}
				else//有小类
				{
					//$s_catepics.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
					$detailsfile="../".$catepics_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/indexdetails.html";
					if(file_exists($detailsfile))
					{$s_catepics.="<a href='".$detailsfile."'>".$pro_midcate_rows['midcateName']."</a>\r\n";}
					else
					{
						//$s_catepics.="<li id=\"catepics_list_li_title\">  <strong>".$pro_midcate_rows['midcateName']."</strong></li> \r\n";			
					}
					//$s_catepics.="<div class=\"subcate_list\">";//小类菜单样式
					while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
					{
					
						if($pro_subcate_rows['ID']=="")continue; //没有跳过循环
						$s_catepics.=get_product_cate_pics($pro_subcate_rows['ID'],$catepics_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']).$pro_subcate_rows['subcateName']; //$catepics_rows['cateName'].$pro_midcate_rows['midcateName'].$pro_subcate_rows['subcateName']
					}
					$s_catepics.=" \n\r\n"; 
				} 
			} //while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
			$s_catepics.="  \r\n";
		  }//if($pro_midcate_num==0)//大类
		}
	$s_catepics.="</ul>\r\n ";
	$allcatepics=str_replace("../","",$s_catepics);//cate

	//$allcatepics=$s_catepics;
	return $allcatepics;
}
	//左侧产品类别 Start
	// public.php	
	//左侧产品类别 End
	
	//产品页面左侧产品类别 Start
	// public.php
	//左侧产品页面产品类别 End
	
	
	
	$tem_sql="select * from ls_config order by ID";	
	$tem_query=$opendb->query($tem_sql);
	$config_row=mysql_fetch_array($tem_query);
	//print_r($row);exit;
	$templates_var = $config_row['templates'];
	
	$mobi_tem_sql="select * from ls_mobiconfig order by ID";	
	$mobi_tem_query=$opendb->query($mobi_tem_sql);
	$mobi_row=mysql_fetch_array($mobi_tem_query);
	$mobi_templates_var = $mobi_templates;
	

	//首页新闻列表 Start
	
	$news_cate_sql3="select * from `ls_functioncates` where functionName='新闻分类' and enable=1 order by Num asc ";
	$news_cate_query3=$opendb->query($news_cate_sql3);
	$news = array();
	$i=0;
	while($news_cate_rows3=mysql_fetch_assoc($news_cate_query3)){
		$sort='';
		if($newsSort=="ID"){
			$sort = "ID";
		}else if($newsSort=="Num"){
			$sort = "Num";
		}else{
			$sort = "ID";
		}
		$news_sql="select * from ls_news where cate = '".$news_cate_rows3['cateName']."' and enable=1 order by $sort desc limit 0,".$newsNum."";
		$news_query=$opendb->query($news_sql);
		//equire_once('inc/char_set.php');
	
		$news[$i] = "";
		while($news_rows=mysql_fetch_assoc($news_query)){
			$news[$i].="<li><span style='float:right;'>(".$news_rows['newsDate'].")</span><a href=\"".$newsshowFolders."/news".$news_rows['ID'].".html\">".$news_rows['newsTitle']." </a>";
			$news[$i].="</li>";
		}
		$i++;
	}
	//首页新闻列表 End
	
	//首页常见问题列表 Start
	$sort='';
	if($newsSort=="ID") {
		$sort = "ID";
	}else if($newsSort=="Num"){
		$sort = "Num";
	}else{
		$sort = "ID";
	}
	$problem_sql="select * from ls_problem order by $sort desc limit 0,".$newsNum."";	
	$problem_query=$opendb->query($problem_sql);
	//equire_once('inc/char_set.php');

	$i=1;
	while($problem_rows=mysql_fetch_assoc($problem_query)){
		$problem.="<li><a href=\"".$problemshowFolders."/problem".$problem_rows['ID'].".html\">".$problem_rows['problemTitle']."  (".$problem_rows['problemDate'].")</a>";
		$problem.="</li>";
		$i++;
	}
	//首页常见问题列表 End
	
//类产品展示 Start, selectPic 或者默认 后台每类选择图片 文字水命并排序
	
if($ls_classproType=="selectPic" || $ls_classproType=="")
{

	$products_sql="select * from ls_products where branchID=0 and  midcateName is null and cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributesClassPro&1 and enable=1";
	$products_sql.=" order by NoClassPro asc";
	$products_query=$opendb->query($products_sql);
	$classpro="";
	while($products_rows=mysql_fetch_assoc($products_query)){
					
		if(hassameclass($products_rows['productID'])){
			continue;
		}
		
		$p_id = $products_rows['productID'];
		$sql2 = "select * from ls_products where ID = ".$p_id." ";
		$products_query2=$opendb->query($sql2);
		
		$catename_query = mysql_fetch_assoc($products_query2);
		if(!$catename_query['subcateName']){
			if(!$catename_query['midcateName']){
				//只有大类
				$class_name = $catename_query['cateName'];
			}else{
				//有大类、有中类
				//获得关于中类的记录
				$search_catename2 = "SELECT * FROM ls_products WHERE ID={$catename_query[midcateID]}";
				$catename_query2 = mysql_fetch_assoc($opendb->query($search_catename2));
				
				$class_name = $catename_query['midcateName'];
			}
		}else{
			//有大类、有中类、有小类
			//获得关于中类的记录
			$search_catename2 = "SELECT * FROM ls_products WHERE ID={$catename_query[subcateID]}";
			$catename_query2 = mysql_fetch_assoc($opendb->query($search_catename2));
			
			//获得关于大类的记录
			$search_catename3 = "SELECT * FROM ls_products WHERE ID={$catename_query2[midcateID]}";
			$catename_query3 = mysql_fetch_assoc($opendb->query($search_catename3));
			
			$class_name = $catename_query['subcateName'];
		}
		
		
		$profile=getproductfolder($products_rows['productID']);
		$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
	//$prolink=$profile."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html"; 原来类产品链接
		$prolink=$profile."/index.html";//类分类的链接
		$classpro.="<li><a href=\"".$prolink."\" ><img src=\"".$prosrc."\" width=\"188\" height=\"188\" border=\"0\" alt=\"".$class_name."\" title=\"".$class_name."\"></a><span>".$class_name."</span></li>";
	}		
}	
	
	//类产品展示 End
	
	//类产品展示 Start
	//默认 $ls_classproType="picIntro" 或空 是图片列表
	if($ls_classproType=="pic" )
	{
		$products_sql="select * from ls_products where branchID=0 and midcateName is null and cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and AdditionalAttributesClassPro&1 and enable=1";
		$products_sql.=" order by NoClassPro asc";
		$products_query=$opendb->query($products_sql);
		$classpro="";
		while($products_rows=mysql_fetch_assoc($products_query)){
					
			if(hassameclass($products_rows['productID'])){
			continue;
			}
		
			$p_id = $products_rows['productID'];
			$sql2 = "select * from ls_products where ID = ".$p_id." ";
			$products_query2=$opendb->query($sql2);
			$products_rows2=mysql_fetch_assoc($products_query2);
			
			$class_name = "";
			if($products_rows2['cateBrief'] != null){
				$class_name = $products_rows2['cateName'];
			}elseif($products_rows2['midcateBrief'] != null){
				$class_name = $products_rows2['midcateName'];
			}elseif($products_rows2['subcateBrief'] != null){
				$class_name = $products_rows2['subcateName'];
			}
			
			$pro_i++;
			$profile=getproductfolder($products_rows['productID']);
			$prosrc=$profile."/".$SmallFoldersProducts."/".$products_rows['productPic'];
					//$prolink=$profile."/".$showproductsFolders."/".trim(str_replace(substr($products_rows['productPic'],-4),"",$products_rows['productPic'])).".html"; 原来类产品链接
			$prolink=$profile."/index.html";//类分类的链接
			$classpro.="<li><a href=\"".$prolink."\" ><img src=\"".$prosrc."\" width=\"188\" height=\"188\" border=\"0\" alt=\"".$class_name."\" title=\"".$class_name."\"></a><span>".$class_name."</span></li>";
		}		
	}
	
// $ls_classproType="picIntro" 是图片文字列表
if($ls_classproType=="picIntro")
	{
		$s_classpro="";
		$classpro_sql="select * from ls_products where branchID=0 and  midcateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 order by Num asc";
		$classpro_query=$opendb->query($classpro_sql);
		//$s_classpro="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		$s_classpro.="<ul class=\"classpro_list\">";
		while($classpro_rows=mysql_fetch_assoc($classpro_query))
		{
		  $pro_midcate_sql="select * from ls_products where branchID=0 and cateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and midcateID=".$classpro_rows['ID']." order by Num asc";
		  $pro_midcate_query=$opendb->query($pro_midcate_sql);
		  $pro_midcate_num=mysql_num_rows($pro_midcate_query);
	  
		  if($pro_midcate_num==0)//大类
		  {
		//$s_classpro.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_classpro.="\n<dt>".$classpro_rows['cateName']."</dt>";
			////
			if($classpro_rows['ID']=="")continue; //没有跳过循环
			$product_class_rows=get_product_class_rows($classpro_rows['ID']);
			$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']); //
			//echo $classpro_rows['ID']."--".$product_class_piclink['picsrc']; // /thumbnails/1361107436.jpg  带/
			
			if($product_class_piclink['picsrc'] == null){
				$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders']."/index.html\"><img src='ls_admin/images/NoPictures_en.jpg' width='".$ls_classproPicW."' border='0'></a> <a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders']."/index.html\"><strong>".$classpro_rows['cateName']."</strong></a></li> \r\n";	
			}else{
				$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders']."/index.html\"><img src='../".$classpro_rows['cateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'></a> <a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders']."/index.html\"><strong>".$classpro_rows['cateName']."</strong></a></li> \r\n";	
			}

			// $s_classpro.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		  } 
		  else//大类中类
		  {
			//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
			$detailsfile="../".$classpro_rows['cateFolders']."/indexdetails.html";
			if(file_exists($detailsfile))
			{$s_classpro.=" <dt><a href='".$detailsfile."'>".$classpro_rows['cateName']."</a></dt>\r\n";}
			else
			{
				if($classpro_rows['ID']=="")continue; //没有跳过循环

				$product_class_rows=get_product_class_rows($classpro_rows['ID']);
				$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
				//echo $product_class_piclink['picsrc'];
			
				//$s_classpro.="<li id=\"classpro_list_li_title\"> <strong>".$classpro_rows['cateName']."</strong></li> \r\n";	
				//有图：
				//$s_classpro.="<li class=\"class_dt\"><img src='../".$classpro_rows['cateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'> <strong>".$classpro_rows['cateName']."</strong></li> \r\n";	
			}

				//$s_classpro.=" <li class=\"class_dt\"><img src='../".$templates_var."/images/006.gif' width='12' border='0'> <strong>".$classpro_rows['cateName']."</strong><ul>\r\n";}
		
				//？ 不应该有$s_classpro.="\n <div class=\"cate_list\">\n";
				while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
				{
					$pro_subcate_sql="select * from ls_products where branchID=0 and midcateName is null and cateName is null and cateFolders is null and catePagePic is null and catePagePicWidth is null and catePagePicHeight is null and cateBrief is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and subcateID=".$pro_midcate_rows['ID']." order by Num asc";
					$pro_subcate_query=$opendb->query($pro_subcate_sql);
					$pro_subcate_num=mysql_num_rows($pro_subcate_query); 

				//$s_classpro.="<div class=\"midcate_list\">"; //中类菜单样式
	
					if($pro_subcate_num==0)//没小类
					{
						if($pro_midcate_rows['ID']=="")continue; //没有跳过循环

						$product_class_rows=get_product_class_rows($pro_midcate_rows['ID']);
						$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
						
						if($product_class_piclink['picsrc'] == null){
							$s_classpro.="<li class=\"class_dt\"> <a href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><img src='ls_admin/images/NoPictures_en.jpg' width='".$ls_classproPicW."' border='0'></a>  <a id='classpro_list_a2' href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><strong>".$pro_midcate_rows['midcateName']."</strong></a></li> \r\n";
						}else{
							$s_classpro.="<li class=\"class_dt\"> <a href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><img src='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'></a>  <a id='classpro_list_a2' href='../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders']."/index.html'><strong>".$pro_midcate_rows['midcateName']."</strong></a></li> \r\n";
						}

					//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";  //中类引导图
				//	$s_classpro.="<li><img src='Templates1/images/name_prefix.gif' border='0'> <a href='../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/index.html'>".$pro_midcate_rows['midcateName']."</a></li>\r\n";
					}
					else//有小类
					{
					//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
						$detailsfile="../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/indexdetails.html";
						if(file_exists($detailsfile))
						{$s_classpro.="<a href='".$detailsfile."'>".$pro_midcate_rows['midcateName']."</a>\r\n";}
						else
						{
							if($pro_midcate_rows['ID']=="")continue; //没有跳过循环
							$product_class_rows=get_product_class_rows($pro_midcate_rows['ID']);
							$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
				
							//$s_classpro.="<li id=\"classpro_list_li_title\">  <strong>".$pro_midcate_rows['midcateName']."</strong></li> \r\n";			
							//有图：
							//$s_classpro.="<li class=\"class_dt\"><img src='../".$classpro_rows['cateFolders'] .$pro_midcate_rows['midcateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'>  <strong>".$pro_midcate_rows['midcateName']."</strong></li> \r\n";			

					//$s_classpro.="\n<dd><a href='javascript:void(0)'>".$pro_midcate_rows['midcateName']."</a>\n<ul>\r\n";
					
						}
				//$s_classpro.="<div class=\"subcate_list\">";//小类菜单样式
						while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
						 {
					
							if($pro_subcate_rows['ID']=="")continue; //没有跳过循环
							$product_class_rows=get_product_class_rows($pro_subcate_rows['ID']);
							$product_class_piclink=getpiclink($product_class_rows['ID'],$product_class_rows['productPic']);
							
							if($product_class_piclink['picsrc'] == null){
								$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" ><img src='ls_admin/images/NoPictures_en.jpg' width='".$ls_classproPicW."' border='0'></a>  <strong><a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></strong></li>  \r\n";
							}else{
								$s_classpro.="<li class=\"class_dt\"><a href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" ><img src='../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders'].$product_class_piclink['picsrc']."' width='".$ls_classproPicW."' border='0'></a>  <strong><a id='classpro_list_a2' href=\"../".$classpro_rows['cateFolders'] ."/".$pro_midcate_rows['midcateFolders'] ."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></strong></li>  \r\n";
							}

					//$s_classpro.="<li><a href=\"../".$classpro_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></li>\r\n";
						 }
						$s_classpro.=" \n\r\n"; 
					} 
			}
			$s_classpro.="  \r\n";
		  }//if($pro_midcate_num==0)//dalei
	
		}
		$s_classpro.="</ul>\r\n ";
		$classpro=str_replace("../","",$s_classpro);//cate

	}

	// $ls_classproType="cateList" 产品分类展开列表
	if($ls_classproType=="cateList"  )
	{	
		$s_classpro="";
		$classpro_sql="select * from ls_products where branchID=0 and midcateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 order by Num asc";
		$classpro_query=$opendb->query($classpro_sql);
		//$s_classpro="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		$s_classpro.="<ul class=\"ls_classpro\">";
		while($classpro_rows=mysql_fetch_assoc($classpro_query))
		{
		  $pro_midcate_sql="select * from ls_products where branchID=0 and cateName is null and subcateName is null and subcateFolders is null and subcateBrief is null and subcateID is null and productPic is null and productItemNo is null and productName is null and productSpecification is null and productID is null and enable=1 and midcateID=".$classpro_rows['ID']." order by Num asc";
		  $pro_midcate_query=$opendb->query($pro_midcate_sql);
		  $pro_midcate_num=mysql_num_rows($pro_midcate_query);
	  
		  if($pro_midcate_num==0)//大类
		  {
		//$s_classpro.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_classpro.="\n<dt>".$classpro_rows['cateName']."</dt>";
		
			$s_classpro.="<li><img src='../".$templates_var."/images/name_prefix.gif' border='0'> <a href='../".$classpro_rows['cateFolders']."/index.html'>".$classpro_rows['cateName']."</a></li><ul> \r\n";
			// $s_classpro.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
		  } 
		  else//大类中类
		  {
			//$s_classpro.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
			$detailsfile="../".$classpro_rows['cateFolders']."/indexdetails.html";
			if(file_exists($detailsfile))
			{ 	$s_classpro.=" <dt><a href='".$detailsfile."'>".$classpro_rows['cateName']."</a></dt>\r\n";}
			else
			{	$s_classpro.=" <li><img src='../".$templates_var."/images/name_prefix.gif' border='0'> <a href='javascript:void(0)'>".$classpro_rows['cateName']."</a><ul>\r\n";}
		
			//？ 不应该有$s_classpro.="\n <div class=\"cate_list\">\n";
				while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
				{
					$pro_subcate_sql="select * from ls_products where branchID=0 and midcateName is null and cateName is null and cateFolders