<!--#include file="inc/Encrypt.jsp"-->
<%

Function InterceptString(txt,length)
	dim x,y,ii
	txt=trim(txt)
	x = len(txt)
	y = 0
	if x >= 1 then
		for ii = 1 to x
			if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是汉字
				y = y + 2
			else
				y = y + 1
			end if
			if clng(y)>=clng(length) then
				txt = left(trim(txt),ii) '字符串限长
				InterceptString = txt 
				exit for
			else
				InterceptString = txt
			end if
		next
		
	else
		InterceptString = ""
	end if
End Function


'首页调用商城最新商品,以文字显示,
sub ShowIndexNewProduct(ShowNum)
set rsNewProduct = conn.execute("select top "&ShowNum&" id,mc,xt from chanpin where xt<>'xt.gif' and cang=0 and tuijian=1 order by id desc")
if not rsNewProduct.eof then
  do while not rsNewProduct.eof
    strNewProduct=strNewProduct & "<DD>" & vbcrlf
    strNewProduct=strNewProduct & "<a href=""shop/goodsinfo.jsp?id="&encode( rsNewProduct("id"))&""" target=""_blank"">" & vbcrlf
    strNewProduct=strNewProduct & InterceptString(rsNewProduct("mc"),22)&"</a>" & vbcrlf
    strNewProduct=strNewProduct & "</DD>"
	rsNewProduct.movenext
    loop
else
    strNewProduct=strNewProduct & "<DD>" & vbcrlf
    strNewProduct=strNewProduct & "还没有商品！"
    strNewProduct=strNewProduct & "</DD>"
end if
rsNewProduct.close
set rsNewProduct=nothing
response.write strNewProduct
end sub
%>