window.addEventListener("load", function() { setTimeout(loaded, 100);}, false);
	
	
		var Xstart;
		var Xend;
		
		function loaded() {
			window.scrollTo(0, 1); // pan to the bottom, hides the location bar
		}
		
		document.ontouchstart = function(evt){
  			if(evt.touches.length == 1){
				Xstart = evt.touches[0].screenX;
			}
		}
		
		document.ontouchmove = function(evt){
  			if(evt.touches.length == 1){
				Xend = evt.touches[0].screenX;
			}
		}
		
		document.ontouchend = function(evt) {
			Xstart=parseInt(Xstart);
			Xend=parseInt(Xend);
			
			if(Xstart>Xend && (Xstart-Xend>100)) {
				moveRight();
			} else if(Xstart<Xend && (Xend-Xstart>100)) {
				moveLeft();
			}
		}
		
		var slidewidth=320;
		
		function moveToSlide(nb) {
			var delta=320-(slidewidth*nb);
			$("#container [id*=slide]").animate({
			  left: delta+'px'
			}, 500);
			window.location = window.location.toString().replace(/(#slide\d+)?$/,"#slide"+nb);
		}
		
		function getCurrentSlide(){
			var nb=parseInt($("#container [id*=slide]").css('left'))/slidewidth;
			return Math.round(1-nb,0);
		}
		
		function moveNext() {
			moveToSlide(getCurrentSlide()+1);
		}

		function movePrev() {
			moveToSlide(getCurrentSlide()-1);
		}
		
		function moveRight(){
			 //$("#container").scrollTo( 150, 800 );
			
			if (getCurrentSlide() != 5) {
				$("#container [id*=slide]").animate({
					left: '-=' + slidewidth + 'px'
				}, 500);
				new_id=getCurrentSlide()+1;
				old=getCurrentSlide();
				document.getElementById('menu'+new_id).className="menu_actif";
				document.getElementById('menu'+old).className="menu_inactif";
			}
			
			if(getCurrentSlide()+1==4) {
				document.getElementById('video').style.display='block';
			} else {
				document.getElementById('video').style.display='none';
			}
		}
		
		
		function moveLeft(){
			
			if (getCurrentSlide() != 1 && !isNaN(getCurrentSlide())) {
				$("#container [id*=slide]").animate({
					left: '+=' + slidewidth + 'px'
				}, 500);
				
				new_id=getCurrentSlide()-1;
				old=getCurrentSlide();
				document.getElementById('menu'+new_id).className="menu_actif";
				document.getElementById('menu'+old).className="menu_inactif";
				
			}
			
			if(getCurrentSlide()-1==4) {
				document.getElementById('video').style.display='block';
			} else {
				document.getElementById('video').style.display='none';
			}
			
		}

		function voir(i) {
			
				if(document.getElementById("test"+i).style.display=='') {
					document.getElementById("text"+i).style.color='#ff5c0f';
				} else {
					document.getElementById("text"+i).style.color='#FFF';
				}
				
      			$("#test"+i).toggle();
		}
		
		function cache(i) {
			$("#test"+i).toggle();
			document.getElementById("text"+i).style.color='#FFF';
		}
		
		
		function tog1() {
			$("#info1").toggle();
		}
		
		function tog2() {
			$("#info2").toggle();
		}
		
		function tog3() {
			$("#info3").toggle();
		}
		
		function tog4() {
			$("#info4").toggle();
		}
