
// nombre total de photo
var nbtof = 7;

var tof1 = new Array('', 'albert', 'sar', 'georges', 'ma', 'in', 'hal', 'fon');

var tof2 = new Array('', 'eins', 'ko', 'w', 'ri', 'nom', 'ly', 'te');

var tof3 = new Array('', 'tein', 'zy', 'bush', 'lyn', 'mable', 'day', 'nay');

// initialisation
$(document).ready(function() {
	
	// ### initialisation
	var num = 1;

	// haut
	num = Math.round(Math.random(0)*(nbtof-1))+1;
	$("#tof_1").attr("src","./img/" + num + "_1.jpg");
	$("#tof_1").attr("alt", num);
	$("#tof1 span").html(tof1[num]);

	// milieu
	num = Math.round(Math.random(0)*(nbtof-1))+1;
	$("#tof_2").attr("src","./img/" + num + "_2.jpg");
	$("#tof_2").attr("alt", num);
	$("#tof2 span").html(tof2[num]);

	// bas
	num = Math.round(Math.random(0)*(nbtof-1))+1;
	$("#tof_3").attr("src","./img/" + num + "_3.jpg");
	$("#tof_3").attr("alt", num);
	$("#tof3 span").html(tof3[num]);


	// ### clic haut
	$("#tof_1").click(function() {
		num = $(this).attr("alt");
		num++;
		if (num > nbtof) { num = 1; }
		$(this).attr("src","./img/" + num + "_1.jpg");
		$(this).attr("alt", num);
		$("#tof1 span").html(tof1[num]);
		return false;
	});

	// ### clic milieu
	$("#tof_2").click(function() {
		num = $(this).attr("alt");
		num++;
		if (num > nbtof) { num = 1; }
		$(this).attr("src","./img/" + num + "_2.jpg");
		$(this).attr("alt", num);
		$("#tof2 span").html(tof2[num]);
		return false;
	});

	// ### clic bas
	$("#tof_3").click(function() {
		num = $(this).attr("alt");
		num++;
		if (num > nbtof) { num = 1; }
		$(this).attr("src","./img/" + num + "_3.jpg");
		$(this).attr("alt", num);
		$("#tof3 span").html(tof3[num]);
		return false;
	});

	// ### pif
	$("#pif").click(function() {
		// haut
		num = Math.round(Math.random(0)*(nbtof-1))+1;
		$("#tof_1").attr("src","./img/" + num + "_1.jpg");
		$("#tof_1").attr("alt", num);
		$("#tof1 span").html(tof1[num]);

		// milieu
		num = Math.round(Math.random(0)*(nbtof-1))+1;
		$("#tof_2").attr("src","./img/" + num + "_2.jpg");
		$("#tof_2").attr("alt", num);
		$("#tof2 span").html(tof2[num]);

		// bas
		num = Math.round(Math.random(0)*(nbtof-1))+1;
		$("#tof_3").attr("src","./img/" + num + "_3.jpg");
		$("#tof_3").attr("alt", num);
		$("#tof3 span").html(tof3[num]);
		return false;
	});
});



