// Mootools 1.11
var AnimImages = new Class({

	initialize: function(element) {
		this.items = $$('#'+element+' img');
		this.hide();
	},

	// Cache les images
	hide: function() {
		// On rend toutes les images transparentes
		this.items.each(function(item) {
			item.setStyles({'opacity': 0});
		});
		this.show();
	},
	
	// Affiche la galerie
	show: function() {
		// On crée une "chaine" pour l'effet d'apparition des miniatures l'une après l'autre
		var itemsChain = new Chain();
		this.items.each(function(item) {
			itemsChain.chain(function() {
				fx = new Fx.Styles(item, {'duration': 1000});
				fx.start({'opacity': 1});
			});
		});
		// On exécute la chaine
		var runChain = function() {
			itemsChain.callChain();
			if (itemsChain.chains.length == 0) { runChain = $clear(timer); } 
		}
		var timer = runChain.periodical(600);
	}
	
});