<!--#include file="../odbc/conn.asp" -->
<%
rs.open "select top 2 * from ad where District='a' and pos=4 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 "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=400;"& 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 no1;"& vbCrLf
response.write "var chip;"& vbCrLf
response.write "function no1()"& vbCrLf
response.write "{checkbrOK();"& vbCrLf
response.write "no1=new Chip(""no1"","&cint(trim(rs("width")&" "))+20&","&cint(trim(rs("height")&" "))&");"& vbCrLf
response.write "if(brOK)"& vbCrLf
response.write "{ movechip(""no1"");"& vbCrLf
response.write "}"& vbCrLf
response.write "}"& vbCrLf
response.write "document.write('<DIV id=no1 style=""WIDTH: 100px; POSITION: absolute; HEIGHT: 100px  "" ><a href="""&"/kingstone/configseting/ad/adcount.asp?district=a&pos=4-5&url="&htmlcode(trim(rs("url")&" "))&"""><img src=/ad/pic/"&trim(rs("show")&" ")&" WIDTH="&cint(trim(rs("width")&" "))&" HEIGHT="&cint(trim(rs("height")&" "))&" id=changhongout ></a></DIV>');"& vbCrLf
response.write "no1();"& 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=400;"& 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 no1;"& vbCrLf
response.write "var chip;"& vbCrLf
response.write "function no1()"& vbCrLf
response.write "{checkbrOK();"& vbCrLf
response.write "no1=new Chip(""no1"","&cint(trim(rs("width")&" "))+20&","&cint(trim(rs("height")&" "))&");"& vbCrLf
response.write "if(brOK)"& vbCrLf
response.write "{ movechip(""no1"");"& vbCrLf
response.write "}"& vbCrLf
response.write "}"& vbCrLf
response.write "document.write('<DIV id=no1 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 "no1();"& vbCrLf
end if
end if
rs.close
set rs=nothing
dsnstr.close
set dsnstr=nothing
%>