window.addEvent ("load", function () {
	// INFOS PROMO
	if ($('espace_promo')) {
		// INSTANCIATION DU DIAPORAMA
		promoSlideShow = new SlideShow ($('espace_promo'), {
			transition: 'pushLeft',
			duration: 400,
			delay: 15000,
			autoplay: true,
			slides: $('espace_promo').getChildren('div')
		});
		if (promoSlideShow.slides.length>1 && $('promo_precedente') && $('promo_suivante')) {
			$('promo_precedente').fade ('hide');
			$('promo_suivante').fade ('hide');
			$('promo_precedente').addEvent ('click', function(e) {
				e.stop();
				promoSlideShow.show (promoSlideShow.slides.indexOf (promoSlideShow.previousSlide()), {transition: 'pushRight', duration: 400});
			});
			$('promo_suivante').addEvent ('click', function(e) {
				e.stop();
				promoSlideShow.show (promoSlideShow.slides.indexOf (promoSlideShow.nextSlide()), {transition: 'pushLeft', duration: 400});
			});
			var hoverEvents = {
				mouseenter: function(){ 
					promoSlideShow.pause(); 
					$('promo_precedente').fade ('in');
					$('promo_suivante').fade ('in');
				},
				mouseleave: function(){ 
					promoSlideShow.play();
					$('promo_precedente').fade ('out');
					$('promo_suivante').fade ('out');
				}
			};
			$('espace_promo').addEvents (hoverEvents);
		}
	}
	// LA MAGNETOTHERAPIE
	if ($('univers_magnetotherapie')) {
		$('bloc_magnetotherapie').set ('tween', {duration: 400});
		var hoverEvents = {
			mouseenter: function(){ 
				$('bloc_magnetotherapie').fade (0);
			},
			mouseleave: function(){ 
				$('bloc_magnetotherapie').fade (1);
			}
		};
		$('univers_magnetotherapie').getElement ('div.bouton a').addEvents (hoverEvents);
		$('le_precis').addEvents (hoverEvents);
	}
	// CADEAUX
	if ($('offre_jour')) {
		// INSTANCIATION DU DIAPORAMA
		cadeauxSlideShow = new SlideShow ($('offre_jour'), {
			transition: 'pushLeft',
			duration: 400,
			delay: 6000,
			autoplay: true,
			slides: $('offre_jour').getElements('p')
		});
		if (cadeauxSlideShow.slides.length>1 && $('cadeau_suivant')) {
			$('cadeau_suivant').fade ('hide');
			$('cadeau_suivant').addEvent ('click', function(e) {
				e.stop();
				cadeauxSlideShow.show (cadeauxSlideShow.slides.indexOf (cadeauxSlideShow.nextSlide()), {transition: 'pushLeft', duration: 400});
			});
			var hoverEvents = {
				mouseenter: function(){ 
					promoSlideShow.pause();
					$('cadeau_suivant').fade ('in');
				},
				mouseleave: function(){ 
					promoSlideShow.play();
					$('cadeau_suivant').fade ('out');
				}
			};
			$('offre_jour').addEvents (hoverEvents);
		}
	}
	// ACTUS
	if ($('blockActus')) {
		// INSTANCIATION DU DIAPORAMA
		actuSlideShow = new SlideShow ($('blockActus'), {
			transition: 'pushLeft',
			duration: 400, 
			delay: 10000,
			autoplay: false
		});
		$('counter').set ('text', (actuSlideShow.slides.indexOf (actuSlideShow.current)+1)+'/'+actuSlideShow.slides.length);
		$('actu_precedente').addEvent ('click', function(e) {
			e.stop();
			actuSlideShow.show (actuSlideShow.slides.indexOf (actuSlideShow.previousSlide()), {transition: 'pushRight', duration: 400});
		});
		$('actu_suivante').addEvent ('click', function(e) {
			e.stop();
			actuSlideShow.show (actuSlideShow.slides.indexOf (actuSlideShow.nextSlide()), {transition: 'pushLeft', duration: 400});
		});
		actuSlideShow.addEvent('show', function(slideData){
			$('counter').set ('text', (slideData.next.index+1)+'/'+this.slides.length);
		});
	}
	// BLOCS NOUVEAUTES 
	if ($('bloc_nouveaute')) {
		nouveautesSlideShow = new SlideShow ($('bloc_nouveaute'), {
			transition: 'pushUp',
			duration: 400, 
			delay: 5000,
			autoplay: false,
			slides: $('bloc_nouveaute').getElements ('dl')
		});
		$('bloc_nouveaute').getElements('dl').setStyle ('padding', '25px 0 0 0');
		$('nouveaute_suivant').addEvent ('click', function(e) {
			e.stop();
			nouveautesSlideShow.show (nouveautesSlideShow.slides.indexOf (nouveautesSlideShow.nextSlide()), {transition: 'pushUp', duration: 400});
		});
		$('nouveaute_suivant').fade ('hide');
		if (nouveautesSlideShow.slides.length>1) {
			$('nouveaute_suivant').fade ('in');
		};
	}
	// BLOCS TOP VENTES
	if ($('bloc_topvente')) {
		top_venteSlideShow = new SlideShow ($('bloc_topvente'), {
			transition: 'pushUp',
			duration: 400, 
			delay: 5000,
			autoplay: false,
			slides: $('bloc_topvente').getElements ('dl')
		});
		$('bloc_topvente').getElements('dl').setStyle ('padding', '25px 0 0 0');
		$('top_vente_suivant').addEvent ('click', function(e) {
			e.stop();
			top_venteSlideShow.show (top_venteSlideShow.slides.indexOf (top_venteSlideShow.nextSlide()), {transition: 'pushUp', duration: 400});
		});
		$('top_vente_suivant').fade ('hide');
		if (top_venteSlideShow.slides.length>1) {
			$('top_vente_suivant').fade ('in');
		};
	}
	// LES AVANTAGES
	/*if ($('mes_avantages')) {
		var aTriggers = $$('#mes_avantages .trigger');
		aTriggers.each (function (item, index) {
			item.getElement('.bulle').set ('tween', {duration: 200});
			item.getElement('.bulle').fade ('hide');
			item.addEvent('mouseenter', function(e) {
				e.stop();
				this.getElement('.bulle').fade ('in');
			}), 
			item.addEvent('mouseleave', function(e) {
				e.stop();
				this.getElement('.bulle').fade ('out');
			});
		});
	}
	// BLOCS FETE DE MERE
	if ($('presentoir_fete_mere')) {
		pop = new SlideShow ($('presentoir_fete_mere'), {
		transition: 'fade',
		duration: 1000,
		delay: 3000,
		autoplay: true,
		slides: $('presentoir_fete_mere').getElements('li')
		});
	}*/
});
