$(document).ready(function()
{

///////////////////////////////////////////////////////////////////////////	


	///////  menu principal
	$(function(){
	//Hide SubLevel Menus
	$('#entete ul li div').hide();	
	//OnHover Show SubLevel Menus
	$('#entete ul li').hover(	
		function(){
			//Hide Other Menus
			$('#entete ul li').not($('div', this)).stop();
			
			// Show Hoved Menu
			$('div', this).stop(true, true).show();
		},
		//OnOut
		function(){
			// Hide Other Menus
			$('div', this).hide();
		});		
});
	
	
//////// slideshow page d'accueil
	$("#showcase").awShowcase(
	{
		content_width:			973,
		content_height:			507,
		fit_to_parent:			false,
		auto:					true,
		interval:				3000,
		continuous:				false,
		loading:				true,
		tooltip_width:			200,
		tooltip_icon_width:		32,
		tooltip_icon_height:	32,
		tooltip_offsetx:		18,
		tooltip_offsety:		0,
		arrows:					true,
		buttons:				false,
		btn_numbers:			false,
		keybord_keys:			true,
		mousetrace:				false, /* Trace x and y coordinates for the mouse */
		pauseonover:			true,
		stoponclick:			false,
		transition:				'hslide', /* hslide/vslide/fade */
		transition_delay:		0,
		transition_speed:		500,
		show_caption:			'onload', /* onload/onhover/show */
		thumbnails:				false,
		thumbnails_position:	'outside-last', /* outside-last/outside-first/inside-last/inside-first */
		thumbnails_direction:	'vertical', /* vertical/horizontal */
		thumbnails_slidex:		1, /* 0 = auto / 1 = slide one thumbnail / 2 = slide two thumbnails / etc. */
		dynamic_height:			false, /* For dynamic height to work in webkit you need to set the width and height of images in the source. Usually works to only set the dimension of the first slide in the showcase. */
		speed_change:			true, /* Set to true to prevent users from swithing more then one slide at once. */
		viewline:				false, /* If set to true content_width, thumbnails, transition and dynamic_height will be disabled. As for dynamic height you need to set the width and height of images in the source. */
		custom_function:		null /* Define a custom function that runs on content change */
	});
	 
/////////////////////////////////////////// galerie d'image			
	$('p.thumb a').live("click", function()
	{	
		$('p.thumb').removeClass("actif");
		var url = $(this).attr('href');
	    var image = $('<img />').attr('src', url);
		$(this).parent("p").addClass("actif");
		$('article#big').addClass('loading');

		$("#magalerie").fadeOut(600, function(){
								$("#magalerie").empty();
								$("#magalerie").append(image);
								$('article#big').removeClass('loading');
								$("#magalerie").fadeIn(500);	
												 });
		return false;
		
   });	
//////////////////////////////////////////////////////////////////////////////


	$('p a.prev').live("click", function()
	{	
		if (!($("#thumb p.actif a").hasClass("first")))
			{
		var prochain = $("#thumb p.actif").prev().find("a");
		var url = $("#thumb p.actif").prev().find("a").attr('href'); 
		
		$('p.thumb').removeClass("actif");
		prochain.parent("p").addClass("actif");
		 
	    var image = $('<img />').attr('src', url);
		$('article#big').addClass('loading');

		$("#magalerie").fadeOut(600, function(){
								$("#magalerie").empty();
								$("#magalerie").append(image);
								$('article#big').removeClass('loading');
								$("#magalerie").fadeIn(500);	
												 });
			}
		return false;
		
   });
	
	///////////////////////////////////////////////////////////////////////////////////////
		$('p a.next').live("click", function()
		{	
		
			if (!($("#thumb p.actif a").hasClass("last")))
			{
			var prochain = $("#thumb p.actif").next().find("a");
			var url = $("#thumb p.actif").next().find("a").attr('href'); 
			$('p.thumb').removeClass("actif");
			prochain.parent("p").addClass("actif");
			
			var image = $('<img />').attr('src', url);
			$('article#big').addClass('loading');
			$("#magalerie").fadeOut(600, function(){
									$("#magalerie").empty();
									$("#magalerie").append(image);
									$('article#big').removeClass('loading');
									$("#magalerie").fadeIn(500);	
													 });
								}
			return false;
			
   });
		//////////////////////////////////////////////////////////////
		 });
/////////////////////////////////////////////////////////////////////////////////////////	 

