function contentRotator($content, options) {
    var fullTimeout = options.timeout;
    var halfTimeout = fullTimeout/2;
    var $kontejner = $content.parent();
        $content.fadeOut("fast", function($content) {

            return function() {

                /* HIDE ALL ITEMS */
                $kontejner.children().hide(); //not($content)

                $content.fadeIn(halfTimeout, function() {

                    /* GO BACK TO FIRST ITEM */

                    if ($(this).is($kontejner.children().last())) {

                        setTimeout(function() {

                            contentRotator($kontejner.children().first(), options);

                        }, fullTimeout);

                    }

                    else { /* FADE IN NEXT ITEM  */

                        setTimeout(function() {

                            contentRotator($($content.next()), options);

                        }, fullTimeout);

                    }

                });

            };

        } ($content));
}


(function($) {
    $.fn.rotator = function(userOptions) {
        var options = $.extend({}, $.fn.rotator.defaultOptions, userOptions);
		var that = this.not('.'+options.cssHotovoClass);
//        that.addClass(options.cssHotovoClass);

        return that.each(function() {
            var $kontejner = $(this);
            if ($kontejner.children().length > 1) {
            var $prvniPolozka = $kontejner.children().first();
            contentRotator($prvniPolozka, options);
            }
        });

    };
})(jQuery);

$.fn.rotator.defaultOptions = {
    cssHotovoClass : 'hotovoRotator',
    timeout : 3000
};
