<?php
/*
----------------------------------------------------------------------------------------
Public function

创建产品分类菜单标签 
	1)纵向竖排主菜单  $s_pro_cate
	2)侧面竖排产品菜单—-鼠标悬停展开$s_pro_cate
	3)大类横向，中小类下拉产品菜单 $pro_cate
	4)主题图标产品菜单 $icon_main_pro_cate


创建主菜单标签变量 
	1)横向主菜单 $menu
	2)纵向竖排主菜单 $menu
	
创建分类新闻单标签变量 $ls_newsdongtai

首页热点产品展示标签变量 $ls_hotpro

获得标签变量：底部信息 $ls_designby，$ls_title，$ls_keywords，$ls_description，$foot

菜单生成文件图片和样式
	1) 引导图片  大类引导图cate.gif， 中类引导图midcate.gif，小类引导图subcate.gif
	2) 侧面竖排产品菜单样式  大类菜单样式cate_list，  中类菜单样式midcate_list，  小类菜单样式subcate_list
	3) 大类横向，中小类下拉产品菜单 大类样式1 menu2(变换颜色样式menu1)和menu22 (变换颜色样式menu12)

----------------------------------------------------------------------------------------
*/
	$opendb=new mydb();
	require_once('char_set.php');
	require_once('constant.php');

	$tem_sql="select * from ls_config order by ID";
	$tem_query=$opendb->query($tem_sql);
	$row=mysql_fetch_array($tem_query);
	$templates_var = $row['templates'];
	//echo $templates_var;

switch($proCateStytle){
	
case "Popup Expanded Vertical":

	
case "Full Expanded Vertical":

//==================================================
//		 1) 侧面竖排产品菜单 $s_pro_cate
//==================================================

	$pro_cate_sql="select * from ls_products where 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";
	$pro_cate_query=$opendb->query($pro_cate_sql);
	//$s_pro_cate="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	$pro_num=mysql_num_rows($pro_cate_query);
	
	$s_pro_cate="<ul class=\"sub-menu  styled dl-submenu-disabled\">";
	$x = $pro_num;
	$y = 0;
	while($pro_cate_rows=mysql_fetch_assoc($pro_cate_query))
	{
	  $y++;
	  $pro_midcate_sql="select * from ls_products where 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=".$pro_cate_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_pro_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_pro_cate.="\n<dt>".$pro_cate_rows['cateName']."</dt>";

		  $s_pro_cate.="<li class=\"menu-item\"><a href='../".$pro_cate_rows['cateFolders']."/".$pro_cate_rows['cateFolders'].".html'><translate>".$pro_cate_rows['cateName']."</translate></a></li>";

		// $s_pro_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$s_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		$detailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_cate_rows['cateFolders'].".html";
		$detailsfile2="../".$templates_var."/catedetail.html";
		if(file_exists($detailsfile2)){
			$s_pro_cate.="\n<li class=\"menu-item\"><a href='".$detailsfile."' ><translate>".$pro_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$pro_cate_rows['ID']."\" >";
		}else{
			$s_pro_cate.="\n<li class=\"menu-item\"><a href='javascript:void(0)' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\" ><translate>".$pro_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$pro_cate_rows['ID']."\" >";
		}
		
		//？ 不应该有$s_pro_cate.="\n <div class=\"cate_list\">\n";
		while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
		{
			$pro_subcate_sql="select * from ls_products where 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_pro_cate.="<div class=\"midcate_list\">"; //中类菜单样式
	
			if($pro_subcate_num==0)//没小类
			{
				$s_pro_cate.="\n<li class=\"menu-item\"><a href='../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_midcate_rows['midcateFolders'].".html' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\"><translate>".$pro_midcate_rows['midcateName']."</translate></a></li>";

			}
			else//有小类
			{
			//$s_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			$detailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/".$pro_midcate_rows['midcateName'].".html";
			if(file_exists($detailsfile))
			{$s_pro_cate.="<li class=\"menu-item\"><a href='".$detailsfile."'><translate>".$pro_midcate_rows['midcateName']."<translate></a><ul>";}
			else
			{$s_pro_cate.="\n<li class=\"menu-item\"> <a href='javascript:void(0)' ><span class=\"glyphicon glyphicon-forward\"></span> <translate>".$pro_midcate_rows['midcateName']."</translate></a>\n<ul class=\"sub-menu\">\n";}
			//$s_pro_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
			 {
				$s_pro_cate.="<li class=\"menu-item\"> <a href=\"../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/".$pro_subcate_rows['subcateFolders'].".html\" ><translate>".$pro_subcate_rows['subcateName']."</translate></a></li>\n";
			 }
			$s_pro_cate.="</ul>\n</li>\n"; 
			} 
		}
		$s_pro_cate.="</ul>";
	  }//if($pro_midcate_num==0)//dalei
	
	}
	$s_pro_cate.="\n </ul>";
	//echo $s_pro_cate;
	
	$s_cate=str_replace("../","",$s_pro_cate);//cate
	$s_cate0 = $s_cate;
	$s_pro2_cate=str_replace("../","../../",$s_pro_cate);//pro2_cate
	$s_pro3_cate=str_replace("../","../../../",$s_pro_cate);//pro3_cate
	$s_pro4_cate=str_replace("../","../../../../",$s_pro_cate);//pro4_cate

	//echo $s_pro_cate;

//侧面竖排产品菜单end
	break;

case "Hover Expended Vertical":

