<?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'];

switch($proCateStytle){
	
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
	$s_pro_cate.="<ul class=\"ls_s_cate\">";
	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/images/cate.gif' border='0'> \n";
		//$s_pro_cate.="\n<dt>".$pro_cate_rows['cateName']."</dt>";
		$s_pro_cate.="<li><img src='../".$templates_var."/images/sdd.gif' border='0'><a href='../".$pro_cate_rows['cateFolders']."/index.html'>".$pro_cate_rows['cateName']."</a></li><hr width=292 size=1 color=#e7e7e7 align=left noshade>";
		// $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']."/indexdetails.html";
		if(file_exists($detailsfile))
		{$s_pro_cate.="\n<dt><a href='".$detailsfile."'>".$pro_cate_rows['cateName']."</a></dt>";}
		else
		{$s_pro_cate.="\n<li><img src='../Templates/".$templates_var."/images/sdd.gif' border='0'><a href='javascript:void(0)'>".$pro_cate_rows['cateName']."</a><ul>";}
		
		//？ 不应该有$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.="&nbsp;<img src='../Templates/".$templates_var."/images/midcate.gif' border='0'> \n";  //中类引导图
				$s_pro_cate.="\n<li><a href='../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/index.html'>".$pro_midcate_rows['midcateName']."</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']."/indexdetails.html";
			if(file_exists($detailsfile))
			{$s_pro_cate.="<a href='".$detailsfile."'>".$pro_midcate_rows['midcateName']."</a>";}
			else
			{$s_pro_cate.="\n<dd><a href='javascript:void(0)'>".$pro_midcate_rows['midcateName']."</a>\n<ul>\n";}
			//$s_pro_cate.="<div class=\"subcate_list\">";//小类菜单样式
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))		//小类生成
			 {
				$s_pro_cate.="<li><a href=\"../".$pro_cate_rows['cateFolders']."/".$pro_midcate_rows['midcateFolders']."/".$pro_subcate_rows['subcateFolders']."/index.html\" >".$pro_subcate_rows['subcateName']."</a></li>\n";
			 }
			$s_pro_cate.="</ul>\n</dd>\n"; 
			} 
		}
		$s_pro_cate.="</ul></li>";
	  }//if($pro_midcate_num==0)//dalei
	
	}
	$s_pro_cate.="</ul>\n ";
	//echo $s_pro_cate;
	$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

	//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/images/cate.gif' border='0'> \n";	//大类前导图

		$s_pro_cate.="    		   <a href='../".rawurlencode($pro_cate_rows['cateFolders'])."/index.html' >  \n".$pro_cate_rows['cateName']."</div></a><br> ";	//大类菜单链接
		//$s_pro_cate.="\n <div class=\"cate_list\">\n";
	  }
	  else//大类中类
	  {
		$onmouseoverscript="";
		$onmouseoverscript2="";
		$menuListscate_sql="select distinct midcateID from ls_products where enable=1";		//  get the number of cate that has midecate
		$menuListscate_query=$opendb->query($menuListscate_sql);
		$menuListscate_num=mysql_num_rows($menuListscate_query);

		for($i=1;$i<$menuListscate_num;$i++)		// total $menuListscate_num .=-1	//鼠标经过脚本生成，勿动
		{
			if($i==$j)
			{
				$onmouseoverscript.="menuLists".$i.".style.display = 'block';jia".$i.".style.display = 'none';jian".$i.".style.display = 'block';";
			}else{
				$onmouseoverscript.="menuLists".$i.".style.display = 'none';jia".$i.".style.display = 'block';jian".$i.".style.display = 'none';";
			}
		}
		for($i=1;$i<$menuListscate_num;$i++)		// total $menuListscate_num .=-1	//鼠标经过脚本生成，勿动
		{
			if($i==$j)
			{
				$onmouseoverscript2.="menuLists".$i.".style.display = 'none';jia".$i.".style.display = 'block';jian".$i.".style.display = 'none';";
			}else{
				$onmouseoverscript2.="menuLists".$i.".style.display = 'none';jia".$i.".style.display = 'block';jian".$i.".style.display = 'none';";
			}
		}
		//$s_pro_cate.="&nbsp;<img src='../Templates/images/cate.gif' border='0'> \n";		//大类前导图
		$s_pro_cate.="\n<div class=\"dtClass\" id='".$j."'  onclick='menuopenclose(this.id);'><div id=\"jia".$j."\" class=\"jia\"></div><div id=\"jian".$j."\" class=\"jian\" style=\"display:none;\"></div><a href=\"javascript:void(0);\">".$pro_cate_rows['cateName']."&nbsp;&nbsp;&gt;&gt;</a>\n</div>";	//大类菜单链接
		//$s_pro_cate.="\n <div class=\"cate_list\">\n";
		
		if($j == 1){
		$s_pro_cate.="<div  id=\"menuLists".$j."\" style=\"display:block;\">\n";	// don't change it will be changed by ls_syscode
		}else{
			$s_pro_cate.="<div  id=\"menuLists".$j."\" style=\"display:none;\">\n";	// don't change it will be changed by ls_syscode
		}

		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=\"catelist\">";
	
			if($pro_subcate_num==0)//没小类
			{
			//$s_pro_cate.="    		    <img src='../Templates/images/midcate.gif' border='0'> \n";	//无小类的中类前导图
			$s_pro_cate.="\n<div class=\"ddClass\"><a class=\"smidcatemenu\" href='../".rawurlencode($pro_cate_rows['cateFolders'])."/".rawurlencode($pro_midcate_rows['midcateFolders'])."/index.html?menuId=".$j."' ><div class=\"jian1\"></div>\n".$pro_midcate_rows['midcateName']."</a>\n</div>\n";	//中类菜单链接
			}
			else//有小类
			{
			//$s_pro_cate.="    		    <img src='../Templates/images/midcate.gif' border='0'> \n";	//有小类的中类前导图
			$s_pro_cate.="\n<div class=\"ddClass\"><div class=\"jian1\"></div>".$pro_midcate_rows['midcateName']."&nbsp;&nbsp;&gt;&gt;\n</div>\n";
			}
		
			while($pro_subcate_rows=mysql_fetch_assoc($pro_subcate_query))
			 {
				if(strlen($pro_subcate_rows['subcateName'])>32){
					$subName = substr($pro_subcate_rows['subcateName'],0,32)."..";
				}else{
					$subName = $pro_subcate_rows['subcateName'];
				}
				//$s_pro_cate.="    		    <img src='../Templates/images/subcate.gif' border='0' >&nbsp; \n";	//小类前导图
				$s_pro_cate.="<div class=\"liClass\"><a class=\"ssubcatemenu\" href=\"../".rawurlencode($pro_cate_rows['cateFolders'])."/".rawurlencode($pro_midcate_rows['midcateFolders'])."/".rawurlencode($pro_subcate_rows['subcateFolders'])."/index.html?menuId=".$j."'\" ><div class=\"jian\"></div>\n".$subName."</a><br></div>\n";	//小类菜单链接
			 }
		}
		$j++;
		$s_pro_cate.="	</div>\n";
	  }//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
//==================================================

	$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>";
	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='../search.php?cateid=".$pro_cate_rows['ID']."&catename=".$pro_cate_rows['cateName']."&brief=".substr($pro_cate_rows['cateBrief'],0,$CateLength)."' > \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'])."/index.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_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);
	//$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
//==================================================

	$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;
}



//==================================================
//	   新闻列表 动态新闻 $ls_newsdongtai 等
//==================================================

$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\">".substr($news_rows_pub['newsTitle'],0,$hotWords)."  (".substr($news_rows_pub['newsDate'],-5).")</a>";		//新闻分类链接

		$news_.="</li>";
//		if($i==$news_Num)
//		{
//		$news_.="<div align=\"right\"><a href=\"news_.php\">more..</a></div>";
//		}
		
		$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	


//====================================================================================================
//		 首页热点产品展示 $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);
	$addprolink_row = mysql_fetch_array($addprolink_query);
	if($addprolink_row['cateFolders']!=''){
		$addprolink_str = $addprolink_row['cateFolders'].'/';//大类地址
	}elseif($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;//大类地址加上中类地址
	}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;//大类加上中类加上小类地址
	}
	$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;

?>
