<%
'**************************************
'* 最后更新 2014-01-20 by 56770.kingdge
'* Copyright www.56770.com
'**************************************
'..................................
'读取商品分类 品牌 列表
'..................................
Function ProductListBrand()
        Dim App_ProductListBrand,ProductListBrand_num,Getrows_ProductListBrand_error,Getrows_ProductListBrand, ProductListBrand_i,sql_brand,strFile,strLoad,RLoadStyle(2),LoadListStr,loopstr
	    sort_id = checknum(sort_id,0)
		strFile = Eshop_url& Style_Folder &"Lebi.ProductListBrand."
		LoadListStr = LoadStyle(strFile&"0.style")
		App_ProductListBrand = cookiesname&"ProductListBrand"& LangTxt &p_width&p_height&p_linenum&sort_id
		If Not IsArray(Application(App_ProductListBrand)) Then
                sql_brand="select brand"& LangTxt &",brand_pic,b_pronum from [Lebi_brand] where b_class=',,'"
                if sort_id<>"0" And IsSqlDataBase ="1" then sql_brand=sql_brand+" or CharIndex(',"& sort_id &",',b_class)>0"
	            if sort_id<>"0" And IsSqlDataBase ="0" then sql_brand=sql_brand+" or instr(b_class,',"& sort_id &",')>0"
	            sql_brand = sql_brand&" order by paixu DESC"
                set Rs = conn.execute(sql_brand)
                if rs.eof And rs.bof Then
                        Getrows_ProductListBrand_error = 1
                Else
                        Getrows_ProductListBrand_error = 0
                        Application(App_ProductListBrand) = rs.getrows
		        End If
		        rs.close : Set rs = Nothing
		End If
		If Getrows_ProductListBrand_error = 0 Then
				LoadListStr = LoadListStr & ""
		        Getrows_ProductListBrand = Application(App_ProductListBrand)
				RLoadStyle(0) = splits(LoadStyle(strFile&"2.style"))
                For ProductListBrand_i = 0 To UBound(Getrows_ProductListBrand,2)
						Dim LoadPLBrand,PLBrand_name_pic
						If Not IsNull(Trim(Getrows_ProductListBrand(0,ProductListBrand_i))) And Trim(Getrows_ProductListBrand(0,ProductListBrand_i)) <> "" Then 
							loopstr = RLoadStyle(0)
							If Getrows_ProductListBrand(1,ProductListBrand_i) <> "" Then
									ReplaceStyle "pic_url",Getrows_ProductListBrand(1,ProductListBrand_i),loopstr
							Else
									ReplaceStyle "pic_url","images/space.gif",loopstr
							End If
							ReplaceStyle "name", Trim(Getrows_ProductListBrand(0,ProductListBrand_i)),loopstr
							Select Case ISAPI_Rewrite
								   Case "0" ReplaceStyle "url",PagePath(4) &"?sort_id="& sort_id &"&brand="& Urlencode(Trim(Getrows_ProductListBrand(0,ProductListBrand_i))),loopstr
								   Case "1" ReplaceStyle "url",LangPath &"brand-s"& sort_id &"-"& Urlencode(Trim(Getrows_ProductListBrand(0,ProductListBrand_i))) &".html",loopstr
							End Select
							ReplaceStyle "num",Getrows_ProductListBrand(2,ProductListBrand_i),loopstr
							ReplaceStyle "loop_num",ProductListBrand_i+1,loopstr
							LoadListStr = LoadListStr & loopstr
						End If 
		        Next
		Else
			LoadListStr = LoadListStr & splits(LoadStyle(strFile&"1.style"))
		End If
	    LoadListStr = LoadListStr & splits(LoadStyle(strFile&"3.style"))
		ProductListBrand = LoadListStr
End Function

Function ProductListChoicePrice()
        Dim s_price
        s_price = request("s_price")
		If Not IsNumeric(s_price) Or IsEmpty(s_price) Then s_price = 1
        ProductListChoicePrice = LoadStyle(Eshop_url& style_folder &"Lebi.ProductListChoicePrice.0.style")
		ReplaceStyle "price",s_price,ProductListChoicePrice
		ProductListChoicePrice = splits(ProductListChoicePrice)
End Function