//======================================================
//	  2)侧面竖排产品菜单—-鼠标悬停展开$s_pro_cate
//======================================================

	$s_pro_cate="";
	$pro_cate_sql="select * from ls_products where 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";
	$pro_cate_query=$opendb->query($pro_cate_sql);
	$pro_cate_num=mysql_num_rows($pro_cate_query);
	$j=1;
	//$s_pro_cate="\n <div class=\"cate_list\">\n";
	$s_pro_cate.="\n";
	
	while($pro_cate_rows=mysql_fetch_assoc($pro_cate_query))
	{
	  $pro_midcate_sql="select * from ls_products where 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=".$pro_cate_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_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";	//大类前导图

		$s_pro_cate.="<li><a href='../".$pro_cate_rows['cateFolders']."/".$pro_cate_rows['cateFolders'].".html' >  \n".$pro_cate_rows['cateName']."</a></li>";	//大类菜单链接
		//$s_pro_cate.="\n <div class=\"cate_list\">\n";
	  }
	  else//大类中类
	  {
		$detailsfile="../".$pro_cate_rows['cateFolders']."/indexdetails.html";
		if(file_exists($detailsfile)){
			$a_links="\"../".$pro_cate_rows['cateFolders']."/indexdetails.html\"";
		}else{
			$a_links="\"javascript:void(0);\"";
		}
		//$s_pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";		//大类前导图
			if($j == 1){
				$s_pro_cate.="\n<div class=\"dtClass\" ><a href=".$a_links.">".$pro_cate_rows['cateName']."&nbsp;</a>\n</div>";	//大类菜单链接
			}else{
				$s_pro_cate.="\n<div class=\"dtClass\" ><a href=".$a_links.">".$pro_cate_rows['cateName']."&nbsp;</a>\n</div>";	//大类菜单链接
			}
		
		//$s_pro_cate.="\n <div class=\"cate_list\">\n";
		$num_i = 0;
		while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))	//中类获取
		{
			$num_i ++;
			$pro_subcate_sql="select * from ls_products where 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_pro_cate.="<div class=\"catelist\">";
			if($pro_subcate_num==0)//没小类
			{
				if($num_i == $pro_midcate_num){
					$className = "ddClass_footer_no";
					$last = 10;
				}else{
					$className = "ddClass_no";
					$last = 11;
				}
			//$s_pro_cate.="    		    <img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";	//无小类的中类前导图
			$s_pro_cate.="\n<div class=\"".$className."\"><a href='../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_midcate_rows['midcateFolders'].".html' >\n".$pro_midcate_rows['midcateName']."</a>\n</div>\n";	//中类菜单链接
			}
			else//有小类
			{
				if($num_i == $pro_midcate_num){
					$className = "ddClass_footer_last";
					$last = 10;
				}else{
					$className = "ddClass";
					$last = 11;
				}
				$detailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/indexdetails.html";
				if(file_exists($detailsfile)){
					$a_sublinks="\"../".rawurlencode($pro_cate_rows['cateFolders'])."/".rawurlencode($pro_midcate_rows['midcateFolders'])."/indexdetails.html\"";
				}else{
					$a_sublinks="\"javascript:void(0);\"";
				}
				
			//$s_pro_cate.="    		    <img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";	//有小类的中类前导图
			$s_pro_cate.="\n<div class=\"".$className."\"><a href=".$a_sublinks.">".$pro_midcate_rows['midcateName']."</a></div>\n";
			}
			
			$num_ii = 0;
			$pro_subcate_num=mysql_num_rows($pro_subcate_query);
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))
			{
				$num_ii ++;
				
				if($num_ii == $pro_subcate_num){
					if($last == 10){
						$subclassName = "liClass_footer_last_no";
					}else{
						$subclassName = "liClass_footer_no";
					}
				}else{
					if($last == 10){
						$subclassName = "liClass_last";
					}else{
						$subclassName = "liClass";
					}

				}
				//$s_pro_cate.="    		    <img src='../Templates/".$templates_var."/images/subcate.gif' border='0' >&nbsp; \n";	//小类前导图
				$s_pro_cate.="<div class=\"".$subclassName."\"><a href=\"../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/".$pro_subcate_rows['subcateFolders'].".html\" >".$pro_subcate_rows['subcateName']."</a><br></div>\n";	//小类菜单链接
			 }
		} 
		$j++;
		$s_pro_cate.="";
	  }//if($pro_midcate_num==0)//dalei
	//$s_pro_cate.="</div>\n ";
	}

	$s_cate=str_replace("../","",$s_pro_cate);//cate
	$s_pro2_cate=str_replace("../","../../",$s_pro_cate);//pro2_cate
	$s_pro3_cate=str_replace("../","../../../",$s_pro_cate);//pro3_cate
	$s_pro4_cate=str_replace("../","../../../../",$s_pro_cate);//pro4_cate

//侧面竖排产品菜单—-鼠标悬停展开 end

	break;


case "Hover Drawer Horizontal":

//==================================================
//	  3) 大类横向，中小类下拉产品菜单 $pro_cate P 
//==================================================

	$pro_cate_sql="select * from ls_products where 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";
	$pro_cate_query=$opendb->query($pro_cate_sql);
	$cateclass="2";
	$pro_cate.="\n		<ul  style=\"width:1096px;background-color: rgb(198, 197, 197);padding-left: 34px;margin-top: -9px;padding-top: 15px;display: none;\"";
	while($pro_cate_rows=mysql_fetch_assoc($pro_cate_query))
	{
	  if($cateclass=="2")
	 	 {$cateclass="";}
	  else
	 	 {$cateclass="2";}
	  
	  $pro_midcate_sql="select * from ls_products where 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=".$pro_cate_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)//大类
	  {
		$pro_cate.="	 				<li class=\"menu2".$cateclass."\" onMouseOver=\"this.className='menu1".$cateclass."'\" onMouseOut=\"this.className='menu2".$cateclass."'\"> \n <a class=\"cate_menu\" href='../".rawurlencode($pro_cate_rows['cateFolders'])."/index.html' > \n".$CateMenuPrefix.$pro_cate_rows['cateName']."</a><br/>";		//仅大类菜单项，li css:menu2; a css:cate_menu
		$pro_cate.="\n	 				<div class=\"cate_list\">\n";
	  }
	  else//大类中类
	  {
		$pro_cate.="	 				<li class=\"menu2".$cateclass."\" onMouseOver=\"this.className='menu1".$cateclass."'\" onMouseOut=\"this.className='menu2".$cateclass."'\"> \n <a class=\"cate_menu\" href='javascript:void(0)' onclick=\"turnit(".$p_cate_rows['ID'].",".$p_cate_rows['ID'].");this.href=this.href+'?

menuId='+".$p_cate_rows['ID']."+'&cate='+".$p_cate_rows['ID'].";\" > \n".$CateMenuPrefix.$pro_cate_rows['cateName']."</a><br/>";		//含中类大类菜单项， li css:menu2; a css:cate_menu
		$pro_cate.="\n	 				<div class=\"cate_list\">\n";
		while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
		{
			$pro_subcate_sql="select * from ls_products where 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); 
		
			if($pro_subcate_num==0)//没小类
			{
			//$pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";	//中类前导图，下无小类
			$pro_cate.="	 				<a class=\"cate_menu".$cateclass."\" href='../".rawurlencode($pro_cate_rows['cateFolders'])."/".rawurlencode($pro_midcate_rows['midcateFolders'])."/".rawurlencode($pro_midcate_rows['midcateFolders']).".html' >\n".$midCateMenuPrefix.$pro_midcate_rows['midcateName']."</a><br>\n";	//中类菜单项，css：cate_menu2
			}
			else//有小类
			{
			//$pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate2.gif' border='0'> \n";	//中类前导图，下有小类
			$pro_cate.="	 				<a class=\"cate_menu".$cateclass."\" href='../search.php?cateid=".$pro_cate_rows['ID']."&midcatename=".$pro_midcate_rows['midcateName']."&midcateid=".$pro_midcate_rows['ID']."&brief=".substr($pro_midcate_rows['midcateBrief'],0,$CateLength)."' >\n".$midCateMenuPrefix.$pro_midcate_rows['midcateName']."</a><br>\n";	//中类菜单项，css：cate_menu2
			}
		
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))
			 {
				//$pro_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/subcate.gif' border='0' > \n";	//小类前导图
				$pro_cate.="	 				<a class=\"cate_menu".$cateclass."\" href=\"../".rawurlencode($pro_cate_rows['cateFolders'])."/".rawurlencode($pro_midcate_rows['midcateFolders'])."/".rawurlencode($pro_subcate_rows['subcateFolders'])."/index.html\" >\n ".$SubCateMenuPrefix.$pro_subcate_rows['subcateName']."</a><br>\n";	//小类菜单项，css：cate_menu2
			 }
		} 
	  }//if($pro_midcate_num==0)//dalei
	$pro_cate.="	 			</div>\n </li>\n";
	}
	$pro_cate.="		</ul>\n ";
		
	$cate=str_replace("../","",$pro_cate);//cate
	$pro2_cate=str_replace("../","../../",$pro_cate);//pro2_cate
	$pro3_cate=str_replace("../","../../../",$pro_cate);//pro3_cate
	$pro4_cate=str_replace("../","../../../../",$pro_cate);//pro4_cate


