$.fn.scroller = function( settings )
{
  return this.find("ul").
              each(function()
                   {
                     var $tr = $("<tr>");
                     $(this).find("li").
                             each(function(){$tr.append("<td>"+$(this).html()+"</td>");}).
                             end().
                             replaceWith( $("<table cellpadding='0' cellspacing='0'>").append($tr.append($tr.find("td:first").clone())) );
                   }).
              end().
              each(function()
                   {
                     var scroller = this;
                     $.extend( this
                             , {timer       : 0
                               ,scrollLeft  : 0
                               ,options     : $.extend( {speed: 1, step: 1}, settings )
                               ,marginPos   : this.scrollWidth - $(this).width()
                               ,$icon       : $("<div class='header_icon'>").insertAfter(this).
                                                mousemove(function(){$(this).show();}).
                                                click( function(){scroller.scrollToggle();} )
                               ,scrollStart:  function( settings )
                                              {
                                                settings   = $.extend( this.options, settings );
                                                this.timer = setInterval( function()
                                                                          {
                                                                            var scrollPos = scroller.scrollLeft + settings.step;
                                                                            var $first    = scroller.marginPos <= scrollPos
                                                                                              ? $(scroller).find("td:first")
                                                                                              : null;
                                                                            if ( $first )
                                                                              scrollPos -= $first.width();
                                                                            scroller.scrollLeft = scrollPos;
                                                                            if ( $first )
                                                                              $first.appendTo( $first.parent() );
                                                                          }
                                                                        , settings.speed
                                                                        );
                                              }
                               ,scrollStop  : function(){clearInterval(this.timer);this.timer=0;}
                               ,scrollToggle: function(){if(this.timer)this.scrollStop();else this.scrollStart();}
                               } );
                   }).
              click(function(){this.scrollToggle();}).
              hover(function(){this.$icon.show();}, function(){this.$icon.hide();});
}
