// JavaScript Document

	Event.observe(window, 'load', function() {
										   										 			
		$$('.bulle').each(function(element) {	
			new Tooltip(element, { infobulle: 'bulle_information' });
		});
		
	 $$('a[href^=#]:not([href=#])').each(function(element) {
		element.observe('click', function(event) {
		  new Effect.ScrollTo(this.hash.substr(1));
		  Event.stop(event);
		}.bindAsEventListener(element))
	  });
	 
		$$('.lien').each(function(element) {
			var id = element.id.substr(5);
 			Event.observe(element, "mouseover", function(event) {
				$('url_'+id).setStyle({ display: ''}); 
			}),
			Event.observe(element, "mouseout", function(event) {
				$('url_'+id).setStyle({ display: 'none'});
			});
		});
										
	});

	function resizePrincipale() {
		var projetWidth = 420;
		var largeurEcran = document.viewport.getWidth();
		var nb_projet = Math.floor(largeurEcran / projetWidth)
		var width = parseInt(projetWidth * nb_projet);
		var marge = parseInt((largeurEcran - width) / 2);
		$('page').setStyle({ width: width+'px'});
		$('footer').setStyle({ width: width+'px'});
	}
	
	function rand( min, max ) {  
		var argc = arguments.length;
		if (argc === 0) {
			min = 0;
			max = 2147483647;
		} else if (argc === 1) {
			throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
		}
		return Math.floor(Math.random() * (max - min + 1)) + min;
	}
	
	function changePage(value) {
	
		// Si c'est une page HTML
		if(value.endsWith('.html')) {
			
			location.href = value;
			
		} else {
			
			listerType(value);
			
		}
	
	}
	
	function openConnexion(id) {
		
	if($(id).getStyle('display') == 'none') {
		new Effect.SlideRightIn(id, { duration: 2, queue: 'end' });
	} else {
		new Effect.SlideLeftOut(id, { duration: 2, queue: 'end' });
	}
		
	}