//大类横向，中小类下拉产品菜单 End
	break;

case "Icon List":

//==================================================
//	  4) 图标产品菜单 $icon_main_cate P 
//==================================================

	$pro_cate_sql="select * from ls_products where 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";
	$pro_cate_query=$opendb->query($pro_cate_sql);
	//$icon_main_pro_cate="\n <div class=\"cate_list\">\n";
	$icon_main_pro_cate.="\n		<ul class=\"smenu\">";
	while($pro_cate_rows=mysql_fetch_assoc($pro_cate_query))
	{
	  $pro_midcate_sql="select * from ls_products where 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=".$pro_cate_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)//大类
	  {
		//$icon_main_pro_cate.="<a class=\"scatemenu\" href='../search.php?cateid=".$pro_cate_rows['ID']."&catename=".$pro_cate_rows['cateName']."&brief=".substr($pro_cate_rows['cateBrief'],0,$CateLength)."' > \n<img src='../".$pro_cate_rows['cateFolders']."/".$pro_cate_rows['cateIconPic']."' border='0'></a><br/> \n";	//无中类大类菜单项图片链接，css：scatemenu
		$icon_main_pro_cate.="	 				<a href='../".$pro_cate_rows['cateFolders']."/index.html' > \n".$pro_cate_rows['cateName']."</a><br/><br/></li>\n";	//大类文字链接，css：smenu
		//$icon_main_pro_cate.="\n <div class=\"cate_list\">\n";
	  }
	  else//大类中类
	  {
		//$icon_main_pro_cate.="<a class=\"scatemenu\" href='../search.php?cateid=".$pro_cate_rows['ID']."&catename=".$pro_cate_rows['cateName']."&brief=".substr($pro_cate_rows['cateBrief'],0,$CateLength)."' > \n <img src='../".$pro_cate_rows['cateFolders']."/".$pro_cate_rows['cateIconPic']."' border='0'></a><br/>  \n";		//带中类大类菜单项图片链接，css：scatemenu
		//$icon_main_pro_cate.=" <a class=\"scatemenu\" href='../search.php?cateid=".$pro_cate_rows['ID']."&catename=".$pro_cate_rows['cateName']."&brief=".substr($pro_cate_rows['cateBrief'],0,$CateLength)."' > \n".$pro_cate_rows['cateName']."</a><br/><br/>";		//大类简要介绍，css：scatemenu
		//$icon_main_pro_cate.="\n <div class=\"cate_list\">\n";
		while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
		{
			$pro_subcate_sql="select * from ls_products where 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); 

			//$icon_main_pro_cate.="<div class=\"catelist\">";
	
			if($pro_subcate_num==0)//没小类
			{
			$icon_main_pro_cate.="	 				<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";		//无小类中类前导图
			$icon_main_pro_cate.="	 				<a href='../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/index.html' >\n".$pro_midcate_rows['midcateName']."</a><br>\n";	//无小类中类菜单链接
			}
			else//有小类
			{
			$icon_main_pro_cate.="	 				<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";		//有小类中类前导图
			$icon_main_pro_cate.="	 				<a class=\"ssubcatemenu\" href='../search.php?cateid=".$pro_cate_rows['ID']."&midcatename=".$pro_midcate_rows['midcateName']."&midcateid=".$pro_midcate_rows['ID']."&brief=".substr($pro_midcate_rows['midcateBrief'],0,$CateLength)."' >\n".$pro_midcate_rows['midcateName']."</a><br>\n";		//有小类中类菜单链接，css：subcatemenu
			}
		
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))
			 {
				$icon_main_pro_cate.="	 				;<img src='../Templates/".$templates_var."/images/subcate.gif' border='0' >&nbsp; \n";		//小类前导图
				$icon_main_pro_cate.="	 				<a class=\"ssubcatemenu\" href=\"../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/index.html\" >\n".$pro_subcate_rows['subcateName']."</a><br>\n";		//小类文字链接，css：ssubcatemenu
			 }
		} 
	  }//if($pro_midcate_num==0)//dalei
	//$icon_main_pro_cate.="</div>\n ";
	}
	$icon_main_pro_cate.="		</ul>\n ";
	//echo $icon_main_pro_cate;
	$icon_main_cate=str_replace("../","",$icon_main_pro_cate);//cate
	$icon_main_pro2_cate=str_replace("../","../../",$icon_main_pro_cate);//pro2_cate
	$icon_main_pro3_cate=str_replace("../","../../../",$icon_main_pro_cate);//pro3_cate
	$icon_main_pro4_cate=str_replace("../","../../../../",$icon_main_pro_cate);//pro4_cate

	//echo $icon_main_pro_cate;
	//主体图标产品菜单end
	break;

}

