window.addEvent('domready', function() {

 
		
/*		var scroll = new Fx.Scroll(window, {
   wait: false,
   duration: 1500,
   transition: Fx.Transitions.Quad.easeInOut
 });

 $('eaudetoiletteScroll').addEvent('click', function(event) {
  event = new Event(event).stop();
  //scroll.toElement('Eaudetoilette');
  scroll.toElement('Eaudetoilette');
  });
 */
 var test="";
var list = $$('.toTopPage');
list.each(function(element) {
 
	//var fx = new Fx.Styles(element, {duration:200, wait:false});
	var scroll = new Fx.Scroll(window, {
   wait: false,
   duration: 500,
   transition: Fx.Transitions.Quad.easeInOut
 });
 
	 element.addEvent('click', function(event) {
 

  event = new Event(event).stop();
  //scroll.toElement('Eaudetoilette');
  scroll.toTop();
  });
	 });

var list2 = $$('.titleScrollDown');
list2.each(function(element) {
 
	//var fx = new Fx.Styles(element, {duration:200, wait:false});
	var scroll2 = new Fx.Scroll(window, {
   wait: false,
   duration: 500,
   transition: Fx.Transitions.Quad.easeInOut
 });
 	
	
	
	//alert(test);
	 element.addEvent('click', function(event) {
 test = element.get('html');
	test = test.toLowerCase();
	test = test+'Scroll';
	test = test.replace(' ','');
	test = test.replace(' ','');
	test = test.replace(' ','');
	test = test.replace(' ','');
	
  event = new Event(event).stop();
  scroll2.toElement(test);
  
  //scroll2.toTop();
  });
	 });
	 
 
 
	// From http://feeds.feedburner.com/SmashingMagazine

	var feed = [

		['FRAIS DE PORT OFFERTS POUR LA FRANCE', 'jusqu\'au 5 fevrier Inclus, les frais de port sont offerts pour la France en collissimo'],

		['RESTEZ INFORMES DES DERNIERES NOUVEAUTES!', 'Inscrivez vous a notre newsletter et beneficiez d\offres tout au long de l\'annee'],

		['PASSEZ VOTRE COMMANDE PAR TELEPHONE', 'Vous pouvez passer votre commande par téléphone grace a notre service de VAD au 04 76 00 00 00 '],

		['BESOIN D\'UN CONSEIL?', 'Vous pouvez nous contacter au 04 76 00 00 00 et ainsi beneficier de conseils sur nos produits'],

		

	];

 

	var running = true;

 	



	var randomize = function() {

		if (!running) return;

 

		// Random message from the feed

		var item = feed.getRandom();

		// First argument title, second message body

		roar.alert(item[0], 'Info Premiere Avenue : ' + item[1])

		// Get last added element and add the click event

 

		roar.items.getLast().addEvent('click', function() {

			// Old school way for forcing a new window (not the best style!)

			window.open('http://www.smashingmagazine.com/' + item[1], 'demo')

		});

	};

	

	var reloadIt = function(){

		randomize.delay(20000);

	}

 

	// Our roar instance for all our messages

	var roar = new Roar({

						

		position: 'lowerLeft',

		duration: 6000,

		onHide: reloadIt

	});

 



 

	// Hey ho, lets go!

	//randomize();
	
	
	
	
	// You can skip the following two lines of code. We need them to make sure demos
	// are runnable on MooTools demos web page.
	// --
	if($('formAlreadyClient')) $('formAlreadyClient').addEvent('submit', function(e) {
		//Prevents the default submit event from loading a new page.
		e.stop();
		//Empty the log and show the spinning indicator.
		var log = $('log_res').empty().addClass('ajax-loading');
		//Set the options of the form's Request handler. 
		//("this" refers to the $('myForm') element).
		this.set('send', {onComplete: function(response) { 
			log.removeClass('ajax-loading');
			log.set('html', response);
		}});
		//Send the form.
		this.send();
	});
	
	//gestion du click sur la case a cocher pour copier les informations de facturation
	if($('copyData')) $('copyData').addEvent('click', function(e) {
		//Prevents the default submit event from loading a new page.
		e.stop();
		//Empty the log and show the spinning indicator.
		$('lastname').value = $('lastname_bill').value;
		$('firstname').value = $('firstname_bill').value;
		$('address').value = $('address_bill').value;
		$('address2').value = $('address2_bill').value;
		$('zipcode').value = $('zipcode_bill').value;
		$('city').value = $('city_bill').value;
		$('zipcode').value = $('zipcode_bill').value;
		$('country').value = $('country_bill').value;
		$('telephone').value = $('telephone_bill').value;
	});





	//cache les menus au demarrage et chage l'opacité
/*	$('scroll1').setStyle('height', '0'); //The width is now 300px.
	$('scroll1').setStyle('visibility', 'hidden');
	$('scroll1').setOpacity(0.90); //The width is now 300px.
	
	$('scroll2').setStyle('height', '0'); //The width is now 300px.
	$('scroll2').setStyle('visibility', 'hidden');
	$('scroll2').setOpacity(0.90); //The width is now 300px.
	
	$('scroll3').setStyle('height', '0'); //The width is now 300px.
	$('scroll3').setStyle('visibility', 'hidden');
	$('scroll3').setOpacity(0.90); //The width is now 300px.*/

/*	$('scroll4').setStyle('height', '0'); //The width is now 300px.
	$('scroll4').setStyle('visibility', 'hidden');
	$('scroll4').setOpacity(0.90); //The width is now 300px.

	$('scroll5').setStyle('height', '0'); //The width is now 300px.
	$('scroll5').setStyle('visibility', 'hidden');
	$('scroll5').setOpacity(0.90); //The width is now 300px.
	
	$('scroll6').setStyle('height', '0'); //The width is now 300px.
	$('scroll6').setStyle('visibility', 'hidden');
	$('scroll6').setOpacity(0.90); //The width is now 300px.
	
	$('scroll7').setStyle('height', '0'); //The width is now 300px.
	$('scroll7').setStyle('visibility', 'hidden');
	$('scroll7').setOpacity(0.90); //The width is now 300px.	
	
	$('scroll8').setStyle('height', '0'); //The width is now 300px.
	$('scroll8').setStyle('visibility', 'hidden');
	$('scroll8').setOpacity(0.90); //The width is now 300px.	*/
	
	
	
	//ouvre le menu 1 lors du survol du scroller 1
//	$('item1').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll1').setStyle('visibility', 'visible');
//			$('scroll1').setStyle('height', 480); //The width is now 300px.
//		//$('scroll').tween('height', 300)
//			//$('scroll').fade('in'); //Fades "myElement" out;
//			$('scroller1').setStyle('background-position', '0px -53px'); //The width is now 300px
//
//			//ferme les autres menus
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
///*			$('scroll4').setStyle('height', 0); //The width is now 300px.
//			$('scroll5').setStyle('height', 0); //The width is now 300px.
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroll7').setStyle('height', 0); //The width is now 300px.
//			$('scroll8').setStyle('height', 0); //The width is now 300px.*/
//	});
//	//ouvre le menu 2 lors du survol du scroller 2
//	$('item2').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll2').setStyle('visibility', 'visible');
//			$('scroll2').setStyle('height', 480); //The width is now 300px.
//			//$('scroll2').tween('height', 300);
//			//modifie l'affichage du fond
//			$('scroller2').setStyle('background-position', '-369px -53px'); //The width is now 300px
//			//alert($('scroller2').getStyle('background-position'))
//			
//			//ferme les autres menus
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
///*			$('scroll4').setStyle('height', 0); //The width is now 300px.						
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroll7').setStyle('height', 0); //The width is now 300px.
//			$('scroll8').setStyle('height', 0); //The width is now 300px.			
//			*/
//	});
//	//ouvre le menu 3 lors du survol du scroller 3
//	$('item3').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll3').setStyle('visibility', 'visible');
//			$('scroll3').setStyle('height', 480); //The width is now 300px.
//			$('scroller3').setStyle('background-position', '-671px -53px'); //The width is now 300px
//			//$('scroll2').tween('height', 300);
//			
//			//ferme les autres menus
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
///*			$('scroll4').setStyle('height', 0); //The width is now 300px.			
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroll7').setStyle('height', 0); //The width is now 300px.*/
//
//
//	});
//	//ouvre le menu 3 lors du survol du scroller 3
///*	$('item4').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll4').setStyle('visibility', 'visible');
//			$('scroll4').setStyle('height', 480); //The width is now 300px.
//			$('scroller4').setStyle('background-position', '-402px -53px'); //The width is now 300px
//			//$('scroll2').tween('height', 300);
//			
//			//ferme les autres menus
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroll7').setStyle('height', 0); //The width is now 300px.
//			
//	});
//		//ouvre le menu 3 lors du survol du scroller 3
//	$('item5').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll5').setStyle('visibility', 'visible');
//			$('scroll5').setStyle('height', 480); //The width is now 300px.
//			$('scroller5').setStyle('background-position', '-471px -53px'); //The width is now 300px
//			//$('scroll2').tween('height', 300);
//			
//			//ferme les autres menus
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
//			$('scroll4').setStyle('height', 0); //The width is now 300px.			
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroll7').setStyle('height', 0); //The width is now 300px.
//			$('scroll8').setStyle('height', 0); //The width is now 300px.
//	});
//			//ouvre le menu 3 lors du survol du scroller 3
//	$('item6').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll6').setStyle('visibility', 'visible');
//			$('scroll6').setStyle('height', 480); //The width is now 300px.
//			$('scroller6').setStyle('background-position', '-611px -53px'); //The width is now 300px
//			//$('scroll2').tween('height', 300);
//			
//			//ferme les autres menus
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
//			$('scroll4').setStyle('height', 0); //The width is now 300px.			
//			$('scroll7').setStyle('height', 0); //The width is now 300px.
//			$('scroll8').setStyle('height', 0); //The width is now 300px.			
//	});
//			//ouvre le menu 3 lors du survol du scroller 3
//	$('item7').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll7').setStyle('visibility', 'visible');
//			$('scroll7').setStyle('height', 480); //The width is now 300px.
//			$('scroller7').setStyle('background-position', '-730px -53px'); //The width is now 300px
//			//$('scroll2').tween('height', 300);
//			
//			//ferme les autres menus
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
//			$('scroll4').setStyle('height', 0); //The width is now 300px.			
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroll8').setStyle('height', 0); //The width is now 300px.
//			
//	});
//	
//		$('item8').addEvent('mouseover', function(e) {
//			e.stop();
//			$('scroll8').setStyle('visibility', 'visible');
//			$('scroll8').setStyle('height', 480); //The width is now 300px.
//			$('scroller8').setStyle('background-position', '-788px -53px'); //The width is now 300px
//			//$('scroll2').tween('height', 300);
//			
//			//ferme les autres menus
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
//			$('scroll4').setStyle('height', 0); //The width is now 300px.			
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroll7').setStyle('height', 0); //The width is now 300px.
//			
//	});*/
//	//ferme les menu lors des sorties
//	$('item1').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll1').setStyle('height', 0); //The width is now 300px.
//			$('scroll1').setStyle('visibility', 'hidden');
//			$('scroller1').setStyle('background-position', '-0px 0px'); //The width is now 300px
//			
//	});
//	$('item2').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll2').setStyle('visibility', 'hidden');
//			$('scroll2').setStyle('height', 0); //The width is now 300px.
//			$('scroller2').setStyle('background-position', '-369px 0px'); //The width is now 300px
//			
//	});
//	$('item3').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll3').setStyle('visibility', 'hidden');
//			$('scroll3').setStyle('height', 0); //The width is now 300px.
//			$('scroller3').setStyle('background-position', '-671px 0px'); //The width is now 300px
//			
//	});
//	/*$('item4').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll4').setStyle('visibility', 'hidden');
//			$('scroll4').setStyle('height', 0); //The width is now 300px.
//			$('scroller4').setStyle('background-position', '-402px 0px'); //The width is now 300px
//			
//	});
//	$('item5').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll5').setStyle('visibility', 'hidden');
//			$('scroll5').setStyle('height', 0); //The width is now 300px.
//			$('scroller5').setStyle('background-position', '-471px 0px'); //The width is now 300px
//			
//	});	
//		$('item6').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll6').setStyle('visibility', 'hidden');
//			$('scroll6').setStyle('height', 0); //The width is now 300px.
//			$('scroller6').setStyle('background-position', '-611px 0px'); //The width is now 300px
//			
//	});	
//			$('item7').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll7').setStyle('visibility', 'hidden');
//			$('scroll7').setStyle('height', 0); //The width is now 300px.
//			$('scroller7').setStyle('background-position', '-730px 0px'); //The width is now 300px
//			
//	});	
//						$('item8').addEvent('mouseout', function(e) {
//			e.stop();
//			$('scroll8').setStyle('visibility', 'hidden');
//			$('scroll8').setStyle('height', 0); //The width is now 300px.
//			$('scroller8').setStyle('background-position', '-788px 0px'); //The width is now 300px
//			
//	});	*/
//	
	//gestion de la fermeture du menu de login
		if($('loginFormCont')) $('loginFormCont').setStyle('height', '0'); //The width is now 300px.
		var loginFormState = 'closed';
		if($('titleLogin')) $('titleLogin').addEvent('click', function(e) {
			e.stop();
			if(loginFormState == 'closed'){
				$('loginFormCont').setStyle('height', 50); //The width is now 300px.
				loginFormState = 'opened';
			}
			else{
				$('loginFormCont').setStyle('height', 0); //The width is now 300px.
				loginFormState = 'closed';
			}
											   });
		
		//scroling elements


	
});