$(document).ready(function () {

/// infos webcam
	var style = 'easeOutQuart';

	$('.push').hover(
		function() {
			//afficher le caption
			$(this).children('div:last').stop(false,true).animate({bottom:0},{duration:200, easing: style});
		},

		function() {
			//cacher le caption
			$(this).children('div:last').stop(false,true).animate({bottom:-30},{duration:200, easing: style});
		}
	);

//// foire aux questions
	$('#faq').find('dd').hide().end().find('dt').click(function() {
    	$(this).next().slideToggle("normal");
   	});

/// notification	
	$('#slidedown_content').fadeIn(3000);
	var top = '-' + $('#slidedown_content .content').css('height');
	var easing = 'easeOutQuart';
	
	$('#slidedown_top').mouseover(function() {
		$('#slidedown_content').animate({'top' : 0}, {queue:false, duration:1000, easing: easing});
	});
	
	$('#slidedown_bottom').mouseover(function() {
		$('#slidedown_content').animate({'top' : top}, {queue:false, duration:500, easing: easing});
	});
	
////spec
	$("#spec1").click(function(){
		$("#slide1").animate({right: "280"}, 500)
		$("#slide2").animate({right: "0"}, 500)
		return false;
	}); 
	
	$("#spec2").click(function(){
		$("#slide2").animate({right: "280"}, 500)
		$("#slide1").animate({right: "0"}, 500)
		return false;
	}); 
	
/////affichage passage jeunes

	$('.liste_jeunes').vTicker({
	   speed: 500,
	   pause: 4000,
	   showItems: 1,
	   animation: 'fade',
	   mousePause: true,
	   height:0,
	   direction: 'up'
	});

	
////retour live depuis VOD
	/*$("#retour_live").hide();
	$("#player").opacity(
		function() {
			$("#retour_live").fadeIn();
		},
		
		function() {
			$("#retour_live").fadeOut();
		}
	);*/
	
	
/////////////////pop-up
	function loadPopup(){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup, #popup").fadeIn("slow");	
		$("#MediaPlayer, #playerUne").fadeOut("slow");  
	}
	
	function disablePopup(){
		$("#backgroundPopup, #popup").fadeOut("slow");
		$("#popupVideo").remove(); // hack IE6
		$("#MediaPlayer, #playerUne").fadeIn("slow");
	}    
	
	function placePopup(){
		var position = $("#agenda").position();
			
		$("#popup").css({
			"position": "absolute",  
			"top": position.top,  
			"left": position.left + 5
		});
		//hack IE6
		$("#backgroundPopup").css({
			"height": 3000
		});
	}
	
	//afficher
	$("#avis").click(function(){
		$('html,body').animate({scrollTop: 350}, "slow");
		placePopup();
		loadPopup();
	});
	
	//retirer
	$("#back").click(function(){
		disablePopup();  
	});
	$("#popupClose").click(function(){
		disablePopup();  
	});  
	$("#backgroundPopup").click(function(){
		disablePopup();  
	});
	$(document).keypress(function(e){
		if(e.keyCode==27){
			disablePopup();
		}
	});
	
/////// sélecteur de langue
	$('.select_langue ul').hide();
	$('.select_langue .courant').click(function(){
		$(this).next('ul').toggle();
	});

/////// suggestions
	/* setTimeout(function() { 
    	$("#suggestions").fadeOut("slow");
	}, 7000); */
	
	setTimeout(function() { 
    	$("#suggestions").hide();
	}, 7000);

});