Function Get_showsort_path(a)
		Dim Rs_s
	    set Rs_s = conn.execute("select c_id,c_name"& LangTxt &",c_parentid,c_foldername,c_filename from [Lebi_category] where is_hide = 0 and c_id = "& a &"")
	    do while not rs_s.eof
		Select Case show_html
			   Case "0"
					Get_showsort_path = Get_showsort_path & Get_showsort_path(rs_s(2))
					Select Case ISAPI_Rewrite
						   Case "0"
								Select Case Config_Lebi_Eshop(16)
									   Case "0" : Get_showsort_path = Get_showsort_path &"<a href="""& Eshop_url & LangPath &"showsort.asp?sort_id="& rs_s(0) &""">"& rs_s(1) &"</a> → "
									   Case "1" : Get_showsort_path = Get_showsort_path &"<a href="""& Eshop_url & LangPath &"category/"& rs_s(3) &"/"">"& rs_s(1) &"</a> → "
									   Case "2" : Get_showsort_path = Get_showsort_path &"<a href="""& Eshop_url & LangPath &"category/"& rs_s(3) &"/default.asp"">"& rs_s(1) &"</a> → "
								End Select
						   Case "1" Get_showsort_path = Get_showsort_path &"<a href="""& Eshop_url & LangPath &"category-"& rs_s(3) &".html"">"& rs_s(1) &"</a> → "
					End Select
			   Case "1" : Get_showsort_path = Get_showsort_path &"<a href="""& Eshop_url & LangPath & Folder(2) & rs_s(4) &".1."& Sys_Ext &""">"& rs_s(1) &"</a> → "
		End Select
	    rs_s.movenext
	    Loop
	    rs_s.Close : set Rs_s = nothing
End Function

Function Get_showsort_sortname(a)
		Dim Rs_s
	    set Rs_s = conn.execute("select c_name"& LangTxt &",c_parentid from [Lebi_category] where is_hide = 0 and c_id = "& a &"")
	    do while not rs_s.eof
		If Not IsNull(Trim(rs_s(0))) And Trim(rs_s(0)) <> "" Then 
			Get_showsort_sortname = Get_showsort_sortname &"_"& rs_s(0)
			Get_showsort_sortname = Get_showsort_sortname & Get_showsort_sortname(rs_s(1))
		End If 
	    rs_s.movenext
	    Loop
	    rs_s.Close : set Rs_s = nothing
End Function
'..................................
'读取商品分类 商品列表
'动态页调用模块
'..................................
Function ProductList(showheadpage,showfootpage)
        Dim showsort_price,sql_c,DataCount,DataList,List_num,Filename,i,showpic_width,showpic_height,pic_url, div_width,div_height,briefed,j,RLoadStyle(5),LoadListStr,strFile,skin_ys,tmpstr,loopstr,stock
        showheadpage = checknum(showheadpage,0) : showfootpage = checknum(showfootpage,0)
        skin_ys = Left(Trim(skin_ys1),1)
        If listtype="pic" Then skin_ys = 1
	    If listtype="word" Then skin_ys = 0
	    If listtype="listpic" Then skin_ys = 2
	    Dim ors
	    Set ors=new Cls_vbsPage
	    Set ors.Conn=conn
	    With ors
		    .PageSize=top12
		    .PageName="Page"
			If IsSqlDataBase = 0 Then
		            .DbType="AC"
			Else
			        .DbType="MSSQL"
			End If
		    .RecType=-1
		    .Pkey="p.id"
    	    .Field="p.id,p.product_name"& LangTxt &",p.pic,p.sprice,p.cprice,p.cx,p.stj,p.ytj,p.p_jifen,p.briefed"& LangTxt &",p.views,p.kucun,p.p_cx_sj,p.p_stj_sj,p.p_ytj_sj,p.sj,p.pic_size,p.cpic,g.price,p.IsNew,p_filename,bianhao"
		    .Table="[Lebi_product] as p,[Lebi_product_price] as g"
		    sql_c = "p.zhuangtai=1 and g.product_id=p.id and g.grade_id="&Lebi_UserGrade
            if sort_id<>"0" And IsSqlDataBase ="1" then sql_c=sql_c+" and CharIndex(',"& sort_id &",',p.categoryid)>0"
	        if sort_id<>"0" And IsSqlDataBase ="0" then sql_c=sql_c+" and instr(p.categoryid,',"& sort_id &",')>0"
            if brand<>"" And IsSqlDataBase ="1" then sql_c=sql_c+" and CharIndex('"&brand&"',brand)>0"
	        if brand<>"" And IsSqlDataBase ="0" then sql_c=sql_c+" and instr(brand,'"&brand&"')>0"
			rem	<-{  价格差联合搜索  2008-2-29 by 56770.WangLei
            if price1<>"" and price2<>"" Then
				sql_c=sql_c + " and g.price >"&price1&" and g.price <"&price2&" "
			End If
			rem	}->
	        rem 增加商品类型选择 2006-1-22 by 56770.kingdge
	        If sle_type="1" Then sql_c=sql_c+" And IsNew=1"
	        If sle_type="2" Then sql_c=sql_c+" And p.views>"&Config_Lebi_Eshop(6)&""
	        If sle_type="3" Then sql_c=sql_c+" And (p.ytj=1 or p.stj=1)"
	        If sle_type="4" Then sql_c=sql_c+" And p.cx=1"
	        rem 结束
	        If gongxiao<>"" And IsSqlDataBase =1 Then sql_c=sql_c+" and charindex(',"&gongxiao&",',p.p_gongxiao)>0"
	        If gongxiao<>"" And IsSqlDataBase =0 Then sql_c=sql_c+" and instr(p.p_gongxiao,',"&gongxiao&",')>0"
	        If person<>"" And IsSqlDataBase =1 Then sql_c=sql_c+" and charindex(',"&person&",',p.p_person)>0"
	        If person<>"" And IsSqlDataBase =0 Then sql_c=sql_c+" and instr(p.p_person,',"&person&",')>0"
			rem <-{增加筛选值 by 56770.kingdge 2012-06-28
			If value <> "" Then 
				sql_c=sql_c+" and ("
				arr_value = Split(value,"|")
				For i = 0 To Ubound(arr_value)
					If Right(Trim(arr_value(i)),2) <> "_0" Then 
						If IsSqlDataBase =1 Then sql_c=sql_c+" charindex('_"&Split(arr_value(i),"_")(1)&"',p.p_SelectValue)>0"
						If IsSqlDataBase =0 Then sql_c=sql_c+" instr(p.p_SelectValue,'_"&Split(arr_value(i),"_")(1)&"')>0"
'						sql_c=sql_c+" p.p_SelectValue like '%"& arr_value(i) &"%'"
					Else
						sql_c=sql_c+" 1=1"
					End If 
					If i < UBound(arr_value) Then sql_c=sql_c+" and "
				Next
				sql_c=sql_c+")"
			End If 
			rem }->增加筛选值 by 56770.kingdge 2012-06-28
	        .Condition=sql_c		'条件,不需要where
	        If listprice="up" Then .OrderBy="g.price DESC"
	        If listprice="down" Then .OrderBy="g.price ASC"
	        If listtime="up" Or (listprice="" And listtime="") Then .OrderBy="p.sj DESC"
	        If listtime="down" Then .OrderBy="p.sj ASC"
	        If listview="up" Then .OrderBy="p.views DESC"
	        If listview="down" Then .OrderBy="p.views ASC"
	        If listbuy="up" Then .OrderBy="p.buys DESC"
	        If listbuy="down" Then .OrderBy="p.buys ASC"
			If listprice="" And listtime="" And listview="" And listbuy="" Then .OrderBy="p.p_order desc,p.id desc"
	    End With
	    DataCount=ors.RecCount()
	    DataList=ors.ResultSet()
		List_num = 1
		strFile = Eshop_url& style_folder &"Lebi.ProductList."
		RLoadStyle(0) = splits(LoadStyle(strFile&"11.style"))	'购买按钮
		RLoadStyle(2) = splits(LoadStyle(strFile&"12.style"))	'预订按钮
		RLoadStyle(3) = splits(LoadStyle(strFile&"13.style"))	'零库存
		RLoadStyle(1) = splits(LoadStyle(strFile&"14.style"))	'收藏按钮
		LoadListStr = "<form action="""" method=""post"" name=""LEBI_FORMBUY_0001"" id=""LEBI_FORMBUY_0001"">"
		LoadListStr = LoadListStr & LoadStyle(strFile&"0.style")
		Select Case show_html
			   Case "0" : Filename = "category/"
			   Case "1"
					Select Case sle_type
						   Case "0" : Filename = Eshop_url & LangPath & Folder(2) & sort_filename
						   Case Else
								Filename = Eshop_url & LangPath & Folder(2) & sort_filename &"-"& sle_type
					End Select
		End Select
		If showheadpage = 1 Then
				tmpstr = LoadStyle(strFile&"1.style")
				ReplaceStyle "headpage",ors.ShowPageHead(Filename),tmpstr
				LoadListStr = LoadListStr & tmpstr
		End If
	    If DataCount > 0 Then
				If skin_ys <> 2 Then
					LoadListStr = LoadListStr & splits(LoadStyle(strFile&"3.style"))
				End If
				Select Case skin_ys
				       Case "0" : RLoadStyle(4) = splits(LoadStyle(strFile&"7.style")) '文字显示
				       Case "1" : RLoadStyle(4) = splits(LoadStyle(strFile&"5.style")) '图片显示
				       Case "2" : RLoadStyle(4) = splits(LoadStyle(strFile&"6.style")) '图片多列显示
				End Select
				LoadListStr = LoadListStr & LoadStyle(strFile&"4.style")
		        For i = 0 To Ubound(DataList,2)
						Dim PList_url,icostr
						loopstr = RLoadStyle(4)
						stock=DataList(11,i)
						tmpstr = "":icostr = ""
						briefed = DataList(9,i)
						Select Case show_html
							   Case "0"
									Select Case ISAPI_Rewrite
										   Case "0" PList_url=PagePath(10) &"?id="& DataList(0,i)
										   Case "1" PList_url=LangPath &"product-"& DataList(0,i) &".html"
									End Select
							   Case "1" : PList_url=LangPath & Folder(0) & DataList(20,i) &".1."& Sys_Ext
						End Select
						icostr=""
						If Config_Lebi_Eshop(7)=1 And DataList(19,i)=1 Then
								icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_3.gif' align='absmiddle'> "
						End if
						If Config_Lebi_Eshop(5)=1 And Int(DataList(10,i))>Int(Config_Lebi_Eshop(6)) Then
								icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_2.gif' align='absmiddle'> "
						End if
						If Config_Lebi_Eshop(3)=1 And DataList(5,i)=1 Then
								icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_1.gif' align='absmiddle'> "
						End If
						If Config_Lebi_Eshop(4)=1 And (DataList(6,i)=1 Or DataList(7,i)=1) Then
								icostr=icostr&" <img src='"& Eshop_url &"images/icons/pro_4.gif' align='absmiddle'> "
						End If
						ReplaceStyle "ico",icostr,loopstr
						If Trim(DataList(2,i))<>"" Then
								tmpstr = ""
								ReplaceStyle "pic_url",PicturePath & DataList(2,i),loopstr
								ReplaceStyle "lazyload_pic_url",Eshop_url & PicturePath & DataList(2,i),loopstr
								If show_mouse = "0" Then
										If InStr(DataList(17,i),"@@") > 0 Then
												pic_url = Split(DataList(17,i),"@@")(0)
												If pic_url = "" Then pic_url = Split(DataList(17,i),"@@")(1)
										Else
												pic_url = DataList(17,i)
										End If
										tmpstr = " onMouseover=""javascript:ddrivetip('<img src="& Eshop_url & PicturePath & pic_url &" width="& pic_dw &">', '#ffffff', '"& pic_dw + 10 &"')"" onMouseout=""hideddrivetip()"""
								Else
										tmpstr = ""
								End If
								ReplaceStyle "onmouse",tmpstr,loopstr
						End If
						ReplaceStyle "url",PList_url,loopstr
						ReplaceStyle "target",Config_Lebi_Eshop(9),loopstr
						ReplaceStyle "id",DataList(0,i),loopstr
						ReplaceStyle "name",DataList(1,i),loopstr
						rem	  会员组价格显示 2008-2-28 by 56770.WangLei
						If checkPricePurview(Lebi_UserGrade) Then
								Select Case DataList(5,i)
									   Case "0" : ReplaceStyle "buy_price",Formatnumber2(DataList(18,i)/moneyhl),loopstr
									   Case "1" : ReplaceStyle "buy_price",Formatnumber2(DataList(4,i)/moneyhl),loopstr
								End Select
						Else
								ReplaceStyle "buy_price",Lebi_word(66),loopstr
						End If
						ReplaceStyle "market_price",Formatnumber2(DataList(3,i)/moneyhl),loopstr
						ReplaceStyle "sale_price",Formatnumber2(DataList(4,i)/moneyhl),loopstr
						ReplaceStyle "point",DataList(8,i),loopstr
						ReplaceStyle "stock",DataList(11,i),loopstr
						ReplaceStyle "content",cutchar(briefed,100),loopstr
						ReplaceStyle "bianhao",DataList(21,i),loopstr
						rem	 购买、预订、零库存 样式 by 56770.WangLei
						If InStr(loopstr,"{@btn_buy}") > 0 Then
								tmpstr = ""
								if stock <= 0 then
										Select Case CInt(getGradePurview(17))
											   Case "1" : tmpstr=tmpstr & RLoadStyle(2)	'预定
											   Case "0" : tmpstr=tmpstr & RLoadStyle(3)	'零库存
										End Select
								else
										tmpstr=tmpstr & RLoadStyle(0)	'购买
								end If
								ReplaceStyle "listcode","0001",tmpstr
								ReplaceStyle "type","",tmpstr
								ReplaceStyle "isValid",getGradePurview(0),tmpstr
								ReplaceStyle "id",DataList(0,i),tmpstr
								ReplaceStyle "btn_buy",tmpstr,loopstr
						End If
						rem	}->
						rem	 收藏按钮 by 56770.WangLei
						If InStr(loopstr,"{@btn_fav}") > 0 Then
								tmpstr = ""
								tmpstr = RLoadStyle(1)	'收藏按钮
								ReplaceStyle "id",DataList(0,i),tmpstr
								ReplaceStyle "name",DataList(1,i),tmpstr
								ReplaceStyle "backurl",Urlencode(geturl()),tmpstr
								ReplaceStyle "type","",tmpstr
								ReplaceStyle "btn_fav",tmpstr,loopstr
						End If
						rem	}->
						ReplaceStyle "loop_num",i + 1,loopstr
						LoadListStr = LoadListStr & loopstr
						List_num = List_num + 1
                Next
		Else
				LoadListStr = LoadListStr & splits(LoadStyle(strFile&"2.style"))
		End If
		LoadListStr = LoadListStr & LoadStyle(strFile&"8.style")
		If showfootpage = 1 Then
				tmpstr = LoadStyle(strFile&"9.style")
				ReplaceStyle "footpage",ors.ShowPageFoot(Filename),tmpstr
				LoadListStr = LoadListStr & tmpstr
		End If
		LoadListStr = LoadListStr & LoadStyle(strFile&"10.style")
		LoadListStr = LoadListStr & "</form>"
		ProductList = LoadListStr
