function displayDetailVoyage(divToShow){

	

	var targetToShowElement;

	

	//on affiche le div à afficher

	if(document.getElementById(divToShow))

	{

		targetToShowElement = document.getElementById(divToShow) ;

		if(targetToShowElement.style.display == "block"){

			masqueDiv(divToShow) ;

		}else{

			afficheDiv(divToShow);

		}

	}

}



function afficheDiv(divToShow){

	

	var targetToShowElement;

	

	//on affiche le div à afficher

	if(document.getElementById(divToShow))

	{

		targetToShowElement = document.getElementById(divToShow) ;

		targetToShowElement.style.display = "block" ;

	}

}



function masqueDiv(divToHide){

	

	var targetToHideElement;

	

	//on affiche le div à masquer

	if(document.getElementById(divToHide))

	{

		targetToHideElement = document.getElementById(divToHide) ;

		targetToHideElement.style.display = "none" ;

	}

}



function naviguerGuide(sens,max){



	var idBloc = "bloc_" + blocAffiche;

	

	//vers la gauche

	if(sens==0 && blocAffiche>0)

	{

		masqueDiv(idBloc);

		blocAffiche = blocAffiche - 1;

		idBloc = "bloc_" + blocAffiche;

		afficheDiv(idBloc);		

	}

	//vers la droite

	if(sens==1 && blocAffiche<max)

	{

		masqueDiv(idBloc);

		blocAffiche = blocAffiche + 1;

		idBloc = "bloc_" + blocAffiche;

		afficheDiv(idBloc);		

	}

}



function afficheOnSelect(nomSelect,tableauDiv){

	var rang = document.getElementById(nomSelect).selectedIndex;

	masquePlusieursDiv(tableauDiv);

	if(rang>0)

		afficheDiv(document.getElementById(nomSelect)[rang].value);

	else

		afficheDiv('0');

}



function masquePlusieursDiv(tableauDiv){

	masqueDiv('0');

	for(var i=0;i<tableauDiv.length;i++)

	{

		masqueDiv(tableauDiv[i]);

	}

}



//navigation paginée dans la recherche

function rechercher(page){

	document.forms[0].page.value = page;

	document.forms[0].submit();

}



//navigation paginée dans la recherche photo frontoffice

function rechercherPhoto(page){

	document.rechercherPhotoForm.page.value = page;

	document.rechercherPhotoForm.submit();

}



//navigation paginée dans la recherche carnet frontoffice

function rechercherCarnet(page){

	document.rechercherCarnetForm.page.value = page;

	document.rechercherCarnetForm.submit();

}

//navigation triée dans la recherche carnet frontoffice

function trierCarnet(){

	document.rechercherCarnetForm.tri.value = document.trierCarnetForm.tri[document.trierCarnetForm.tri.selectedIndex].value;

	document.rechercherCarnetForm.submit();

}

//navigation paginée dans la recherche son frontoffice
function rechercherSon(page){
	document.rechercherSonForm.page.value = page;
	document.rechercherSonForm.submit();
}

//navigation triée dans la recherche son frontoffice
function trierSon(){
	document.rechercherSonForm.tri.value = document.trierSonForm.tri[document.trierSonForm.tri.selectedIndex].value;
	document.rechercherSonForm.submit();
}

//navigation paginée dans la recherche son frontoffice

function rechercherSon(page){

	document.rechercherSonForm.page.value = page;

	document.rechercherSonForm.submit();

}



//navigation triée dans la recherche son frontoffice

function trierSon(){

	document.rechercherSonForm.tri.value = document.trierSonForm.tri[document.trierSonForm.tri.selectedIndex].value;

	document.rechercherSonForm.submit();

}



//navigation paginée dans la recherche membre frontoffice

function rechercherUtilisateur(page){

	document.rechercherUtilisateurForm.page.value = page;

	document.rechercherUtilisateurForm.submit();

}



//navigation paginée dans la recherche video frontoffice

function rechercherVideo(page){

	document.rechercherVideoForm.page.value = page;

	document.rechercherVideoForm.submit();

}

//navigation triée dans la recherche photo frontoffice

function trierPhoto(){

	document.rechercherPhotoForm.tri.value = document.trierPhotoForm.tri[document.trierPhotoForm.tri.selectedIndex].value;

	document.rechercherPhotoForm.submit();

}



//navigation triée dans la recherche Membre frontoffice

function trierUtilisateur(){

	document.rechercherUtilisateurForm.tri.value = document.trierUtilisateurForm.tri[document.trierUtilisateurForm.tri.selectedIndex].value;

	document.rechercherUtilisateurForm.submit();

}

//navigation triée dans la recherche video frontoffice

function trierVideo(){

	document.rechercherVideoForm.tri.value = document.trierVideoForm.tri[document.trierVideoForm.tri.selectedIndex].value;

	document.rechercherVideoForm.submit();

}



//navigation triée dans la recherche guide frontoffice

