/* titleImgRotate.js */

function TitleImgRotate(baseElementId) {
	this.interval = 5000;
	this.active;
	this.images;
	this.index = 0;

	this.init = function(baseElementId) {
		var findImgs = document.getElementById(baseElementId);
		if (findImgs) {
			var imgs = findImgs.getElementsByTagName('img');
			if (imgs && imgs.length > 0) {
				this.active = imgs[0];
				this.images = new Array(imgs.length);
				for (var i = 0; i < imgs.length; i++) {
					this.images[i] = imgs[i].src;
				}
			}
		}
		var anInterval = this.interval;
		window.setInterval("TIR.next()",anInterval);
	}
	this.next = function() {
		this.index++;
		if (this.index >= this.images.length) {
			this.index = 0;
		}
		this.active.src = this.images[this.index];
	}
}
var TIR = new TitleImgRotate();
window.setTimeout("TIR.init('bilder')",100);


