var images = new Array(
	["http://www.viaberlin.de/img/titel/titel.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_bbi2.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_lehmann_haifa.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_trh1.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_andi_kai.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_trh2.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_a99.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_axel.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_carmel1.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_carmel2.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_carmel3.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_carmel4.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_carmel5.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_kai_haim.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_sib1.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_sib3.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_sib2.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_lehmann_kai.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_dwistaa8.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_ruegen1.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_ruegen2.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_kai_elal.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_ruegen3.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_TFT2.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_andi_impuls.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_kai_krayot.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_TTS1.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_TTS2.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_axel_tlzbe.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_dwistabln.jpg", "Titelbild", "weiter..."],
	["http://www.viaberlin.de/img/titel/titel_a12.jpg", "Titelbild", "weiter..."]
	 );

var speed = 10;
var interval = 2000;
var index = 0;

function start() {
	createBackgroundContainer(document.getElementById('image'));
	setTimeout('startFading()', interval);
}

function createBackgroundContainer(element) {
	var image = document.createElement('img');
	image.setAttribute('id', 'image');
	image.setAttribute('src', element.src);
	image.setAttribute('alt', element.alt);
	image.style.width = element.width + 'px';
	image.style.height = element.height + 'px';
	image.style.margin = '0';
	
	var backgroundContainer = document.createElement('span');
	backgroundContainer.setAttribute('id', 'backgroundContainer');
	backgroundContainer.style.display = 'block';
	backgroundContainer.style.margin = '0 0 0 0';
	backgroundContainer.style.padding = '0';
	backgroundContainer.style.width = element.width + 'px';
	backgroundContainer.style.height = element.height + 'px';
	backgroundContainer.appendChild(image);
	
	var parent = element.parentNode;
	parent.replaceChild(backgroundContainer, element);
}

function startFading() {
	var image = document.getElementById('image');
	var backgroundContainer = document.getElementById('backgroundContainer');
	backgroundContainer.style.backgroundImage = "url('" + document.getElementById('image').src + "')";
	
	image.style.opacity = 0;
	image.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
	index=index+1
	image.setAttribute('src', images[index % (images.length)][0]);
	image.setAttribute('alt', images[index % (images.length)][1]);
	image.setAttribute('title', images[index % (images.length)][2]);
	
	for (var i = 0; i < 100; i++) {
		setTimeout('fadeIn(' + i + ')', speed*i);
	}
	setTimeout("startFading()", interval);
}

function fadeIn(i) {
	document.getElementById('image').style.opacity = i/100;
	document.getElementById('image').style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + i + ")";
}

