<!-- #Include File="Skin.asp" -->
<!-- #Include File="Cls_Class.asp" -->
<!-- #Include File="Cls_Public.asp" -->
<!-- #Include File="Inc_pay.asp" -->
<!-- #Include File="Inc_md5.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

Dim ViewData			'浏览数据数组
Dim iSpecialID
iSpecialID = Cls.Code_ID("ID")

'//* 载入频道数据分类 *//
Public Sub Channel_Load(LoadType)
    Call Channel_Loader()
    Call ShopChannelOption()
	Call Cid_Load()
	Call Class_Load()
	If LoadType = 0 Then
	   Call DoWebHead(0,0)
	ElseIf LoadType = 1 Then
	   Call DoWebHead(2,1)
	End If
End Sub

'//* 释放频道数据分类 *//
Public Sub Channel_End(Endtype)
	If IsArray(ViewData) Then Erase ViewData
	Call Class_End()
	If Endtype=0 Then Call DoWebEnd()
End Sub

'//* 频道数据分类并跳转网页 *//
Public Sub Channel_Redirect(frvar)
	Call Channel_End(0)
	Call Format_Redirect(frvar)
End Sub

Dim v_id,v_name,v_tcolor,v_serial,v_brand,v_stock,v_Brief,v_remark, v_pic,v_counter,v_buy_counter,v_hidden,v_isgood,v_tim,v_Price_Market,v_cod,v_keyes,p_price,v_discount,v_is_emoney,v_emoney,v_Stocks,v_con_integral,v_con_emoney,v_price,v_price_now,v_Price_Origina,tmp_err,tmp_commend,v_file,v_StocksName
Dim iSpecialTopic, iSpecialRemark, iSpecialTim
Dim StrDownLoadUrl,DownLoadUrl,UrlID
Dim Dim_Shop,val_name,val_unit,val_carry,val_emoney_carry

'//* 频道数据参数设置读取 *//
Public Sub ShopChannelOption()
	dim_Shop=split(Cls.ChannelOption,"|")
	val_name=dim_Shop(0)
	val_unit=dim_Shop(1)
	val_carry=dim_Shop(4)
	val_emoney_carry=dim_Shop(5)
End Sub

Public Function ShowChannelIndex(IsHtml)
        Tit=Cls.ChannelName:tit_fir=""
		Tit_Dir = "频道首页"
        HtmlContent = Cls.ReadTemplate(0)
        Call LoadChannelMainList(0)
		Call LoadChannelSort(0,0)
		Call LoadChannelSearch()
		Call LoadChannelSpecial()
		HtmlContent = Html.ReadWebHead(HtmlContent)
		HtmlContent = Html.ReadWebEnd(HtmlContent)
		HtmlContent = Html.ReadUserLogin(HtmlContent)
		HtmlContent = Html.ReadShopList(HtmlContent)
		HtmlContent = Html.ReadShopPic(HtmlContent)
		HtmlContent = Html.ReadShopPic2(HtmlContent)
		HtmlContent = Html.ReadMoviePic(HtmlContent)
		HtmlContent = Html.ReadFlashPic(HtmlContent)
		HtmlContent = Html.ReadCast(HtmlContent)
		HtmlContent = Html.ReadVote(HtmlContent)
		HtmlContent = Html.ReadChannelMenu(HtmlContent)
		HtmlContent = Cls.ReHtml(HtmlContent,0)
		If IsHtml=True Then
		ShowChannelIndex = HtmlContent
		Else
		Response.Write HtmlContent
		End If
End Function

Public Function ShowChannelLists(IsHtml,ClsID)
		tit=Cls.ChannelTit&"列表"
	    Tit_Dir = Class_Grade(ClsID,Cls.ClassDepth) & Tit
	    tit_fir=Cls.ChannelName
		IndexUrl=Cls.Web_Dir & Cls.ChannelDir
		HtmlContent = Cls.ReadTemplate(2)
        Call LoadChannelMainList(ClsID)
		Call LoadChannelSort(ClsID,0)
		Call LoadChannelSearch()
		Call LoadChannelSpecial()
		Call Html.LoadReplaced()		
 		HtmlContent = Html.ReadWebHead(HtmlContent)
		HtmlContent = Html.ReadWebEnd(HtmlContent)
		HtmlContent = Html.ReadUserLogin(HtmlContent)
		HtmlContent = Html.ReadShopList(HtmlContent)
		HtmlContent = Html.ReadShopPic(HtmlContent)
		HtmlContent = Html.ReadShopPic2(HtmlContent)
		HtmlContent = Html.ReadCast(HtmlContent)
		HtmlContent = Html.ReadChannelMenu(HtmlContent)
		HtmlContent = Cls.ReHtml(HtmlContent,0)	
 		If IsHtml=True Then
		ShowChannelLists = HtmlContent
		Else
		Response.Write HtmlContent
		End If	
End Function

