function addOpacityClass() {
	var arr=$('div.ausstellung');
	for (var i=0; i<arr.length; i++) {
		$(arr[i]).addClass('with-opacity');
	}
}

function removeOpacityClass(i) {
	var elem=$('#ausstellung-'+i)	;
	if (elem)
		elem.removeClass('with-opacity');
}

function swap(){
	img=document.getElementById('image1');
	if(x>anzahl)
		x=0;
	img.style.backgroundImage='url('+images[x].src+')';
	addOpacityClass();
	removeOpacityClass(x+1);
	x++;
	
	if(doswap)window.setTimeout('swap()',4000);
}


// special function for mohler
function openImage(imgNum){
	var elem=document.getElementById("image1");
	if (elem) {
		elem.style.backgroundImage="url("+images[imgNum].src+")";
		addOpacityClass();
		removeOpacityClass(imgNum+1);
		if (imgNum<=anzahl)
			x=imgNum;
	}
}

function setSwap(wert){
	doswap=wert;
	if(wert==true)
		swap();
}
