/**
 * @author jmagner
 */
var Slider = {
	construct: function(target, numberOfSeconds) {
		this._list = target;
		this._time = numberOfSeconds * 1000;
		$(this._list).children(':not(img:first)').hide();
		this.index = $(this._list).find('img').index(this) + 1; // +1 is so it doesn't transition to the first image on first rotation, since that image is already visibile
		this.start();
	},
	start: function() {
		var _this = this;
		setTimeout(function() {
			if ($(_this._list).children('img').eq(_this.index + 1).length > 0) {
				_this.index++;
			} else {
				_this.index = 0;
			}
			$(_this._list).children('img:visible').fadeOut();
			$(_this._list).children('img').eq(_this.index).fadeIn();
			_this.start();
		}, _this._time);
	}
}
