
var imageFunctionArray = new Array();
function image(aImgId, aTimer, aImages) {
	this.imgId = aImgId;
	this.timer = aTimer;
	this.images = aImages;
	this.counter = 0;
	var d = new Date();
	this.lastShifted = d.getTime();
	this.shift = function shiftMe(now) {
		if (this.counter + 1 == this.images.length) {
			this.counter = 0;
		} else {
			this.counter++;
		}
		document.getElementById(this.imgId).src = this.images[this.counter];
		this.lastShifted = now;
	};
}
function shiftImages() {
	for (var i = 0; i < imageFunctionArray.length; i++) {
		var now = new Date();
		now_miliseconds = now.getTime();
		if (now_miliseconds > imageFunctionArray[i].lastShifted + imageFunctionArray[i].timer) {
			imageFunctionArray[i].shift(now_miliseconds);
		}
	}
}


