function photo_num(numero, if_fleche){
	if (typeof(if_fleche) == 'undefined'){if_fleche = false;}
	$("#photo_lien_"+window.photo_a_modifier).removeClass("lien_actif");
	$("#photo_lien_"+window.photo_a_modifier).addClass("lien_inactif");
	window.photo_a_modifier = numero;
	if(!if_fleche){window.photo_en_cours = numero;}
	change_photo(numero);
	$("#photo_lien_"+numero).removeClass("lien_inactif");
	$("#photo_lien_"+numero).addClass("lien_actif");
}


function photo_suiv(){
	window.photo_a_modifier = window.photo_en_cours;
	cache_comment_en_cours();
	if (window.photo_en_cours < 32){
		window.photo_en_cours ++;
	}
	else{
		window.photo_en_cours = 1;
	}
	photo_num(window.photo_en_cours, true);
}

function photo_prec(){
	if(window.photo_en_cours < 2){
		window.photo_en_cours = 32;
	}
	else {window.photo_en_cours --;}
	change_photos();
	change_num();
}

function photo_prec(nombre){
	
	photo_num(window.photo_en_cours-1, true);
	
	if (typeof(nombre) == 'undefined'){nombre = 32;}
	cache_comment_en_cours();
	if(window.photo_en_cours < 2){
		window.photo_en_cours = nombre;
	}
	else {window.photo_en_cours --;}
	photo_num(window.photo_en_cours);
	//change_photo();
	//change_num_photo(nombre);
}

function cache_comment_en_cours(){
	
	$("#comment_photo > #comment_photo"+window.photo_en_cours).removeClass("comment_visible");
	$("#comment_photo > #comment_photo"+window.photo_en_cours).addClass("comment_cache");
}

function change_photo(){
	//on change la photo
	$("#photo").attr("src", "img/photos/"+window.photo_en_cours+".jpg");
	//le nom du bloc duquel récupérer les infos
	var html_comment = $("#comment_photo"+window.photo_en_cours).html();
	//on change le texte de description
	$("#comment_photo").html(html_comment);
	$("#comment_photo > #comment_photo"+window.photo_en_cours).removeClass("comment_cache");
	$("#comment_photo > #comment_photo"+window.photo_en_cours).addClass("comment_visible");
	
}

function change_num(){
	$("#num_photo").html(window.photo_en_cours+" / 32");
}