<!--#include file="../conn.asp"-->
<!--#include file="../Function/Function.asp"-->
<%
'===================================================================================================================
'软件名称：云网影视管理系统
'Copyright (C) 2002-2007 ywnt.net  All rights reserved.
'产品咨询QQ：489234,2813712
'程序版权：云网互动科技有限公司
'程序开发：云网互动科技有限公司
'官方网站：http://www.ywnt.net 
'郑重声明:
'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
'    2、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    3、云网互动科技有限公司保留此软件的法律追究权利
'===================================================================================================================
	Dim ID,HostURL,AD_Type,AD_Src,AD_Width,AD_Height,AD_Link,AD_Alt,AD_Views,ADViews,AD_Hits,ADHits,AD_Stop_Views,AD_Stop_Hits,AD_Stop_Date,ScrCode
		Response.Expires = 0

		ID=NoSqlHack(Request.QueryString("ID"))
		HostURL="http://"&Request.Servervariables("server_name")&":"&Request.ServerVariables("SERVER_PORT")&replace(Request.Servervariables("url"),"/Ad.asp","")

	Set rs=server.createobject("adodb.recordset")
		sql = "Select ADType,ADSrc,ADWidth,ADHeight,ADAlt,ADViews,ADHits,ADStopViews,ADStopHits,ADStopDate from YWNT_TMS_Ad where ID=" & ID & ""
		rs.open sql,conn,1,3
	If Not (rs.bof or rs.eof) Then
		AD_Type=rs("ADType")
		AD_Src=rs("ADSrc")
		AD_Width=rs("ADWidth")
		AD_Height=rs("ADHeight")
		AD_Alt=rs("ADAlt")
		AD_Views=rs("ADViews")
		AD_ADHits=rs("ADHits")
		AD_Stop_Views=rs("ADStopViews")
		AD_Stop_Hits=rs("ADStopHits")
		AD_Stop_Date=rs("ADStopDate")
		rs("ADViews")= AD_Views + 1
		rs.Update
	Else
		response.write "document.write('<! -- 没有找到您要浏览的广告 -->');"
	End If
		rs.Close
	Set rs=nothing
	call connclose()

	If ( AD_Stop_Views <> 0 and AD_Views > AD_Stop_Views) Then AD_Type = 0
	If ( AD_Stop_Hits <> 0 and AD_Hits > AD_Stop_Hits) Then AD_Type = 0
	If ( NOW() > AD_Stop_Date) Then AD_Type = 0

	If InStr(1,AD_Src,".swf",1)>0 Then
		ScrCode="<EMBED src="""& AD_Src &""" quality=high WIDTH="""& AD_Width &""" HEIGHT="""& AD_Height &""" TYPE=""application/x-shockwave-flash"" PLUGINSPAGE=""http://www.macromedia.com/go/getflashplayer""></EMBED>"
	Else
		ScrCode="<a href="""& HostURL &"/openad.asp?id="& ID &""" target=_blank><img src="""& AD_Src &""" border=0 width="""& AD_Width &""" height="""& AD_Height &""" alt="""& AD_Alt &""" align=top></a>"
	End If

	Select Case AD_Type
	Case 1
		response.write ("document.write('"& ScrCode &"')")
	Case 2
		response.write ("ns4=(document.layers)?true:false;" & _
						"ie4=(document.all)?true:false;" & _
						"if(ns4){document.write('<layer id=DGbanner2 width="& AD_Width &" height="& AD_Height &" onmouseover=stopme(""DGbanner2"") onmouseout=movechip(""DGbanner2"")>"& ScrCode &"</layer>');}" & _
						"else{document.write('<div id=DGbanner2 style=""position:absolute; width:"& AD_Width &"px; height:"& AD_Height &"px; z-index:9; filter: Alpha(Opacity=90)"" onmouseover=stopme(""DGbanner2"") onmouseout=movechip(""DGbanner2"")>"& ScrCode &"</div>');}" & _
						"document.write('<script language=javascript src="& HostURL &"/ad_float_fullscreen.js></script>');")
	Case 3
		response.write ("if (navigator.appName == 'Netscape')" & _
						"{document.write('<layer id=DGbanner3 top=150 width="& AD_Width &" height="& AD_Height &">"& ScrCode &"</layer>');}" & _
						"else{document.write('<div id=DGbanner3 style=""position: absolute;width:"& AD_Width &";top:150;visibility: visible;z-index: 1"">"& ScrCode &"</div>');}" & _
						"document.write('<script language=javascript src="& HostURL &"/ad_float_upanddown.js></script>');")
	Case 4
		response.write ("if (navigator.appName == 'Netscape')" & _
						"{document.write('<layer id=DGbanner10 top=150 width="& AD_Width &" height="& AD_Height &">"& ScrCode &"</layer>');}" & _
						"else{document.write('<div id=DGbanner10 style=""position: absolute;width:"& AD_Width &";top:150;visibility: visible;z-index: 1"">"& ScrCode &"</div>');}" & _
						"document.write('<script language=javascript src="& HostURL &"/ad_float_upanddown_L.js></script>');")
	Case 5
		response.write ("ns4=(document.layers)?true:false;" & _
						"if(ns4){document.write('<layer id=DGbanner4Cont onLoad=""moveToAbsolute(layer1.pageX-160,layer1.pageY);clip.height="& AD_Height &";clip.width="& AD_Width &"; visibility=show;""><layer id=DGbanner4News position:absolute; top:0; left:0>"& ScrCode &"</layer></layer>');}" & _
						"else{document.write('<div id=DGbanner4 style=""position:absolute;top:0; left:0;""><div id=DGbanner4Cont style=""position:absolute; width:"& AD_Width &"; height:"& AD_Height &";clip:rect(0,"& AD_Width &","& AD_Height &",0)""><div id=DGbanner4News style=""position:absolute;top:0; left:0; right:820"">"& ScrCode &"</div></div></div>');} " & _
						"document.write('<script language=javascript src="& HostURL &"/ad_fullscreen.js></script>');")
	Case 6
		response.write ("window.showModalDialog('"& AD_Src &"','','dialogWidth:"& AD_Width &"px;dialogHeight:"& AD_Height &"px;scroll:no;status:no;help:no');")
	Case 7
		JsCode= "document.write('<script language=javascript src="& HostURL &"/ad_dialog.js></script>'); " & vbCrLf & _
			"document.write('<div style=""position:absolute;left:300px;top:150px;width:"& AD_Width &"; height:"& AD_Height &";z-index:1;solid;filter:alpha(opacity=90)"" id=ClarityBoxID onmousedown=""ClarityBox(this)"" onmousemove=""ClarityBoxMove(this)"" onMouseOut=""down=false"" onmouseup=""down=false""><table cellpadding=0 border=0 cellspacing=1 width="& AD_Width &" height="& AD_Height &" bgcolor=#000000><tr><td height=20 align=right bgcolor=#5A8ACE style=""cursor:move;""><a href=# style=""font-size: 9pt; color: white; text-decoration: none"" onClick=ClarityBoxclose(""ClarityBoxID"") >×</a></td></tr><tr><td bgcolor=f4f4f4>"& AD_Src &"</td></tr></table></div>');"
			
		response.write JsCode
	Case 8
		response.write ("window.open('"& AD_Src &"','_blank');")
	Case 9
		response.write ("window.open('"& AD_Src &"','DGBANNER7','width="& AD_Width &",height="& AD_Height &",scrollbars=1')")
	Case 10
		response.write ("suspendcode=""<DIV id=lovexin1 style='Z-INDEX: 10; LEFT: 6px; POSITION: absolute; TOP: 105px; width: "& AD_Width &"; height: "& AD_Height &";'><img src='"& HostURL &"/close.gif' onClick='javascript:window.hide()' width='100' height='14' border='0' vspace='3' alt='关闭对联广告'>" & Replace(ScrCode,"""","'") & "</DIV>""" & vbCrLf & _
						"document.write(suspendcode);" & vbCrLf & _
						"suspendcode=""<DIV id=lovexin2 style='Z-INDEX: 10; Right: 6px; POSITION: absolute; TOP: 105px; width: "& AD_Width &"; height: "& AD_Height &";'><img src='"& HostURL &"/close.gif' onClick='javascript:window.hide()' width='100' height='14' border='0' vspace='3' alt='关闭对联广告'>" & Replace(ScrCode,"""","'") & "</DIV>""" & vbCrLf & _
						"document.write(suspendcode);" & vbCrLf & _
						"lastScrollY=0;" &_
						"function heartBeat(){" &_
						"diffY=document.body.scrollTop;" & _
						"percent=.3*(diffY-lastScrollY);" & _
						"if(percent>0)percent=Math.ceil(percent);" & _
						"else percent=Math.floor(percent);" & _
						"document.all.lovexin1.style.pixelTop+=percent;" & _
						"document.all.lovexin2.style.pixelTop+=percent;" & _
						"lastScrollY=lastScrollY+percent;" & _
						"}" & _
						"function hide()" & _
						"{" & _
						"lovexin1.style.visibility=""hidden"";" & _
						"lovexin2.style.visibility=""hidden"";" & _
						"}" & _	
						"window.setInterval(""heartBeat()"",1);")
	End Select
%>