// JavaScript Document
/*$(document).ready(function(){
	$(".menuTitre").each(function(){
		$(this).click(function(){
			$(this).next().slideToggle("slow");
		});
	});
	

});*/
	var strhref = window.location.href;
		
$(document).ready(function(){
	//on centrer le layer de fond	
	center();
	
	//on ajoute la fonction toggle aux entrées de menu
	$(".menuTitre").each(function(i){		
   		$(this).toggle(
			function open(){
				$(this).addClass("menu_titre_open");
				$(this).removeClass("menu_titre_closed");
				$(this).next().animate({ height: 'show' }, 'normal');
			},	
			function(){
				$(this).addClass("menu_titre_closed");
				$(this).removeClass("menu_titre_open");
				$(this).next().animate({ height: 'hide' }, 'normal');
			}
		);
	});
	
	$(".onglets a").each(function(i){		
   		$(this).click(
			function(i){
				$(".onglets a").not(this).removeAttr("rel");
				$(".onglets a").not(this).removeClass("onglet_on");
				$(".onglets a").not(this).addClass("onglet_off");
				
				$(this).attr("rel","selected");
				$(this).removeClass("onglet_off");
				$(this).addClass("onglet_on");
				$(this).css({ cursor:"default"});
				
				//$("#"+$(this).attr("id")+"_texte").animate({ height: 'show' }, 'normal');
				//$("#"+$(this).attr("id")+"_texte").siblings().animate({ height: 'hide' }, 'normal');
				$("#"+$(this).attr("id")+"_texte").css({ display:"block"});
				$("#"+$(this).attr("id")+"_texte").siblings().css({ display:"none"});
				//$("#"+$(this).attr("id")+"_texte").css({ display:"block"});

				if( (strhref.search(/produits/)) != -1 ||(strhref.search(/products/)) != -1) {
					if((strhref.search(/castgenie/)) != -1) {
						sIFR.replace(FagoCo, { 
							selector: 'h4',
							css: [ '.sIFR-root { font-size:30px;color:#0095d8;}'], wmode: 'transparent'});
					}
					else if(((strhref.search(/ingenie/)) != -1) || ((strhref.search(/clipshuttle/)) != -1)
							 || ((strhref.search(/dsxrecord/)) != -1) || ((strhref.search(/dvplayer/)) != -1)
							 || ((strhref.search(/gfx/)) != -1) || ((strhref.search(/pigeantenne/)) != -1)
							 || ((strhref.search(/footscoring/)) != -1) || ((strhref.search(/dvcapture/)) != -1)) {
						sIFR.replace(FagoCo, { 
							selector: 'h1',
							css: [ '.sIFR-root { font-size:30px;color:#bdcd00;}'], wmode: 'transparent'});
					}
					else {
						sIFR.replace(FagoCo, { 
							selector: 'h3',
							css: [ '.sIFR-root { font-size:30px;color:#000000;}'], wmode: 'transparent'});
					}
				}
				
				substitute();
			}
		);
		$(this).hover(
			function(){
				if(!$(this).attr("rel"))
				{
					$(this).removeClass("onglet_off");
					$(this).addClass("onglet_on");
					$(this).css({ cursor:"pointer"});
				}				
			},	
			function(){
				if(!$(this).attr("rel"))
				{
					$(this).addClass("onglet_off");
					$(this).removeClass("onglet_on");
					$(this).css({ cursor:"none"});
				}
			}
		)		
	});
	
	//on ouvre le menu de la section courante
	$("#menu_"+section).click();
				
});