switch($mainMenuStyle)
{
	case "Horizontal":

//==================================================
//		  横向主菜单 $menu_pro P -> $ls_menu T -> {ls_menu} T
//==================================================

	$menu_pro_h_sql="select * from ls_menu where enable=1 order by menuNum asc";
	$menu_pro_h_query=$opendb->query($menu_pro_h_sql);
	$menu_pro_h="";
	$i=1;
	while ($menu_pro_h_rows=mysql_fetch_assoc($menu_pro_h_query))
	{
	  if($i==1)
	  {
	  	$menu_pro_h.="	 				<a href=\"../".$menu_pro_h_rows['menuLink']."\">".$menu_pro_h_rows['menuName']."</a>";		//菜单链接第一项
	  }
	  else
	  {	
		$menu_pro_h.=$mainMenuSpliter."	 				<a href=\"../".$menu_pro_h_rows['menuLink']."\">".$menu_pro_h_rows['menuName']."</a>";		//菜单链接第二项与其后项
	  }	
	  $i++;
	}
	$menu_pro=$menu_pro_h;
	
//横排主菜单 end  
	break;
	
	case "Vertical":
	

//==================================================
//		  纵向竖排主菜单 $menu
//==================================================

	$cate_start_sql="select * from ls_products where cateName!='' order by Num asc";
	$cate_start_query=$opendb->query($cate_start_sql);	
	$cate_start_rows=mysql_fetch_assoc($cate_start_query);
	$cate_start_num=mysql_num_rows($cate_start_query);

	$midcate_start_sql="select * from ls_products where midcateName!='' order by Num asc";
	$midcate_start_query=$opendb->query($midcate_start_sql);	
	$midcate_start_rows=mysql_fetch_assoc($midcate_start_query);
	$midcate_start_num=mysql_num_rows($midcate_start_query);

	$subcate_start_sql="select * from ls_products where subcateName!='' order by Num asc";
	$subcate_start_query=$opendb->query($subcate_start_sql);	
	$subcate_start_rows=mysql_fetch_assoc($subcate_start_query);
	$subcate_start_num=mysql_num_rows($subcate_start_query);

	if($cate_start_num==0)
	{
		die("没有产品类别，请先设置产品类别！");
	}else{
		if($cate_start_rows['ID']!=$midcate_start_rows['midcateID'])
		{$product_link="../".$cate_start_rows['cateFolders']."/index.html";}
		else
		{
			if($midcate_start_rows['ID']!=$subcate_start_rows['subcateID'])
			{$product_link="../".$cate_start_rows['cateFolders']."/".$midcate_start_rows['midcateFolders']."/index.html";}		//中类下产品列表页链接
			else
			{
				$product_link="../".$cate_start_rows['cateFolders']."/".$midcate_start_rows['midcateFolders']."/".$subcate_start_rows['subcateFolders']."/index.html";
			}		//小类下产品列表页链接
		}
	
	}
	//end $product_link;
	
	$menu_pro_sql="select * from ls_menu where enable=1 order by menuNum asc";
	$menu_pro_query=$opendb->query($menu_pro_sql);
	$i=1;
	$menu_pro="\n		<ul>";
	while ($menu_pro_rows=mysql_fetch_assoc($menu_pro_query))
	{
	  if($i==1)
	  {
	  	
	  		$menu_pro.="\n	 				<li> <a  href=\"../".$menu_pro_rows['menuLink']."\">".$menu_pro_rows['menuName']."</a></li><br/>";		//菜单项首项
	  }
	  else
	  {	
	  	if($menu_pro_rows['menuLink']=="products.html")
	  	{
	  		$menu_pro.="\n	 				<li><a href=\"".$product_link."\">".$menu_pro_rows['menuName']."</a></li><br/>";		//菜单项为产品列表页面链接项
	  	}
	  	else
	  	{
			$menu_pro.="\n	 				<li><a  href=\"../".$menu_pro_rows['menuLink']."\">".$menu_pro_rows['menuName']."</a></li><br/>";		//菜单项为非产品类别页面链接项
	  	}
	  }	
	  $i++;
	}

	//echo $menu_pro;
	$menu_pro.="\n		</ul>";



	$menu=str_replace("../","",$menu_pro);//menu
	$menu_pro2=str_replace("../","../../",$menu_pro);//menu2_cate
	$menu_pro3=str_replace("../","../../../",$menu_pro);//menu3_cate
	$menu_pro4=str_replace("../","../../../../",$menu_pro);//menu4_cate
	//echo $menu_pro;

//纵向竖排主菜单 end

	break;
}

//语言国旗代码    $languages  P -> $ls_languages T 等 -> {ls_languages}
if($lang != "en"){
	$languages = "<a href=\"../index.html\"><img src=\"../ls_admin/img/gq/china.jpg\" height=\"20\" /></a> <a href=\"../parent/index.html\"><img src=\"../ls_admin/img/gq/eng.jpg\"  height=\"20\" /></a> ";
	
	$languages0=str_replace("parent","..",str_replace("../","",$languages));//cate
	$languages2=str_replace("parent","..",str_replace("../","../../",$languages));//pro2_cate
	$languages3=str_replace("parent","..",str_replace("../","../../../",$languages));//pro3_cate
	$languages4=str_replace("parent","..",str_replace("../","../../../../",$languages));//pro4_cate
}else{
	$languages = "<a href=\"../cn/index.html\"><img src=\"../ls_admin/img/gq/china.jpg\" height=\"20\" /></a> <a href=\"../index.html\"><img src=\"../ls_admin/img/gq/eng.jpg\"  height=\"20\" /></a> ";
	$languages0=str_replace("../","",$languages);//cate
	$languages2=str_replace("../","../../",$languages);//pro2_cate
	$languages3=str_replace("../","../../../",$languages);//pro3_cate
	$languages4=str_replace("../","../../../../",$languages);//pro4_cate
}
//语言国旗代码 End


//首页新闻列表， 已经移到 ls_syscode 2326 
$news_cate_sql3="select * from `ls_functioncates` where functionName='新闻分类' and enable=1 order by Num asc ";
$news_cate_query3=$opendb->query($news_cate_sql3);
$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";
	}
	//equire_once('inc/char_set.php');

	$news = "";
	$nui = 0;
	
	$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);
	$news = "";
	while($news_rows=mysql_fetch_assoc($news_query)){
		$suffix_str2 = $news_cate_rows3['suffStr'];
		
		$news.="<li class=\"media\">
			<div class=\"media-body\">
			  <h4 class=\"media-heading\"><a href=\"../".$newsshowFolders."/news".$suffix_str2.$news_rows['ID'].".html\"><translate>".$news_rows['newsTitle']."</translate></a></h4>
			  <p><translate>".mb_substr(strip_tags($news_rows['newsText']),0,100,'utf-8')."</translate> ...</p>
			</div>
		</li>";
	}

	$ls_h_news = $news;
	$i++;
}
$ls_h1_news = $ls_h_news;
	$ls_h0_news=str_replace("../","",$ls_h_news);//cate
	$ls_h2_news=str_replace("../","../../",$ls_h_news);//pro2_cate
	$ls_h3_news=str_replace("../","../../../",$ls_h_news);//pro3_cate
	$ls_h4_news=str_replace("../","../../../../",$ls_h_news);//pro4_cate
//首页新闻列表 End

//首页常见问题列表 Start  {ls_faq}
$sort='';
if($newsSort=="ID") {
	$sort = "ID";
}else if($newsSort=="Num"){
	$sort = "Num";
}else{
	$sort = "ID";
}
$faq_sql="select * from ls_news where cate = 'faq'  order by $sort desc limit 0,".$newsNum."";	
$faq_query=$opendb->query($faq_sql);
//equire_once('inc/char_set.php');