End Function
'..................................
'读取商品分类下属分类列表
'..................................
Function ProductListCategory()
        Dim rs,c_id,c_name,c_num,c_parentid,c_pic,c_pic_size,showsort_url,showpic_width,showpic_height, Getrows_error,rss,c_num_2,c_backurl,RLoadStyle(8),strFile,loopstr,loopstr_2,loopstr_3,LoadListStr, tmpstr,loop_tmpstr,c_foldername,c_filename
		If sort_parentid > 0 Then
	            Set rs=conn.Execute("Select c_foldername,c_filename,c_parentid,c_pronum,c_name"& LangTxt &",c_pic,c_pic_size from [Lebi_category] where c_id="& sort_parentid &" and is_hide=0")
				If rs.eof And rs.bof Then
		                c_id = rs(3)
						c_foldername = sort_foldername
						c_filename = sort_filename
						c_num = sort_num
						c_name = B_sort_name
						c_parentid = sort_parentid
						c_pic = sort_pic
						c_pic_size = sort_pic_size
				Else
						c_foldername = rs(0)
						c_filename = rs(1)
						c_parentid = rs(2)
						c_num = rs(3)
						c_id = sort_parentid
						c_name = rs(4)
						c_pic = rs(5)
						c_pic_size = rs(6)
		        End If
		        rs.close:Set rs=Nothing
		Else
				c_id = sort_id
				c_foldername = sort_foldername
				c_filename = sort_filename
				c_num = sort_num
				c_name = B_sort_name
				c_parentid = sort_parentid
				c_pic = sort_pic
				c_pic_size = sort_pic_size
		End If
		strFile = Eshop_url& style_folder &"Lebi.ProductListCategory."
		LoadListStr = LoadStyle(strFile&"0.style")
	    If sort_id<>"0" Then
				If show_html = 1 Or html_page = 1 Then
						showsort_url = Folder(2) & c_filename &".1."& Sys_Ext
				Else
						Select Case Config_Lebi_Eshop(16)
							   Case "0" : showsort_url = "showsort.asp?sort_id="&c_id
							   Case "1" : showsort_url = "category/"& c_foldername &"/"
							   Case "2" : showsort_url = "category/"& c_foldername &"/default.asp"
						End Select
				End If
				If trim(c_pic)<>"" Then
						showpic_width=Split(trim(c_pic_size),"|")(0)
						showpic_height=Split(trim(c_pic_size),"|")(1)
				End If
				If c_parentid <> 0 Then
						If show_html = 1 Or html_page = 1 Then
								c_backurl = Eshop_url & Folder(2) & c_filename &".1."& Sys_Ext
						Else
								Select Case ISAPI_Rewrite
									   Case "0"
											Select Case Config_Lebi_Eshop(16)
												   Case "0" : c_backurl = Eshop_url & LangPath &"showsort.asp?sort_id="& c_parentid
												   Case "1" : c_backurl = Eshop_url & LangPath &"category/"& c_foldername &"/"
												   Case "2" : c_backurl = Eshop_url & LangPath &"category/"& c_foldername &"/default.asp"
											End Select
									   Case "1" c_backurl = Eshop_url & LangPath &"category-"& c_foldername &".html"
								End Select
						End If
				End If
				RLoadStyle(1) = splits(LoadStyle(strFile&"1.style"))
				RLoadStyle(2) = splits(LoadStyle(strFile&"2.style"))
				RLoadStyle(3) = splits(LoadStyle(strFile&"3.style"))
				RLoadStyle(4) = splits(LoadStyle(strFile&"4.style"))
				RLoadStyle(5) = splits(LoadStyle(strFile&"5.style"))
				loopstr = RLoadStyle(1)
				If InStr(loopstr,"{@pic}") > 0 Then
						tmpstr = ""
						If c_pic <> "" Then
								tmpstr = RLoadStyle(2)
								ReplaceStyle "pic_url",c_pic,tmpstr
								ReplaceStyle "pic_width",showpic_width,tmpstr
								ReplaceStyle "pic_height",showpic_height,tmpstr
						End If
						ReplaceStyle "pic",tmpstr,loopstr
				End If
				ReplaceStyle "pro_qty",c_num,loopstr
				ReplaceStyle "id",c_id,loopstr
				If InStr(loopstr,"{@backurl}") > 0 Then
						tmpstr = ""
						if c_parentid <> 0 then
								tmpstr = RLoadStyle(3)
								ReplaceStyle "backurl",c_backurl,tmpstr
						End If
						ReplaceStyle "backurl",tmpstr,loopstr
						loopstr = Replace(loopstr,"//","/")
				End If
				ReplaceStyle "url",LangPath & showsort_url,loopstr
				ReplaceStyle "name",c_name,loopstr
				Select Case ISAPI_Rewrite
					   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& c_id,loopstr
					   Case "1" ReplaceStyle "xml",LangPath &"rss-"& c_id &".html",loopstr
				End Select
				LoadListStr = LoadListStr & loopstr
				Getrows_error = 0
				If Not IsArray(Application(cookiesname& LangTxt &c_id&"ProductListCategory_c")) Then
						Set rs=conn.execute("select c_id,c_name"& LangTxt &",c_pronum,c_pic,c_pic_size,c_foldername,c_filename from [Lebi_category] where c_parentid="& c_id &" and is_hide=0 order by c_order desc")
						If rs.eof And rs.bof Then
								Getrows_error = 1
						Else
								Getrows_error = 0
								Application(cookiesname& LangTxt &c_id&"ProductListCategory_c") = rs.getrows
						End If
						rs.close : Set rs = Nothing
				End If
				loopstr = ""
				If Getrows_error = 0 Then
						DataList = Application(cookiesname& LangTxt &c_id&"ProductListCategory_c")
						For i = 0 To UBound(DataList,2)
							If Not IsNull(Trim(DataList(1,i))) And Trim(DataList(1,i)) <> "" Then
								loopstr_2 = RLoadStyle(4)
								If show_html = 1 Or html_page = 1 Then
										showsort_url = Folder(2) & DataList(6,i) &".1."& Sys_Ext
								Else
										Select Case ISAPI_Rewrite
											   Case "0"
													Select Case Config_Lebi_Eshop(16)
														   Case "0" : showsort_url = "showsort.asp?sort_id="& DataList(0,i)
														   Case "1" : showsort_url = "category/"& DataList(5,i) &"/"
														   Case "2" : showsort_url = "category/"& DataList(5,i) &"/default.asp"
													End Select
											   Case "1" showsort_url = "category-"& DataList(5,i) &".html"
										End Select
								End If
								If trim(DataList(3,i))<>"" Then
										showpic_width=Split(trim(DataList(4,i)),"|")(0)
										showpic_height=Split(trim(DataList(4,i)),"|")(1)
								End If
								If InStr(loopstr_2,"{@pic}") > 0 Then
										tmpstr = ""
										If DataList(3,i) <> "" Then
												tmpstr = RLoadStyle(2)
												ReplaceStyle "pic_url",DataList(3,i),tmpstr
												ReplaceStyle "pic_width",showpic_width,tmpstr
												ReplaceStyle "pic_height",showpic_height,tmpstr
										End If
										ReplaceStyle "pic",tmpstr,loopstr_2
								End If
								ReplaceStyle "pro_qty",DataList(2,i),loopstr_2
								ReplaceStyle "id",DataList(0,i),loopstr_2
								ReplaceStyle "url",LangPath & showsort_url,loopstr_2
								ReplaceStyle "name",DataList(1,i),loopstr_2
								ReplaceStyle "loop_num",i + 1,loopstr_2
								Select Case ISAPI_Rewrite
									   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& DataList(0,i),loopstr_2
									   Case "1" ReplaceStyle "xml",LangPath &"rss-"& DataList(0,i) &".html",loopstr_2
								End Select
								If InStr(loopstr_2,"{@loop_smallcategory}") > 0 Then
										loop_tmpstr = ""
										Set rss = conn.execute("select c_id,c_name"& LangTxt &",c_pronum,c_foldername,c_filename from [Lebi_category] where c_parentid="& DataList(0,i) &" and is_hide=0 order by c_order desc")
										c_num_2 = 1
										Do While Not rss.eof
											If Not IsNull(Trim(rss(1))) And Trim(rss(1)) <> "" Then
												loopstr_3 = RLoadStyle(5)
												Select Case show_html
													   Case "1" : showsort_url = Folder(2) & rss(4) &".1."& Sys_Ext
													   Case "0" :
															Select Case ISAPI_Rewrite
																   Case "0"
																		Select Case Config_Lebi_Eshop(16)
																			   Case "0" : showsort_url = "showsort.asp?sort_id="& rss(0)
																			   Case "1" : showsort_url = "category/"& rss(3) &"/"
																			   Case "2" : showsort_url = "category/"& rss(3) &"/default.asp"
																		End Select
																   Case "1" showsort_url = "category-"& rss(3) &".html"
															End Select
												End Select
												ReplaceStyle "pro_qty",rss(2),loopstr_3
												ReplaceStyle "id",rss(0),loopstr_3
												ReplaceStyle "url",LangPath & showsort_url,loopstr_3
												ReplaceStyle "name",rss(1),loopstr_3
												Select Case ISAPI_Rewrite
													   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& rss(0),loopstr_3
													   Case "1" ReplaceStyle "xml",LangPath &"rss-"& rss(0) &".html",loopstr_3
												End Select
												ReplaceStyle "loop_num",c_num_2,loopstr_3
												c_num_2 = c_num_2 + 1
												loop_tmpstr = loop_tmpstr & loopstr_3
												rss.movenext
											End If 
										Loop
										rss.close : Set rss = Nothing
										ReplaceStyle "loop_smallcategory",loop_tmpstr,loopstr_2
								End If
								loopstr = loopstr & loopstr_2
							End If 
						Next
				End If
				ReplaceStyle "loop_category",loopstr,LoadListStr
		Else
				Dim Getrows_c_error,DataList,i
				Getrows_c_error=0
				If Not IsArray(Application(cookiesname& LangTxt &sort_id&"ProductListCategory")) Then
						Set rs=conn.execute("select c_id,c_name"& LangTxt &",c_pronum,c_foldername,c_filename from [Lebi_category] where c_father = 1 and is_hide=0 order by c_order desc")
						If rs.eof And rs.bof Then
								Getrows_c_error = 1
						Else
								Getrows_c_error = 0
								Application(cookiesname& LangTxt &sort_id&"ProductListCategory") = rs.getrows
						End If
						rs.close : Set rs = Nothing
				End If
				If Getrows_c_error = 0 Then
						RLoadStyle(6) = splits(LoadStyle(strFile&"6.style"))
						DataList = Application(cookiesname& LangTxt &sort_id&"ProductListCategory")
						For i = 0 To UBound(DataList,2)
							If Not IsNull(Trim(DataList(1,i))) And Trim(DataList(1,i)) <> "" Then
								loopstr = RLoadStyle(6)
								Select Case show_html
									   Case "1" : showsort_url = Folder(2) & DataList(4,i) &".1."& Sys_Ext
									   Case "0" :
											Select Case ISAPI_Rewrite
												   Case "0"
														Select Case Config_Lebi_Eshop(16)
															   Case "0" : showsort_url = "showsort.asp?sort_id="& DataList(0,i)
															   Case "1" : showsort_url = "category/"& DataList(3,i) &"/"
															   Case "2" : showsort_url = "category/"& DataList(3,i) &"/default.asp"
														End Select
												   Case "1" showsort_url = "category-"& DataList(3,i) &".html"
											End Select
								End Select
								ReplaceStyle "pro_qty",DataList(2,i),loopstr
								ReplaceStyle "id",DataList(0,i),loopstr
								ReplaceStyle "url",LangPath & showsort_url,loopstr
								ReplaceStyle "name",DataList(1,i),loopstr
								Select Case ISAPI_Rewrite
									   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& DataList(0,i),loopstr
									   Case "1" ReplaceStyle "xml",LangPath &"rss-"& DataList(0,i) &".html",loopstr
								End Select
								ReplaceStyle "loop_num",i + 1,loopstr
								LoadListStr = LoadListStr & loopstr
							End If 
						Next
				End If
	    End If
		ProductListCategory = LoadListStr & LoadStyle(strFile&"7.style")
