
window.addEvent('domready', LBArssfeed);
function LBArssfeed()
{
	var loNewsTranslator = new ItemTranslator('actualites_dyn','actualites_dyn_hidden');
	var loEventTranslator = new ItemTranslator('agenda_dyn','agenda_dyn_hidden');
	loNewsTranslator.start();
	loEventTranslator.start();
}

function ItemTranslator(psShowCssClass, psHideCssClass){
	this.sShowCssClass = psShowCssClass;
	this.sHideCssClass = psHideCssClass;
	this.aItems = $$('.' + psShowCssClass);
	this.nMaxItems = this.aItems.length
	this.nCurrentItem = 0;
}

ItemTranslator.prototype.start = function(){
	if(this.nMaxItems > 1){
		var loItemTranslator = this;
		window.setInterval(function(){loItemTranslator.rotate();}, refreshRSSinterval);
	}
}

ItemTranslator.prototype.rotate = function(){
	var loCurrentElm = this.aItems[this.nCurrentItem];
	this.nCurrentItem++;
	if(this.nCurrentItem >= this.nMaxItems) this.nCurrentItem = 0;
	var loNextElm = this.aItems[this.nCurrentItem];
	
	loCurrentElm.addClass(this.sHideCssClass);
	loCurrentElm.removeClass(this.sShowCssClass);
	loNextElm.setStyle('opacity', '0');
	loNextElm.removeClass(this.sHideCssClass);
	loNextElm.addClass(this.sShowCssClass);
	var myFx = new Fx.Tween(loNextElm, {duration : 'normal'});	
	myFx.start('opacity', '0', '1');	
	myFx = null;
}
