function ChangeImages2(el, imgs) {
	this.element = $('#' + el);
	this.images = imgs;
	this.length = imgs.length;
	this.index = 0;
	
	this.init = function() {
		this._setPhoto(0);
		this._addRoundRobin();
		//this._nextStep();
	}
	
	this._nextStep = function() {
		this.index = this.index + 1;
		if(this.index >= this.length) {
			this.index = 0;
		}
		this._setPhoto(this.index);
	}
	
	this._onClick = function() {
		this._nextStep();
	}
	
	this._addRoundRobin = function() {
		var t = this;

		this.element.everyTime(4000, function(ta) {
			t._onClick();
		});
	}

	this._setPhoto = function(i) {
		this.element.attr('src', this.images[i]);
	}

	this.init();
}

ChangeImages = function(el, imgs) {
	var element = $('#' + el);
	var images = imgs;
	var length = imgs.length;
	var index = 0;
	
	var _nextStep = function() {
		element.fadeOut(400, function(){
			element.src = images[0];
			_setPhoto(index)
			index = index + 1;
			if(index >= length) {
				index = 0;
			}
		});
		element.fadeIn(400);
	}
	
	var _setPhoto = function(i) {
		element.attr('src',images[index]);
	}
	
	var _addRoundRobin = function() {
		element.everyTime(3000, function() {
			_nextStep();

		});
	}
	
	_nextStep();
	_addRoundRobin();
	
	return {
		getImages: function() {
			return {
				images: images,
				index: index
			};
		},
		setPhoto: function(i) {
			_setPhoto(i);
		}
	} 
}