End Function

Function ProductListCategory2()
        Dim rs,c_id,c_name,c_num,c_parentid,c_pic,c_pic_size,showsort_url,showpic_width,showpic_height, Getrows_error,rss,c_num_2,c_backurl,RLoadStyle(8),strFile,loopstr,loopstr_2,loopstr_3,LoadListStr, tmpstr,loop_tmpstr,c_foldername,c_filename
		If sort_parentid > 0 Then
	            Set rs=conn.Execute("Select c_foldername,c_filename,c_parentid,c_pronum,c_name"& LangTxt &" from [Lebi_category] where c_id="& sort_parentid &" and is_hide=0")
				'Set rs=conn.Execute("Select c_foldername,c_filename,c_parentid,c_pronum,c_name"& LangTxt &" from [Lebi_category] where c_id="& sort_id &" and is_hide=0")
				If rs.eof And rs.bof Then
		                c_id = rs(3)
						c_foldername = sort_foldername
						c_filename = sort_filename
						c_num = sort_num
						c_name = B_sort_name
						c_parentid = sort_parentid
				Else
						c_foldername = rs(0)
						c_filename = rs(1)
						c_parentid = rs(2)
						c_num = rs(3)
						c_id = sort_id 'sort_parentid
						c_name = rs(4)
		        End If
		        rs.close:Set rs=Nothing
		Else
				c_id = sort_id
				c_foldername = sort_foldername
				c_filename = sort_filename
				c_num = sort_num
				c_name = B_sort_name
				c_parentid = sort_parentid
		End If
		strFile = Eshop_url& style_folder &"Lebi.ProductListCategory."
		LoadListStr = LoadStyle(strFile&"0.style")
	    If sort_id<>"0" Then
				If show_html = 1 Or html_page = 1 Then
						showsort_url = Folder(2) & c_filename &".1."& Sys_Ext
				Else
						Select Case Config_Lebi_Eshop(16)
							   Case "0" : showsort_url = "showsort.asp?sort_id="&sort_id
							   Case "1" : showsort_url = "category/"& sort_foldername &"/"
							   Case "2" : showsort_url = "category/"& sort_foldername &"/default.asp"
						End Select
				End If
				If trim(c_pic)<>"" Then
						showpic_width=Split(trim(c_pic_size),"|")(0)
						showpic_height=Split(trim(c_pic_size),"|")(1)
				End If
				If c_parentid <> 0 Then
						If show_html = 1 Or html_page = 1 Then
								c_backurl = Eshop_url & Folder(2) & c_filename &".1."& Sys_Ext
						Else
								Select Case ISAPI_Rewrite
									   Case "0"
											Select Case Config_Lebi_Eshop(16)
												   Case "0" : c_backurl = Eshop_url & LangPath &"showsort.asp?sort_id="& c_parentid
												   Case "1" : c_backurl = Eshop_url & LangPath &"category/"& c_foldername &"/"
												   Case "2" : c_backurl = Eshop_url & LangPath &"category/"& c_foldername &"/default.asp"
											End Select
									   Case "1" c_backurl = Eshop_url & LangPath &"category-"& c_foldername &".html"
								End Select
						End If
				End If
				RLoadStyle(1) = splits(LoadStyle(strFile&"1.style"))
				RLoadStyle(2) = splits(LoadStyle(strFile&"2.style"))
				RLoadStyle(3) = splits(LoadStyle(strFile&"3.style"))
				RLoadStyle(4) = splits(LoadStyle(strFile&"4.style"))
				RLoadStyle(5) = splits(LoadStyle(strFile&"5.style"))
				loopstr = RLoadStyle(1)
				If InStr(loopstr,"{@pic}") > 0 Then
						tmpstr = ""
						If DataList(3,i) <> "" Then
								tmpstr = RLoadStyle(2)
								ReplaceStyle "pic_url",DataList(3,i),tmpstr
								ReplaceStyle "pic_width",showpic_width,tmpstr
								ReplaceStyle "pic_height",showpic_height,tmpstr
						End If
						ReplaceStyle "pic",tmpstr,loopstr
				End If
				ReplaceStyle "pro_qty",c_num,loopstr
				ReplaceStyle "id",c_id,loopstr
				If InStr(loopstr,"{@backurl}") > 0 Then
						tmpstr = ""
						if c_parentid <> 0 then
								tmpstr = RLoadStyle(3)
								ReplaceStyle "backurl",c_backurl,tmpstr
						End If
						ReplaceStyle "backurl",tmpstr,loopstr
						loopstr = Replace(loopstr,"//","/")
				End If
				ReplaceStyle "url",LangPath & showsort_url,loopstr
				ReplaceStyle "name",sort_name,loopstr
				Select Case ISAPI_Rewrite
					   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& c_id,loopstr
					   Case "1" ReplaceStyle "xml",LangPath &"rss-"& c_id &".html",loopstr
				End Select
				LoadListStr = LoadListStr & loopstr
				Getrows_error = 0
				If Not IsArray(Application(cookiesname& LangTxt &c_id&"ProductListCategory2_c")) Then
						Set rs=conn.execute("select c_id,c_name"& LangTxt &",c_pronum,c_pic,c_pic_size,c_foldername,c_filename from [Lebi_category] where c_parentid="& c_id &" and is_hide=0 order by c_order desc")
						If rs.eof And rs.bof Then
								Getrows_error = 1
						Else
								Getrows_error = 0
								Application(cookiesname& LangTxt &c_id&"ProductListCategory2_c") = rs.getrows
						End If
						rs.close : Set rs = Nothing
				End If
				loopstr = ""
				If Getrows_error = 0 Then
						DataList = Application(cookiesname& LangTxt &c_id&"ProductListCategory2_c")
						For i = 0 To UBound(DataList,2)
								loopstr_2 = RLoadStyle(4)
								If show_html = 1 Or html_page = 1 Then
										showsort_url = Folder(2) & DataList(6,i) &".1."& Sys_Ext
								Else
										Select Case ISAPI_Rewrite
											   Case "0"
													Select Case Config_Lebi_Eshop(16)
														   Case "0" : showsort_url = "showsort.asp?sort_id="& DataList(0,i)
														   Case "1" : showsort_url = "category/"& DataList(5,i) &"/"
														   Case "2" : showsort_url = "category/"& DataList(5,i) &"/default.asp"
													End Select
											   Case "1" showsort_url = "category-"& DataList(5,i) &".html"
										End Select
								End If
								If trim(DataList(3,i))<>"" Then
										showpic_width=Split(trim(DataList(4,i)),"|")(0)
										showpic_height=Split(trim(DataList(4,i)),"|")(1)
								End If
								If InStr(loopstr_2,"{@pic}") > 0 Then
										tmpstr = ""
										If DataList(3,i) <> "" Then
												tmpstr = RLoadStyle(2)
												ReplaceStyle "pic_url",c_pic,tmpstr
												ReplaceStyle "pic_width",showpic_width,tmpstr
												ReplaceStyle "pic_height",showpic_height,tmpstr
										End If
										ReplaceStyle "pic",tmpstr,loopstr_2
								End If
								ReplaceStyle "pro_qty",DataList(2,i),loopstr_2
								ReplaceStyle "id",DataList(0,i),loopstr_2
								ReplaceStyle "url",LangPath & showsort_url,loopstr_2
								ReplaceStyle "name",DataList(1,i),loopstr_2
								ReplaceStyle "loop_num",i + 1,loopstr_2
								Select Case ISAPI_Rewrite
									   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& DataList(0,i),loopstr_2
									   Case "1" ReplaceStyle "xml",LangPath &"rss-"& DataList(0,i) &".html",loopstr_2
								End Select
								If InStr(loopstr_2,"{@loop_smallcategory}") > 0 Then
										loop_tmpstr = ""
