var pos = 0;
var children = Array();
$(document).ready(function(){
	$(".eventsRotate .event").css("opacity", 0);


	$(".eventsRotate .event").each(function(){
		children[pos] = $(this);
		pos++;
	});
	pos = 0;
	fadeInOut(children[0], callbackFn);


});

function fadeInOut(obj, callback) {
	obj.animate({
		 top: '20px'
		, opacity: 1
	}, 2000, function() {
		obj.animate({opacity: 1}, 5000, function(){
			obj.animate({
				 top: '202px'
				, opacity: 0
			}, 1000, callback);
		});
	});
}

function callbackFn() {
	pos++;
	if (pos == children.length)
		pos = 0;
	fadeInOut(children[pos], callbackFn);
}