var etatSelectionRegion = 'ferme';

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

	/* Menu de sélection des région - DEBUT */
	if ($('selectionRegionOpener'))
	{
		var FX_menuSelectionRegion = new Fx.Morph($('SelectionRegion'), {link:'cancel'});
		$('selectionRegionOpener').addEvent('click' , function () {
		
			if (etatSelectionRegion == 'ferme') { etatSelectionRegion = 'ouvert'; var nouvelleHeight = $('SelectionRegionHeightGetter').getStyle('height'); var nouvelleMargin = parseInt(nouvelleHeight)+16; }
			else								{ etatSelectionRegion = 'ferme'; var nouvelleHeight = 0; var nouvelleMargin = 0; }
			
			if (accueil == 1) {	FX_menuSelectionRegion.start( { 'margin-top' : '-'+nouvelleMargin , 'height' : nouvelleHeight }); }
			else { FX_menuSelectionRegion.start( { 'height' : nouvelleHeight }); }
			return false;
		
		});
	}
	
	if ($$('a.selectionRegionCloser'))
	{
		$$('a.selectionRegionCloser').each(function(el){ 
			el.addEvent('click' , function () {
				etatSelectionRegion = 'ferme';
				FX_menuSelectionRegion.start( { 'margin-top' : 0 , 'height' : 0 });
			});										
		});
	}
	/* Menu de sélection des région - FIN */
	
	
	/* Menu général - DEBUT */
	$$('a.menuElement').each( 
		function (el) { 
			if ( !el.getElement('img').hasClass('noAction') )
			{
				el.addEvent('mouseover' , function () { el.getElement('img').setStyle('visibility' , 'hidden'); } );
				el.addEvent('mouseout' , function () { el.getElement('img').setStyle('visibility' , 'visible'); } );
			}
		}
	);
	/* Menu général - FIN */
	
	/* Connexion - DEBUT */
	if ($('identification'))
	{
		$('identification').addEvent('click' , function () {  
			var FX_mouvement_identification = new Fx.Morph($('adhesionIn1'), {link:'cancel'});
			FX_mouvement_identification.start( { 'margin-top' : '-53px' });
			return false;
		} );
		
		$('menu8').addEvent('click' , function () {  
			var FX_mouvement_identification = new Fx.Morph($('adhesionIn1'), {link:'cancel'});
			FX_mouvement_identification.start( { 'margin-top' : '-53px' });
			return false;
		} );
		
		if ( $('identificationClose') )
		{
			$('identificationClose').addEvent('click' , function () {  
				var FX_mouvement_identification = new Fx.Morph($('adhesionIn1'), {link:'cancel'});
				FX_mouvement_identification.start( { 'margin-top' : '0px' });
				return false;
			} );
		}
	}
	
	/* Gestion de l'ouverture des sous menus */
	if ($('ouvrirSousMenu1'))
	{
		$('ouvrirSousMenu1').addEvent('click' , function () {  
			$('SousMenu1').setStyle('display' , 'block');
		} );
	}
	if ($('ouvrirSousMenu2'))
	{
		$('ouvrirSousMenu2').addEvent('click' , function () {  
			$('SousMenu2').setStyle('display' , 'block');
		} );
	}
	if ($('ouvrirSousMenu3'))
	{
		$('ouvrirSousMenu3').addEvent('click' , function () {  
			$('SousMenu3').setStyle('display' , 'block');
		} );
	}
	
	/* Désactivation lien */
	var notimooManager = new Notimoo({
	   locationVType: 'top',
	   locationHType: 'right'
	});
	$$('a.lien_desactive').each( function (el) { el.addEvent('click' , function () {
				// Showing a simple notification
				notimooManager.show({
					title: 'Fonctionnalité bientôt disponible',
					message: '<br /><strong>Cette fonctionnalité sera bientôt disponible sur le site de l\'ABF</strong>' 
				});
				return false;
		});
	 });
	
	
	/* Désactivation lien */
	if ( $$('a.nonlog') )
	{
		$$('a.nonlog').each( function (el) {  
				el.addEvent('click' , function () {
					// Showing a simple notification
					notimooManager.show({
						title: '',
						message: '<br /><strong>Il est nécessaire de vous identifier pour accéder à cet espace</strong>' 
					});
					return false;
				});
		 });
	}
	
	if ($('formCon2Conteneur') )
	{
		var FX_con2 = new Fx.Morph($('formCon2Conteneur'), {link:'cancel'});
		
		$('formCon2Conteneur').setStyle('opacity' , 0);
		$('formCon2Conteneur').setStyle('display' , 'block');
		
		$('menu8').addEvent('click' , function () {
				
				FX_con2.start( {'opacity' : 1} );
				
		});
		$('closeCon2').addEvent('click' , function () {
				
				FX_con2.start( {'opacity' : 0} );
				
		});
	
	}

});