$(document).ready(function() {	
						   
	$("a.thickbox, a[rel='lightbox']").fancybox({
		'hideOnContentClick': false,
		imageScale : true
	}); 
	$("a#box_ami").fancybox({
		frameWidth : 300,
		frameHeight : 200
	});
	
	$("a.box-etude").fancybox({ 
		hideOnContentClick: false,
		hideOnOverlayClick: false,
		frameWidth : 500,
		frameHeight : 630			 
	});
	if(document.all){
		$("a#box_fav").click(function(){
			window.external.AddFavorite(location.href, document.title);
		});
	}else{
		$("a#box_fav").fancybox({ 
			'hideOnContentClick': true,
			frameWidth : 400,
			frameHeight : 100			 
		});
	}
		
		

var hauteurdocument = $(document).height();
var largeurdocument = $(document).width();

//////PANEL CONTENT

	$("div.panel_button").click(function(){
		$("div#panel").animate({height: "30px"}).animate({height: "45px"}, "fast");
		$("div.panel_button").toggle();
		if (hauteurdocument<800)
   		{
			$(".page_centre").fadeIn("slow");
		}
	});	

   $("div#hide_button").click(function(){
		$("div#panel").animate({height: "230px"}, "fast");
		if (hauteurdocument<800)
   		{
			$(".page_centre").fadeOut("slow");
		}
   });

		
   if (hauteurdocument<800)
   {
		$("div#panel").animate({height: "30px"}).animate({height: "50px"}, "fast");
		$("div#show_button").css('display', 'none');
		$("div#hide_button").css('display', 'block');
   }
   
	
   if (largeurdocument<1024)
   {
		$(".tpl_box").css('margin', '1.9%');
   }
   
   
	$('.menuHorizontal ul').css('display','none');
//////SOUS MENUS 01	
	$('#ssmenu01').hover(
			function(){				
				$('#ssmenu01').stop(true).animate({'height':300+'px'},300);
				$('.menuHorizontal li#menu01 a').addClass("selected1");
			},
			function(){
			   $('#ssmenu01').stop(true).animate({'height':0+'px'},300);
			   $('.menuHorizontal li#menu01 a').removeClass("selected1");
			}
	);
	$('.menuHorizontal li#menu01').hover(
			function(){
				$('#ssmenu01').stop(true).animate({'height':300+'px'},300);
			},
			function(){
			   $('#ssmenu01').stop(true).animate({'height':0+'px'},300);
			}
	);
	
//////SOUS MENUS 02	
	$('#ssmenu02').hover(
			function(){				
				$('#ssmenu02').stop(true).animate({'height':240+'px'},300);
				$('.menuHorizontal li#menu02 a').addClass("selected1");
			},
			function(){
			   $('#ssmenu02').stop(true).animate({'height':0+'px'},300);
			   $('.menuHorizontal li#menu02 a').removeClass("selected1");
			}
	);
	$('.menuHorizontal li#menu02').hover(
			function(){
				$('#ssmenu02').stop(true).animate({'height':240+'px'},300);
			},
			function(){
			   $('#ssmenu02').stop(true).animate({'height':0+'px'},300);
			}
	);

//////SOUS MENUS 05	
	$('#ssmenu05').hover(
			function(){				
				$('#ssmenu05').stop(true).animate({'height':240+'px'},300);
				$('.menuHorizontal li#menu05 a').addClass("selected1");
			},
			function(){
			   $('#ssmenu05').stop(true).animate({'height':0+'px'},300);
			   $('.menuHorizontal li#menu05 a').removeClass("selected1");
			}
	);
	$('.menuHorizontal li#menu05').hover(
			function(){
				$('#ssmenu05').stop(true).animate({'height':240+'px'},300);
			},
			function(){
			   $('#ssmenu05').stop(true).animate({'height':0+'px'},300);
			}
	);

//////SOUS MENUS 03	
	$('#ssmenu03').hover(
			function(){				
				$('#ssmenu03').stop(true).animate({'height':240+'px'},300);
				$('.menuHorizontal li#menu03 a').addClass("selected1");
			},
			function(){
			   $('#ssmenu03').stop(true).animate({'height':0+'px'},300);
			   $('.menuHorizontal li#menu03 a').removeClass("selected1");
			}
	);
	$('.menuHorizontal li#menu03').hover(
			function(){
				$('#ssmenu03').stop(true).animate({'height':240+'px'},300);
			},
			function(){
			   $('#ssmenu03').stop(true).animate({'height':0+'px'},300);
			}
	);
	
	
	
	
	$('.liens_top ul').css('display','none');
	$('.liens_top li').hover(
		function(){
			$(this).find('ul').stop(true,true).slideDown();  
		}, function(){
			$(this).find('ul').stop(true,true).slideUp();
		}
	);
	
	

   
   
//////FOOTER
  
   $('.footer').hover(
			function(){
				$('.footer').stop(true).animate({'height':340+'px'},300);
			},
			function(){
			   $('.footer').stop(true).animate({'height':0+'px'},300);
			}
	);
   $('.btn_footer').hover(
			function(){
				$('.footer').stop(true).animate({'height':340+'px'},300);
			},
			function(){
			   $('.footer').stop(true).animate({'height':0+'px'},300);
			}
	);
   
   

});

