window.addEvent('domready', function(){
			var size = window.getSize();
			$('Content').setStyle('height', size.y-100);
			$('Content').setStyle('overflow', 'auto');


		var list = $$('#Links a');
		list.each(function(element) {
			var menuOverEffect = new Fx.Tween(element, {duration:200, wait:false});
			element.addEvent('mouseenter', function(){
				menuOverEffect.start('font-size', '24px');
				//menuOverEffect.start('color', '#aaa', '#000');
			});
			element.addEvent('mouseleave', function(){
				menuOverEffect.start('font-size', '18px');
				//menuOverEffect.start('color', '#000', '#aaa');
			});
		});

	// Let's define some variables first
	var wrapper = $('wrap'); // The outer wrapper
	var carousel = $('carousel'); // The inner wrapper
	var items = $$('#carousel a'); // The different elements, this is an array
	var item_width = 100; // The full width of a single item (incl. borders, padding, etc ... if there is any)
	var max_margin = items.length * item_width - item_width;
	

	// Set up the animation
	var animation = new Fx.Tween(carousel, {duration: 500});

	// The function to browse forward
	function next_item(pos){
		if(pos == -max_margin){
			animation.start('left', 0);
		} else { 
			var newposition = pos - item_width;
			animation.start('left', newposition);
		}
	}
	
	// The function to browse backward
	function previous_item(pos){
		if(pos == 0){
			animation.start('left', -max_margin);
		} else { 
			var newposition = pos + item_width;
			animation.start('left', newposition);
		}
	}
	// Set up the 'next' and 'previous' buttons

	var repeat = function() {
	var position = parseInt(carousel.getStyle('left'));
		next_item(position);
	};
	var myTimer = repeat.periodical(4000); //Waits 5 seconds then executes myFunction.


	$('next').addEvent('click', function(e){
		myTimer = $clear(myTimer);
		e = new Event(e).stop();
		var position = parseInt(carousel.getStyle('left'));
		next_item(position);
	});
	
	$('prev').addEvent('click', function(e){
		myTimer = $clear(myTimer);
		e = new Event(e).stop();
		var position = parseInt(carousel.getStyle('left'));
		previous_item(position);
	});


			var list = $$('#carousel a');
			var myTips = new Tips('#carousel a');

			list.each(function(element) {
			  	// Gestionnaire d'évènement 'click'
			  	element.addEvent('click', function(e){
				// On stoppe le pointage naturel du lien pour ne pas recharger la page
					e = new Event(e).stop();
					var path = element.getProperty('href');
					var mainID = 'containercontent';
					//We can use one Request object many times.
					var req = new Request.HTML({url:path+':::template/page/inc',evalResponse:true,
						onRequest: function(html) {
							$(mainID).set('text', 'LOADING');
							$(mainID).addClass('loading'); 
						},
						onSuccess: function(html) {
							//Clear the text currently inside the results div.
							$(mainID).set('text', '');
							$(mainID).removeClass('loading'); 
							//Inject the new DOM elements into the results div.
							var innerContent = new Element('div', {'id': 'innerContent'});
							innerContent.adopt(html);
							$(mainID).adopt(innerContent);
							var mySlide = new Fx.Slide(innerContent).hide().chain(function(){
							}).toggle();


						},
						//Our request will most likely succeed, but just in case, we'll add an
						//onFailure method which will let the user know what happened.
						onFailure: function() {
							$(mainID).set('text', 'The request failed.');
						}
					});
					req.send();
				});
			});

});

