/* js for auto-vorbeck kids page */

var numPics = 16;
var currentPicIndex = 1;


function initRundgang() {
	// enable buttons
	$("#btn-back").click(showPrevPic);
	$("#btn-next").click(showNextPic);
	
	$("img#picture").load(function(){
		$(this).fadeIn();
		var picHeight = $(this).attr("height");
		$("#picture-container").css("height", picHeight + "px");		
	})
}

function showNextPic(){
	currentPicIndex = currentPicIndex < numPics ? currentPicIndex + 1 : 1;
	changePic();
}

function showPrevPic(){
	currentPicIndex = currentPicIndex > 1 ? currentPicIndex - 1 : numPics;
	changePic();	
}

function changePic() {
	$("img#picture").hide().attr("src", "images/werkstatt-rundgang/richard-" + currentPicIndex + ".jpg");
}


$(document).ready(function(){
  initRundgang();
});
