jQuery.noConflict();
(function($) {
  return $.fn.slider = function(method) {
    var $that, methods;
    $that = this;
    methods = {
      init: function(options) {
        var $active, data, stack, steps;
        steps = this.find(".slide");
        if (steps.length) {
          stack = _.map($.makeArray(steps).reverse(), function(elem) {
            return $(elem);
          });
          $active = stack.pop();
          _.each(stack, function(elem) {
            var css;
            css = {
              "position": "absolute",
              "opacity": "0",
              "left": $("body").width()
            };
            return elem.css(css);
          });
          data = {
            active: $active,
            stack: stack
          };
          this.data("slider", data);
          return this;
        }
      },
      slide: function(speed) {
        var $active, data, offScreen, stack;
        if (speed == null) {
          speed = "600";
        }
        data = $that.data("slider");
        $active = data.active;
        stack = data.stack;
        offScreen = 0 - $active.width();
        $active.animate({
          "left": offScreen
        }, speed).hide();
        $active = stack.pop();
        $active.css("position", "relative").show().animate({
          "opacity": "1",
          "left": 0
        }, speed);
        data.active = $active;
        data.stack = stack;
        return $active;
      },
      add: function(selector) {
        var css, stack;
        stack = $that.data("slider").stack;
        css = {
          "position": "absolute",
          "opacity": "0",
          "left": $("body").width()
        };
        return _.each($(selector), function(elem) {
          return stack.push($(elem).css(css));
        });
      }
    };
    if (methods[method]) {
      return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
    } else if (typeof method === 'object' || !method) {
      return methods.init.apply(this, arguments);
    } else {
      return $.error('Method ' + method + ' does not exist on jQuery.slider');
    }
  };
})(jQuery);
