var bannerLinks=new Array()
var bannerSrc=new Array()
var bannerPath="banner/images"
var bannerImages=new Array()
function banner(id,c,r) {
  this.name = "banner"+banner.count++
  this.obj = this.name+"Object"
  eval(this.obj+"=this")

  this.id=id||''
  this.path=bannerPath
  this.c=c||'0'
  this.refresh=r||4
  this.index=-1

  this.onTimer = bannerTimer
  this.onTimer()
}
function bannerTimer() {
 if(this.timer) clearInterval(this.timer)
 if(++this.index==bannerSrc.length) this.index=0
 if(document.images) {
  if(!bannerImages[this.index]) {
    bannerImages[this.index]=new Image()
    bannerImages[this.index].src=this.path+"/"+bannerSrc[this.index]
  }
 }
 document.images[this.id].src=eval("bannerImages["+this.index+"].src")
 this.timer = setTimeout(this.obj+'.onTimer()',this.refresh*1000)
}
function bannerclick(count) {
 var bannerObject
 var c=count||0
 eval("bannerObject=banner"+c+"Object")
 var target=bannerLinks[bannerObject.index]
 if( (target.indexOf('http://')>-1 || target.indexOf('https://')>-1) )
  window.open(target)
 else
  window.location.href=target
}
banner.count=0