'										Set rss = conn.execute("select c_id,c_name"& LangTxt &",c_pronum,c_foldername,c_filename from [Lebi_category] where c_parentid="& DataList(0,i) &" and is_hide=0 order by c_order desc")
'										c_num_2 = 1
'										Do While Not rss.eof
'												loopstr_3 = RLoadStyle(5)
'												Select Case show_html
'													   Case "1" : showsort_url = Folder(2) & rss(4) &".1."& Sys_Ext
'													   Case "0" :
'															Select Case ISAPI_Rewrite
'																   Case "0"
'																		Select Case Config_Lebi_Eshop(16)
'																			   Case "0" : showsort_url = "showsort.asp?sort_id="& rss(0)
'																			   Case "1" : showsort_url = "category/"& rss(3) &"/"
'																			   Case "2" : showsort_url = "category/"& rss(3) &"/default.asp"
'																		End Select
'																   Case "1" showsort_url = "category-"& rss(3) &".html"
'															End Select
'												End Select
'												ReplaceStyle "pro_qty",rss(2),loopstr_3
'												ReplaceStyle "id",rss(0),loopstr_3
'												ReplaceStyle "url",LangPath & showsort_url,loopstr_3
'												ReplaceStyle "name",rss(1),loopstr_3
'												Select Case ISAPI_Rewrite
'													   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& rss(0),loopstr_3
'													   Case "1" ReplaceStyle "xml",LangPath &"rss-"& rss(0) &".html",loopstr_3
'												End Select
'												ReplaceStyle "loop_num",c_num_2,loopstr_3
'												c_num_2 = c_num_2 + 1
'												loop_tmpstr = loop_tmpstr & loopstr_3
'												rss.movenext
'										Loop
'										rss.close : Set rss = Nothing
										ReplaceStyle "loop_smallcategory",loop_tmpstr,loopstr_2
								End If
								loopstr = loopstr & loopstr_2
						Next
				End If
				ReplaceStyle "loop_category",loopstr,LoadListStr
		Else
				Dim Getrows_c_error,DataList,i
				Getrows_c_error=0
				If Not IsArray(Application(cookiesname& LangTxt &sort_id&"ProductListCategory2")) Then
						Set rs=conn.execute("select c_id,c_name"& LangTxt &",c_pronum,c_foldername,c_filename from [Lebi_category] where c_father = 1 and is_hide=0 order by c_order desc")
						If rs.eof And rs.bof Then
								Getrows_c_error = 1
						Else
								Getrows_c_error = 0
								Application(cookiesname& LangTxt &sort_id&"ProductListCategory2") = rs.getrows
						End If
						rs.close : Set rs = Nothing
				End If
				If Getrows_c_error = 0 Then
						RLoadStyle(6) = splits(LoadStyle(strFile&"6.style"))
						DataList = Application(cookiesname& LangTxt &sort_id&"ProductListCategory2")
						For i = 0 To UBound(DataList,2)
								loopstr = RLoadStyle(6)
								Select Case show_html
									   Case "1" : showsort_url = Folder(2) & DataList(4,i) &".1."& Sys_Ext
									   Case "0" :
											Select Case ISAPI_Rewrite
												   Case "0"
														Select Case Config_Lebi_Eshop(16)
															   Case "0" : showsort_url = "showsort.asp?sort_id="& DataList(0,i)
															   Case "1" : showsort_url = "category/"& DataList(3,i) &"/"
															   Case "2" : showsort_url = "category/"& DataList(3,i) &"/default.asp"
														End Select
												   Case "1" showsort_url = "category-"& DataList(3,i) &".html"
											End Select
								End Select
								ReplaceStyle "pro_qty",DataList(2,i),loopstr
								ReplaceStyle "id",DataList(0,i),loopstr
								ReplaceStyle "url",LangPath & showsort_url,loopstr
								ReplaceStyle "name",DataList(1,i),loopstr
								Select Case ISAPI_Rewrite
									   Case "0" ReplaceStyle "xml",PagePath(11) &"?sort_id="& DataList(0,i),loopstr
									   Case "1" ReplaceStyle "xml",LangPath &"rss-"& DataList(0,i) &".html",loopstr
								End Select
								ReplaceStyle "loop_num",i + 1,loopstr
								LoadListStr = LoadListStr & loopstr
						Next
				End If
	    End If
		ProductListCategory2 = LoadListStr & LoadStyle(strFile&"7.style")
