$(document).ready(function() {
	// Struktur geladen

	$('div.galleryItemClass > img').bind('click', function() { showNext(); });
	//$('div#pictSupersizeLayer > img').bind('click', function() { alert('jetzt geht es wieder zur Uebersicht ...'); });

	$(document).keyup(function(event) {
		//if (event.keyCode == 37) showPrev();
		if (event.keyCode == 39) showNext();
	});

});

$(window).load( function(){
	// Elemente geladen

	resizeWrapper();

});

function showNext() {
	//alert(curPict + "/" + maxPicts);
	if (maxPicts >= 1) {
		if (curPict < maxPicts) {
			$("div#gallerySliderLayer").animate({"left": "-=410px"},500);
			curPict++;
			resizeWrapper();
		} else {
			$("div#gallerySliderLayer").animate({"left": "0px"},500);
			curPict = 1;
			resizeWrapper();
		}
	}
}

function resizeWrapper() {
	var tempH = $('div#galleryItem' + curPict + 'Layer').height();
	$('div#galleryWrapper').animate({
		//opacity: 0.25,
		//left: '+=50',
		height: tempH + 'px'
	}, 500, function() {
		// Animation complete.
	});
}
