statObj.ar = new Array();
function statObj(id,x,y,w,h,d) {
	this.dur=d||1000; this.xOff=x; 
	if (y>=0) this.yOff=y;	
	else { 
		this.relBtm = y;
		this.yOff = y = getWinHeight() + y;
	}
	this.bobj = dynObj;
	this.bobj(id,x,y,w,h);
  statObj.ar[statObj.ar.length] = this;
  }
statObj.prototype = new dynObj;
statObj.prototype.checkStatLyr=checkStatLyr;
statObj.prototype.glideInit=statGlideInit; 
statObj.prototype.glide=statGlide;
statObj.prototype.onGlideInit=function(){}

// adapted from ypChaser
// Aaron Boodman's updated chaser from www.youngpup.net
window.setInterval("statObj.timer()",20);
statObj.timer = function() {
  for (var i=0; i<statObj.ar.length; i++) {
    curObj = statObj.ar[i];
    if (curObj) curObj.checkStatLyr();
  }
}

// monitors scrolling and position of statLyr
function checkStatLyr() {
	var yScroll = getScrollY();
	this.curTop = parseInt(this.css.top);

        // Nat. this is your fix.  Just copy this file over
        // the one in your home directory.
        var nat_fix_offset = 10;
        var nat_fix = document.body.scrollTop > this.yOff ?
          nat_fix_offset : this.yOff - document.body.scrollTop;
	this.newDestY = yScroll + nat_fix;
	if (this.newDestY!=this.curTop) {
		if (this.newDestY!=this.destY) {
			this.destY = this.newDestY;
			this.glideInit();
			this.onGlideInit();
		} 
		this.glide();
	}
}

function statGlideInit() {
	var now = new Date();
	this.a = this.destY-this.curTop;
	this.b = Math.PI/(2*this.dur);
	this.c = now.getTime();
	if (Math.abs(this.a)>winHt) {	// distance greater than window height?
		this.d = (this.a>0)? this.destY-winHt: this.destY+winHt;
		this.a = (this.a>0)? winHt : -winHt;
	} else this.d = this.curTop;
}

function statGlide() {
	var now = new Date();
	var t = now.getTime()-this.c;
	var y = Math.round(this.d+this.a*Math.sin(this.b*t));
	if ((this.a>0&&y>this.curTop)||(this.a<0&&y<this.curTop)) {
		this.shiftTo(null,y);
	}
}

