﻿(function(jQuery) {
    jQuery.fn.rotate = function() {
        var container = jQuery(this);
        var totale = container.find(".muda").size();
        var current = 0;

        container.find(".muda").filter(":eq(" + current + ")").fadeIn("slow").end().not(":eq(" + current + ")").fadeOut("slow");
        
        var i = setInterval(function() {
            if (current >= totale) current = 0;
            container.find(".muda").filter(":eq(" + current + ")").fadeIn("slow").end().not(":eq(" + current + ")").fadeOut("slow");
            current++;
        }, 5000);
        return container;
    };
})(jQuery);
