<!--#include file="../odbc/conn.asp" -->
<%
rs.open "select top 2 * from ad where District='a' and pos=5 and datafirst<='"&date&"' and datalast>='"&date&"' and type<>'text' and app<>'del' order by pos",dsnstr,3,1
if not rs.bof and not rs.eof then
if trim(rs("type")&" ")="pic" then
response.write "<!--"& vbCrLf
response.write "if(parseInt(navigator.appVersion.charAt(0))<4){"& vbCrLf
response.write "	location.href="""&"/kingstone/configseting/ad/adcount.asp?district=a&pos=4-5&url="&htmlcode(trim(rs("url")&" "))&""""& vbCrLf
response.write "}"& vbCrLf
response.write ""& vbCrLf
response.write "var mvt1Light=""/ad/pic/"&trim(rs("show")&" ")&""""& vbCrLf
response.write "var mvt1Width="&trim(rs("width")&" ")&""& vbCrLf
response.write "var mvt1Height="&trim(rs("height")&" ")&""& vbCrLf
response.write "var mvt1Link="""&"/kingstone/configseting/ad/adcount.asp?district=a&pos=4-5&url="&htmlcode(trim(rs("url")&" "))&""""& vbCrLf
response.write ""& vbCrLf
response.write "brOK=navigator.javaEnabled()?true:false"& vbCrLf
response.write "ns4=(document.layers)?true:false"& vbCrLf
response.write "ie4=(document.all)?true:false"& vbCrLf
response.write ""& vbCrLf
response.write "if(ns4){"& vbCrLf
response.write "document.write('<layer id=""mvt1"" width=40 height=.60;""><a href=""'+mvt1Link+'"" target=_blank><img src=""'+mvt1Light+'"" border=0 width=""'+mvt1Width+'"" height=""'+mvt1Height+'""><\/a><\/layer>');"& vbCrLf
response.write "}"& vbCrLf
response.write "else{"& vbCrLf
response.write "document.write('<div id=""mvt1"" style=""position:absolute; width:40; height:60;""><a href=""'+mvt1Link+'"" target=_blank><img src=""'+mvt1Light+'"" border=0 width=""'+mvt1Width+'"" height=""'+mvt1Height+'""><\/a><\/div>');"& vbCrLf
response.write "}"& vbCrLf
response.write ""& vbCrLf
response.write "var vmin=2;"& vbCrLf
response.write "var vmax=5;"& vbCrLf
response.write "var vr=2;"& vbCrLf
response.write "var timer1;"& vbCrLf
response.write ""& vbCrLf
response.write "function Chip(chipname,width,height)"& vbCrLf
response.write "{this.named=chipname;"& vbCrLf
response.write " this.vx=vmin+vmax*Math.random();"& vbCrLf
response.write " this.vy=vmin+vmax*Math.random();"& vbCrLf
response.write " this.w=width;"& vbCrLf
response.write " this.h=height;"& vbCrLf
response.write " this.xx=600;"& vbCrLf
response.write " this.yy=0;"& vbCrLf
response.write " this.timer1=null;"& vbCrLf
response.write "}"& vbCrLf
response.write ""& vbCrLf
response.write "function movechip(chipname)"& vbCrLf
response.write "{"& vbCrLf
response.write " if(brOK)"& vbCrLf
response.write "	{eval(""chip=""+chipname);"& vbCrLf
response.write "	if(ns4)"& vbCrLf
response.write "	{pageX=window.pageXOffset;"& vbCrLf
response.write "		pageW=window.innerWidth;"& vbCrLf
response.write "		pageY=window.pageYOffset;"& vbCrLf
response.write "		pageH=window.innerHeight;"& vbCrLf
response.write "	}"& vbCrLf
response.write "	else"& vbCrLf
response.write "	{pageX=window.document.body.scrollLeft;"& vbCrLf
response.write "		pageW=window.document.body.offsetWidth-8;"& vbCrLf
response.write "		pageY=window.document.body.scrollTop;"& vbCrLf
response.write "		pageH=window.document.body.offsetHeight;"& vbCrLf
response.write "	}"& vbCrLf
response.write ""& vbCrLf
response.write "	chip.xx=chip.xx+chip.vx;"& vbCrLf
response.write "	chip.yy=chip.yy+chip.vy;"& vbCrLf
response.write ""& vbCrLf
response.write "	chip.vx+=vr*(Math.random()-0.5);"& vbCrLf
response.write "	chip.vy+=vr*(Math.random()-0.5);"& vbCrLf
response.write "	if(chip.vx>(vmax+vmin))	chip.vx=(vmax+vmin)*2-chip.vx;"& vbCrLf
response.write "	if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;"& vbCrLf
response.write "	if(chip.vy>(vmax+vmin))	chip.vy=(vmax+vmin)*2-chip.vy;"& vbCrLf
response.write "	if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;"& vbCrLf
response.write ""& vbCrLf
response.write ""& vbCrLf
response.write "	if(chip.xx<=pageX)"& vbCrLf
response.write "		{	chip.xx=pageX;"& vbCrLf
response.write "		chip.vx=vmin+vmax*Math.random();"& vbCrLf
response.write "		}"& vbCrLf
response.write "	if(chip.xx>=pageX+pageW-chip.w)"& vbCrLf
response.write "		{	chip.xx=pageX+pageW-chip.w;"& vbCrLf
response.write "		chip.vx=-vmin-vmax*Math.random();"& vbCrLf
response.write "		}"& vbCrLf
response.write "	if(chip.yy<=pageY)"& vbCrLf
response.write "		{	chip.yy=pageY;"& vbCrLf
response.write "		chip.vy=vmin+vmax*Math.random();"& vbCrLf
response.write "		}"& vbCrLf
response.write "	if(chip.yy>=pageY+pageH-chip.h)"& vbCrLf
response.write "		{	chip.yy=pageY+pageH-chip.h;"& vbCrLf
response.write "		chip.vy=-vmin-vmax*Math.random();"& vbCrLf
response.write "		}"& vbCrLf
response.write ""& vbCrLf
response.write "	if(ns4){"& vbCrLf
response.write "		eval('document.'+chip.named+'.top ='+chip.yy);"& vbCrLf
response.write "		eval('document.'+chip.named+'.left='+chip.xx);"& vbCrLf
response.write "	}"& vbCrLf
response.write "	else{"& vbCrLf
response.write "		eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);"& vbCrLf
response.write "		eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy);"& vbCrLf
response.write "	}"& vbCrLf
response.write "	chip.timer1=setTimeout(""movechip('""+chip.named+""')"",100);		//设置速度，数值越大速度越慢"& vbCrLf
response.write "	}"& vbCrLf
response.write "}"& vbCrLf
response.write ""& vbCrLf
response.write "function stopme(chipname)"& vbCrLf
response.write "{if(brOK)"& vbCrLf
response.write "	{//alert(chipname)"& vbCrLf
response.write "	eval(""chip=""+chipname);"& vbCrLf
response.write "	if(chip.timer1!=null)"& vbCrLf
response.write "	{clearTimeout(chip.timer1)}"& vbCrLf
response.write "	}"& vbCrLf
response.write "}"& vbCrLf
response.write ""& vbCrLf
response.write "var mvt1;"& vbCrLf
response.write "function mvt1()"& vbCrLf
response.write "{"& vbCrLf
response.write "	mvt1=new Chip(""mvt1"","&cint(trim(rs("width")&" "))+20&","&trim(rs("height")&" ")&");"& vbCrLf
response.write "	if(brOK){"& vbCrLf
response.write "		movechip(""mvt1"");"& vbCrLf
response.write "	}"& vbCrLf
response.write "}"& vbCrLf
response.write ""& vbCrLf
response.write "window.onload=mvt1"& vbCrLf
response.write ""& vbCrLf
response.write "//-->"& vbCrLf

elseif trim(rs("type")&" ")="flash" then
response.write "var brOK=false;"& vbCrLf
response.write "var mie=false;"& vbCrLf
response.write "var aver=parseInt(navigator.appVersion.substring(0,1));"& vbCrLf
response.write "var aname=navigator.appName;"& vbCrLf
response.write "function checkbrOK()"& vbCrLf
response.write "{if(aname.indexOf(""Internet Explorer"")!=-1)"& vbCrLf
response.write "{if(aver>=4) brOK=navigator.javaEnabled();"& vbCrLf
response.write "mie=true;"& vbCrLf
response.write "}"& vbCrLf
response.write "if(aname.indexOf(""Netscape"")!=-1)"& vbCrLf
response.write "{if(aver>=4) brOK=navigator.javaEnabled();}"& vbCrLf
response.write "}"& vbCrLf
response.write "var vmin=2;"& vbCrLf
response.write "var vmax=5;"& vbCrLf
response.write "var vr=2;"& vbCrLf
response.write "var timer1;"& vbCrLf
response.write "function Chip(chipname,width,height)"& vbCrLf
response.write "{this.named=chipname;"& vbCrLf
response.write "this.vx=vmin+vmax*Math.random();"& vbCrLf
response.write "this.vy=vmin+vmax*Math.random();"& vbCrLf
response.write "this.w=width;"& vbCrLf
response.write "this.h=height;"& vbCrLf
response.write "this.xx=600;"& vbCrLf
response.write "this.yy=0;"& vbCrLf
response.write "this.timer1=null;"& vbCrLf
response.write "}"& vbCrLf
response.write "function movechip(chipname)"& vbCrLf
response.write "{"& vbCrLf
response.write "if(brOK)"& vbCrLf
response.write "{eval(""chip=""+chipname);"& vbCrLf
response.write "if(!mie)"& vbCrLf
response.write "{pageX=window.pageXOffset;"& vbCrLf
response.write "pageW=window.innerWidth;"& vbCrLf
response.write "pageY=window.pageYOffset;"& vbCrLf
response.write "pageH=window.innerHeight;"& vbCrLf
response.write "}"& vbCrLf
response.write "else"& vbCrLf
response.write "{pageX=window.document.body.scrollLeft;"& vbCrLf
response.write "pageW=window.document.body.offsetWidth-8;"& vbCrLf
response.write "pageY=window.document.body.scrollTop;"& vbCrLf
response.write "pageH=window.document.body.offsetHeight;"& vbCrLf
response.write "}"& vbCrLf
response.write "chip.xx=chip.xx+chip.vx;"& vbCrLf
response.write "chip.yy=chip.yy+chip.vy;"& vbCrLf
response.write "chip.vx+=vr*(Math.random()-0.5);"& vbCrLf
response.write "chip.vy+=vr*(Math.random()-0.5);"& vbCrLf
response.write "if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;"& vbCrLf
response.write "if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;"& vbCrLf
response.write "if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;"& vbCrLf
response.write "if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;"& vbCrLf
response.write "if(chip.xx<=pageX)"& vbCrLf
response.write "{chip.xx=pageX;"& vbCrLf
response.write "chip.vx=vmin+vmax*Math.random();"& vbCrLf
response.write "}"& vbCrLf
response.write "if(chip.xx>=pageX+pageW-chip.w)"& vbCrLf
response.write "{chip.xx=pageX+pageW-chip.w;"& vbCrLf
response.write "chip.vx=-vmin-vmax*Math.random();"& vbCrLf
response.write "}"& vbCrLf
response.write "if(chip.yy<=pageY)"& vbCrLf
response.write "{chip.yy=pageY;"& vbCrLf
response.write "chip.vy=vmin+vmax*Math.random();"& vbCrLf
response.write "}"& vbCrLf
response.write "if(chip.yy>=pageY+pageH-chip.h)"& vbCrLf
response.write "{chip.yy=pageY+pageH-chip.h;"& vbCrLf
response.write "chip.vy=-vmin-vmax*Math.random();"& vbCrLf
response.write "}"& vbCrLf
response.write "if(!mie)"& vbCrLf
response.write "{"& vbCrLf
response.write "if(document.getElementById){"& vbCrLf
response.write "document.getElementById(chip.named).style.top =chip.yy;"& vbCrLf
response.write "document.getElementById(chip.named).style.left =chip.xx;"& vbCrLf
response.write "}else{"& vbCrLf
response.write "eval('document.'+chip.named+'.top ='+chip.yy);"& vbCrLf
response.write "eval('document.'+chip.named+'.left='+chip.xx);"& vbCrLf
response.write "}  "& vbCrLf
response.write "}"& vbCrLf
response.write "else"& vbCrLf
response.write "{eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);"& vbCrLf
response.write "eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy);"& vbCrLf
response.write "}"& vbCrLf
response.write "chip.timer1=setTimeout(""movechip('""+chip.named+""')"",100);"& vbCrLf
response.write "}"& vbCrLf
response.write "}"& vbCrLf
response.write "function stopme(chipname)"& vbCrLf
response.write "{if(brOK)"& vbCrLf
response.write "{//alert(chipname)"& vbCrLf
response.write "eval(""chip=""+chipname);"& vbCrLf
response.write "if(chip.timer1!=null)"& vbCrLf
response.write "{clearTimeout(chip.timer1)}"& vbCrLf
response.write "}"& vbCrLf
response.write "}"& vbCrLf
response.write "var no2;"& vbCrLf
response.write "var chip;"& vbCrLf
response.write "function no2()"& vbCrLf
response.write "{checkbrOK();"& vbCrLf
response.write "no2=new Chip(""no2"","&cint(trim(rs("width")&" "))+20&","&cint(trim(rs("height")&" "))&");"& vbCrLf
response.write "if(brOK)"& vbCrLf
response.write "{ movechip(""no2"");"& vbCrLf
response.write "}"& vbCrLf
response.write "}"& vbCrLf
response.write "document.write('<DIV id=no2 style=""WIDTH: 100px; POSITION: absolute; HEIGHT: 100px  "" ><EMBED src=/ad/flash/"&trim(rs("show")&" ")&" quality=high WIDTH="&cint(trim(rs("width")&" "))&" HEIGHT="&cint(trim(rs("height")&" "))&" TYPE=""application/x-shockwave-flash"" id=changhongout ></EMBED></DIV>');"& vbCrLf
response.write "no2();"& vbCrLf
end if
end if
rs.close
set rs=nothing
dsnstr.close
set dsnstr=nothing
%>