function fDelete(){
	$$('.fDelete').each(function(el){
		el.addEvent('click', function(e){
			e = new Event(e);
			if( !confirm(el.title ? el.title : 'Etes vous sûr de vouloir supprimer cet élément ?')){
				e.stop();
			}
		});
	});
}

function fFlashMessage() {
	new mooFlashMessage($$('.flash'));
}



function giveMeclass() {
	$$('.hideMe').each(function (li) {/* Choppe lelement qui a .li-off pour classe, pour chacun d'entre eux est appliqué la function (li) */
		li.addEvents({
			'mouseenter': function (e) {
				li.addClass('showMe');
			},
			'mouseleave': function (e) {
				li.removeClass('showMe');
			}
		});
	});
}


function tips() {	
	var tips = new Tips($$('.tips'), {
		initialize: function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 200, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	});
	
	if( $('cetelem') ) {
		var cetelem = new Tips($$('#cetelem p'), {
			fixed: true, 
			className: 'cetelem',
			offsets: { x: 0, y: 42 },
			initialize: function(){
				this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 200, wait: false}).set(0);
			},
			onShow: function(toolTip) {
				this.fx.start(1);
			},
			onHide: function(toolTip) {
				this.fx.start(0);
			}
		});
	}
}
 
function fInit(){
	fDelete();
	fFlashMessage();
	giveMeclass();
	tips()
}

function initPartners(){
	if( $('mousemove') ){
		var scroll = new OuterScroller('mousemove', {area: 40, velocity: 1, addarea: 1, outArea : {type: 'V', height: '20'}, always:0, runVelocity:1});
		$('mousemove').addEvent('mouseenter', scroll.start.bind(scroll));
		$('mousemove').addEvent('mouseleave', scroll.stop.bind(scroll));
	}
}

function newsClick( elem ){
	
	if( elem.value == 'votre adresse e-mail' )
		elem.value = '';
	
}

function closeOverlayMessage(){
	
	$('overlay_message').setStyle('display','none');
	
}

window.addEvent('domready',function(){
	
	if( $('news_email') ){
		
		$('news_email').addEvent('click', function(){
			newsClick( this );
		});
		
	}
	
	initPartners();
	fInit();
});