var Fader = new Class({
	initialize: function(){	
	
		//User settings
		this.fadeOutDuration = 200;					//Fade out duration
		this.fadeInDuration = 500;					//Fade in duration
		this.slogan = 'slogan';						//Id of the bloc with fade
		this.sloganBackgroundColor = '#e2dbbf';		//Fix for only IE6 : background color of previous bloc
		this.buttonClass = '.o';					//Button's class
		
		this.fadeIn = new Fx.Style(this.slogan,'opacity',{
			duration: this.fadeInDuration,
			transition: Fx.Transitions.linear
		});	
		
		this.fadeOut = new Fx.Style(this.slogan,'opacity',{
			duration: this.fadeOutDuration,
			transition: Fx.Transitions.linear
		});		
		
		this.title = '';
		this.firstPass = 0;
		this.addE();
		this.sloganDiv = $(this.slogan);
		if (window.ie6) this.sloganDiv.setStyle('background-color', this.sloganBackgroundColor);	
	},
	
	addE: function(){
		// add mouseover on buttons
		$$(this.buttonClass).each(function(el){
			el.addEvent('mousemove', function(){this.showSlogan(el.getAttribute('name'));}.bind(this));
		}.bind(this));
	},
	
	showSlogan: function(title){
		if (title != this.title) {
			if (this.sloganDiv.getStyle('opacity') == 1 || this.firstPass == 0) {
					this.title = title;
					this.fadeOut.start(this.sloganDiv.getStyle('opacity'),0).chain(this.fadeIn.start.pass([0,1], this.fadeIn).bind(this));
					this.swapSlogan.pass(title).delay(200);
					this.firstPass = 1;
			}	
		}
	},
	
	swapSlogan: function(title) {
		$('slogan').innerHTML = title;
	}
});
// Execute the site.start
window.addEvent('load', function() {var fader = new Fader()});