$i=1;
while($faq_rows=mysql_fetch_assoc($faq_query)){
	
	/*$faq.="<li class=\"media\">
			<div class=\"media-body\">
			  <h4 class=\"media-heading\"><a href=\"".$faqshowFolders."/faq".$faq_rows['ID'].".html\"><translate>".$faq_rows['newsTitle']."</translate></a></h4>
			  <p><translate>".mb_substr(strip_tags($faq_rows['newsText']),0,100,'utf-8')."</translate>...</p>
			</div>
		</li>";*/
		
	$faq.="<li><div class='art_title2' id=\"faq".$faq_rows['ID']."\"><a href=\"javascript:void(0)\" onclick='loadfaq(".$faq_rows['ID'].")'><translate>".$faq_rows['newsTitle']."</translate></a></div>
			<div class='art_content' id='applyfaq".$faq_rows['ID']."'><translate>".strip_tags($faq_rows['newsText'])."</translate></div>
			</li>";
	$i++;
}
$ls_faq = $faq;
//首页常见问题列表 End

$p_cate_sql="select * from ls_products where 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";
	$p_cate_query=$opendb->query($p_cate_sql);
	//$s_p_cate="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	$p_num=mysql_num_rows($p_cate_query);
	
	$s_p_cate="<ul id=\"pro-menu\" class=\"no-responsive list-group\">";
	$x = $p_num;
	$y = 0;
	while($p_cate_rows=mysql_fetch_assoc($p_cate_query))
	{
	  $detailsfile = "";
	  $y++;
	  $p_midcate_sql="select * from ls_products where 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=".$p_cate_rows['ID']." order by Num asc";
	  $p_midcate_query=$opendb->query($p_midcate_sql);
	  $p_midcate_num=mysql_num_rows($p_midcate_query);
	  
	  if($p_midcate_num==0)//大类
	  {
		//$s_p_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_p_cate.="\n<dt>".$p_cate_rows['cateName']."</dt>";

		  $s_p_cate.="<li class=\"list-group-item side-pro-list-item\"><a href='../".$p_cate_rows['cateFolders']."/".$p_cate_rows['cateFolders'].".html'> <translate>".$p_cate_rows['cateName']."</translate></a></li>";

		// $s_p_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$s_p_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		
		$detailsfile="../".$p_cate_rows['cateFolders']."/".$p_cate_rows['cateFolders'].".html";

		$detailsfile2="../".$templates_var."/catedetail.html";
		if(file_exists($detailsfile2)){
			$s_p_cate.="\n<li class=\"list-group-item side-pro-list-item\"><a href='".$detailsfile."' > <translate>".$p_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$p_cate_rows['ID']."\" >";
		}else{
			$s_p_cate.="\n<li class=\"list-group-item side-pro-list-item\"><a href='javascript:void(0)' onclick=\"turnit(".$p_cate_rows['ID'].",".$p_cate_rows['ID'].");this.href=this.href+'?menuId='+".$p_cate_rows['ID']."+'&cate='+".$p_cate_rows['ID'].";\" > <translate>".$p_cate_rows['cateName']."</translate></a><ul class=\"list-unstyled\" id=\"content".$p_cate_rows['ID']."\" >";
		}
		
		//？ 不应该有$s_p_cate.="\n <div class=\"cate_list\">\n";
		while($p_midcate_rows=mysql_fetch_assoc($p_midcate_query))
		{
			$p_subcate_sql="select * from ls_products where 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=".$p_midcate_rows['ID']." order by Num asc";
			$p_subcate_query=$opendb->query($p_subcate_sql);
			$p_subcate_num=mysql_num_rows($p_subcate_query);

			//$s_p_cate.="<div class=\"midcate_list\">"; //中类菜单样式
	
			if($p_subcate_num==0)//没小类
			{
				$s_p_cate.="\n<li  class=\"list-group-item side-pro-list-item\"><a href='../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/".$p_midcate_rows['midcateFolders'].".html' onclick=\"turnit(".$p_cate_rows['ID'].",".$p_cate_rows['ID'].");this.href=this.href+'?menuId='+".$p_cate_rows['ID']."+'&cate='+".$p_cate_rows['ID'].";\"> <translate>".$p_midcate_rows['midcateName']."</translate></a></li>";

			}
			else//有小类
			{
			//$s_p_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			$detailsfile="../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateName']."/".$p_midcate_rows['midcateName'].".html";
			if(file_exists($detailsfile))
			{$s_p_cate.="<a href='".$detailsfile."'><translate>".$p_midcate_rows['midcateName']."</translate></a>";}
			else
			{$s_p_cate.="\n<li  class=\"list-group-item side-pro-list-item\"> <a href='javascript:void(0)' > <translate>".$p_midcate_rows['midcateName']."</translate></a>\n<ul class=\"sub-menu\">\n";}
			//$s_p_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($p_subcate_rows=mysql_fetch_assoc($p_subcate_query))		//小类生成
			 {
				$s_p_cate.="<li> <a href=\"../".$p_cate_rows['cateFolders']."/".$p_midcate_rows['midcateFolders']."/".$p_subcate_rows['subcateFolders']."/".$p_subcate_rows['subcateFolders'].".html\" ><translate>".$p_subcate_rows['subcateName']."</translate></a></li>\n";
			 }
			$s_p_cate.="</ul>\n</li>\n"; 
			} 
		}
		$s_p_cate.="</ul>";
	  }//if($p_midcate_num==0)//dalei
	
	}
	$s_p_cate.="\n </ul>";
	//echo $s_p_cate;
	$s_p0_cate = $s_p_cate;
	$s_p1_cate=str_replace("../","",$s_p_cate);//cate
	$s_p2_cate=str_replace("../","../../",$s_p_cate);//pro2_cate
	$s_p3_cate=str_replace("../","../../../",$s_p_cate);//pro3_cate
	$s_p4_cate=str_replace("../","../../../../",$s_p_cate);//pro4_cate


//==================================================
//	  分类新闻 P  {ls_newsdongtai} {ls_newsgonggao} {ls_newstieshi}
//==================================================

$news_cate_sql2="select * from `ls_functioncates` where functionName='新闻分类' and enable=1 order by Num asc ";
//$opendb->query("SET character_set_client = gb2312");
//$opendb->query("SET character_set_results = gb2312");
//$opendb->query("SET character_set_connection = gb2312");

$result_cate_pub=$opendb->query($news_cate_sql2);
$num_cate_pub=mysql_num_rows($result_cate_pub);
$i_news_pub=1;

