$(window).load(function() {
	$(".uoScrolling").jcarousel({
		animation: 300,
		scroll: 2,
		initCallback: function(carousel, s) {
			$(carousel.container).parent().find('.next').bind('click', function() {
				carousel.next();
				return false;
			});
	
			$(carousel.container).parent().find('.prev').bind('click', function() {
				carousel.prev();
				return false;
			});
		},
		buttonNextCallback: function(carousel, e, f) {
			if(!f) $(carousel.container).parent().find('.next').addClass('notVisible');
			else $(carousel.container).parent().find('.next').removeClass('notVisible');
		},
		buttonPrevCallback: function(carousel, e, f) {
			if(!f) $(carousel.container).parent().find('.prev').addClass('notVisible');
			else $(carousel.container).parent().find('.prev').removeClass('notVisible');
		}
	});
});

$(document).ready(function() {

	$("a.grouped_elements").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'	  : 'easeOutBack',
		'easingOut'	 : 'easeInBack',
		'titlePosition': 'over',
		'titleFormat'  : function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '  -  Bildwechsel mit Mausrad oder Pfeiltasten m&ouml;glich</span>';
		}
	});

	$("a.blickinsbuch").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'	  : 'easeOutBack',
		'easingOut'	 : 'easeInBack',
		'titlePosition': 'over',
		'titleFormat'  : function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + '  -  Bildwechsel mit Mausrad oder Pfeiltasten m&ouml;glich</span>';
		}
	});
	
	var startlink = $("#start_fotogalerie")
	if(startlink) {
		startlink.click(function(e) {
			var fotolink = $('#fotogalerie a').first()
			if(fotolink) {
				fotolink.click()
			}
		});
	}
	
	var cover_link = $("#cover_link");
	if(cover_link) {
		cover_link.fancybox({
			'titleShow'		: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'easingIn'	  : 'easeOutBack',
			'easingOut'	 : 'easeInBack',
			'overlayOpacity': '0.9',  	//Opacity of the overlay (from 0 to 1; default - 0.3)
			'overlayColor': '#666' //	Color of the overlay
		});
	}
});
