jQuery.fn.slideShow = function(options) {
    // instead of selecting a static container with 
    // $("#rating"), we now use the jQuery context
    
    var settings = jQuery.extend({
        delay: 3000,
        slideDuration: 500,
        indicators:'.indicators' //maybe make this more customizable later
    }, options);
    
    // ... rest of the code ...
    this.each(function(){
        var s = $(this),
            $ul = s.find('.slideshow_list'),
            slideAmount = $ul.children('li').length,
            slideWidth = $ul.children('li').outerWidth(true),
            $slideIndicators = s.find(settings.indicators),
            currentSlide = 0,
            slideInterval = null,
            isSliding = false;
        
        
        $ul.width(slideAmount*slideWidth);
        
        controls();
        setLink();
        doAnimate(); //set initial
        
        
        //start slideshow Interval
        slideInterval = setInterval(next, settings.delay+settings.slideDuration);

        function controls(){
                    // prev/next events
                    s.find('.controls').live('click', function(e){
                        e.preventDefault();
                        //stop the interval on any control click
                        clearInterval(slideInterval);

                        if($(this).hasClass('next')){next();}
                        else if($(this).hasClass('prev')){prev();}

                        //start up slideshow interval again.
                        slideInterval = setInterval(next, settings.delay+settings.slideDuration);
                    });
                    $slideIndicators.live('click', function(e){
                        e.preventDefault();
                        //stop the interval on any control click
                        clearInterval(slideInterval);
                        
                        currentSlide = $(this).index(settings.indicators);
                        doAnimate();

                        //start up slideshow interval again.
                        slideInterval = setInterval(next, settings.delay+settings.slideDuration);
                    });
        }
        function indicator(){
                    $slideIndicators.each(function(){$(this).removeClass('active');});
                    $($slideIndicators[currentSlide]).addClass('active');
        }

        function prev(){
                    if(currentSlide!==0){currentSlide--;}
                    else{currentSlide = slideAmount-1;}

                    doAnimate();
        }
        function next(){
                    if(currentSlide < slideAmount-1){currentSlide++;}
                    else{currentSlide = 0;}

                    doAnimate();
        }
        function doAnimate(){
                    $ul.stop().animate({left: -(currentSlide*slideWidth)+'px'}, settings.slideDuration);

                    indicator();
                    setLink();
        }
        function setLink(){
                    var href = $ul.children('li:eq('+currentSlide+')').children('a').attr('href');
                    s.find('.slideshow_link').attr('href', href);
        }
    });
    
    
    
    // if possible, return "this" to not break the chain
    return this;
};
$(document).ready(function(){
    $('.slideshow').slideShow();
//var y = new slideShow('phantom-featured2');
});

