var bannerDelay = 5500;
var bannerTimeout = null;

function switchBanners() {
	//alert('switchBanners');

	var $active = $('#motiv > :visible');

    if($active.length == 0) {
	    $active = $('#motiv > :first');
    }

    $active.removeClass('active');

    var $next = $active.next().length ? $active.next()
        : $('#motiv > :first');

    $next.addClass('active');

	$active.fadeOut(100, function () {
		$next.fadeIn(400);
	});

	bannerTimeout = setTimeout("switchBanners()", bannerDelay);
}

$(document).ready(function() {
	$('#motiv :first').addClass('active');
	$('#motiv :first').show();

	bannerTimeout = setTimeout("switchBanners();", bannerDelay);

	$('#motiv').hover(
		function () {
			clearTimeout(bannerTimeout);
		},
		function () {
			bannerTimeout = setTimeout("switchBanners();", bannerDelay);
		}
	);

});
