(function($) {
    $.fn.vertScroller = function() {
        var contHeight = 0;
        $('ul li', this).each(function(index, li) {
            if(index < 3)
                contHeight += $(li).outerHeight();
        });
        this.css({
            height: contHeight+'px',
            overflow: 'hidden',
            position: 'relative'
        });
        
        var self = this;
        // this.bind("scroll_now", function() {
        //     var first = $('ul li', self).first();
        //     var liHtml = first.get();
        //      first.animate({
        //          'opacity': '0.0'
        //      }, 500, function() {
        //          first.animate({
        //              height: '0'
        //          }, 500, function() {
        //              $('ul', self).append($(liHtml).css({
        //                  'opacity': '1.0',
        //                  'height': '50px'
        //              }));
        //              //self.trigger("scroll_now");
        //          });
        //      });  
        // }); 
        this.bind("scroll_now", function() {
            var first = $('ul li', self).first();
            var liHtml = first.get();
            first.animate({
                height: '0'
            }, 500, function() {
                $('ul', self).append($(liHtml).css({
                    //'opacity': '1.0',
                    'height': '50px'
                }));
                //self.trigger("scroll_now");
            });
        });
        if($('ul li', this).length > 3){
	        setInterval(function() {
	            self.trigger("scroll_now");
	        }, 7000);
		}
    }
})(jQuery);

$(document).ready(function() {
    $('#news_in_evidenza').vertScroller();
})
