function animateContent(nStories, frameName, timeToPlay){
	this.nStories = nStories;
	this.currentDiv = 0;
	this.animeDiv = null;
	this.frameName = frameName;
	this.timeToPlay = timeToPlay;
}

animateContent.prototype.animateContent2 = function (id){
	clearTimeout(this.animeDiv);
	var lastDiv = this.currentDiv;
	if((this.currentDiv+id) >= this.nStories){
		this.currentDiv = 0;
	}else{
		if((this.currentDiv+id) < 0){
			this.currentDiv = this.nStories-1;
		}else{
			this.currentDiv += id;
		}
	}
	var fader1 = new Fadomatic(document.getElementById(this.frameName+lastDiv), 10, 100);
	var fader2 = new Fadomatic(document.getElementById(this.frameName+this.currentDiv), 10, 0);
	fader1.fadeOut();
	fader2.fadeIn();	
  	var objref = this;
	this.animeDiv = setTimeout(function() {objref.animateContent2(1);}, 7000);
}

animateContent.prototype.pauseContent = function (){
	clearTimeout(this.animeDiv);
}

animateContent.prototype.playContent = function (frameName, id){
}

animateContent.prototype.initStories = function (){
	for(i=1; i < this.nStories; i++){
		var fader = new Fadomatic(document.getElementById(this.frameName+i), 5,0);
	}
  	var objref = this;
	this.animeDiv = setTimeout(function() {objref.animateContent2(1);}, this.timeToPlay);
}