window.addEvent('domready', function() {

	var status = {
	'true': 'open',
	'false': 'close'
	};
	
	Locale.use('fr-FR');

	AFtoggle('scrollingMenu');
	AFtoggle('scrollingMenuMore');

	
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////////
	// NEWSLETTER FORM
	// The elements used.
	var newsletterForm = document.id('newsletterForm'),
    myResult = document.id('myResult');

	// Labels over the inputs.
	newsletterForm.getElements('[type=text], textarea').each(function(el){
	new OverText(el);
	});

	// Validation.
	new Form.Validator.Inline(newsletterForm);

	// Ajax (integrates with the validator).
	new Form.Request(newsletterForm, myResult, {
	requestOptions: {
	'spinnerTarget': myResult
    },
	onSuccess: function(s)
		{
		// alert('success');
		// $('emailNewsLetter').innerHTML='inscrit';
		},
    extraData: { // This is just to make this example work.
      'html': 'Form sent.'
    }
  });	
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	
	// $('popupMessageDiv').fade('hide');
	// $('popupMessageDiv').fade('in');
	new Fx.Move($('popupMessageDiv'), {
	relativeTo: 'premiereZone',
	position: 'upperLeft',
	edge: 'upperLeft',
	offset: {x: 0, y: 0},
	duration: 1,
	transition: Fx.Transitions.linear
	}).start();
	$('popupMessageDiv').morph({'width': '800px','height': '500px'});
	$('popupMessageMessage').morph({'height': '390px'});
	
	
	
	
	// Petit menu sites sociaux
  var el = $('scrollingMenu'),
    color = el.getStyle('scrollingMenu');

  // We are setting the opacity of the element to 0.5 and adding two events
  $('scrollingMenuContainer').set('opacity', 0.6).addEvents({
    mouseenter: function(){
      // This morphes the opacity and backgroundColor
      $('scrollingMenuContainer').morph({
        'opacity': 0.9
      });
      $('scrollingMenu').morph({
        'background-color': '#CCC5A9'
      });
	  $('scrollingMenu').slide('in');
    },
    mouseleave: function(){
	  $('scrollingMenu').slide('out');
      // Morphes back to the original style
      $('scrollingMenuContainer').morph({
        'opacity': 0.6
      });
      $('scrollingMenu').morph({
        'backgroundColor': color
      });
    }
  });
  
  
  
	// Menu complémentaire
  var el2 = $('scrollingMenuMore'),
    color2 = el2.getStyle('scrollingMenuMore');

  // We are setting the opacity of the element to 0.5 and adding two events
  $('scrollingMenuMoreContainer').set('opacity', 0.6).addEvents({
    mouseenter: function(){
      // This morphes the opacity and backgroundColor
      $('scrollingMenuMoreContainer').morph({
        'opacity': 0.9
      });
      $('scrollingMenuMore').morph({
        'background-color': '#CCC5A9'
      });
	  $('scrollingMenuMore').slide('in');
    },
    mouseleave: function(){
	  $('scrollingMenuMore').slide('out');
      // Morphes back to the original style
      $('scrollingMenuMoreContainer').morph({
        'opacity': 0.6
      });
      $('scrollingMenuMore').morph({
        'backgroundColor': color2
      });
    }
  });
  
 
var emailNewsLetter = getCookie('newsletter');
if (emailNewsLetter!=null && emailNewsLetter!="")
  {
  // alert("adresse newsletter " + emailNewsLetter);
  $('textNewsLetter').set('html','Vous &ecirc;tes inscrit<br/>&agrave; notre newsletter<br/>avec l\'adresse ' + emailNewsLetter);
  $('newsletter').set('html','&nbsp;');
  }
else 
  {
  username="";
  }
	
}); 


