(function($){
	$.fn.carousel = function(){
		return this.each(function(){
			
			// grab all <li>s in the carousel and hide them
			var $carousel = $('>li', this).hide();
			// set $current item to be the first <li> and fade it in
			var $current = $carousel.filter(':first').fadeIn();
			
			// the main function
			cycle = function(){
				var $next = ($current.next('li').length == 0 ) ? $carousel.filter(':first') : $current.next();
				$current.fadeOut(1000, function(){
					$next.fadeIn(1000);
				});
				$current = $next;
			}
			
			// start the cycle for the first time
			if ($carousel.length > 1) timer = window.setInterval(cycle, 6000);
		});
	}
})(jQuery);

$(function(){
	if ($('.wist-u-dat').length != 0) {
		$('.wist-u-dat').carousel();
	}
});
