jQuery.easing.easeOutQuart = function(x, t, b, c, d) {
	return -c * ((t = t / d - 1) * t * t * t - 1) + b;
};

jQuery( function($) {

	$('div.scrollBar').serialScroll( {
		items :'li',
		prev :'div.scrollBlock div.scrollLeft',
		next :'div.scrollBlock div.scrollRight',
		offset :-200, //when scrolling to photo, stop 230 before reaching it (from the left)
		start :0, //as we are centering it, start at the 2nd
		duration :1200,
		force :true,
		stop :true,
		lock :false,
		cycle :false, //don't pull back once you reach the end
		easing :'easeOutQuart', //use this easing equation for a funny effect
		jump :true //click on the images to scroll to them
	});
});

$(document).ready( function() {
	$('h1').sifr({
		path: '/sifr/', 
		font: 'BellMT'
		}
	);
	
	$('div.menu_left li').hover(function () {
		$('div.menu_left li').removeClass('hover');
		$(this).addClass('hover');
	}, function () {
		$(this).removeClass('hover');
	}
	);
	
	$( function() {
		$("div.scrollBar li").click( function() {
			var imageId = $(this).children("img").attr("id");
			$("div.fotoBlock").addClass("loading");			
			showImage("../artikelAfb/"+imageId+"-550x400.jpg", $(this).children("img").attr("alt"));
			$(this).attr("class", "selected");
			return false;
		});
	});
	
	var showImageActive;
	
	function showImage(src, title) {
		$("div.fotoBlock img").fadeOut("slow").remove().unload();
		var largeImage = new Image();
		$("div.scrollBar li").removeClass("selected");
		$(largeImage).attr("src", src).load(
			function () {
				// Prevent displaying before load complete
			});
		$(largeImage).hide();
		$("div.fotoBlock").removeClass("loading").append(largeImage);
		$(largeImage).fadeIn("slow");
		$("div.fotoInfo").html(title.replace(' | ', "<br />"));
	}
});


