var to_value = 0;

	function go(val){
	
		var nb_answers = jQuery(".news").length;
		
		
		left_value = 700;
		
		if (to_value==-1*(nb_answers-1)*700) { 
			jQuery("#the_news_container").css( { left:0 });
			left_value=700;
			to_value=0;
			
		}
			
			
		if ( val < 2 ) {
		
	
		//actuel_left = jQuery("#enorme").css("left");
		//actuel_left = parseInt(actuel_left);
		actuel_left = to_value;
		
		//alert(actuel_left);
		if (val==-1) to_left = actuel_left - left_value;
		if (val==1) to_left = actuel_left + left_value;
		
		if (to_left < ((nb_answers-1) * left_value)*(-1)) to_left=0;
		
		to_value = to_left;
		
		//alert(to_left);
		jQuery("#the_news_container").animate( { left:to_left }, 500, "linear", function () { setTimeout("go(-1)", 4500);  } );
		
		
		jQuery("#the_icons span").removeClass("on");

		nu = (to_value) / left_value * (-1) + 1;
		//alert(nu);
		if (nu==nb_answers) nu=1;
		num = "#the_icons span:nth-child(" + (nu) + ")";
		//alert(nu%nb_answers);
		jQuery(num).addClass("on");
		
		}

		

	}
	
	
jQuery(document).ready(function(){ 

	setTimeout("go(-1)", 4500);	
	
	var onQR = false;
	jQuery(".qrcode").hover(
		function () {
			if (onQR == false) { jQuery(".qrcode").toggleClass("maxi"); onQR = true; }
		},
		function () {
			onQR = false;
		}
	
	); 
	
	
  	jQuery(".slider:not(#slide0)").fadeOut('fast');
  	
	jQuery(".key_point").hover(
  		function () {
  		
  			jQuery("#slider0").dequeue();
  			jQuery("#slider0").stop();
  		
  			//jQuery(survoled_id).dequeue();
  			//jQuery(survoled_id).stop();
  		
  			//récupération de l'index survolé
  			survoled = jQuery(".key_point").index(this) + 1;
  			//génération de l'id à fadeIn 
  			survoled_id = "#slide"+survoled;
  			
  			jQuery(".slider:not(\"" + survoled_id + "\")").hide();
  			jQuery(survoled_id).show();
  			
    		//jQuery(this).append(survoled);
  		}, 
  		function () {
  			jQuery(survoled_id).hide();
  			jQuery("#slide0").show();
  			
  		}
	);
	
	jQuery("#slider").mouseout(function() {
  		//jQuery("#slide0").fadeIn('fast');
  		//jQuery(".slider:not(#slide0)").fadeOut('fast');
  		//alert("hors de #slider");
	});
	
	jQuery(".menu-header-container ul li ul li:nth-child(1)").find("a").addClass("the_first");
	
	
	jQuery("ul#menu-header li").hover(function() { //When trigger is clicked...

		//Following events are applied to the menu itself (moving menu up and down)
		jQuery(this).find("ul.sub-menu").fadeIn('fast'); //Drop down the menu on click

		jQuery(this).hover(function() {
		}, function(){
			jQuery(this).find("ul.sub-menu").fadeOut('fast'); //When the mouse hovers out of the menu, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			jQuery(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			jQuery(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});


	/*
	jQuery("<li class='end_submenu'></li>").appendTo(".menu-header-container ul li ul");
	*/
	
	
	
	
	jQuery("#menu-header .current-menu-parent").find("ul.sub-menu").clone().appendTo("#the_sub_menu");

	//jQuery("#the_sub_menu li").hide();
	jQuery("#the_sub_menu li.current-menu-item").show();

	jQuery("#menu-header .current-menu-item").addClass("current_menu");
	jQuery("#menu-header .current-menu-parent").addClass("current_menu");

	jQuery("#the_sub_menu .current-menu-item").addClass("current_sub_menu");

	//affichage du lien suivant en bas de page
	jQuery("#menu-header li.current-menu-item:last").next().find("a:first").clone().appendTo("#next_link");
	if (jQuery("#next_link a").length==0) { jQuery("#menu-header .current-menu-parent").next().find("ul li a:first").clone().appendTo("#next_link"); }
	jQuery("#next_link a:first").html("<span>Go to the next menu</span> &laquo; " + jQuery("#next_link a:first").html() + " &raquo;");
	//si aucun lien n'est trouvé, on masque la div
	if (jQuery("#next_link a").length==0) { jQuery("#next_link").hide(); }

	//masquage du menu Numerisun si on n'a pas cliqué depuis la home
	if (jQuery("#menu-item-410").hasClass("current-menu-parent")) numerisun=true; else jQuery("#menu-item-410").hide();


jQuery("#playVideo").click(function() {
		//jQuery("#video_demo").slideDown();
		jQuery('#axio_demo').get(0).play();
		jQuery("#axio_demo").attr("controls","controls");
		//alert("click");
	}
);







	
});