End Function
'..................................
'读取商品分类 特价 列表
's_type 0 新品 1 人气 2 热卖 3 推荐 4 促销
's_cutnumber 截取商品名称长度
'..................................
Function ProductListShow(s_type,s_topnum,s_cutnumber)
		Dim strFile,RLoadStyle
		strFile = Eshop_url& style_folder &"Lebi.ProductListShow."
        Dim rs,sql,s_order,topnum,Getrows_ProductListShow_error,Getrows_ProductListShow,ProductListShow_i
		s_type = checknum(s_type,0) : s_topnum = checknum(s_topnum,10) : s_cutnumber = checknum(s_cutnumber,12) : sort_id = checknum(sort_id,0)
	    Select Case s_type
	           Case "0" : s_order=" and IsNew = 1 order by p_order desc,sj desc,id desc"
               Case "1" : s_order=" order by views desc,id desc"
               Case "2" : s_order=" order by buys desc,id desc"
               Case "3" : s_order=" and (ytj=1 or stj=1) order by p_order desc,id desc"
	           Case "4" : s_order=" and cx=1 order by p_order desc,id desc"
			   Case Else
						s_order=" order by p_order desc,id desc"
	    End Select
        ProductListShow = LoadStyle(strFile&"0.style")
		If Not IsArray(Application(cookiesname&"ProductListShow"& LangTxt &s_type&s_cutnumber&sort_id)) Then
                sql="select top "& s_topnum &" product_name"& LangTxt &",id,p_filename from [Lebi_product] where zhuangtai=1"
                if sort_id<>"0" And IsSqlDataBase ="1" then sql=sql+" and CharIndex(',"& sort_id &",',categoryid)>0"
	            if sort_id<>"0" And IsSqlDataBase ="0" then sql=sql+" and instr(categoryid,',"& sort_id &",')>0"
                sql=sql+s_order
                set Rs = conn.execute(sql)
                if rs.eof And rs.bof Then
		                Getrows_ProductListShow_error = 1
                        ProductListShow = ProductListShow & splits(LoadStyle(strFile&"1.style"))
                Else
		                Getrows_ProductListShow_error = 0
		        		Application(cookiesname&"ProductListShow"& LangTxt &s_type&s_cutnumber&sort_id) = rs.getrows
		        End If
		        rs.close : Set rs = Nothing
		End If
        If Getrows_ProductListShow_error = 0 Then
				RLoadStyle = LoadStyle(strFile&"2.style")
		        Getrows_ProductListShow = Application(cookiesname&"ProductListShow"& LangTxt &s_type&s_cutnumber&sort_id)
		        For ProductListShow_i = 0 To UBound(Getrows_ProductListShow,2)
					Dim LoadPLShow,ProductListShow_url
					If Not IsNull(Trim(Getrows_ProductListShow(0,ProductListShow_i))) And Trim(Getrows_ProductListShow(0,ProductListShow_i)) <> "" Then
		                Select Case show_html
		                       Case "0"
									Select Case ISAPI_Rewrite
										   Case "0" ProductListShow_url=Eshop_url & PagePath(10) &"?id="& Getrows_ProductListShow(1,ProductListShow_i)
										   Case "1" ProductListShow_url=Eshop_url & LangPath &"product-"& Getrows_ProductListShow(1,ProductListShow_i) &".html"
									End Select
		                       Case "1" : ProductListShow_url=Eshop_url & LangPath & Folder(0) & Getrows_ProductListShow(2,ProductListShow_i) &".1."& Sys_Ext
		                End Select
						LoadPLShow = RLoadStyle
						ReplaceStyle "url",ProductListShow_url,LoadPLShow
						ReplaceStyle "name",Getrows_ProductListShow(0,ProductListShow_i),LoadPLShow
						ReplaceStyle "target",Config_Lebi_Eshop(9),LoadPLShow
						ReplaceStyle "cut_name",Cutchar(Getrows_ProductListShow(0,ProductListShow_i),s_cutnumber),LoadPLShow
						ReplaceStyle "loop_num",ProductListShow_i+1,LoadPLShow
						ProductListShow = ProductListShow & LoadPLShow
					End If 
                Next
        End If
	    ProductListShow = ProductListShow & LoadStyle(strFile&"3.style")
