<!--#include file="Config.asp"-->
<!--#include file="Cls_Db.asp"-->
<!--#include file="Cls_Fso.asp"-->
<!--#include file="Cls_My.asp"-->
<!--#include file="Cls_UpLoad.asp"-->
<%
'/*载入模版函数*/
Function LoadTempLate(AppName,FileName)
	Dim Fso,TempStr
	Set Fso=New DmFso
		If Right(TempDir,1)="/" Then
			TempStr=Fso.ReadFile("/admin/film/TempLate/"&FileName)
			'TempStr=Fso.ReadFile(TempDir&FileName)
		Else
			TempStr=Fso.ReadFile("/admin/film/TempLate/"&FileName)
			'TempStr=Fso.ReadFile(TempDir&"/"&FileName)
		End If
	Set Fso=Nothing
	Application.Lock()
	Application.Contents(""&AppName&"")=TempStr
	Application.UnLock()
End Function
'/*清空模版缓存函数*/
Function DelTempLate(AppName)
      Application.Lock
      Application.Contents.Remove(AppName)
      Application.unLock
End Function 
'/*获取分类下拉框*/
Function GetClassSelect(ClassID,sType)
	Dim Rs,Sql,TempStr
	Sql="Select ClassID,ClassName From DM_Class"
	Set Rs=Conn.Execute(Sql)
	TempStr="<select name=""ClassID"">"&vbcrlf
	If sType=0 Then
		TempStr=TempStr&"<option value=""0"">所有分类</option>"
	End If
	Do While Not Rs.Eof
		TempStr=TempStr&"<option value="""&Rs("ClassID")&""""
		If Rs("ClassID")=ClassID Then
			TempStr=TempStr&"selected"
		End If
		TempStr=TempStr&">"&Rs("ClassName")&"</option>"&vbcrlf
	Rs.MoveNext
	Loop
	TempStr=TempStr&"</select>"&vbcrlf
	Rs.Close
	Set Rs=Nothing
	GetClassSelect=TempStr
End Function
'/*定义播放器列表*/
Dim PlaySerList(15)
PlaySerList(0)=Array("暂无数据","no")
PlaySerList(1)=Array("优酷(youku.com)","youku")
PlaySerList(2)=Array("我乐(56.com)","56")
PlaySerList(3)=Array("新浪(you.video.sina.com.cn)","sina")
PlaySerList(4)=Array("土豆tudou.com)","tudou")
PlaySerList(5)=Array("偶偶(ouou.com)","ouou")
PlaySerList(6)=Array("六房间(6.cn)","6rooms")
PlaySerList(7)=Array("BoBoP2P(bobo)","bobo")
PlaySerList(8)=Array("Q播(qvod)","qvod")
PlaySerList(9)=Array("泥巴P2P(neo)","neo")
PlaySerList(10)=Array("迅雷P2P(xunlei)","xunlei")
PlaySerList(11)=Array("迅雷联盟(u.xunlei.com)","xunlei2")
PlaySerList(12)=Array("Flv(flv格式)","flv")
PlaySerList(13)=Array("real(rm.rmvb格式)","real")
PlaySerList(14)=Array("media(wmv.asf格式)","media")
PlaySerList(15)=Array("Flash(swf格式)","swf")
Function GetPlayStype(PlayType,Order)
	Dim I,TempStr
	If Order=1 then
		TempStr="<select name=""PlayType"">"&vbcrlf
	Else
		TempStr="<select name=""PlayType2"">"&vbcrlf
	End If
	For I = 0 To Ubound(PlaySerList)
		TempStr=TempStr&"<option value="""&PlaySerList(I)(1)&""""
		If PlayType=PlaySerList(I)(1) Then
			TempStr=TempStr&"selected"
		End If
		TempStr=TempStr&">"&PlaySerList(I)(0)&"</option>"&vbcrlf
	Next
	TempStr=TempStr&"</select>"&vbcrlf
	GetPlayStype=TempStr
End Function
'/*获取频道路径*/
Function GetClassPath(ClassID,ClassEName)
	If HtmlType=1 Then
		GetClassPath=ClassID&"/"
	Else
		GetClassPath=ClassEName&"/"
	End If
End Function
'/*获取视频路径*/
Function GetVideoPath(VideoID,VideoEName)
	If HtmlType=1 Then
		GetVideoPath=VideoID&"/"
	Else
		GetVideoPath=VideoEName&"_"&VideoID&"/"
	End If
End Function
'/*获取网站分类列表*/
Function GetChannelList(ChannelD,Depth)
	Dim Rs,Sql,TempStr,DepthStr
	TempStr=""
	Select Case Depth
		Case 0
			DepthStr=""
		Case 1
			DepthStr="../"
		Case 2
			DepthStr="../../"
	End Select
	Sql="Select ClassID,ClassName,ClassEName From Dm_Class Order By OrderID"
	Set Rs=Conn.Execute(Sql)
	If ChannelD=0 Then
		TempStr=TempStr&"<a href=""/film/Index.html"" class=""now"">视频首页</a>"
	Else
		TempStr=TempStr&"<a href=""/film/Index.html"">视频首页</a>"
	End If
	If Not(Rs.Bof And Rs.Eof) Then
		Do While Not Rs.Eof
			If ChannelD=Rs("ClassID") Then
				TempStr=TempStr&"<a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&""" class=""now"" title="""&Rs("ClassName")&""">"&Rs("ClassName")&"</a>"
			Else
				TempStr=TempStr&"<a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&""" title="""&Rs("ClassName")&""">"&Rs("ClassName")&"</a>"
			End If
		Rs.MoveNext
		Loop
	End If
	Rs.Close
	Set Rs=Nothing
	GetChannelList=TempStr
