/**
 * => Mootools 1.2
 * 	=> Core
 * @classDescription
 * Classe permettant d'afficher un diaporama de bannières
 * @author M@nu/Baphira
 */
var BannerSlideShow = new Class({
	Extends: SimpleSlideShow,
	
	initialize: function(slideShow, options){
		this.parent(slideShow, options);
		this.btns = [];
		this.addNavBar();
		
		this.addEvent('onShow',function(i) {
			this.btns.each(function(el) {
				if(el == this.btns[i]) {
					el.addClass('current');
				} else {
					el.removeClass('current');
				}
			}.bind(this));
		}.bind(this));
    },
	
	addNavBar: function() {
		this.navBar = this.slideShow.getElement('.nav');
		this.navBar.setStyle('display','block')
		for(var i = 0; i < this.slides.length; i++) {
			this.navBar.adopt(this.newButton(i));
		}
		this.navBar.inject(this.slideShow, 'top');
	},
	
	newButton: function(i){
		var btn = new Element('a', {
			'href': '#',
			'class': 'btn' + (i == 0 ? ' current':''),
			'text': (i + 1)
		});
		btn.addEvent('click', function(e) {
			new Event(e).stop();
			this.show(i);
		}.bind(this));
		this.btns.push(btn);
		return btn;
	}
	
	
});
