<%@language=vbscript codepage=936 %>
<!--#include file="../conn.asp"-->
<!--#include file="../Inc/function.asp"-->
<%
'=======================
'动易插件之“最新图文幻灯片”
'开发：梅子故事(http://www.mz25.com)
'适用范围：动易2005/2006各版本
'调用方式：将本文件放到WEB根目录，在模板任何位置加上：<script language="javascript" src="{$InstallDir}JS/MainPicAD.asp"></script>
'更多插件请关注http://www.mz25.com，联系QQ：146579（梅子）、3194377（残月）
'=======================
Dim RS,SQL
Dim AdID,AdUrl,AdTitle,AdPic,MaxNum,k,i
MaxNum = 5 '设置最多循环多少张图片，不能超过6
If MaxNum > 6 Then MaxNum=6
k = 1

	Set RS=Server.CreateObject("ADODB.RecordSet")
	SQL="select * from PE_Article A Inner Join PE_Channel C On A.ChannelID = C.ChannelID where A.Deleted=0 and Elite = " & PE_True & " and A.Status=3 and A.DefaultPicUrl<>'' Order by ArticleID DESC" '推荐，热门，按ID倒序
	RS.open SQL,conn,1,1
	k=RS.RecordCount
	If K > MaxNum Then k = MaxNum
	i=1
	Do While Not rs.EOF
AdID=rs("ArticleID")
AdTitle=gotTopic(rs("Title"),31) '数字31为标题字数
AdPic=rs("DefaultPicUrl")
AdUrl=""& SiteUrl &InstallDir & rs("ChannelDir")&"/ShowArticle.asp?ArticleID="&rs("ArticleID")&""
	Response.Write"imgUrl"&i&"='"& SiteUrl & InstallDir & rs("ChannelDir")&"/"& rs("UploadDir")&"/" & AdPic & "';" & vbCrLf
	Response.Write"imgtext"&i&"='" & AdTitle & "'" & vbCrLf
	Response.Write"imgLink"&i&"=escape('" & AdUrl & "');" & vbCrLf
	If i>=k Then Exit Do
	i=i+1
	rs.movenext
    loop
    
	Response.Write" var focus_width=230" & vbCrLf '图片宽度
	Response.Write" var focus_height=290" & vbCrLf '图片高度
	Response.Write"	var text_height=1" & vbCrLf '文字高度
	Response.Write" var swf_height = focus_height+text_height" & vbCrLf
	Response.Write" var pics="
	For m=1 to k
		If m<k Then
			Response.Write"imgUrl"&m&"+'|'+"
		Else
			Response.Write"imgUrl"&m&"" & vbCrLf
		End If
	Next
	Response.Write" var links="
	For m=1 to k
		If m<k Then
			Response.Write"imgLink"&m&"+'|'+"
		Else
			Response.Write"imgLink"&m&"" & vbCrLf
		End If
	Next
	Response.Write" var texts="
	For m=1 to k
		If m<k Then
			Response.Write"imgtext"&m&"+'|'+"
		Else
			Response.Write"imgtext"&m&"" & vbCrLf
		End If
	Next
	Response.Write" document.write('<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 width='+ focus_width +' height='+ swf_height +'>');" & vbCrLf
	Response.Write" document.write('<param name=allowScriptAccess value=sameDomain><param name=movie value=" & InstallDir & "Images/focus.swf><param name=quality value=high><param name=bgcolor value=#F0F0F0>');" & vbCrLf
	Response.Write" document.write('<param name=menu value=false><param name=wmode value=opaque>');" & vbCrLf
	Response.Write" document.write('<param name=FlashVars value=pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'>');" & vbCrLf
	Response.Write" document.write('<embed src=" & InstallDir & "Images/focus.swf  wmode=opaque FlashVars=pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+' menu=false bgcolor=#F0F0F0 quality=high width='+ focus_width +' height='+ focus_height +' allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer />');" & vbCrLf
	Response.Write" document.write('</object>');" & vbCrLf

	RS.Close
	Set RS=Nothing
	conn.Close
	Set conn=Nothing
%>