End Function
'/*获取指定条件的*/
Function GetTopVideo(TopNum,AndStr,sType,IsPic,IsTime,IsHits,TitleLen,Depth)
	Dim Rs,Sql,TempStr,DepthStr
	TempStr=""
	Select Case Depth
		Case 0
			DepthStr=""
		Case 1
			DepthStr="../"
		Case 2
			DepthStr="../../"
	End Select
	Select Case sType
		Case 1
			Sql="Select Top "&TopNum&" A.*,B.ClassEName From Dm_Video As A,Dm_Class As B Where A.ClassID=B.ClassID "&AndStr&" Order By A.PostTime Desc,A.VideoID Desc"
		Case 2
			Sql="Select Top "&TopNum&" A.*,B.ClassEName From Dm_Video As A,Dm_Class As B Where A.ClassID=B.ClassID "&AndStr&" Order By A.Hits Desc,A.VideoID Desc"
		Case 3
			Sql="Select Top "&TopNum&" A.*,B.ClassEName From Dm_Video As A,Dm_Class As B Where A.ClassID=B.ClassID And A.IsShow=1 "&AndStr&" Order By A.VideoID Desc"
	End Select
	TempStr=TempStr&"<ul>"&vbcrlf
	Set Rs=Conn.Execute(Sql)
	If Rs.Bof And Rs.Eof Then
		TempStr=TempStr&"<li>暂无数据</li>"
	Else
		Do While Not Rs.Eof
			VideoName=Rs("VideoName")
			VideoColor=Rs("VideoColor")
			If VideoColor<>"" And IsNull(VideoColor)=False Then
				VideoName="<font color="""&VideoColor&""">"&LeftStr(VideoName,TitleLen)&"</font>"
			Else
				VideoName=LeftStr(VideoName,TitleLen)
			End If
			If IsPic=True Then
				TempStr=TempStr&"<li><a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&GetVideoPath(Rs("VideoID"),Rs("VideoEName"))&""" title="""&Rs("VideoName")&""" target=""_blank""><img src="""&DepthStr&Rs("VideoPic")&""" alt="""&Rs("VideoName")&""" onerror=""this.src='"&DepthStr&"Images/error.gif'""></a><p><a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&GetVideoPath(Rs("VideoID"),Rs("VideoEName"))&""" title="""&Rs("VideoName")&""" target=""_blank"">"&VideoName&"</a></p></li>"&vbcrlf
			Else
				TempStr=TempStr&"<li>"
				If IsTime=True Then TempStr=TempStr&"<span>"&FormatTime(Rs("PostTime"),3)&"</span>"
				If IsHits=True Then TempStr=TempStr&"<span class=""hits"">("&Rs("Hits")&")</span>"
				TempStr=TempStr&"<a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&GetVideoPath(Rs("VideoID"),Rs("VideoEName"))&""" title="""&Rs("VideoName")&""" target=""_blank"">"&VideoName&"</a>"
				TempStr=TempStr&"</li>"&vbcrlf
			End If
		Rs.MoveNext
		Loop
	End If
	Rs.Close
	Set Rs=Nothing
	TempStr=TempStr&"</ul>"&vbcrlf
	GetTopVideo=TempStr
