﻿/* -----------------------------------------------------------------
Version	1.0
Date de création modification 	15 janvier 2009
Auteur	Patrick
-------------------------------------------------------------------- */

var avecSmooth=false;
var mySlider ;
var mySlideTextTable = new Array();
var myCurrentIndice = 0;
var mySimpleCarousel ;
var  myAccordeon ;
function updateWidgets () {
	// Création des éventuels widgets après modi AJAX 
	if ($('myAccordeon')) {
		myAccordeon = new MultipleOpenAccordion($('myAccordeon'), {
			elements: $$('#myAccordeon div.stretcher'),
			togglers: $$('#myAccordeon h1.stretchtoggle'),
			openAll:false,
			firstElementsOpen: []	
		});
		$$('#myAccordeon h1.stretchtoggle').each(function(elt) { elt.setStyle('cursor','pointer');});
	}
	if ($('slideShow')) {
		mySlideTextTable = $$('.slideTexte');
		$(mySlideTextTable[myCurrentIndice]).setStyle('display','block');
		 mySlider = new SimpleSlideShow({
			startIndex :0,
			nextLink: 'sliderBtnNext', 
			prevLink: 'sliderBtnPrevious',
			slides: $$('.slide'),
			onNext: function() {
				mySlideTextTable[myCurrentIndice].setStyle('display','none');
				myCurrentIndice++;
				if(myCurrentIndice>mySlideTextTable.length-1) myCurrentIndice = 0;

				mySlideTextTable[myCurrentIndice].setStyle('display','block');
			},
			onPrev: function() {
				mySlideTextTable[myCurrentIndice].setStyle('display','none');
				myCurrentIndice--;
				if(myCurrentIndice<0) myCurrentIndice = mySlideTextTable.length-1;
				mySlideTextTable[myCurrentIndice].setStyle('display','block');
			},
			onSlideClick :function() {
				// this.slides[this.now].fireEvent('nouveauSlide',this.now);
				// utilisé dans le cas où il y avait une stickyWin pour afficher les infos associées
			
			}
		});
	
	}
	if ($('presentationCarroussel')) {
		mySimpleCarousel = new SimpleCarousel($('presentationCarroussel'), $$('#presentationCarroussel div.slide'), $$('#presentationCarroussel a.button'), {
		  rotateAction: 'click', 
		  slideInterval: 5000,
		  
			  onShowSlide: function(){
				$$('#presentationCarroussel div.panel-top a.off img').each(function(button, index){button.src = button.src.replace('_on', '_off');});
				$$('#presentationCarroussel div.panel-top a.selected img').each(function(button, index){button.src = button.src.replace('_off','_on');});
			  }
		});
	}


}



window.addEvent('domready', function(){

	// Empêcher la détection hreh
	
	// Mettre les onclick sur chaque éléments
	// Ajax

updateWidgets();
	
	

});
		
