$(document).ready(function(){
	$(".nav .nav_niv_1 img")
	.each (function () {
		var resti_width = $(this).width();	
		$(this).parents("li.nav_niv_1").each( function () {
			$('ul a',this).width(resti_width-6);						   
		})
		
	})
	//.hover(function(){$(this).attr("src", $(this).attr("src").split('_off').join('_on'))}, function(){$(this).attr("src", $(this).attr("src").split('_on').join('_off'))});
	$(".nav")
	.superfish({
		animation	: { height:"show",opacity:'show'} ,
		men_actif	: function(){var_men_actif=new Array(); var_men_actif[0]='1';return var_men_actif; },
		delay		: 1000
	});
	$(".hover").hover(
		function() {
			if($(this).parent().parent().children(".nav_niv_2").html()==null)
			{
				$('.hover').each(function() {$(this).attr("src", $(this).attr("src").split('_on').join('_off'));});
				$(this).attr("src", $(this).attr("src").split('_off').join('_on'));
				$('.nav_niv_2').hide().css('visibility','hidden');
			}
			}, 
		function() {
			if($(this).parent().parent().children(".nav_niv_2").html()==null)
			{
				$(this).attr("src", $(this).attr("src").split('_on').join('_off'));
			}
			}
	);
	//Mise en place de la bulle écouter au roll-over sur le haut parleur
	$(".ecouter").hover(
		function () { $(this).append("<span class=\"bulle\"><img src=\"../img/modele/ecouter.gif\" style=\"margin:0; \"></span>");}, 
		function () { $(this).find(".bulle").remove();}
		);
	$('.ecoute_radio_off').hover(
		function () {$(this).attr("src","../img/fr/bt_ecouter_on.gif");},
		function () {$(this).attr("src","../img/fr/bt_ecouter_off.gif");}
		);
	$('.ecoute_radio_off_fd_orange').hover(
		function () {$(this).attr("src","../img/fr/bt_ecouter_on.gif");},
		function () {$(this).attr("src","../img/fr/bt_ecouter_off_fd_orange.gif");}
		);	
	var base ="";
	$.fn.extend({
		boucle_fondu : function (base) {
			if ($(this).next().html()){
				$(this).removeClass('on').fadeOut(500, function () {
					$(this).next().addClass('on').show().css({opacity:0}).animate ({opacity:1},500,function () {
						setTimeout(function(){$(base+".on").boucle_fondu(base);},3000);
					});
				});
			}else{
				$(this).removeClass('on').fadeOut(500, function () {
					$(base + ":first-child").addClass('on').show().css({opacity:0}).animate ({opacity:1},500,function () {
						setTimeout(function(){;$(base+".on").boucle_fondu(base);},3000);
					});
				});
			}
		}
	})
	$("#fil-info ul li:first-child").boucle_fondu("#fil-info ul li");
	
	var bt_open = true ;
	$("#fil-info .bt_open")	.click ( function () {
		if (bt_open) {
			bt_open = false ;
			$("#fil-info .fd").animate({ paddingTop: 0, paddingBottom: 0 },500);
			$(this).html("Ouvrir").removeClass ("on").addClass ("off");
		}else {
			bt_open = true ;
			$("#fil-info .fd").animate({ paddingTop: 10, paddingBottom: 10 },500);
			$(this).html("Réduire").removeClass ("off").addClass ("on");
		}
		$("#fil-info .corp_flash ul").animate({ opacity: 'toggle' },500);
		return false;
	});
	
});	

/*---------------------------------------------------------------------------- popup ------------------------------------------------------------------------*/

function popup(u,nom_fenetre,largeur,hauteur)
{
	switch(u)
	{
		//Direct zone nord
		case 1: url="popup_player_direct_nord.html";
				break;
		//Direct zone sud
		case 2: url="popup_player_direct_sud.html";
				break;
		//Direct Grand Lyon
		case 3: url="popup_player_direct_lyon.html";
				break;
		//Traffic zone nord
		case 4: url="popup_player_traffic_nord.html";
				break;
		//Traffic zone sud
		case 5: url="popup_player_traffic_sud.html";
				break;
		//Traffic Grand Lyon
		case 6: url="popup_player_traffic_lyon.html";
				break;
		case 'default':url="popup_player_direct_nord.html";
				break;
	}
	window.open(url,nom_fenetre,"width="+largeur+"px,height="+hauteur+"px,menubar=no,resizable=no,scrollbars=no");
}
/*--------------------------------------------------------------------------- /popup ------------------------------------------------------------------------*/