End Function

Function SelectValue()
		IsSelectType = 0
		IsSelectValue = 0
		SelectValue = "<ul class=""selectvalue"">"
		SelectValue = SelectValue &"<li><label class=""select_name""><span>"& Lebi_pro(83) &"：</span></label><label class=""select_value""><a href="""& UnionUrl("_0","brand=") &""" class=""selectall"">"& Lebi_pro(16) &"</a>"
		sql = "select brand"& LangTxt &" from [lebi_brand] "
		if sort_id<>"0" And IsSqlDataBase ="1" then sql = sql &" where (CharIndex(',"& sort_id &",',b_class)>0 or CharIndex(',,',b_class)>0)"
		if sort_id<>"0" And IsSqlDataBase ="0" then sql = sql &" where (instr(b_class,',"& sort_id &",')>0 or instr(b_class,',,')>0)"
		sql = sql &" order by paixu DESC"
		set Rs = conn.execute(sql)
		If Not rs.eof Then 
			Do while not rs.eof
			If Not IsNull(Trim(rs(0))) And Trim(rs(0)) <> "" Then
				SelectValue = SelectValue &"<a href='"& paramurl(GetPageURL(pagename,"brand",urlencode(rs(0)))) &"'"
				If InStr(brand,rs(0)) > 0 Then SelectValue = SelectValue &" class=""selectone"""
				SelectValue = SelectValue &">"&rs(0)&"</a>"
			End If 
			rs.movenext
			Loop 
		End If 
		rs.Close:set rs=Nothing
		SelectValue = SelectValue &"</label></li>"
		sql = "select s_id from [Lebi_SelectType]"
		if sort_id<>"0" And IsSqlDataBase ="1" then sql = sql&" where CharIndex(',"& sort_id &",',categoryid)>0"
		if sort_id<>"0" And IsSqlDataBase ="0" then sql = sql&" where instr(categoryid,',"& sort_id &",')>0"
		sql = sql&" order by s_order desc"
		Set rs = conn.execute(sql)
		If Not rs.eof Then 
			IsSelectType = 1
			DataSelectType = rs.getrows()
		End If 
		rs.close : Set rs = Nothing 
		If IsSelectType = 1 Then 
			For i = 0 To UBound(DataSelectType,2)
				SelectTypeId = SelectTypeId & DataSelectType(0,i)
				If i < UBound(DataSelectType,2) Then SelectTypeId = SelectTypeId & ","
			Next 
			sql = "select s_name"& LangTxt &",s_id,s_name from [Lebi_SelectName] where s_mode = 0 and typeid in("& SelectTypeId &") order by s_order desc"
			Set rs = conn.execute(sql)
			If Not rs.eof Then 
				IsSelectName = 1
				DataSelectName = rs.getrows()
			End If 
			rs.close : Set rs = Nothing 
			If IsSelectName = 1 Then 
			For n = 0 To UBound(DataSelectName,2)
			SelectValue = SelectValue &"<li><label class=""select_name""><span>"& DataSelectName(0,n) &"：</span></label><label class=""select_value""><a href="""& paramurl(UnionUrl(DataSelectName(2,n) &"_0","")) &""" class=""selectall"">"& Lebi_pro(16) &"</a>"
			sql = "select s_value"& LangTxt &",id from [Lebi_SelectValue] where s_id = "& DataSelectName(1,n) &" order by s_order desc"
			Set rs = conn.execute(sql)
			If Not rs.eof Then 
				IsSelectValue = 1
				DataSelectValue = rs.getrows()
			End If 
			rs.close : Set rs = Nothing 
			If IsSelectValue = 1 Then 
			For v = 0 To UBound(DataSelectValue,2)
				If Not IsNull(Trim(DataSelectValue(0,v))) And Trim(DataSelectValue(0,v)) <> "" Then
					SelectValue = SelectValue &"<a href="""& paramurl(UnionUrl(DataSelectName(2,n)&"_"& DataSelectValue(1,v),"")) &""""
					If InStr(value,DataSelectName(2,n) &"_"& DataSelectValue(1,v)) > 0 Then SelectValue = SelectValue &" class=""selectone"""
					SelectValue = SelectValue &">"& DataSelectValue(0,v) &"</a>"
				End If 
			Next 
			End If 
			SelectValue = SelectValue &"</label></li>"
			Next 
			End If 
		End If 
		SelectValue = SelectValue &"</ul>"
