Date.prototype.lag = function(x){
	var c = new Date();
	return Math.max(x*1000+this.valueOf()-c.valueOf(),0);
}
ow_teasers.t = document.getElementById('topimg');
ow_teasers.xfade = function() {
	var start = new Date(); 
	if (this.list.length==1) return; 
	else {
		if (++this.i==this.list.length) this.i=0;
		var o = 0;
		
		this.ximage = document.createElement('img');
		this.ximage.opacity = function(x){
			if (this.filters && this.filters.alpha) this.filters.alpha.opacity = x;
			else this.style.opacity = x/100;
			return x;
		}
		this.ximage.onerror = ow_teasers.xfade;
		this.ximage.onload = function(){
			var me = ow_teasers.t.appendChild(this);
			setTimeout(function(){	
				var animation = setInterval(function(){
					if (me.opacity(o+=2)==100) {
						clearInterval(animation);
						var prev = ow_teasers.t.getElementsByTagName('img')[0];
						if (prev!=me) ow_teasers.t.removeChild(prev);
						ow_teasers.ximage = null;
						ow_teasers.xfade();
					}
				},ow_teasers.step);
			},start.lag(ow_teasers.interval));
		}
		this.ximage.src = this.imgroot+this.list[this.i];
	}	
}
if (ow_teasers.t) ow_teasers.xfade();	

