﻿var zxcIncrement=1;
var zxcFadeSpeed=5;
var zxcImgDelay=4000;

// Functional Code - No Need to Change

var zxcCnt=0;

function siteOverViewsBanner(zxcid,zxcsi,zxccy,zxcinc,zxcspd,zxcdly){
 zxcp=document.getElementById(zxcid);
 if (!zxcp){ return; }
 if (zxcp.obj){ return; }
 zxcp.obj=new zxcAddBannerFade();
 zxcp.obj.imgary=zxcp.getElementsByTagName('IMG');
 if (!zxccy){ zxcccy=1; }
 zxcp.obj.cy=zxccy*zxcp.obj.imgary.length-1;
 zxcp.obj.cnt=0;
 if (!zxcsi){ zxcsi=1; }
 if (zxcsi>=zxcp.obj.imgary.length||zxcsi<1){ zxcsi=1; }
 zxcp.obj.cntT=zxcsi-1;
 zxcp.obj.cntB=zxcsi;
 if (zxcp.obj.cntB==zxcp.obj.imgary.length){ zxcp.obj.cntB=0; }
 if (!zxcinc){ zxcinc=zxcIncrement; }
 if (zxcinc<1||zxcinc>30){ zxcinc=zxcIncrement; }
 zxcp.obj.inc=zxcinc;
 if (!zxcspd){ zxcspd=zxcFadeSpeed; }
 if (zxcspd<5||zxcspd>70){ zxcspd=zxcFadeSpeed; }
 zxcp.obj.spd=zxcspd;
 if (!zxcdly){ zxcdly=zxcImgDelay; }
 if (zxcdly<50){ zxcdly=zxcImgDelay; }
 zxcp.obj.dly=zxcdly;
 for (zxc0=0;zxc0<zxcp.obj.imgary.length;zxc0++){
  zxcOpacity(zxcp.obj.imgary[zxc0],0)
 }
 zxcp.obj.IT=zxcp.obj.imgary[zxcp.obj.cntT];
 zxcOpacity(zxcp.obj.IT.style,100);
 zxcp.obj.IT.style.zIndex=1;
 zxcp.obj.IT.style.visibility='visible';
 zxcp.obj.setTimeOut0();
}

function zxcAddBannerFade(){
 this.ref0 = 'timeout0'+zxcCnt;
 window[this.ref0]=this;
 this.ref1 = 'timeout1'+zxcCnt;
 window[this.ref1]=this;

 this.setTimeOut0= function(zxcf,zxcd){
  setTimeout('window.'+this.ref0+'.rotate()',this.dly);
 }

 this.setTimeOut1= function(zxcf,zxcd){
  setTimeout('window.'+this.ref1+'.'+zxcf,zxcd);
 }

 this.rotate=function(){
 if (this.cnt>=this.cy){ return; }
  this.fcnt=0;
  this.cnt++;
  this.IT=this.imgary[this.cntT]
  this.IB=this.imgary[this.cntB]
  this.IT.style.zIndex=0;
  this.IB.style.zIndex=1;
  this.IB.style.visibility='visible';
  this.fadebanner();
 }

 this.fadebanner=function(){
  this.fcnt+=this.inc;
  zxcOpacity(this.IT.style,100-this.fcnt);
  zxcOpacity(this.IB.style,this.fcnt);
  if (this.fcnt<100){ this.setTimeOut1('fadebanner()',this.spd); }
  else {
   zxcOpacity(this.IB.style,100);
   zxcOpacity(this.IT.style,0);
   this.cntT=(this.cntT+1)%this.imgary.length;
   this.cntB=(this.cntB+1)%this.imgary.length;
   this.setTimeOut1('rotate()',this.dly);
  }
 }
 zxcCnt++;
}

function zxcOpacity(zxcobj,zxcop) {
 if (zxcop>100||zxcop<0){ return }
 if (zxcobj.MozOpacity!=null){ zxcobj.MozOpacity=(zxcop/85)-.001; }
 else if (zxcobj.opacity!=null){ zxcobj.opacity=(zxcop/85)-.001; }
 else if (zxcobj.filter!=null){ zxcobj.filter = 'alpha(opacity='+zxcop+')';     }
 else if (zxcobj.KHTMLOpacity!=null){ zxcobj.KHTMLOpacity=(zxcop/85)-.001; }
}