End Function 

Function UnionUrl(param,param2)
		If param = "" Then Exit Function 
		If sort_id = 0 Then sort_foldername = 0
		Select Case Config_Lebi_Eshop(16)
			  Case "0" : url = Eshop_url & LangPath &"showsort.asp?sort_id="& sort_id
			  Case "1" : url = Eshop_url & LangPath &"category/"& sort_foldername &"/"
			  Case "2" : url = Eshop_url & LangPath &"category/"& sort_foldername &"/default.asp"
		End Select
		If Split(param,"_")(1) = "0" Then 
				If InStr(value,"|") > 0 Then 
						arr_value = Split(value,"|")
						paramorder = GetArrayOrder(param)
						If paramorder > -1 Then
								For i = 0 To paramorder-1
										new_param = new_param & arr_value(i) &"|"
								Next 
								new_param = new_param & param
								For i = paramorder+1 To UBound(arr_value)
										new_param = new_param &"|"& arr_value(i)
								Next 
								param = new_param
						Else
								If value <> "" Then 
										param = value &"|"& param
								Else
										param = param
								End If 
						End If 
				Else 
						param = ""
				End If 
		Else 
				If InStr(value,"|") > 0 Then 
						arr_value = Split(value,"|")
						paramorder = GetArrayOrder(param)
						If paramorder > -1 Then 
								For i = 0 To paramorder-1
										new_param = new_param & arr_value(i) &"|"
								Next 
								new_param = new_param & param
								For i = paramorder+1 To UBound(arr_value)
										new_param = new_param &"|"& arr_value(i)
								Next 
								param = new_param
						Else
								If value <> "" Then 
										param = value &"|"& param
								Else
										param = param
								End If 
						End If 
				Else 
						paramorder = GetArrayOrder(param)
						If paramorder > -1 Then 
								If value <> "" Then 
										If CStr(Split(value,"_")(0)) = CStr(Split(param,"_")(0)) Then 
												param = param
										Else 
												param = value &"|"& param
										End If 
								Else
										param = param
								End If 
						Else 
								param = value &"|"& param
						End If 
'						If value <> "" Then param = value &"|"& param
				End If 
		End If 
'		If listtype <> "" Then 
'				If InStr(url,"?") > 0 Then 
'						url = url &"&listtype="& listtype
'				Else
'						url = url &"?listtype="& listtype
'				End If 
'		End If 
'		If listprice <> "" Then 
'				If InStr(url,"?") > 0 Then 
'						url = url &"&listprice="& listprice
'				Else
'						url = url &"?listprice="& listprice
'				End If 
'		End If 
'		If listview <> "" Then 
'				If InStr(url,"?") > 0 Then 
'						url = url &"&listview="& listview
'				Else
'						url = url &"?listview="& listview
'				End If 
'		End If 
'		If listbuy <> "" Then 
'				If InStr(url,"?") > 0 Then 
'						url = url &"&listbuy="& listbuy
'				Else
'						url = url &"?listbuy="& listbuy
'				End If 
'		End If 
'		If listtime <> "" Then 
'				If InStr(url,"?") > 0 Then 
'						url = url &"&listtime="& listtime
'				Else
'						url = url &"?listtime="& listtime
'				End If 
'		End If 
'		If sle_type <> 0 Then 
'				If InStr(url,"?") > 0 Then 
'						url = url &"&sle_type="& sle_type
'				Else
'						url = url &"?sle_type="& sle_type
'				End If 
'		End If 
'		If brand <> "" Then 
'				If InStr(url,"?") > 0 Then 
'						url = url &"&brand="& brand
'				Else
'						url = url &"?brand="& brand
'				End If 
'		End If 
		If InStr(url,param2) = 0 Then 
				If InStr(url,"?") > 0 Then 
						url = url &"&"& param2
				Else
						url = url &"?"& param2
				End If 
		End If 
		If InStr(url,"?") > 0 Then 
				UnionUrl = url &"&value="& server.urlencode(param)
		Else
				UnionUrl = url &"?value="& server.urlencode(param)
		End If 
'		If param2 = "brand=" Then 
'				arr_param2 = Split(UnionUrl,param2)
'				UnionUrl = arr_param2(0)&"&brand="
'				If InStr(arr_param2(1),"&") > 0 Then UnionUrl = UnionUrl &"&"& Split(arr_param2(1),"&")(1)
'		End If 
End Function 

Function GetArrayOrder(param)
		GetArrayOrder = -1
		If InStr(value,"|") > 0 Then 
				arr_value = Split(value,"|")
				For i = 0 To UBound(arr_value)
						If InStr(arr_value(i),Split(param,"_")(0) &"_") > 0 Then 
								GetArrayOrder = i
								Exit Function 
						End If 
				Next 
		Else
				GetArrayOrder = 0
		End If 
End Function 
%>