<%
	sub QuaryChild()
		dim rsTotalCount, rSubTotalCount
		dim MyParent
		set r2 = server.createobject("adodb.recordset")

		'搜索 含有一级子栏目 的双亲栏目编号
		sqlc = "select distinct MyColumn from [column] " &_
			"where isUse=(1) and ParentId=0 and name='" & CurrCom & "' order by MyColumn asc"

		rs.open sqlc,conn,1,1
		if not (rs.eof or rs.bof) then
			rsTotalCount = rs.RecordCount
			Redim Preserve Columns(rsTotalCount)
			for i = 1 to rsTotalCount
				Columns(i) = rs(0)
				rs.movenext
			next
		else
			rsTotalCount = 0
		end if
		rs.close
		'########################################################################################
		for n = 1 to rsTotalCount-1 '栏目
			response.write "栏目》》》》》》》》" & n
			ThisColumn = Columns(n)
			response.write "ThisColumn=" & ThisColumn & "<br>"
			sql1 = "select ID, ParentId, CN, CNLink, EN, ENLink from [column] " &_
				"where isUse=(1) and ParentId=0 and name='" & CurrCom & "' " &_
				"and MyColumn=" & ThisColumn
			rSub.open sql1,conn,1,1		'检索指定一级子菜单
			if not (rSub.eof or rSub.bof) then
				rSubTotalCount = rSub.RecordCount
				ReDim Preserve mu(i)	'@@@@@@@@@ 新的一级二级菜单临时数组
				ReDim Preserve MyParent(i)
				for i = 1 to rSubTotalCount-1
					if HomeCurrVer = "CN" or HomeCurrVer = "" then	'中文版本
						ThisMenu1 = rSub("CN")
					elseif HomeCurrVer = "EN" then	'英文版本
						ThisMenu1 = rSub("EN")
					end if
					MyParent(i) = rSub(0)
					mu(i) = mu(i) = ThisMenu1 & "~" & MyParent(i)
					rSub.movenext
				next
			else
				rSubTotalCount = 0
			end if
			rSub.close
			'========================================================================
			for i = 1 to rSubTotalCount-1
				response.write "rSubTotalCount=" & rSubTotalCount
				sql2 = "select ID, ParentId, CN, CNLink, EN, ENLink from [column] " &_
					"where isUse=(1) and name='" & CurrCom & "' " &_
					"and ParentId=" & MyParent(i)
				r2.open sql2,conn,1,1 '二级子菜单
				'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
				do while not r2.eof
					if HomeCurrVer = "CN" or HomeCurrVer = "" then	'中文版本
						ThisMenu2 = r2("CN")
					elseif HomeCurrVer = "EN" then	'英文版本
						ThisMenu2 = r2("EN")
					end if
					mu(i) = mu(i) & "|" & ThisMenu2 & "~" & r2(0)
					r2.movenext
				loop
				'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
				r2.close
			next
			'========================================================================
				

			'制作子菜单
			'------------------------
			call MakeChildMenu( ThisColumn )

		next
		'########################################################################################

		set r2 = nothing
	end sub







	'接收 mu(i) 数组的内容，制作子菜单	用 CSS 控制菜单外观
	'--------------------------------------------------------------------------------
	sub MakeChildMenu( m )
		'm 为栏目编号
		dim MuTmp	'临时变量
		dim ChildTmp	'临时变量
		dim ArrChild	'再次披开子菜单
		dim Arr		'栏目名和连接 ID

		'中文~15|中1~17|中2~18

		for i = 1 to ubound(mu)
			response.write "mu(" & i & ")=" & mu(i) & "<br>"
		next
		response.write "" &_
			"<script language=""JavaScript"">" &_
			"	NowLoading( true, ""系统正在装载栏目子菜单 " & m & "，请稍候..."" );" &_
			"</script>"

		response.write "" &_
			"<div " &_
			"class=""ChildMenu"" " &_
			"id=""ChildMenu0" & m & """ " &_
			"style=""display:none"" " &_
			"onmouseover=""ShowChildMenu( ChildMenu0" & m & ", false );"" " &_
			"onmouseout=""HideChildMenu( ChildMenu0" & m & " );"" " &_
			">" &_
			"<center>" &_
			"<TABLE border=0 cellspacing=1 cellpadding=0 class=""ChildTable"">" &_
			"  <tbody>" &_
			"  <TR>" &_
			"    <td class=""ChildTD"" width=""100%"">"

		dim CurrVerRequest
		if HomeCurrVer = "CN" or HomeCurrVer = "" then	'中文版本
			CurrVerRequest = ""
		elseif HomeCurrVer = "EN" then		'英文版本	
			CurrVerRequest = "ver=EN&"
		end if

		dim ChildNum
		ChildNum = 0
		for x = 0 to ubound(mu)
			if mu(x) <> "" then
				MuTmp = mu(x)
				ArrChild = split( MuTmp,"|" )
				ChildTmp = ArrChild(0)	'第一个一级子栏目，接下来是这个一级栏木下的二级栏目
				Arr = split(ChildTmp,"~")
				if ChildNum<>0 then
					response.write "<br>"
				end if
				response.write "&nbsp;" &_
					"<a href=""column" & m & ".asp?" & CurrVerRequest & "ColumnID=" & Arr(1) & """" &_
					"  class=ChildTitle>" & Arr(0) & "</a>"
				if ubound(ArrChild)>=1 then
					for y = 1 to ubound(ArrChild)
						ChildTmp = ArrChild(y)
						Arr = split(ChildTmp,"~")
						response.write "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &_
							"<font class=TitleList>■</font> " &_
							"<a href=""column" & m & ".asp?" & CurrVerRequest & "ColumnID=" & Arr(1) & """ class=ChildTitle>" &_
							Arr(0) & "</a>"
					next
				end if
				ChildNum = ChildNum + 1
			end if
		next

		response.write "" &_
			"    </td>" &_
			"  </tr>" &_
			"  </tbody>" &_
			"</table>" &_
			"</center>" &_
			"</div>"

	end sub





	sub MakeProductChildMenu()

		response.write "" &_
			"<script language=""JavaScript"">" &_
			"	NowLoading( true, ""系统正在装载产品分类菜单，请稍候..."" );" &_
			"</script>"

		response.write "" &_
			"<div " &_
			"class=""ChildMenu"" " &_
			"id=""ProductChildMenu"" " &_
			"style=""display:none"" " &_
			"onmouseover=""ShowChildMenu( ProductChildMenu, false );"" " &_
			"onmouseout=""HideChildMenu( ProductChildMenu );"" " &_
			">" &_
			"<center>" &_
			"<TABLE border=0 cellspacing=1 cellpadding=0 class=""ChildTable"">" &_
			"  <tbody>" &_
			"  <TR>" &_
			"    <td class=""ChildTD"" width=""100%"">"

		dim psql
		dim ChildNum
		ChildNum = 0

		set rsp = server.createobject("adodb.recordset")
		psql = "select distinct PSort from [product] " &_
			"where name='" & CurrCom & "' and ver='" & HomeCurrVer & "'"
		rsp.open psql,conn,1,1
		if rsp.eof or rsp.bof then
			response.write "&nbsp;暂时还没有任何分类"
		end if
		do while not rsp.eof
			if ChildNum<>0 then
				response.write "<br>"
			end if
			if trim(rsp(0))<>"" then
				response.write "&nbsp;" &_
					"<a href=""product.asp?sort=" & rsp(0) & "&ver=" & HomeCurrVer & """ " &_
					"class=ChildTitle>" & rsp(0) & "</a>"
				ChildNum = ChildNum + 1
			end if
			rsp.movenext
		loop
		rsp.close
		set rsp = nothing

		response.write "" &_
			"    </td>" &_
			"  </tr>" &_
			"  </tbody>" &_
			"</table>" &_
			"</center>" &_
			"</div>"

	end sub
%>