$(function(){
	$('.feature.ecards').each(function(index) {
		var scrollIntervall = 6000;
		var content = $(this).find('.content');
		var leftHandle = content.before('<div class="left handle"></div>').prev();
		var rightHandle = content.after('<div class="right handle"></div>').next();

		content.serialScroll({
			items: 'li',
			prev: leftHandle,
			next: rightHandle,
			interval: scrollIntervall,
			constant: false,
			exclude: 3,
			step: 3
		});

		window.setTimeout(function() {
			content.trigger('next');
		}, (scrollIntervall / 2) * (1 + index));
	});
});

$(window).load(function() {

	$('.feature.ecards').each(function(index) {
		$(this).find('li').each(function() {
			var li = $(this);
			var img = $(this).find('img');
			var liHeight = li.innerHeight();
			var imgHeight = img.outerHeight();

			img.css({
				verticalAlign: 'auto',
				marginTop: (liHeight - imgHeight) / 2
			});
		});
	});

});