// JavaScript Document


// Rotation logos sur page d'accueil
function theRotator() {	
	jQuery('div#rotator ul li').hide();
	jQuery('div#rotator ul li:first').show();
	setInterval('rotate()',3000);
}

function rotate() {	
	var current = (jQuery('div#rotator ul li.show')?  jQuery('div#rotator ul li.show') : jQuery('div#rotator ul li:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? jQuery('div#rotator ul li:first') :current.next()) : jQuery('div#rotator ul li:first'));	
	next.hide().addClass('show').slideDown('slow');
	current.slideUp('slow').removeClass('show');
};

jQuery(document).ready(function() {

	//Menu panoptique	
	if( jQuery('#menu-pano').length != 0 )
	{
		
		//hauteur des UL
		var ulmaxHeight = 0;
		
		jQuery('#menu-pano ul').each(function(){
			
			if(jQuery(this).height() > ulmaxHeight)
			{
				ulmaxHeight = jQuery(this).height()
			}
		});
		
		jQuery('#menu-pano ul').each(function(){
			jQuery(this).css('height',ulmaxHeight+'px');
		});
		
		jQuery('#menu-pano').css('display','none');

		
		jQuery('#header-nav').mouseenter(function(){
			jQuery('#menu-pano').fadeIn();		
		})
				
		jQuery('#header-nav').mouseleave(function(){
			jQuery('#menu-pano').fadeOut();
		});
		
		
		jQuery('#menu-pano ul li.niv_01, #menu-pano ul li.niv_02').each(function(){
			
			jQuery(this).mouseenter(function(){
				jQuery('ul:first', this).css('display','block');
				//alert(jQuery('ul', this).css('display'));
			});
			
			jQuery(this).mouseleave(function(){
				jQuery('ul:first', this).css('display','none');
				//alert(jQuery('ul', this).css('display'));
			});		
		
		})		
	}
	
	//Google Map
	if( jQuery('#map').length != 0 )
	{
		initialize()
	}
	
});