function trierGuide(){

	document.rechercherGuideForm.tri.value = document.trierGuideForm.tri[document.trierGuideForm.tri.selectedIndex].value;

	document.rechercherGuideForm.submit();

}



//visualiser un media dans une map

function visualiser(){

	document.forms[1].adresse.value = document.forms[0].adresse.value;

	document.forms[1].submit();

}

//recherche depuis la barre de navigation sur le front
//function rechercherNav(type,routePhoto,routeVideo,routeGuide,routeCarnet,routeTout){	
function rechercherNav(type,routePhoto,routeVideo,routeSon,routeGuide,routeCarnet,routeTout){

	var perimetre;

	

	perimetre = document.rechercher.perimetre[document.rechercher.perimetre.selectedIndex].value;

		

	//aiguillage selon type de recherche

	if(type=='MOT'){

		if(perimetre == 'PHO'){

			document.rechercher.action = routePhoto;

		}else if (perimetre == 'VID'){

			document.rechercher.action = routeVideo;

		}else if (perimetre == 'GUI'){

			document.rechercher.action = routeGuide;

		}else if (perimetre == 'CAR'){

			document.rechercher.action = routeCarnet;

		}

		else if (perimetre == 'SON'){

			document.rechercher.action = routeSon;

		}

		else{

			document.rechercher.action = routeTout;

		}

	}

	

	document.rechercher.typeRecherche.value = type;

	document.rechercher.submit();

}



//lien vers résultat recherche photo

function lienRecherche(route){

	document.rechercherForm.action = route;

	document.rechercherForm.submit();

}



//top rédaction pour un guide pays =>BO

function validerTopRedaction(){

	

	if(document.publierForm.top_redaction[0].checked)

		document.topRedactionForm.top_redaction.value = '1';

	else

		document.topRedactionForm.top_redaction.value = '0';

	

	document.topRedactionForm.submit();

}



//navigation dans un select multiple

function tjs_haut(l) {

	var indice=l.selectedIndex

	if (indice<0) {

		alert("Aucune ligne n'est sélectionnée");

	}

	if (indice>0) {	// Il reste une ligne au-dessus

		tjs_swap(l,indice,indice-1);

	}

}



function tjs_bas(l) {

	var indice=l.selectedIndex

	if (indice<0) {

		alert("Aucune ligne n'est sélectionnée");

	}

	if (indice<l.options.length-1) {	// Il reste une ligne en-dessous

		tjs_swap(l,indice,indice+1);

	}

}



function tjs_swap(l,i,j) {

	var valeur=l.options[i].value;

	var texte=l.options[i].text;

	l.options[i].value=l.options[j].value;

	l.options[i].text=l.options[j].text;

	l.options[j].value=valeur;

	l.options[j].text =texte;

	l.selectedIndex=j

	tjs_ordre(l.form);

}



function tjs_ordre(f) {

	var l=f.region;

	var ordre="";

	for(var i=0;i<l.options.length;i++) {

		if (i>0) {ordre+="-";}

		ordre+=l.options[i].value;		

	}

	f.ordre.value=ordre;

}

//fin navigation dans un select multiple



//texte par défaut dans un input texte

function textepardefaut(evenement){

	var oMail = document.getElementById('email');

	if(evenement=="prisedefocus")

	{

		if(oMail.value == "mail")

		{

			oMail.style.color = "#000";

			oMail.value = '';

		}

	}



	if(evenement=="pertedefocus")

	{

		if(oMail.value == "")

		{

			oMail.value = 'mail';

			oMail.style.color = "#848484";

		}



		if(oMail.value == "mail")

		{

			oMail.style.color = "#848484";

		}

	}

}



/*

* permet d'afficher le contenu d'un input file dans un input text

* pour la fiche identité

*/

function afficheNomFichierPerso(){

	document.modifierPhotoPersoForm.fichier_photo_visu.value = document.modifierPhotoPersoForm.fichier_photo.value;

	

	//à faire

	targetToShowElement = document.getElementById('validerFicheDiv') ;

	

	if(document.modifierPhotoPersoForm.fichier_photo_visu.value!="")

		targetToShowElement.style.display = "block";

}



/*

* Idem pour les vraies photos

*/

function afficheNomFichierPhoto(){

	document.ajouterPhotoForm.fichier_photo_visu.value = document.ajouterPhotoForm.fichier.value;

}



/*

* Idem pour les vidéos

*/

function afficheNomFichierVideo(){

	document.ajouterVideoForm.fichier_video_visu.value = document.ajouterVideoForm.fichier.value;

}



/*

* Idem pour les bandeau (carnet)

*/

function afficheNomFichierBandeau(){

	document.creerCarnetForm.fichier_bandeau_visu.value = document.creerCarnetForm.fichier.value;

}



/*

* Idem pour les sons

*/

function afficheNomFichierSon(){

	document.ajouterSonForm.fichier_son_visu.value = document.ajouterSonForm.fichier.value;

}