while(true)//遍历所有分类
{
	  if($num_cate_pub==0)
	  {
		 $hotLines=8;
		 $hotWords=16;

		 $news_sql2_pub="select * from ls_news where enable=1 order by Num,newsDate desc limit 0,".$hotLines."  ";
		 $suffix_str="_all";
	  }
	  else
	  {
		 $catenews_pub = mysql_fetch_assoc($result_cate_pub);
		 $hotLines=$catenews_pub['hotLines'];
		 $hotWords=$catenews_pub['hotWords'];

		 $news_sql2_pub="select * from ls_news where enable=1 and cate='".$catenews_pub['cateName']."' order by Num,newsDate desc limit 0,".$hotLines." ";
 		 $suffix_str=$catenews_pub['suffStr'];
	  }

	$news_query_sql2=$opendb->query($news_sql2_pub);
	$news_="<ul>";

	$i=1;
	while($news_rows_pub=mysql_fetch_assoc($news_query_sql2))
	{
		$news_.="<li> <a href=\"../".$newsshowFolders."/news".$suffix_str.$news_rows_pub['ID'].".html\">".mb_substr($news_rows_pub['newsTitle'],0,$hotWords,'UTF-8')."  (".substr($news_rows_pub['newsDate'],-5).")</a>";		//新闻分类链接

		$news_.="<p>".strip_tags(mb_substr($news_rows_pub['newsText'],0,180))."...</p>";	// 新闻截取部分

		$news_.="</li>";
 		
		$i++;
	}
	$news_.="</ul>";

	$news_2=$news_;					// 子目录下新闻菜单
	$news_=str_replace("../","",$news_2);  //根目录下新闻菜单
	$news_3=str_replace("../","../../",$news_2);  //2级子目录下新闻菜单
	$news_4=str_replace("../","../../../",$news_2);  //3级子目录下新闻菜单

	switch($suffix_str)
	{
		case "_dongtai":
		$ls_newsdongtai=$news_;				//globle News动态
		$ls_newsdongtai2=$news_2;				//globle News动态
		$ls_newsdongtai3=$news_3;				//globle News动态
		$ls_newsdongtai4=$news_4;				//globle News动态

		break;
		case "_gonggao":
		$ls_newsgonggao=$news_;				//globle News公告
		$ls_newsgonggao2=$news_2;	
		$ls_newsgonggao3=$news_3;	
		$ls_newsgonggao4=$news_4;	
		break;

		case "_tieshi":
		$ls_newstieshi=$news_;				//globle News贴士
		$ls_newstieshi2=$news_2;
		$ls_newstieshi3=$news_3;
		$ls_newstieshi4=$news_4;
		break;

		case "_all":
		$ls_newsall=$news_;				//globle News全部
		$ls_newsall2=$news_2;
		$ls_newsall3=$news_3;
		$ls_newsall4=$news_4;
		break;
	}	
//	echo $suffix_str."<br/>".$news_;
	
		if($num_cate_pub==0 || $i_news_pub==$num_cate_pub)		//没有新闻分类 循环一遍退出， 如有新闻分类 循环所有分类
		{break;}
		else
		{
			$i_news_pub++;
		}
		
}
	
//新闻列表 End	


//======================================================
//	  2)手机产品分类 $p_pro_cate P ->  {ls_m_cate} S Sm
//======================================================

	$pro_cate_sql="select * from ls_products where 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";
	$pro_cate_query=$opendb->query($pro_cate_sql);
	//$s_pro_cate="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	$pro_num=mysql_num_rows($pro_cate_query);
	
	$ls_m_cate = "<ul class=\"nav navbar-nav\">";
	$x = $pro_num;
	$y = 0;
	while($pro_cate_rows=mysql_fetch_assoc($pro_cate_query))
	{
	  $y++;
	  $pro_midcate_sql="select * from ls_products where 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=".$pro_cate_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)//大类
	  {
		//$ls_m_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$ls_m_cate.="\n<dt>".$pro_cate_rows['cateName']."</dt>";
		  $ls_m_cate.="<li><a href='../".$mobi_path.$pro_cate_rows['cateFolders']."/".$pro_cate_rows['cateFolders'].".html'>".$pro_cate_rows['cateName']."</a></li>";

		// $ls_m_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$ls_m_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		$detailsfile="../../".$mobi_path.$pro_cate_rows['cateFolders']."/".$pro_cate_rows['cateFolders'].".html";
		$detailsfile2="../".$mobi_templates."/catedetail.html";
		if(file_exists($detailsfile2)){
			$ls_m_cate.="\n<li><a href='".$detailsfile."' class=\"dropdown-toggle blue\" data-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">".$pro_cate_rows['cateName']."<span class=\"caret\"></span></a><ul class=\"protit dropdown-menu\" >";
		}else{
			$ls_m_cate.="\n<li><a href='javascript:void(0)' class=\"dropdown-toggle blue\" data-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\" >".$pro_cate_rows['cateName']."<span class=\"caret\"></span></a><ul class=\"protit dropdown-menu\">";
		}
		
		//？ 不应该有$ls_m_cate.="\n <div class=\"cate_list\">\n";
		while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
		{
			$pro_subcate_sql="select * from ls_products where 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);

			//$ls_m_cate.="<div class=\"midcate_list\">"; //中类菜单样式
	
			if($pro_subcate_num==0)//没小类
			{
				$ls_m_cate.="\n<li><a href='../".$mobi_path.$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_midcate_rows['midcateFolders'].".html' onclick=\"turnit(".$pro_cate_rows['ID'].",".$pro_cate_rows['ID'].");this.href=this.href+'?menuId='+".$pro_cate_rows['ID']."+'&cate='+".$pro_cate_rows['ID'].";\">".$pro_midcate_rows['midcateName']."</a></li>";
			}
			else//有小类
			{
			//$ls_m_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			$detailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/".$pro_midcate_rows['midcateName'].".html";
			if(file_exists($detailsfile))
			{$ls_m_cate.="<a href='".$detailsfile."'>".$pro_midcate_rows['midcateName']."</a>";}
			else
			{$ls_m_cate.="\n<li> <a href='javascript:void(0)' ><span class=\"glyphicon glyphicon-forward\"></span> ".$pro_midcate_rows['midcateName']."</a>\n<ul class=\"sub-menu\">\n";}
			//$ls_m_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
			 {
				$ls_m_cate.="<li class=\"menu-item\"> <a href=\"../".$mobi_path.$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/".$pro_subcate_rows['subcateFolders'].".html\" >".$pro_subcate_rows['subcateName']."</a></li>\n";
			 }
			$ls_m_cate.="</ul>\n</li>\n"; 
			} 
		}
		$ls_m_cate.="</ul>";
	  }//if($pro_midcate_num==0)//dalei
	
	}
	$ls_m_cate.="\n </ul>";
	
	$m_cate=str_replace("../","",$ls_m_cate);//cate
	$p_m_cate=str_replace("../","../",$ls_m_cate);//pro2_cate
	$p_m_cate1=str_replace("../","../../",$ls_m_cate);//pro2_cate
	$p_m_cate2=str_replace("../","../../../",$ls_m_cate);//pro3_cate
	$p_m_cate3=str_replace("../","../../../../",$ls_m_cate);//pro4_cate
	
	//footer产品菜单—-鼠标悬停展开 end

