window.addEvent('domready', function(){

	if ($('choix_gamme'))
	{		
	

		/* for keeping track of what's "open" */
		var activeClass = 'dropdown-active', showingDropdown, showingMenu, showingParent;
		/* hides the current menu */
		var hideMenu = function() {
			if(showingDropdown) {
				showingDropdown.removeClass(activeClass);
				showingMenu.setStyle('display','none');
			}
		};
		/* recurse through dropdown menus */
		$$('.dropdown').each(function(dropdown) {
			/* track elements: menu, parent */
			var menu = dropdown.getNext('div.dropdown-menu'), parent = dropdown.getParent('div');
			/* function that shows THIS menu */
			var showMenu = function() {
				hideMenu();
				showingDropdown = dropdown.addClass('dropdown-active');
				showingMenu = menu.setStyle('display','block');
				showingParent = parent;
			};
			/* function to show menu when clicked */
			dropdown.addEvent('click',function(e) {
				if(e) e.stop();
				showMenu();
			});
			/* function to show menu when someone tabs to the box */
			dropdown.addEvent('focus',function() {
				showMenu();
			});
		});
		/* hide when clicked outside */
		$(document.body).addEvent('click',function(e) {
			if(showingParent && !e.target || !$(e.target).getParents().contains(showingParent)) { 
				hideMenu();
			}
		});



	
	}
	
	if ($('slides1'))
	{		
	
		// set up the instance
		var slideshow = new SlideShow('slides1',{
			delay: 5000,
			duration: 600,
			transition: 'fade',
			autoplay: true
		});
		
		var manualPaused = false;

		// add play / pause elements are hovered
		var hoverEvents = {
			mouseenter: function(){ slideshow.pause(); },
			mouseleave: function(){
				if (!manualPaused) 
				{
					manualPaused = false;
					slideshow.play();
					
				}
			}
		};
		
		slideshow.element.addEvents($merge(hoverEvents,{
			// can send transition and duration information to show methods
			click: function() { slideshow.pause(); }
		}));

	}
	
	if ($('slides2'))
	{		
	
		// set up the instance
		var slideshow = new SlideShow('slides2',{
			delay: 5000,
			duration: 600,
			transition: 'fade',
			autoplay: true
		});
		
		var manualPaused = false;

		// add play / pause elements are hovered
		var hoverEvents = {
			mouseenter: function(){ slideshow.pause(); },
			mouseleave: function(){
				if (!manualPaused) 
				{
					manualPaused = false;
					slideshow.play();
					
				}
			}
		};
		
		slideshow.element.addEvents($merge(hoverEvents,{
			// can send transition and duration information to show methods
			click: function() { slideshow.pause(); }
		}));

	}
	
	if ($('slides3'))
	{		
	
		// set up the instance
		var slideshow = new SlideShow('slides3',{
			delay: 5000,
			duration: 600,
			transition: 'fade',
			autoplay: true
		});
		
		var manualPaused = false;

		// add play / pause elements are hovered
		var hoverEvents = {
			mouseenter: function(){ slideshow.pause(); },
			mouseleave: function(){
				if (!manualPaused) 
				{
					manualPaused = false;
					slideshow.play();
					
				}
			}
		};
		
		slideshow.element.addEvents($merge(hoverEvents,{
			// can send transition and duration information to show methods
			click: function() { slideshow.pause(); }
		}));

	}


});