Public Function ShowChannelList(IsHtml,ClsID,PgID,ListAction)
	    Select Case ListAction
	    Case "pic"
	    	tit="图片"&Cls.ChannelTit
	        tit_fir=Cls.ChannelName
			IndexUrl=Cls.Web_Dir & Cls.ChannelDir
			HtmlContent = Cls.ReadTemplate(1)
	    Case "focus"
	    	tit="焦点"&Cls.ChannelTit
    	    tit_fir=Cls.ChannelName
			IndexUrl=Cls.Web_Dir & Cls.ChannelDir
			HtmlContent = Cls.ReadTemplate(1)
        Case "good"
   	    	tit="推荐"&Cls.ChannelTit
   	        tit_fir=Cls.ChannelName
			IndexUrl=Cls.Web_Dir & Cls.ChannelDir
			HtmlContent = Cls.ReadTemplate(1)
	    Case "hot"
	     	tit="热门"&Cls.ChannelTit
	        tit_fir=Cls.ChannelName
			IndexUrl=Cls.Web_Dir & Cls.ChannelDir
			HtmlContent = Cls.ReadTemplate(1)
	    Case "search"
	    	tit=Cls.ChannelTit&"搜索"
	    	tit_fir=Cls.ChannelName
			Tit_Dir = Class_Grade(ClsID,Cls.ClassDepth) & Tit
			IndexUrl=Cls.Web_Dir & Cls.ChannelDir
			HtmlContent = Cls.ReadTemplate(1)
		Case "special"
	    	tit=Cls.ChannelTit&"专题"
	    	tit_fir=Cls.ChannelName	
			IndexUrl=Cls.Web_Dir & Cls.ChannelDir
			HtmlContent = Cls.ReadTemplate(4)
                                HtmlContent = Replace(HtmlContent, "{$SpecialID}", iSpecialID)
			HtmlContent = Replace(HtmlContent, "{$s_name}", iSpecialTopic)
			HtmlContent = Replace(HtmlContent, "{$s_remark}", iSpecialRemark)
			HtmlContent = Replace(HtmlContent, "{$s_tim}", iSpecialTim)
		Case Else
		    tit=Cls.ChannelTit&"列表"
			tit_fir=Cls.ChannelName
	    	Tit_Dir = Class_Grade(ClsID,Cls.ClassDepth) & Tit
			IndexUrl=Cls.Web_Dir & Cls.ChannelDir
			HtmlContent = Cls.ReadTemplate(1)
	    End Select
  Dim taxis
  Dim ListContent,ListContents,HtmlUrl
  Dim Mhead,obj_search,obj_page
  Dim Tempstr, PageCt
  Dim SQL, i, foundstr, ListStyle
  Dim sDot,sTitle, sTopic, BestCode, BestString
  Dim ArticleTopic, ClassName, HtmlFileUrl, ImageUrl, WriteTime, LinkTarget, HtmlFileName
  Dim tmp_sql,tmp_sql_order,tmp_url,tmp_keyword
  taxis=Cls.Code_Query("taxis")
  Mhead="":tmp_url=""
  Select Case ListAction
  Case "hot"
      mhead=tit
      tmp_sql="A.counter>20"
      tmp_sql_order="A.counter desc"
	If Cls.RssTrue Then ChannelRss=" <link type='application/rss+xml' rel='alternate'><a href='"&Cls.Web_Dir&Cls.ChannelDir&"/RssFeed.asp?action=hot' target=_blank><img src='"&Cls.Web_SkinDir&"sys/"&Cls.ChannelDir&"_rss_xml.gif' class=xrss border=0 title='RSS 2.0 支持'></a>"
  Case "good"
      mhead=tit
      tmp_sql="A.isgood=1"
	If Cls.RssTrue Then ChannelRss=" <link type='application/rss+xml' rel='alternate'><a href='"&Cls.Web_Dir&Cls.ChannelDir&"/RssFeed.asp?action=good' target=_blank><img src='"&Cls.Web_SkinDir&"sys/"&Cls.ChannelDir&"_rss_xml.gif' class=xrss border=0 title='RSS 2.0 支持'></a>"
  Case "focus"
      mhead=tit
      tmp_sql="A.isfocus=1"
	If Cls.RssTrue Then ChannelRss=" <link type='application/rss+xml' rel='alternate'><a href='"&Cls.Web_Dir&Cls.ChannelDir&"/RssFeed.asp?action=focus' target=_blank><img src='"&Cls.Web_SkinDir&"sys/"&Cls.ChannelDir&"_rss_xml.gif' class=xrss border=0 title='RSS 2.0 支持'></a>"
  Case "pic"
      mhead=tit
      tmp_sql="A.ispic=1"	
	If Cls.RssTrue Then ChannelRss=" <link type='application/rss+xml' rel='alternate'><a href='"&Cls.Web_Dir&Cls.ChannelDir&"/RssFeed.asp?action=pic' target=_blank><img src='"&Cls.Web_SkinDir&"sys/"&Cls.ChannelDir&"_rss_xml.gif' class=xrss border=0 title='RSS 2.0 支持'></a>"  	  
  Case "search"
  	  if int(ClsID)>0 then
	  tmp_sql="A.ClassID in ("&Class_Cid_Get(Clsid)&")"
	  else
	  tmp_sql=""
	  end if
      set obj_search=New Cls_Search
      obj_search.inc_url="?c_id="&ClsID&"action=Search&"
      obj_search.inc_sql=tmp_sql
      'call obj_search.format_search("A.Name","A.Name,A.keyes,A.username",2,1,0)  //使用按用户名搜索用此条
      call obj_search.format_search("A.Name","A.Name,A.keyes",2,1,0)  '为修正搜索按用户名搜索错误用此条
      tmp_url=obj_search.inc_url
      tmp_sql=obj_search.inc_sql
      tmp_keyword=obj_search.keyword
      mhead=mhead&"（"&Cls.code_html(obj_search.keyword,1,0)&"）"
      set obj_search=nothing
  Case "special"
	 tmp_url="?ID="&iSpecialID&"&"
	 tmp_sql="A.SpecialID="&iSpecialID
	 mhead=tit
	 If Cls.RssTrue Then ChannelRss=" <link type='application/rss+xml' rel='alternate'><a href='"&Cls.Web_Dir&Cls.ChannelDir&"/RssFeed.asp?action=special&id="&iSpecialID&"' target=_blank><img src='"&Cls.Web_SkinDir&"sys/"&Cls.ChannelDir&"_rss_xml.gif' class=xrss border=0 title='RSS 2.0 支持'></a>"	 
  Case Else
	  if int(ClsID)>0 then tmp_sql="A.ClassID="&ClsID
	  mhead=tit
	  If Cls.RssTrue Then ChannelRss=" <link type='application/rss+xml' rel='alternate'><a href='"&Cls.Web_Dir&Cls.ChannelDir&"/RssFeed.asp?c_id="&ClsID&"' target=_blank><img src='"&Cls.Web_SkinDir&"sys/"&Cls.ChannelDir&"_rss_xml.gif' class=xrss border=0 title='RSS 2.0 支持'></a>"	  
  End Select
  if tmp_sql="" then
    tmp_sql="A.hidden=1"
  else
    tmp_sql="A.hidden=1 and "&tmp_sql
  End if
  Select Case taxis
  Case "tim"
    tmp_sql_order="A.tim Desc"
  Case "buy"
    tmp_sql_order="A.buy_counter"	
  Case "price_high"
    tmp_sql_order="A.price desc"
  Case "price_low"
    tmp_sql_order="A.price" 
  Case "counter"
    tmp_sql_order="A.counter Desc"
  Case Else
    tmp_sql_order=""
  End Select
  if tmp_sql_order="" then
    tmp_sql_order="A.istop desc,A.id desc"
  else
    tmp_sql_order=tmp_sql_order&",A.istop desc,A.id desc"
  End if
  set obj_page=New Cls_PageCute
  obj_page.nummer=Cls.ChannelListNum
  obj_page.page_tit=Cls.ChannelTit
  obj_page.page_unit=Cls.ChannelUnit
  obj_page.v_id="A.id"
  if action="hot" then obj_page.v_id="A.counter"
  tmp_sql=tmp_sql&" And A.ChannelIDs="&ChannelIDs
  call obj_page.p_init("","["&Cls.ChannelTable&"] A INNER JOIn [AsaiMHClass] C ON A.ClassID=C.C_ID",tmp_sql,"")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
	    If Instr(HtmlContent,"[ShowList]") > 0 Then
	        ListContents=""
            ListContent = Cls.CutFixContent(HtmlContent, "[ShowList]" , "[/ShowList]", 0)
			'检查分页数据
			If PgID<>"" then obj_page.setpage=PgID
			Call obj_page.p_main("A.ID,A.ClassID,A.TColor,A.Name,A.pic,A.brand,A.price,A.discount,A.is_emoney,A.emoney,A.Price_Original,A.counter,A.Brief,A.Tim,A.isgood,A.isfocus,A.istop,A.HtmlFileDate,C.ClassName,C.HtmlFileDir","["&Cls.ChannelTable&"] A INNER JOIn [AsaiMHClass] C ON A.ClassID=C.C_ID",tmp_sql,tmp_sql_order)
			'循还读数据
            For i=1 to obj_page.page_num
                If rs.eof Then exit for
				If (i Mod 2) = 0 Then
					ListStyle = "ll" & 1
				Else
					ListStyle = "ll" & 2
				End If
				If Rs("isgood") <> 0 Then
					BestCode = 2
					BestString = "<font color='red'>推荐</font>"
				Else
					BestCode = 1
					BestString = ""
				End If
				'前标
				sDot=Cls.GetDot(rs("istop"),rs("isfocus"),rs("isgood"))
				'sTopic = Cls.GetIncInfo(Rs("IncludeInfo"))
				sTitle = Cls.Cuted(Rs("name"), Cls.ChannelCuteNum)
				sTitle = Cls.GetTcolor(sTitle,rs("tcolor"),False)
				'-------------搜索关键字显亮 
				sTitle = Cls.Channel_Search(sTitle)
				ClassName = Rs("ClassName")
				If CInt(Cls.ChannelIsCreatHtml) <> 0  Then
					HtmlFileName = Cls.ReadFileName(Rs("HtmlFileDate"), Rs("ID"), Cls.ChannelHtmlExtName, Cls.ChannelHtmlPrefix, Cls.ChannelHtmlForm, "")
					HtmlFileUrl = Cls.Web_Dir& Cls.ChannelDir & "/" & Rs("HtmlFileDir") & Cls.ShowDatePath(Rs("HtmlFileDate"), Cls.ChannelHtmlPath) & HtmlFileName
					ClassName = "<a href='" & Cls.ChannelPath& Rs("HtmlFileDir") & "Index_1" & Cls.ChannelHtmlExtName & "'>" & ClassName & "</a>"
				Else
					HtmlFileUrl = Cls.ChannelPath & "View.asp?id=" & Rs("ID")
					ClassName = "<a href='" & Cls.ChannelPath & "List.asp?c_id=" & Rs("ClassID") & "'>" & ClassName & "</a>"
				End If
				WriteTime = Cls.ShowDateTime(Rs("tim"),6)
				If Cls.ChannelIsNewWindow <> 0 Then
					LinkTarget = " target=""_blank"""
				Else
					LinkTarget = ""
				End If
				If rs("Pic")="" then
					   ImageUrl = Cls.Web_Dir&"Skin/no_pic.gif"
				else
					   ImageUrl = rs("Pic")
				end if
				ImageUrl = "<img src='"&ImageUrl&"' width=" & Cls.ChannelPicWidth & " height=" & Cls.ChannelPicHeight & " class=""ig"">"								
				ArticleTopic = "<a href='" & HtmlFileUrl & "'" & LinkTarget & " title='" & Cls.ChannelModule & "标题：" & Rs("name") & "&#13;&#10;发布时间：" & Rs("tim") & "&#13;&#10;点击次数：" & Rs("counter") & "'>" & sTitle & "</a>"
				Tempstr = ListContent
				Tempstr = Replace(Tempstr, "{$ShopTopic}", ArticleTopic)
				Tempstr = Replace(Tempstr, "{$ShopPicture}", Cls.GetPic("<a href='" & HtmlFileUrl & "' title='" & Rs("name") & "'" & LinkTarget & ">" & ImageUrl & "</a>"))
				Tempstr = Replace(Tempstr, "{$ShopID}", Rs("ID"))
				Tempstr = Replace(Tempstr, "{$ShopTitle}", sTitle)
				Tempstr = Replace(Tempstr, "{$Title}", Rs("name"))
				Tempstr = Replace(Tempstr, "{$Date}", Rs("tim"))
				Tempstr = Replace(Tempstr, "{$Dot}", sDot)
				Tempstr = Replace(Tempstr, "{$HtmlFileUrl}", HtmlFileUrl)
				Tempstr = Replace(Tempstr, "{$ClassName}", ClassName)
				Tempstr = Replace(Tempstr, "[]", "")
				Tempstr = Replace(Tempstr, "{$Target}", LinkTarget)
				Tempstr = Replace(Tempstr, "{$AddTime}", WriteTime)
				Tempstr = Replace(Tempstr, "{$ShopHits}", Rs("counter"))
				Tempstr = Replace(Tempstr, "{$ListStyle}", ListStyle)
				Tempstr = Replace(Tempstr, "{$BestCode}", BestCode)
				Tempstr = Replace(Tempstr, "{$BestString}", BestString)
				Tempstr = Replace(Tempstr, "{$PastPrice}",rs("Price_Original"))
				Tempstr = Replace(Tempstr, "{$DisCount}",Cls.FM_Discount(rs("DisCount")))
				Tempstr = Replace(Tempstr, "{$NowPrice}",Rs("price"))
				Tempstr = Replace(Tempstr, "{$Emoney}",Cls.Shop_Emoney_Pay(rs("is_emoney"),rs("emoney"),ChannelIDs,rs("id"),1))
				Tempstr = Replace(Tempstr, "{$Brief}", Cls.Code_Cut(rs("Brief"),100))
				Tempstr = Replace(Tempstr, "{$ChannelRootDir}",Cls.ChannelPath)
				Tempstr = Replace(Tempstr, "{$ShopUrl}",HtmlFileUrl)
				ListContents=ListContents&Tempstr
                rs.movenext
            Next	
  rs.close
  If Cls.ChannelIsCreatHtml = True And ListAction<>"search" then
  obj_page.pageurl="index_"
  obj_page.pagevar=""
  obj_page.pagefirvar="index_1"&Cls.ChannelHtmlExtName
  obj_page.pageext=Cls.ChannelHtmlExtName
  Else
	  if ListAction="search" then
	    obj_page.pageurl = tmp_url
	  elseif  ListAction<>"" and ListAction<>"List" then
        obj_page.pageurl=obj_page.pageurl&"ID="&iSpecialID&"&Action="&ListAction&"&"
	  else
	    obj_page.pageurl="?c_id="&ClsID&"&"
	  end if
  End if
        '内容载入替换，并输出或返回 
		HtmlContent = Replace(HtmlContent,"[ShowList]" & ListContent&"[/ShowList]",ListContents)
		HtmlContent = Replace(HtmlContent,"{$tit}", Tit)
		HtmlContent = Replace(HtmlContent,"{$mhead}", mhead)
		HtmlContent = Replace(HtmlContent,"{$Channel_Xml}", ChannelRss)
				PageCt="" & _               
		vbcrlf&"<div style='text-align:right;padding-top:8px;'><script language=javascript>" & _
               vbcrlf&"function SelectTo(tvar)" & _
               vbcrlf&"{" & _
               vbcrlf&"  if (tvar=="""" || tvar==null) {return;}" & _
               vbcrlf&"  location.href='"&Cls.Web_Dir&Cls.ChannelDir&"/List.asp?c_id="&Clsid&"&Action="&ListAction&"&taxis='+tvar;" & _
               vbcrlf&"}" & _
               vbcrlf&"</script>" & _
               vbcrlf&"<select name=ListAction size=1 onchange=""javascript:SelectTo(this.options[this.selectedIndex].value);"">" & _
               vbcrlf&"<option value=''>－请选择显示方式－</option>" & _
               vbcrlf&"<option value='tim'"
           if taxis="tim" then PageCt=PageCt&" selected"
           PageCt=PageCt&">按上架时间排序</option>" & _
               vbcrlf&"<option value='buy'"
           if taxis="buy" then PageCt=PageCt&" selected"
           PageCt=PageCt&">按订购次数排序</option>" & _
               vbcrlf&"<option value='price_high'"
           if taxis="price_high" then PageCt=PageCt&" selected"
           PageCt=PageCt&">按价格由高到低排序</option>" & _
               vbcrlf&"<option value='price_low'"
           if taxis="price_low" then PageCt=PageCt&" selected"
           PageCt=PageCt&">按价格由低到高排序</option>" & _		   
		       vbcrlf&"<option value='counter'"
           if taxis="counter" then PageCt=PageCt&" selected"
           PageCt=PageCt&">按点击次数排序</option>" & _
               vbcrlf&"</select>&nbsp;</div>"
           PageCt=PageCt&"<div id='asaipage'>"&obj_page.page_var&" "&obj_page.page_cute&" "&obj_page.page_shortcut&"</div>"
		HtmlContent = Replace(HtmlContent,"{$PageCute}",PageCt)
		Call LoadChannelSort(ClsID,1)
		Call LoadChannelSearch()
		Call LoadChannelSpecial()
		Call Html.LoadReplaced()
		HtmlContent=Replace(HtmlContent,"{$ClassID}",ClsID)
 		HtmlContent = Html.ReadWebHead(HtmlContent)
		HtmlContent = Html.ReadWebEnd(HtmlContent)
		HtmlContent = Html.ReadUserLogin(HtmlContent)
		HtmlContent = Html.ReadShopList(HtmlContent)
		HtmlContent = Html.ReadShopPic(HtmlContent)
		HtmlContent = Html.ReadShopPic2(HtmlContent)
		HtmlContent = Html.ReadCast(HtmlContent)
		'HtmlContent = Html.ReadRssList(HtmlContent)
		HtmlContent = Html.ReadChannelMenu(HtmlContent)
		HtmlContent = Cls.ReHtml(HtmlContent,0)	
 		If IsHtml=True Then
		    ShowChannelList = HtmlContent
		Else
		    Response.Write HtmlContent
		End If
	    set obj_page=nothing 	
  End If
End Function

'//* 频道浏览 *//
Public Function ShowChannelView(Vid,IsHtml)
    '初始载入
	tit=Cls.ChannelTit&"浏览"
   If Cls.Is_Null(vid)="" Then vid=Cls.Code_ID("id")
   v_id=vid
	SQL="Select Top 1 * From "&Cls.ChannelTable&" Where hidden=1 And ChannelIDs="&ChannelIDs&" And id="&v_id
	Set Rs=Cls.Exec(SQL,1)
	If Rs.Eof Then
	   Rs.Close
		Call Channel_Redirect(Cls.Web_Dir&Cls.ChannelDir)
	End If
	cid=rs("ClassID")
	v_name=rs("name")
	v_tcolor=rs("tcolor")
	cid=rs("ClassID")
	v_name=rs("name")
	v_serial=rs("serial")
	v_brand=rs("brand")
	v_stock=rs("stock")
	v_Brief=rs("Brief")
	v_remark=rs("word")
	v_Pic=rs("Pic")
	v_counter=rs("counter")
	v_buy_counter=rs("buy_counter")
	v_hidden=rs("hidden")
	v_isgood=rs("isgood")
	v_tim=rs("tim")
	v_cod=rs("cod")
	v_keyes=rs("keyes")
	v_Price_Origina=rs("Price_Original")
	v_Price_Market=rs("Price_Market")
	v_discount=rs("discount")
	v_is_emoney=rs("is_emoney")
	v_emoney=rs("emoney")
	v_Stocks=rs("Stocks")
	v_StocksName=rs("StocksName")
	v_con_integral=rs("con_integral")
	v_con_emoney=rs("con_emoney")
	v_counter=rs("counter")
	v_file=Rs("HtmlFileDate")
	Rs.Close
	'头部信息
	If Int(Web_Dim(15)) = 0 Then
	   tit=tit&"--"&v_name
        Else
	   tit=v_name&"--"&tit
	End if
	Tit_Dir = Class_Grade(Cid,Cls.ClassDepth) & Cls.ChannelTit&"浏览" &":"& Tit
	tit_fir=Cls.ChannelName
	IndexUrl=Cls.Web_Dir & Cls.ChannelDir
   '信息处理
  if v_pic<>"" then
     v_pic=pic_show(v_pic,2,v_pic)
	 else
	 v_pic=pic_show(Cls.Web_Dir&"Images/no_pic_show.gif",2,Cls.Web_Dir&"Images/no_pic_show.gif")
  End if
  if Cls.Is_Null(v_tcolor)<>"" then v_name="<font color="&v_tcolor&">"&v_name&"</font>"
  If Cls.ErrTrue Then tmp_err=commend_error(ChannelIDs,v_name,v_id,Cls.ChannelName)
  tmp_commend=format_commend(Cls.ChannelName,v_name,Cls.Web_Dir&Cls.ChannelDir&"/View.asp?id="&v_id)
  if int(v_cod)=0 then
    v_remark=Ubb.Ubbcode(v_remark)
  Else
    v_remark=Ubb.HtmlCode(v_remark)
  End If
  If v_isgood=true Then
    v_isgood="<font color=red><u>推荐</u></font>"
  Else
    v_isgood=""
  End If
    If v_Price_Market>0 Then
    v_Price_Market="市场价格："&v_Price_Market&"&nbsp;"&val_unit&""
  Else
    v_Price_Market=""
  End If
  HtmlContent=Cls.ReadTemplate(3)  
  HtmlContent=Replace(HtmlContent,"{$id}",v_id)  
  HtmlContent=Replace(HtmlContent,"{$emoney}",v_emoney)
  HtmlContent=Replace(HtmlContent,"{$tit_fir}",Cls.ChannelTit)
  HtmlContent=Replace(HtmlContent,"{$tcolor}",v_tcolor)
  HtmlContent=Replace(HtmlContent,"{$tim}",Cls.time_type(v_tim,4))
  HtmlContent=Replace(HtmlContent,"{$tit}",tit)
  HtmlContent=Replace(HtmlContent,"{$name}",v_name)
  HtmlContent=Replace(HtmlContent,"{$serial}",v_serial)
  HtmlContent=Replace(HtmlContent,"{$brand}",v_brand)
  HtmlContent=Replace(HtmlContent,"{$stock}",v_stock)
  HtmlContent=Replace(HtmlContent,"{$Brief}",v_Brief)
  HtmlContent=Replace(HtmlContent,"{$remark}",v_remark)
  HtmlContent=Replace(HtmlContent,"{$buy_counter}",v_buy_counter)
  HtmlContent=Replace(HtmlContent,"{$isgood}",v_isgood)
  HtmlContent=Replace(HtmlContent,"{$stocks}",v_Stocks)
  HtmlContent=Replace(HtmlContent,"{$stocksname}",v_StocksName)
  HtmlContent=Replace(HtmlContent,"{$pic}",v_pic)
  HtmlContent=Replace(HtmlContent,"{$val_name}",val_name)
  HtmlContent=Replace(HtmlContent,"{$val_unit}",val_unit)
  HtmlContent=Replace(HtmlContent,"{$web_unit}",Cls.web_unit)
  HtmlContent=Replace(HtmlContent,"{$price_now}",fm_price(v_Price_Origina*(v_discount/100),0))
  HtmlContent=Replace(HtmlContent,"{$price}",v_Price_Origina)
  HtmlContent=Replace(HtmlContent,"{$rice_Market}",v_Price_Market)
  HtmlContent=Replace(HtmlContent,"{$discount}",Cls.FM_Discount(v_discount))
  HtmlContent=Replace(HtmlContent,"{$link_emoney}",Cls.Shop_Emoney_Pay(v_is_emoney,v_emoney,ChannelIDs,v_id,1))
  HtmlContent=Replace(HtmlContent,"{$link_bag}","<a href='{$web_dir}Shop/Bag.asp?id="&v_id&"'><img src='"&Cls.web_skindir&"sys/button_bag.gif' border=0></a>")
  HtmlContent=Replace(HtmlContent,"{$con_integral}",v_con_integral)
  HtmlContent=Replace(HtmlContent,"{$con_emoney}",v_con_emoney)  
  HtmlContent=Replace(HtmlContent,"{$commend_friend}",tmp_commend)
  HtmlContent=Replace(HtmlContent,"{$commend_err}",tmp_err)
  If IsHtml = True then
        If Cls.ReviewTrue Then HtmlContent=Replace(HtmlContent,"{$review}","<script language=""JavaScript"" src="""&Cls.Web_Dir&"Include/Review.asp?c_id="&ChannelIDs&"&id="&v_id&"""></script>")
	    HtmlContent=Replace(HtmlContent,"{$counter}","<script language=""JavaScript"" src="""&Cls.Web_Dir&"Include/GetHits.asp?c_id="&ChannelIDs&"&id="&v_id&"""></script>")
  Else
        If Cls.ReviewTrue Then HtmlContent=Replace(HtmlContent,"{$review}",review_type(ChannelIDs,v_id,Cls.Web_Dir&Cls.ChannelDir&"/View.asp?id="&v_id,1,"",""))
	    HtmlContent=Replace(HtmlContent,"{$counter}",v_counter)
	    Call Cls.Exec("update "&Cls.ChannelTable&" set counter=counter+1 where id="&v_id,0)
  End If
  '载入模板函数
  Call LoadChannelSort(Cid,1)
  Call LoadChannelSearch()
  Call LoadChannelSpecial()
  Call Html.LoadReplaced()
  HtmlContent = Replace(HtmlContent,"{$ChannelID}",ChannelIDs)
  HtmlContent = Replace(HtmlContent,"{$ClassID}",cid)
  HtmlContent = Html.ReadWebHead(HtmlContent)
  HtmlContent = Html.ReadWebEnd(HtmlContent)
  HtmlContent = Html.ReadUserLogin(HtmlContent)
  HtmlContent = Html.ReadShopList(HtmlContent)
  HtmlContent = Html.ReadShopPic(HtmlContent)
  HtmlContent = Html.ReadShopPic2(HtmlContent)
  HtmlContent = Html.ReadRelateList(HtmlContent,ChannelIDs,v_id,v_keyes,Cls.ChannelIsCreatHtml) 
  HtmlContent = Html.ReadCast(HtmlContent)
  HtmlContent = Html.ReadChannelMenu(HtmlContent)
  '判断输出
  Dim CFS,obj_page
  Dim tmp_err,tmp_commend,tmp_topic,v_jt,HtmlUrl,FilePath,vClassPath,ilepaths,Filepaths,Filepathes,ii,j,HtmlFileName
        If int(v_cod)=0 then
        v_remark=Ubb.Ubbcode(v_remark)
        Else
        v_remark=Ubb.HtmlCode(v_remark)
        End if
        v_remark = KeyWord_Url(v_remark) '关键字显亮＋链接
        HtmlContent = Replace(HtmlContent,"{$remark}",v_remark)
		HtmlContent = Cls.ReHtml(HtmlContent,0)	
		If Cls.ChannelIsCreatHtml = True  and IsHtml=True then
		  Set Cfs=New Cls_FileSystem
		   '开始生成文件所在目录
		   vClassPath = Class_Path_Get(cid)
		   FilePath =  vClassPath & Cls.ShowDatePath(v_file, Cls.ChannelHtmlPath)
		   HtmlFileName = Cls.ReadFileName(v_file, v_id, Cls.ChannelHtmlExtName, Cls.ChannelHtmlPrefix, Cls.ChannelHtmlForm, 0)
		   CfS.CreateHtmlFile Cls.Web_Dir&Cls.ChannelDir,FilePath,HtmlFileName,HtmlContent
		   set Cfs=nothing
		Else
		    If IsHtml=True Then
			    ShowChannelView = HtmlContent
	        Else
		        Response.Write HtmlContent
		   End If	
		End If
End Function

sub ShowMsg(s_tit,s_msg)
		Tit_Dir = Tit
        HtmlContent = Cls.ReadTemplate(6)
		Call LoadChannelSort(0,0)
		Call LoadChannelSearch()
		Call LoadChannelSpecial()
		Call Html.LoadReplaced()
		HtmlContent = Html.ReadWebHead(HtmlContent)
		HtmlContent = Html.ReadWebEnd(HtmlContent)
		HtmlContent = Html.ReadShopList(HtmlContent)
		HtmlContent = Html.ReadShopPic(HtmlContent)
		HtmlContent = Html.ReadShopPic2(HtmlContent)
		HtmlContent = Html.ReadCast(HtmlContent)
		HtmlContent = Html.ReadChannelMenu(HtmlContent)
		HtmlContent = Replace(HtmlContent,"{$title}",s_tit)		
		HtmlContent = Replace(HtmlContent,"{$ShowMsg}",s_msg)
		HtmlContent = Cls.ReHtml(HtmlContent,0)
		Response.Write HtmlContent
end sub

'//* 列表初始 *//
Public Sub LoadListFirst()
	Select Case action
	Case "pic"
		Call ShowChannelList(False,Cid,"","pic")
	Case "focus"
		Call ShowChannelList(False,Cid,"","focus")		
	Case "good"
		Call ShowChannelList(False,Cid,"","good")
	Case "hot"
		Call ShowChannelList(False,Cid,"","hot")
	Case "search"
		Call ShowChannelList(False,Cid,"","search")
	Case Else
		if int(cid)<1 then Call Channel_Redirect(Cls.Web_Dir&Cls.ChannelDir)
		If Class_Child_Get(Cid)=0 Then
		Call ShowChannelList(False,Cid,"","List")
		Else
		Call ShowChannelLists(False,Cid)
		End If
	End Select
End Sub

Sub LoadChannelMainList(ListCid)
    Dim ListContent,ListContents
    Dim tmp1,ncid,ncname,mores
    Dim isdb,lablez,si,ji
	ListContents=""
	If Instr(HtmlContent,"[Repeat=1]") > 0 Then
	   isdb = False
	   lablez = "[Repeat=1]"
	ElseIf Instr(HtmlContent,"[Repeat=2]") > 0 Then
	   isdb =True
	   lablez = "[Repeat=2]"
	Else
	   Call Html.LoadReplaced()
	   Exit Sub
	End If
    ListContent = Cls.CutFixContent(HtmlContent, lablez , "[/Repeat]", 0)
	If ClassTrue Then
	ji=2
	
	for si=0 to ClassNum
		if int(ClassArr(2,si))=ListCid then
			ncid=Int(ClassArr(0,si))
			ncname=ClassArr(1,si)
			tmp1=""
			If Cls.RssTrue Then ChannelRss=" <link type='application/rss+xml' rel='alternate'><a href='"&Cls.Web_Dir&Cls.ChannelDir&"/RssFeed.asp?c_id="&ncid&"' target=_blank class=dvaam><img src='"&Cls.Web_SkinDir&"sys/"&Cls.ChannelDir&"_rss_xml.gif' class=xrss border=0 title='RSS 2.0 支持'></a>"
			If Cls.ChannelIsCreatHtml = True then
			mores=Cls.Web_Dir & Cls.ChannelDir & "/"&ClassArr(8,si)&"index_1"&Cls.ChannelHtmlExtName
			Else
			mores="List.asp?c_id="&ncid
			End If
			
            ListContents=ListContents&ListContent 
			ListContents=Replace(ListContents,"{$ClassID}",ncid)
			ListContents=Replace(ListContents,"{$ClassName}",ncname)
			ListContents=Replace(ListContents,"{$more}",mores)
			ListContents=Replace(ListContents,"{$Channel_Xml}",ChannelRss)
    		
    		
			
			ji=ji+1
		End If
    next
	
	Else
	ListContents="请先添加分类"
	End If
	HtmlContent=Replace(HtmlContent,lablez & ListContent&"[/Repeat]",ListContents)
	HtmlContent=Replace(HtmlContent,"{$ClassID}",ListCid)
    Call Html.LoadReplaced()
End Sub

'//* 频道搜索 *//
Public Function LoadChannelSearch()
   If Instr(HtmlContent,"{$Search}")>0 then
   HtmlContent=Replace(HtmlContent,"{$Search}",format_nsort_sea(ChannelSort,img_skin("search"),Class_Select_Type(Cls.ChannelTit,Cls.ClassDepth,0),Cls.ChannelTit))
   End If
End Function

'//* 频道导航 *//
Public Sub LoadChannelSort(tCid,tCtype)
	Dim TmpStr, TmpImg ,Tmpur1,tmpurl
	If Instr(HtmlContent,"{$SortList}")>0 then
		TmpImg="sort_c1"
		TmpStr="<li>"&VbCrlf
	    if action="pic" then TmpImg="sort_c2"
	    If Cls.ChannelIsCreatHtml = True then
    	      Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/PicShop/Index_1"&Cls.ChannelHtmlExtName
    	Else
	          Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/List.asp?Action=pic"
	    End if	
		TmpStr=TmpStr&"<div class=slis>"&img_skin(TmpImg)&"<a href='"&Tmpurl&"'>图片"&Cls.ChannelTit&"</a></div>" & _
		VbCrlf&""
	    TmpImg="sort_c1"
    	if action="focus" then TmpImg="sort_c2"
	    If Cls.ChannelIsCreatHtml = True then
    	      Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/FocusShop/Index_1"&Cls.ChannelHtmlExtName
	    Else
	          Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/List.asp?Action=focus"
        End if	
		TmpStr=TmpStr&"<div class=slis>"&img_skin(TmpImg)&"<a href='"&Tmpurl&"'>焦点"&Cls.ChannelTit&"</a></div>"&VbCrlf&"</li>" & _
		VbCrlf&"<li>"&VbCrlf
    	TmpImg="sort_c1"
	    if action="good" then TmpImg="sort_c2"
	    If Cls.ChannelIsCreatHtml = True then
	          Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/GoodShop/Index_1"&Cls.ChannelHtmlExtName
	    Else
	          Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/List.asp?Action=good"
	    End if	
		TmpStr=TmpStr&"<div class=slis>"&img_skin(TmpImg)&"<a href='"&Tmpurl&"'>推荐"&Cls.ChannelTit&"</a></div>" & _
		VbCrlf&""
	    TmpImg="sort_c1"
	    if action="hot" then TmpImg="sort_c2"
	    If Cls.ChannelIsCreatHtml = True then
	          Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/HotShop/Index_1"&Cls.ChannelHtmlExtName
        Else
    	      Tmpurl=Cls.Web_Dir&Cls.ChannelDir&"/List.asp?Action=hot"
    	End if	
	    TmpStr=TmpStr&"<div class=slis>"&img_skin(TmpImg)&"<a href='"&Tmpurl&"'>热门"&Cls.ChannelTit&"</a></div>"&VbCrlf&"</li>"
		TmpStr=TmpStr&vbcrlf&LoadClass(tCid,tCtype,Cls.ChannelIsCreatHtml)
    	HtmlContent=Replace(HtmlContent,"{$SortList}","<ul>"&VbCrlf&Tmpstr&VbCrlf&"</ul>")
   End If
End Sub

'//* 频道专题列表 *//
Public Sub LoadChannelSpecial()
   If Instr(HtmlContent,"{$SpecialList}")>0 then
   	If Not Cls.SpecialTrue Then 
	HtmlContent=Replace(HtmlContent,"{$SpecialList}","没有专题")
	Exit Sub
	End If
	Dim Tmpstr, Sii
	Tmpstr = "<ul>"
	For Sii = 0 To Ubound(Cls.ChannelSpecial,2)
		Tmpstr = Tmpstr & "<li>"&img_skin("sort_c2")&"<a href='Special.asp?ID="&Cls.ChannelSpecial(0,Sii)&"'"
		If iSpecialID = Cls.ChannelSpecial(0,Sii) Then Tmpstr = Tmpstr & " class=red"
		Tmpstr = Tmpstr & ">"&Cls.ChannelSpecial(1,Sii)&"</a></li>"
	Next
	Tmpstr = Tmpstr & "</ul>"
   HtmlContent=Replace(HtmlContent,"{$SpecialList}",Tmpstr)
   End If
End Sub

'//* 专题初始 *//
Public Sub LoadSpecialFirst()
   SQL = "Select Top 1 * From [AsaiMHSpecial] Where ID="&iSpecialID
   Set Rs=Cls.Exec(SQL,1)
   If Rs.Eof Then
	  Rs.Close
	  Call Channel_Redirect(Cls.Web_Dir&Cls.ChannelDir)
   End If
   iSpecialTopic = Cls.Code_Html(Rs("topic"),1,0)
   iSpecialRemark = Rs("Remark")
   iSpecialTim = Cls.Time_Type(Rs("Tim"),1)
   Rs.Close
   Call ShowChannelList(False,Cid,"","special")
End Sub
%>