End Function
'/*首页选项卡栏目当航*/
Function GetIndexChannel()
	Dim Rs,Sql,TempStr,cCount
	TempStr=""
	Set Rs=Server.CreateObject("Adodb.RecordSet")
	Sql="Select ClassID,ClassName,ClassEName From Dm_Class Order By OrderID"
	Rs.Open Sql,Conn,1,1
	cCount=Rs.RecordCount
	TempStr=TempStr& "<script language=""javascript"">" & vbCrlf
	TempStr=TempStr& "function showdiv(n){" & vbCrlf
	TempStr=TempStr& "	for(var i=1;i<="&cCount&";i++){" & vbCrlf
	TempStr=TempStr& "		var curC=document.getElementById(""showdiv_c""+i);" & vbCrlf
	TempStr=TempStr& "		var curB=document.getElementById(""showdiv_t""+i);" & vbCrlf
	TempStr=TempStr& "		if(n==i){" & vbCrlf
	TempStr=TempStr& "			curC.style.display="""";" & vbCrlf
	TempStr=TempStr& "			curB.className=""now""" & vbCrlf
	TempStr=TempStr& "		}else{" & vbCrlf
	TempStr=TempStr& "			curC.style.display=""none"";" & vbCrlf
	TempStr=TempStr& "			curB.className=""""" & vbCrlf
	TempStr=TempStr& "		}" & vbCrlf
	TempStr=TempStr& "	}" & vbCrlf
	TempStr=TempStr& "}" & vbCrlf
	TempStr=TempStr& "</script>" & vbCrlf
	Dim I
	I=1
	If Not(Rs.Bof And Rs.Eof) Then
		Do While Not Rs.Eof
				If I=1 Then 
					TempStr=TempStr&"<a href=""javascript:;"" class=""now"" onMouseOver=""return showdiv("&I&")"" id=""showdiv_t"&I&""">"&Rs("ClassName")&"</a>"
				Else
					TempStr=TempStr&"<a href=""javascript:;"" onMouseOver=""return showdiv("&I&")"" id=""showdiv_t"&I&""">"&Rs("ClassName")&"</a>"
				End If
		I=I+1
		Rs.MoveNext
		Loop
	End If
	Rs.Close
	Set Rs=Nothing
	GetIndexChannel=TempStr
End Function
'/*首页选项卡分类内容*/
Function GetIndexTabList()
	Dim Rs,Sql,ClassStr,TempStr
	TempStr=""
	Sql="Select ClassID From Dm_Class Order By OrderID"
	Set Rs=Conn.Execute(Sql)
	If Not (Rs.Bof And Rs.Eof) Then
		Do While Not Rs.Eof
			ClassStr=ClassStr&"$"&Rs("ClassID")
		Rs.MoveNext
		Loop
	End If
	Rs.Close
	Set Rs=Nothing
	Dim Key
	Key=Split(ClassStr,"$")
	For I = 1 To Ubound(Key)
		If I=1 Then
			TempStr=TempStr&"<div id=""showdiv_c"&I&""">"&vbcrlf
		Else
			TempStr=TempStr&"<div id=""showdiv_c"&I&""" style=""display:none;"">"&vbcrlf
		End If
		TempStr=TempStr&"<div class=""tlist"">"&vbcrlf
		TempStr=TempStr&"<ul>"&vbcrlf
		Sql="Select Top 4 A.*,B.ClassEName From Dm_Video As A,Dm_Class As B Where A.ClassID=B.ClassID And A.ClassID="&Key(I)&" Order By A.PostTime Desc,A.VideoID Desc"
		Set Rs=Conn.Execute(Sql)
		If Rs.Bof And Rs.Eof Then
			TempStr=TempStr&""
		Else
			Do While Not Rs.Eof
			VideoName=Rs("VideoName")
			VideoColor=Rs("VideoColor")
			If VideoColor<>"" And IsNull(VideoColor)=False Then
				VideoName="<font color="""&VideoColor&""">"&LeftStr(VideoName,16)&"</font>"
			Else
				VideoName=LeftStr(VideoName,16)
			End If
			TempStr=TempStr&"<li><a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&GetVideoPath(Rs("VideoID"),Rs("VideoEName"))&""" title="""&Rs("VideoName")&""" target=""_blank""><img src="""&Rs("VideoPic")&""" alt="""&Rs("VideoName")&""" onerror=""this.src='Images/error.gif'""></a><p><a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&GetVideoPath(Rs("VideoID"),Rs("VideoEName"))&""" title="""&Rs("VideoName")&""" target=""_blank"">"&VideoName&"</a></p></li>"&vbcrlf
			Rs.MoveNext
			Loop
		End If
		Rs.Close
		Set Rs=Nothing
		TempStr=TempStr&"</ul>"&vbcrlf
		TempStr=TempStr&"</div>"&vbcrlf
		TempStr=TempStr&"<div class=""c""></div>"&vbcrlf
		TempStr=TempStr&"<div class=""mlist"">"&vbcrlf
		TempStr=TempStr&"<ul>"&vbcrlf
		Sql="Select Top 40 A.*,B.ClassEName From Dm_Video As A,Dm_Class As B Where A.ClassID=B.ClassID And A.ClassID="&Key(I)&" And A.VideoID Not In (Select Top 4 A.VideoID From Dm_Video As A,Dm_Class As B Where A.ClassID=B.ClassID And A.ClassID="&Key(I)&" Order By A.PostTime Desc,A.VideoID Desc) Order By A.PostTime Desc,A.VideoID Desc"
		Set Rs=Conn.Execute(Sql)
		If Rs.Bof And Rs.Eof Then
			TempStr=TempStr&""
		Else
			For C = 1 To 4
				TempStr=TempStr&"<li>"&vbcrlf
					For D=1 To 10
						If Not Rs.Eof Then
							VideoName=Rs("VideoName")
							VideoColor=Rs("VideoColor")
							If VideoColor<>"" And IsNull(VideoColor)=False Then
								VideoName="<font color="""&VideoColor&""">"&LeftStr(VideoName,16)&"</font>"
							Else
								VideoName=LeftStr(VideoName,16)
							End If
							TempStr=TempStr&"<p><a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&GetVideoPath(Rs("VideoID"),Rs("VideoEName"))&""" title="""&Rs("VideoName")&""" target=""_blank"">"&VideoName&"</a></p>"&vbcrlf
							Rs.MoveNext
						End If
					Next
				TempStr=TempStr&"</li>"&vbcrlf
			Next
		End If
		Rs.Close
		Set Rs=Nothing
		TempStr=TempStr&"</ul>"&vbcrlf
		TempStr=TempStr&"</div>"&vbcrlf
		TempStr=TempStr&"</div>"&vbcrlf
	Next
	 GetIndexTabList=TempStr
