jQuery.fn.SlideBox = function(options) {

    settings = jQuery.extend({
        interval: 10000,
        height: 100,
        show: 2
    }, options);

    function resizeMe() {
        var mw = container.parent().width() - 30;
        container.css({ width: mw + 30 })
            .find('> .wrapper').css({ width: mw })
            .find('> ul').css({ left: -(mw * (settings.show - 1)) })
            .find('> li').css({ width: mw });
        return mw;
    }

    function move_to_prev() {
        if (ready == true && settings.show > 0) {
            ready = false;
            content.animate({
                left: '+=' + max_width + 'px'
            }, 'slow', function() {
                settings.show--;
                ready = true;
                if (settings.show == 1) {
                    content.css({ left: -(max_width * (count - 2)) });
                    settings.show = count - 1;
                }
            });
        }
    }

    function move_to_next() {
        if (settings.show <= count && ready == true) {
            ready = false;
            content.animate({
                left: '-=' + max_width + 'px'
            }, 'slow', function() {
                settings.show++;
                ready = true;
                if (settings.show == count) {
                    content.css({ left: -max_width });
                    settings.show = 2;
                }
            });
        }
    }

    $(window).resize(function() { max_width = resizeMe(); });

    var ready = true;
    var container = this;
    var max_width = resizeMe();

    $ul = this.find('> ul').css({ margin: 0, padding: 0 });
    var count = $ul.find('> li').css({ display: 'block', float: 'left', padding: 0, margin: 0, height: settings.height, width: max_width }).length + 2;
    settings.show = settings.show < 1 ? 1 : settings.show > count ? count : settings.show;
    $last = $ul.find('> li:last').clone();
    $first = $ul.find('> li:first').clone();
    $ul.prepend($last);
    $ul.append($first);

    this.css({ position: 'relative', overflow: 'hidden', width: max_width + 30, height: settings.height }).wrapInner($('<div class="wrapper"></div>'));
    var content = this.find('> .wrapper').css({ position: 'absolute', left: '15px', overflow: 'hidden', width: max_width }).find('> ul').css({ position: 'relative', left: -(max_width * (settings.show - 1)), width: max_width * count + 30 });

    this.prepend(
        $('<div style="background:url(img/arrow_right.png) no-repeat"/>')
            .css({ cursor: 'pointer', zIndex: '2', position: 'absolute', width: '15px', height: '500px', right: 0, top: 0, backgroundPosition: '0 ' + (parseInt(settings.height / 2) - 20) + 'px' })
            .click(function() { window.clearInterval(autoplay); move_to_next(); })
    );
    this.prepend(
        $('<div style="background:url(img/arrow_left.png) no-repeat"/>')
            .css({ cursor: 'pointer', zIndex: '2', position: 'absolute', width: '15px', height: '500px', left: 0, top: 0, backgroundPosition: '0 ' + (parseInt(settings.height / 2) - 20) + 'px' })
            .click(function() { window.clearInterval(autoplay); move_to_prev(); })
    );

    var autoplay = window.setInterval(function() { move_to_next(); }, settings.interval);

}