<%
'**************************************
'* 最后更新 2010-09-18 by 56770.Kingdge
'* 最后更新 2008-5-9 by 56770.WangLei
'* Copyright www.56770.com
'**************************************
Showpath = "<a href='"& Eshop_url & LangPath &"'>"& Lebi_word(0) &"</a> → "& Lebi_word(17)
Dim page : page = checknum(request("page"),1)
'..................................
'读取积分换购 商品列表
'动态页调用模块
'..................................
Public Function GiftList(showheadpage,showfootpage)
        Dim LoadGiftList,LoopGiftList,loop_gift,DataCount,DataList,i,Filename,RLoadStyle(5),strFile,skin_ys,tmpstr,loopstr,stock,PList_url,icostr,List_num,LoadListStr
        showheadpage = checknum(showheadpage,0) : showfootpage = checknum(showfootpage,0)
	    Dim ors
	    Set ors=new Cls_vbsPage
	    Set ors.Conn=conn
	    With ors
		    .PageSize=10
		    .PageName="Page"
			If IsSqlDataBase = 0 Then
		            .DbType="AC"
			Else
			        .DbType="MSSQL"
			End If
		    .RecType=0
		    .Pkey="id"
    	    .Field="id,product_name"& LangTxt &",pic,cpic,jifen,kucun,p_weight,endtime,info"& LangTxt &""
		    .Table="[Lebi_vipproduct]"
			if IsSqlDataBase ="1" then .Condition="datediff(d,endtime,"&sqlnowstring&")<=0"
            if IsSqlDataBase ="0" then .Condition="datediff('d',endtime,"&sqlnowstring&")<=0"
            .OrderBy="addtime desc"
	    End With
	    DataCount=ors.RecCount()
	    DataList=ors.ResultSet()
		strFile = Eshop_url& Style_Folder &"Lebi.GiftList."
		RLoadStyle(0) = splits(LoadStyle(strFile&"9.style"))
		RLoadStyle(3) = splits(LoadStyle(strFile&"10.style"))
		LoadListStr = LoadStyle(strFile&"0.style")
		If show_html = 0 Then
                Filename = "default.asp"
		Else
				Filename = Eshop_url & LangPath & Folder(7) &"list"
		End If
		If showheadpage = 1 Then
				tmpstr = LoadStyle(strFile&"1.style")
				ReplaceStyle "headpage",ors.ShowPageHead(Filename),tmpstr
				LoadListStr = LoadListStr & tmpstr
		End If
		If DataCount >0 Then
				LoadListStr = LoadListStr & splits(LoadStyle(strFile&"3.style")) & LoadStyle(strFile&"4.style")
				RLoadStyle(4) = splits(LoadStyle(strFile&"5.style"))
				For i = 0 To Ubound(DataList,2)
						loopstr = RloadStyle(4)
						If Trim(DataList(3,i))<>"" Then
								tmpstr = ""
								If show_mouse = "0" Then
										tmpstr = " onMouseover=""javascript:ddrivetip('<img src="& Eshop_url & DataList(3,i) &" width="& pic_dw &">', '#ffffff', '"& pic_dw &"')"" onMouseout=""hideddrivetip()"""
								End If
								ReplaceStyle "onmouse",tmpstr,loopstr
						End If
						ReplaceStyle "url",DataList(3,i),loopstr
						ReplaceStyle "name",DataList(1,i),loopstr
						ReplaceStyle "pic_url",DataList(2,i),loopstr
						ReplaceStyle "target",Config_Lebi_Eshop(9),loopstr
						ReplaceStyle "pic_width",pic_xw,loopstr
						ReplaceStyle "pic_height",pic_xh,loopstr
						ReplaceStyle "gift_pic_src",Eshop_url&DataList(2,i),loopstr
						ReplaceStyle "div_width",pic_xw+10,loopstr
						ReplaceStyle "point",DataList(4,i),loopstr
						ReplaceStyle "stock",DataList(5,i),loopstr
						ReplaceStyle "weight",DataList(6,i),loopstr
						ReplaceStyle "content",DataList(8,i),loopstr
						ReplaceStyle "over_time",DataList(7,i),loopstr
						If InStr(loopstr,"{@btn_buy}") > 0 Then
								tmpstr = ""
								if DataList(5,i) <= 0 then
										tmpstr=tmpstr & RLoadStyle(3)	'零库存
								else
										tmpstr=tmpstr & RLoadStyle(0)	'购买
										ReplaceStyle "url",Eshop_url & PagePath(24) &"?action=GiftBuy&id="&DataList(0,i),tmpstr
								end If
								ReplaceStyle "btn_buy",tmpstr,loopstr
						End If
						ReplaceStyle "loop_num",i + 1,loopstr
						LoadListStr = LoadListStr & loopstr
        		Next
		Else
				LoadListStr = LoadListStr & splits(LoadStyle(strFile&"2.style"))
		End If
		LoadListStr = LoadListStr & LoadStyle(strFile&"6.style")
		If showfootpage = 1 Then
				tmpstr = LoadStyle(strFile&"7.style")
				ReplaceStyle "footpage",ors.ShowPageFoot(Filename),tmpstr
				LoadListStr = LoadListStr & tmpstr
		End If
		LoadListStr = LoadListStr & LoadStyle(strFile&"8.style")
	   	GiftList = LoadListStr
End Function
%>