//==================================================
//		 1) sitemap 站点地图 $s_site_cate -> {ls_site_cate} T
//==================================================

	$p_site_cate_sql="select * from ls_products where 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";
	$p_site_cate_query=$opendb->query($p_site_cate_sql);
	//$s_pro_cate="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	$s_site_cate.="<div class=\"ls_sitemap\">";
	while($pro_cate_rows=mysql_fetch_assoc($p_site_cate_query))
	{
	  $pro_midcate_sql="select * from ls_products where 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=".$pro_cate_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_site_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";
		//$s_site_cate.="\n<dt>".$pro_cate_rows['cateName']."</dt>";
		$s_site_cate.="<div class='cate'><a href='../".$pro_cate_rows['cateFolders']."/index.html'>".$pro_cate_rows['cateName']."</a></div>";
		// $s_site_cate.="\n <div class=\"cate_list\">\n"; //大类菜单样式，div css:cate_list
	  } 
	  else//大类中类
	  {
		//$s_site_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/cate.gif' border='0'> \n";  //大类引导图
		$detailsfile="../".$pro_cate_rows['cateFolders']."/indexdetails.html";
		if(file_exists($detailsfile))
		{$s_site_cate.="\n<div class='cate'><a href='".$detailsfile."'>".$pro_cate_rows['cateName']."</a></div><div class='midcate'>";}
		else
		{$s_site_cate.="\n<div class='cate'><a href='javascript:void(0)'>".$pro_cate_rows['cateName']."</a></div><div class='midcate'>";}
		
		//？ 不应该有$s_site_cate.="\n <div class=\"cate_list\">\n";
		while($pro_midcate_rows=mysql_fetch_assoc($pro_midcate_query))
		{
			$pro_subcate_sql="select * from ls_products where 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_site_cate.="<div class=\"midcate_list\">"; //中类菜单样式
	
			if($pro_subcate_num==0)//没小类
			{
				//$s_site_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";  //中类引导图
				$s_site_cate.="\n<a href='../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/index.html'>".$pro_midcate_rows['midcateName']."</a>, &nbsp; ";
			}
			else//有小类
			{
			//$s_site_cate.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n"; //中类引导图
			$detailsfile="../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateName']."/indexdetails.html";
			if(file_exists($detailsfile))
			{$s_site_cate.="<div><a href='".$detailsfile."'>".$pro_midcate_rows['midcateName']."</a></div><div class='subcate'>";}
			else
			{$s_site_cate.="\n<div><a href='javascript:void(0)'>".$pro_midcate_rows['midcateName']."</a></div><div class='subcate'>\n";}
			//$s_site_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
			 {
				$s_site_cate.="<a href=\"../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a>, &nbsp; \n";
			 }
			$s_site_cate.="</div>\n"; 
			}
			$s_site_cate.="\n";
		}
		$s_site_cate.="</div>";
	  }//if($pro_midcate_num==0)//dalei
	
	}
	$s_site_cate.="</div>\n ";
	//echo $s_site_cate;
	$site_cate1=str_replace("../","",$s_site_cate);//cate
	$s_site2_cate=str_replace("../","../../",$s_site_cate);//pro2_cate
	$s_site3_cate=str_replace("../","../../../",$s_site_cate);//pro3_cate
	$s_site4_cate=str_replace("../","../../../../",$s_site_cate);//pro4_cate
	
	// End

//====================================================================================================
//		 首页热点产品展示 $ls_hotpro 首页产品展示已经转移至temp_index.php
//====================================================================================================
	/*
			
	$ls_hotpro="";
	$hotpro='';

	$products_sql="select * from ls_products where 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 AdditionalAttributes&1 and enable=1";
	$products_sql.=" order by Num asc limit 0,".$proNum." ";
	$products_query=$opendb->query($products_sql);
	while($products_rows=mysql_fetch_assoc($products_query))
	{
		$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";


		$hotpro.="<div class=\"hotpro2\">";
		$hotpro.="<div class=\"hotpro\" >";
		$hotpro.="<a href=\"".$prolink."\" target=\"_ablank\"><img src=".$prosrc." border=\"0\" alt=\"".$products_rows['productName']."\"></a>";	//图片链接，css：hotpro
		$hotpro.="</div>";
		$hotpro.="<div class=\"hotpro3\" ><a href=\"".$prolink."\">".$products_rows['productItemNo']."</a></div>";		//文字链接，css：hotpro3
		$hotpro.="</div>";
		
	}		
	$ls_hotpro	=$hotpro;	
	//echo 		$ls_hotpro;												

//首页产品展示 End
	*/
	
