jQuery(document).ready(function(){
jQuery('#s').click(function() { 
	if (this.value == "Recherche dans le site..."){
	this.value = "";
	}
});
var currentItem = 1;
function nextProgramme(){
	currentItem++;
	if (currentItem == 4){
		currentItem = 1;
	}
	for (j = 1;j < 4;j++){
			if(j == currentItem){
				jQuery("#c-programme-mini-"+j).addClass("current-mini");
			}
			else{
				jQuery("#c-programme-mini-"+j).removeClass("current-mini");
				jQuery("#c-programme-"+j).fadeOut(1400, function () {
					jQuery("#c-programme-"+currentItem).fadeIn(1400);
				  });
		
			}
		}
	return currentItem;	
}

jQuery("#submit-2").css("display","none");
jQuery('#btn-subscribe').click(function() { 
jQuery("#submit-1").css("display","block");
jQuery("#submit-2").css("display","none");
});
jQuery('#btn-unsubscribe').click(function() { 
jQuery("#submit-1").css("display","none");
jQuery("#submit-2").css("display","block");
});
var timer = setInterval(nextProgramme, 5000);
	jQuery('#menu>ul>li:has(ul)').hoverIntent(function() { 
    jQuery(this).children('ul').slideDown(100);	
},function() { 
    jQuery(this).children('ul').slideUp(); 
});
	jQuery('#caroussel').hoverIntent(function() { 
   clearTimeout( timer );
},function() { 
	
});

jQuery('.galery-img').hoverIntent(function() { 
   jQuery(this).stop().animate({"opacity": 0.7}); 
},function() { 
	jQuery(this).stop().animate({"opacity": 1}); 
});
jQuery('#igm-principal').hoverIntent(function() { 
   jQuery(this).children('a').stop().animate({"opacity": 0.7}); 
},function() { 
	jQuery(this).children('a').stop().animate({"opacity": 1}); 
});
jQuery('.p-left').hoverIntent(function() { 
   jQuery(this).children('a').stop().animate({"opacity": 0.7}); 
},function() { 
	jQuery(this).children('a').stop().animate({"opacity": 1}); 
});
	jQuery('.c-programme-mini').click(function() { 
	if (jQuery(this).attr("class") != "c-programme-mini current-mini" ){
		//alert(jQuery(this).attr("id"));
		var currentItem =  jQuery(this).attr('id').replace(/c-programme-mini-/, '');
		for (j = 1;j < 4;j++){
			if(j == currentItem){
				jQuery("#c-programme-mini-"+j).addClass("current-mini");
			}
			else{
				jQuery("#c-programme-mini-"+j).removeClass("current-mini");
				jQuery("#c-programme-"+j).fadeOut(1400, function () {
					jQuery("#c-programme-"+currentItem).fadeIn(1400);
				  });
		
			}
		}
	}
	});
});

