$(document).ready(function(){
	//Liens Facebook, BSpace et Jukebox
	$("#iconText").fadeOut(0);
	$("#iconMenu img").css({"opacity":.7,"cursor":"pointer"});
	$("#iconFacebook").hover(
		function(){
			$("#iconText").stop(true,true).html('Notre Facebook').fadeIn(200);
			$(this).stop(true,true).animate({opacity:1},200);
		},
		function(){
			$("#iconText").fadeOut(200,function(){$(this).empty();});
			$(this).animate({opacity:.7},200);
		}
	)
	.click(function(){window.open('http://www.facebook.com/LA.CAVE.A.MUSIQUE','Facebook').focus();});
	$("#iconBSpace").hover(
		function(){
			$("#iconText").stop(true,true).html('B&eacute;n&eacute;vole Space').fadeIn(200);
			$(this).stop(true,true).animate({opacity:1},200);
		},
		function(){
			$("#iconText").fadeOut(200,function(){$(this).empty();});
			$(this).animate({opacity:.7},200);
		}
	)
	.click(function(){window.open('http://www.cavazik.org/benevole','BSpace').focus();});
	$("#iconJukebox").hover(
		function(){
			$("#iconText").stop(true,true).html('Le Jukebox').fadeIn(200);
			$(this).stop(true,true).animate({opacity:1},200);
		},
		function(){
			$("#iconText").fadeOut(200,function(){$(this).empty();});
			$(this).animate({opacity:.7},200);
		}
	)
	.click(function(){window.open('http://www.cavazik.org/jukebox.html','Jukebox',"width=330,height=450,left=100,top=100,resizable=yes").focus();});
	
	//Menu init
	for(i=1;i<11;i++){
		var j=i;
		if(j<10){j="0"+j;}
		if($("#menu_"+j).attr("rel")==page){$("#menu_"+j).css({backgroundColor:"#fff",color:"#000"}).addClass("active");}
		else{$("#menu_"+j).css({backgroundColor:"#000",color:"#fff"}).removeClass("active");}
	}
	if(page.indexOf('prog/')!=-1){$("#menu_02").css({backgroundColor:"#fff",color:"#000"}).addClass("active");}
	if($("#menu div").height()>20){$("#menu a").css('padding','1px 4px 1px 3px');}
	
	//Menu hover
	$("#menu a").hover(
		function(){$(this).stop(true,true).animate({backgroundColor:"#fff",color:"#000"},200);},
		function(){if($(this).hasClass("active")==false){$(this).stop(true,true).animate({backgroundColor:"#000",color:"#fff"},200);}}
	);
	$("#menu ul li").has("ul").hover(
		function(){$(this).find("ul").slideDown(200);$("#contenu").animate({opacity:0.8},200);},
		function(){$(this).find("ul").stop(true,true).slideUp(200);$("#contenu").stop(true,true).animate({opacity:1},200);}
	);
});
