
/*
How to get the element?
Writing jQuery function is relatively easy (thanks to the wonderful documentation). The key point you have to learn is how to get the exact element that you want to apply the effects.
* $("#header") = get the element with id="header"
* $("h3") = get all <h3> element
* $("div#content .photo") = get all element with class="photo" nested in the <div id="content">
* $("ul li") = get all <li> element nested in all <ul>
* $("ul li:first") = get only the first <li> element of the <ul>
*/

 jQuery(document).ready(function($) {
	
	  
	
	//________________________________________________________________________________________________
	// Cycle
	
	 $('.S1').cycle({ 
		fx: 'scrollHorz',		 
		timeout:	   8000,  // milliseconds between slide transitions (0 to disable auto advance)
	    timeoutFn:     null, 
		speed: 1500,
		startingSlide: 0,
		prev: null, 
   		next: '.nextslide',
		pager: null
	});
	
		$('.S2').cycle({ 
		fx: 'fade',		 
		timeout:	   8000,  // milliseconds between slide transitions (0 to disable auto advance)
	    timeoutFn:     null, 
		speed: 1500,
		startingSlide: 0,
		prev: null, 
   		next: '.nextslide',
		pager: null
	});

		$('.S3').cycle({ 
		fx: 'fade',		 
		timeout:	   8000,  // milliseconds between slide transitions (0 to disable auto advance)
	    timeoutFn:     null, 
		speed: 1500,
		startingSlide: 0,
		prev: null, 
   		next:  null,
		pager: null
	});	
	
		$('.S4').cycle({ 
		fx: 'fade',		 
		timeout:	   8000,  // milliseconds between slide transitions (0 to disable auto advance)
	    timeoutFn:     null, 
		speed: 1500,
		startingSlide: 0,
		prev: null, 
   		next: '.nextgallery1',
		pager: '#pagination1'
	});	
	
	
	    $('.S5').cycle({ 
		fx: 'fade',		 
		timeout:	   8000,  // milliseconds between slide transitions (0 to disable auto advance)
	    timeoutFn:     null, 
		speed: 1500,
		startingSlide: 0,
		prev: null, 
   		next: '.nextgallery2',
		pager: '#pagination2'
	});	
	
       	$('.S6').cycle({ 
		fx: 'fade',		 
		timeout:	   8000,  // milliseconds between slide transitions (0 to disable auto advance)
	    timeoutFn:     null, 
		speed: 1500,
		startingSlide: 0,
		prev: null, 
   		next:  null,
		pager: null
	});	    
	
	function onBefore() {
		//to access slide : var ThisSlide = this.alt; (put slide no into alt='' attribute of image)
		var PreviousSlide = this.alt-1;
		var NextSlide = this.alt+1;
		$('#Position'+PreviousSlide).css('font-weight', 'normal');
		$('#Position'+this.alt).css('font-weight', 'normal');
		$('#Position'+NextSlide).css('font-weight', 'normal');
	}
	
	function onAfter() {
		//$('#OutputS1').html("Scroll complete for:<br>" + this.src).append('<h3>' + this.alt + '</h3>');
		//$('#Position'+this.alt).css('font-weight', 'bold');
	}
	
	function GetTimeout(currElement, nextElement, opts, isForward) { 
	    var Index = opts.currSlide; 
		//gets timeout from alt attribute of current image, parseInt used to convert string to int necessary for return
		var Timeout = parseInt($("#Slide"+Index).attr("value"));
		return Timeout; 
	}
	
	/*
	
	//prev and next done with prev: and next: functions in cycle function
	
	$('#Gauche').click(function() { 
		var PreviousSlide = this.alt-1;
		$('#S1').cycle(PreviousSlide); 
		return false; 
	});
	
	$('#Droite').click(function() { 
		var NextSlide = this.alt+1;
		$('#S1').cycle(NextSlide); 
		return false; 
	});
	*/

});
