if(!com) var com = new Object();
if(!com.monocom) com.monocom = new Object();

com.monocom.SlideShow = function (id, elClass, fadeTime, visibleTime) {
	var _this = this;
	this.els = $("#"+ id+ ' > .'+ elClass);
	this.fadeTime = fadeTime*1000;
	this.visibleTime = visibleTime*1000;
	this.i = 0;
	var first = true;
	$(this.els).each(function ( i, el ) {
		if(i!=0) $(el).css({opacity: 0.0});
	});
	this.intervalID = setInterval( function(){ return _this.step.apply(_this)}, this.fadeTime+this.visibleTime);
}

com.monocom.SlideShow.prototype.step = function () {
	var current = this.i;
	this.i = (this.i+1) < this.els.length ? this.i+1 : 0;
	$(this.els[this.i]).css({opacity: 0.0}).animate({opacity: 1.0}, this.fadeTime, function() {
		//
	});
	$(this.els[current]).animate({opacity: 0.0}, this.fadeTime, function() {
		//
	});
}