//====================================================================================================
//		除产品页之外的所有$ls_designby，$ls_title，$ls_keywords，$ls_description，$foot标签内容
//====================================================================================================

	$ls_designby="<a href=\"http://www.lanscend.com/\" target=\"_blank\">Designed by lanscend</a>"; //Designed by lanscend
	$config_sql="SELECT * FROM ls_config";
	$config_query=$opendb->query($config_sql);
	$config_rows=mysql_fetch_assoc($config_query);

	$ls_title=$config_rows['siteKeywords']." - ".$config_rows['companyName'];	//首页title
	$ls_keywords=$config_rows['siteKeywords'];	//首页Keywords关键词
	$ls_description=$config_rows['siteDescription'];//首页Description描述

	$foot="Address:".$config_rows['address']."<br>";
	$foot.="Tel:".$config_rows['tel']."&nbsp;";
	$foot.="&nbsp;Fax:".$config_rows['fax']."&nbsp;";
	$foot.="&nbsp;E-Mail:<a href=\"mailto:".$config_rows['email']."\">".$config_rows['email']."</a>&nbsp;";

	
	//ls_addprolink标签
	$addprolink_sql = 'SELECT * FROM `ls_products` WHERE `addProLink`=1';
	$addprolink_query = $opendb->query($addprolink_sql);
	if(mysql_num_rows($addprolink_query)>0){  //如果未做标记，默认链接到 第一 叶类
		$addprolink_row = mysql_fetch_array($addprolink_query);
		if($addprolink_row['cateFolders']!=''){
			$addprolink_str = $addprolink_row['cateFolders'].'/'.$addprolink_row['cateFolders'].".html";//大类地址
		}elseif($addprolink_row['midcateFolders']!=''){
			$addpro2 =  $addprolink_row['midcateFolders'];//中类地址
			$addprolink_str = $addprolink_row['midcateFolders'];//中类地址
			$addprolink_sql = 'SELECT `cateFolders` FROM `ls_products` WHERE `ID`='.$addprolink_row['midcateID'];
			$addprolink_query = $opendb->query($addprolink_sql);
			$addprolink_row = mysql_fetch_array($addprolink_query);
			$addprolink_str = $addprolink_row['cateFolders'].'/'.$addprolink_str."/".$addpro2.".html";//大类地址加上中类地址
		}elseif($addprolink_row['subcateFolders']!=''){
			$addprolink_str = $addprolink_row['subcateFolders'].'/';//小类地址
			$addprolink_sql = 'SELECT `midcateFolders`,`midcateID` FROM `ls_products` WHERE `ID`='.$addprolink_row['subcateID'];
			$addprolink_query = $opendb->query($addprolink_sql);
			$addprolink_row = mysql_fetch_array($addprolink_query);
			$addprolink_str = $addprolink_row['midcateFolders'].'/'.$addprolink_str;//中类加上小类地址
			$addprolink_sql = 'SELECT `cateFolders` FROM `ls_products` WHERE `ID`='.$addprolink_row['midcateID'];
			$addprolink_query = $opendb->query($addprolink_sql);
			$addprolink_row = mysql_fetch_array($addprolink_query);
			$addprolink_str = $addprolink_row['cateFolders'].'/'.$addprolink_str."/".$addprolink_row['subcateFolders'].".html";//大类加上中类加上小类地址
		}
	}else{
		$pro_cate_sql="select * from ls_products where 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";
		$pro_cate_query = $opendb->query($pro_cate_sql);
		$pro_cate_row = mysql_fetch_array($pro_cate_query);
		
		$midprolink_sql = "SELECT * FROM ls_products WHERE `midcateID`= ".$pro_cate_row['ID']." order by Num asc";
		$midprolink_query = $opendb->query($midprolink_sql);
		if(mysql_num_rows($midprolink_query)==0){ //大类
			$addprolink_str = $pro_cate_row['cateFolders'].'/'.$pro_cate_row['cateFolders'].".html";//大类地址
		}elseif(mysql_num_rows($midprolink_query)>0){
			$mid_cate_row = mysql_fetch_array($midprolink_query);
			$subprolink_sql = "SELECT * FROM ls_products WHERE `subcateID`= ".$mid_cate_row['ID']." order by Num asc";
			$subprolink_query = $opendb->query($subprolink_sql);
			if(mysql_num_rows($subprolink_query)==0){  //中类
				$addprolink_str = $pro_cate_row['cateFolders'].'/'.$mid_cate_row['midcateFolders']."/".$mid_cate_row['midcateFolders'].".html";//大类地址加上中类地址
			}else{  //小类
				$sub_cate_row = mysql_fetch_array($subprolink_query);
				$addprolink_str = $pro_cate_row['cateFolders'].'/'.$mid_cate_row['midcateFolders']."/".$sub_cate_row['subcateFolders']."/".$sub_cate_row['subcateFolders'].".html";//大类加上中类加上小类地址
			}
		}
	}
	$ls_addprolink = $addprolink_str;
	
	//ls_addnewprolink标签
	$addnewprolink_sql = 'SELECT * FROM `ls_products` WHERE `addNewProLink`=1';
	$addnewprolink_query = $opendb->query($addnewprolink_sql);
	$addnewprolink_row = mysql_fetch_array($addnewprolink_query);
	if($addnewprolink_row['cateFolders']!=''){
		$addnewprolink_str = '/'.$addnewprolink_row['cateFolders'].'/';//大类地址
	}elseif($addnewprolink_row['midcateFolders']!=''){
		$addnewprolink_str = $addnewprolink_row['midcateFolders'].'/';//中类地址
		$addnewprolink_sql = 'SELECT `cateFolders` FROM `ls_products` WHERE `ID`='.$addnewprolink_row['midcateID'];
		$addnewprolink_query = $opendb->query($addnewprolink_sql);
		$addnewprolink_row = mysql_fetch_array($addnewprolink_query);
		$addnewprolink_str = '/'.$addnewprolink_row['cateFolders'].'/'.$addnewprolink_str;//大类地址加上中类地址
	}elseif($addnewprolink_row['subcateFolders']!=''){
		$addnewprolink_str = $addnewprolink_row['subcateFolders'].'/';//小类地址
		$addnewprolink_sql = 'SELECT `midcateFolders`,`midcateID` FROM `ls_products` WHERE `ID`='.$addnewprolink_row['subcateID'];
		$addnewprolink_query = $opendb->query($addnewprolink_sql);
		$addnewprolink_row = mysql_fetch_array($addnewprolink_query);
		$addnewprolink_str = $addnewprolink_row['midcateFolders'].'/'.$addnewprolink_str;//中类加上小类地址
		$addnewprolink_sql = 'SELECT `cateFolders` FROM `ls_products` WHERE `ID`='.$addnewprolink_row['midcateID'];
		$addnewprolink_query = $opendb->query($addnewprolink_sql);
		$addnewprolink_row = mysql_fetch_array($addnewprolink_query);
		$addnewprolink_str = '/'.$addnewprolink_row['cateFolders'].'/'.$addnewprolink_str;//大类加上中类加上小类地址
	}
	$ls_addnewprolink = $addnewprolink_str;
	
	
	//友情链接
	$link_sql="select * from ls_links where enable=1 order by linkNum asc";
	$link_query=$opendb->query($link_sql);
	$link_num=mysql_num_rows($link_query);	
	$link="";
  	while ($link_rows=mysql_fetch_assoc($link_query)){ 
		$pro_link.="<a href=\"".$link_rows['linkURL']."\"> <img src=\"../ls_admin/uploadfiles/".$link_rows['linkIconPic']."\" alt=\"".$link_rows['linkTitle']."\" border='0' width=\"".$linkIconPicWidth."\" height=\"".$linkIconPicHeight."\" /></a>";					
    }
	$link=str_replace("../","",$pro_link);
	$pro2_link=str_replace("../","../../",$pro_link);
	$pro3_link=str_replace("../","../../../",$pro_link);
	$pro4_link=str_replace("../","../../../../",$pro_link);

	//主题图流动图片
	$revo_sql="select * from ls_revolvingpics where enable=1 order by Num asc";
	$revo_query=$opendb->query($revo_sql);
	$revo_num=mysql_num_rows($revo_query);	
	$revo="";
  	while ($revo_rows=mysql_fetch_assoc($revo_query)){ 
		$pro_revo.="<img src=\"../revolvingpics/thumbnails/".$revo_rows['Pic']."\" alt=\"".$revo_rows['Text']."\" border='0' width=\"".$revolvingPicW."\" height=\"".$revolvingPicH."\" />";					
    }
	$revo=str_replace("../","",$pro_revo);
	$pro2_revo=str_replace("../","../../",$pro_revo);
	$pro3_revo=str_replace("../","../../../",$pro_revo);
	$pro4_revo=str_replace("../","../../../../",$pro_revo);
	
	//echo $pro_revo;
	
	//生成手机 产品类的菜单
	$sql ="select * from ls_products where 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";
	$query=$opendb->query($sql);
	$procate_m="";
  	while ($revo_rows=mysql_fetch_assoc($query)){ 
		$procate_m.="<li><a  target= '_self' href='/products_list/&amp;pmcId=.html'><strong>".$revo_rows['cateName']."</strong></a></li>";					
    }



 			

?>
<!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">
</head>
