var bandeau2_idCourant = 1;
var bandeau2_play = true;
var nbrPhoto = 0;


function bandeau2_player (bool) {
	bandeau2_play = bool;
}


function bandeau2_change (id) {
	for (var i=1; i<=nbrPhoto; i++) {
		if (i != id) {
			$("#bandeau2Image"+i).css({display: 'none'});
			$("#bandeau2Navigation"+i).attr({src: "images/bandeau2/boutonBlanc.jpg"});
			$("#bandeau2Contenu"+i).css({display: 'none'});
		}
	}
	$("#bandeau2Image"+id).fadeTo(400, 1);
	$("#bandeau2Navigation"+id).attr({src: "images/bandeau2/boutonBleu.jpg"});
	$("#bandeau2Contenu"+id).fadeTo(400, 1);
}


$(document).ready(
	function() {
		$('#bandeau2Navigation img').hover(
			function () { // mouse hover
				$(this).attr({src: "images/bandeau2/boutonBleu.jpg"});
				$(this).css({cursor: 'pointer'});
			}
			,
			function () { // mouse leave  
				var id = $(this).attr('id').substr(18);
				if (id != bandeau2_idCourant) {
					$(this).attr({src: "images/bandeau2/boutonBlanc.jpg"});
				}
				$(this).css({cursor: 'auto'});
			}
		);
		
		$('#bandeau2Navigation img').click(
			function () {
				var id = $(this).attr('id').substr(18);
				bandeau2_idCourant = id;
				bandeau2_play = false;
				bandeau2_change(id);
			}
		);
		
		nbrPhoto = $('#nbrPhotos').html();
	}
);

function bandeau2_defile () {
	if (bandeau2_play) {
		bandeau2_idCourant++;
		if (bandeau2_idCourant > nbrPhoto) bandeau2_idCourant = 1;
		bandeau2_change(bandeau2_idCourant);
	}
}

setInterval("bandeau2_defile()", 6000)

