(function($) {
  $.fn.slides = function (customOptions) {
    var options = {
      interval:5000,
      speed:500
    };
    if (customOptions) {
      $.extend(options, customOptions);
    }
    
    return this.each(function () {
      var e = $(this);
      var photos = e.find('.photos li').hide();
      //var items = e.find('.items li');
      
      var position = -1;
      var count = photos.length;

      //items.append('<div class="wedge"/>');
      
      var rotate = function () {
        var speed = options.speed;
        
        // Out with the old
        if (position > -1) {
          //$(items[position]).find('.wedge').animate({ width:'0', left:'0' }, speed);
          $(photos[position]).fadeTo(speed, 0.0);
        } else {
          speed = 0;
        }
        position = (position+1 >= count) ? 0 : position + 1;
        
        //$(items[position]).find('.wedge').animate({ width:'27px', left:'-27px' }, speed);
        $(photos[position]).fadeTo(speed, 1.0);

      };
      
      rotate();
      setInterval(rotate, options.interval);
      
    });
  };
})(jQuery);