function montre(id) {
	$(id).setProperty('style','opacity:0;display:block'); 
	var fx = new Fx.Styles($(id), {duration:500, wait:false});
	fx.start({'opacity': 1});
}
function montre_inline(id) {
	$(id).setProperty('style','opacity:0;display:inline'); 
	var fx = new Fx.Styles($(id), {duration:500, wait:false});
	fx.start({'opacity': 1});
}
function cache(id) {
	var fx = new Fx.Styles($(id), {duration:500, wait:true});
	fx.start({'opacity': 0});
	$(id).setProperty('style','display:none'); 
}
/*
function ajaxForms(selector) {
	var forms = $$(selector);
	var formID = 0;
					loading = new Element('div', {'class': 'loading'});
					loading.innerHTML = 'En cours de chargement';
	forms.each(function(form) {
		formID++;
		form.setProperty('action',form.getProperty('action') + ':::template/inc');
		var list = form.getElements('input[type=submit]');
		list.each(function(element) {
			  	// Gestionnaire d'évènement 'click'
				element.setProperty('style','background:red;'); 
				//exception pour les uploader de fichiers, il faut uploader par iframe
				if(element.name == 'addfile'){
					//On créé un iframe qui lorsqu'il est loadé fait une requete ajax
						iframe = new Element('iframe', {
						      'src': 'about:blank',
						      'id': 'upload_target'+formID,
						      'name': 'upload_target'+formID,
						      'styles': {
							'display': 'none',
							'width': '100px',
							'height': '600px'
						      }
						    });
						iframe.addEvent('load', function(){
									var url = form.getProperty('action');
									var ajaxRequest = new Ajax(url, {
										update: 'Main',
										onComplete: function() {
											ajaxForms('#Main form');
											ajaxURLS('#Main a');
										}
									});
									ajaxRequest.request();

						});
					//On donne au formulaire le target vers cet iframe
					form.target = 'upload_target'+formID;
					element.setProperty('style','background:blue;');
					//On ajoute un évènement click sur le input qui inclus l'iframe dans la page
					element.addEvent('click', function(e){
						loading.inject(form.getParent(), 'top');
						form.setProperty('style','display:none;');
						form.getParent().adopt(iframe);
					});

				}else{
				//Pour tout les autres cas, ajax traditionnel
				  	element.addEvent('click', function(e){
						new Event(e).stop();
						//form.empty();
						var hidden = new Element('input', {type: 'hidden'}).inject(form);
						hidden.setProperties({
							name: element.name,
							value: element.value
						});
						form.send({
							update: 'Main',
							onRequest: function() {
							},
							onComplete: function() {
								ajaxForms('#Main form');
								ajaxURLS('#Main a');
							}
						});
					});
				}
		});
	});
}

function ajaxURLS(selector) {
	var list = $$(selector);
	list.each(function(element) {
		  	// Gestionnaire d'évènement 'click'
		  	element.addEvent('click', function(e){
			// On stoppe le pointage naturel du lien pour ne pas recharger la page
				e = new Event(e).stop();
						montre('Loader');
				// Requête ajax
				var url = element.getProperty('href') + ':::template/inc';
				var ajaxRequest = new Ajax(url, {
					method: 'get',
					update: $('Main'),
					evalScripts : true,
					evalResponse : true,
					onRequest: function() {
					},
					onComplete: function() {
						ajaxURLS('#Main a');
						ajaxForms('#Main form');
						montre('Main');
						cache('Loader');
					}
				});
				$('Main').setProperty('style','display:none;');
				ajaxRequest.request();
			});
	});
}
*/
function activeMootools(){

/*

window.addEvent('domready', function(){
	$('Links').setProperty('style','opacity:0;display:block'); 
	$('Main').setProperty('style','opacity:0;display:block'); 
});
	//Affichage adouci et retardé du menu, avec effet d'opacité
	$('Links').setProperty('style','opacity:0;display:block'); 
	montre('Main');
 
	var fx = new Fx.Styles($('Links'), {duration:1000, wait:false});
	fx.start({'opacity': 1});


	//$('file_upload_form').onsubmit=function() {
		//$('file_upload_form').target = 'upload_target'; //'upload_target' is the name of the iframe
	//}


	var timetowait = 0;
		var list = $$('#Links a');
		list.each(function(element) {
			var fx = new Fx.Styles(element, {duration:200, wait:false});
		 
			element.addEvent('mouseenter', function(){
				fx.start({
					'font-size': 24,
					'color': '#000'
				});
			});
		 
			element.addEvent('mouseleave', function(){
				fx.start({
					'font-size': 18,
					'color': '#666'
				});
			});

			element.setProperty('style','opacity:0;'); 
			timetowait ++;
			var fx2 = new Fx.Styles(element, {duration:500, wait:1000});
			fx2.start.delay(timetowait*300, fx, {
				'opacity': 1
			});
		 
		});

	//Affichage séquenciel des résumés
	var timetowait = 2;
	var list = $$('#Main .resume');
	list.each(function(element) {
				element.setProperty('style','opacity:0;'); 
				timetowait ++;
				var fx = new Fx.Styles(element, {duration:500, wait:1000});
				fx.start.delay(timetowait*500, fx, {
					'opacity': 1
				});
	});*/
}