End Function
'/*网站地图*/
Function GetSiteMapList()
	Dim Rs,Sql,ClassStr,TempStr
	TempStr=""
	Sql="Select ClassID From Dm_Class Order By OrderID"
	Set Rs=Conn.Execute(Sql)
	If Not (Rs.Bof And Rs.Eof) Then
		Do While Not Rs.Eof
			ClassStr=ClassStr&"$"&Rs("ClassID")
		Rs.MoveNext
		Loop
	End If
	Rs.Close
	Set Rs=Nothing
	Dim Key
	Key=Split(ClassStr,"$")
	For I = 1 To Ubound(Key)
		Sql="Select A.*,B.ClassName,B.ClassEName From Dm_Video As A,Dm_Class As B Where A.ClassID=B.ClassID And A.ClassID="&Key(I)&" Order By A.PostTime Desc"
		Set Rs=Conn.Execute(Sql)
		If Rs.Bof And Rs.Eof Then
			TempStr=TempStr&""
		Else
			TempStr=TempStr&"<div class=""mbox"">"&vbcrlf
			TempStr=TempStr&"<h4>"&Rs("ClassName")&"</h4>"&vbcrlf
			TempStr=TempStr&"<ul>"&vbcrlf
			Do While Not Rs.Eof
				VideoName=Rs("VideoName")
				VideoColor=Rs("VideoColor")
				If VideoColor<>"" And IsNull(VideoColor)=False Then
					VideoName="<font color="""&VideoColor&""">"&LeftStr(VideoName,18)&"</font>"
				Else
					VideoName=LeftStr(VideoName,18)
				End If
				TempStr=TempStr&"<li><a href=""/film/film/"&GetClassPath(Rs("ClassID"),Rs("ClassEName"))&GetVideoPath(Rs("VideoID"),Rs("VideoEName"))&""" title="""&Rs("VideoName")&""" target=""_blank"">"&VideoName&"</a></li>"&vbcrlf
			Rs.MoveNext
			Loop
		TempStr=TempStr&"</ul>"&vbcrlf
		TempStr=TempStr&"</div>"&vbcrlf
		End If
		Rs.Close
		Set Rs=Nothing
	Next
	GetSiteMapList=TempStr
End Function

Function GetFriendLink(TopNum)
	Dim Rs,Sql,TempStr
	TempStr=""
	Sql="Select Top "&TopNum&" * From Dm_Link Order By LinkID"
	Set Rs=Conn.Execute(Sql)
	If Rs.Bof And Rs.Eof Then
		TempStr=TempStr&""
	Else
		TempStr=TempStr&"<ul>"&vbcrlf
		Do While Not Rs.Eof
			TempStr=TempStr&"<li>"
			If Rs("LinkPic")<>"" And IsNull(Rs("LinkPic"))=False Then
				TempStr=TempStr&"<a href="""&Rs("LinkUrl")&""" target=""_blank""><img src="""&Rs("LinkPic")&""" alt="""&Rs("LinkName")&""" width=""80"" height=""31""></a>"
			Else
				TempStr=TempStr&"<a href="""&Rs("LinkUrl")&""" target=""_blank"">"&Rs("LinkName")&"</a>"
			End If
			TempStr=TempStr&"</li>"&vbcrlf
		Rs.MoveNext
		Loop
		TempStr=TempStr&"</ul>"&vbcrlf
	End If
	GetFriendLink=TempStr
End Function
%>