// Fonction permettant de montrer/cacher le plan d'une section
function afficherSection(section,bool) {
	var part = document.getElementById(section);
	if (bool) {
		part.style.visibility = "visible";
		part.style.display = "";
	} else {
		part.style.visibility = "hidden";
		part.style.display = "none";
	}
}

// Fonction permettant d'afficher les infos sur un organisme
function afficherInfosSite(section,num,abrev,lienSite,nomOrg,adresse,zip,ville,code,pays,tel,fax,web,contact,mail,lat,lon,hide) {
	var part = document.getElementById(section);
	afficherSection(section,true);
	var zipVille;
	if (zip == "null" || zip == "") {
		zipVille = ville;
	} else {
		zipVille = zip+" "+ville;
	}
	var cadreSite = "<div align='left' style='border:solid 1px blue; font-size:11px; min-width:210px; width:210px'>"+
						"<b>"+num+" - <a href='"+lienSite+"' title='View details of this institute'>"+abrev+"</a></b>"+
						"<br/>"+nomOrg+
						"<br/><b>Lat.</b> = "+lat+" ° - <b>Lon.</b> = "+lon+" °"+
						"<br/>"+adresse+
						"<br/>"+zipVille+
						"<br/>"+pays+" - "+code+
						"<br/><b>Phone:</b>&nbsp;"+tel+
						"<br/><b>Fax:</b>&nbsp;"+fax+
						"<br/><a href='"+web+"' title='Enter this website' target='help'>"+web+"</a>"+
						"<br/><b>Contact:</b><br/>"+contact;
	if (hide != "Yes") { 
		cadreSite += "<br/><a href='mailto:"+mail+"?subject=[TREEBREEDEX]' title='E-mail this contact'>"+mail+"</a>";
	}
	cadreSite += "</div>";
	part.innerHTML = cadreSite;
}

//Fonction permettant d'afficher les infos sur un dispositif
function afficherInfosFT(section,nat,lienNat,espece,lienEspece,org,lienOrg,pays,lat,lon,vitrine) {
	var part = document.getElementById(section);
	afficherSection(section,true);
	if (vitrine == 0) {
		part.innerHTML = "<div align='left' style='border:solid 1px blue; font-size:12px; width:150px;'>"+
							"<b>Field trial</b>"+
							"<br/><b><a href='"+lienNat+"' title='View details of this field trial'>"+nat+"</a></b>"+
							"<br/><a href='"+lienEspece+"' title='View details of this species'>"+espece+"</a>"+
							"<br/><a href='"+lienOrg+"' title='View details of this organization'>"+org+"</a>"+
							"<br/>"+pays+
							"<br/><b>Lat.</b> = "+lat+" °<br/><b>Lon.</b> = "+lon+" °"+
						"</div>";
	} else {
		part.innerHTML = "<div align='left' style='border:solid 1px blue; font-size:12px; width:150px;'>"+
							"<b>Field trial</b>"+
							"<br/><b>"+nat+"</b>"+
							"<br/>"+espece+
							"<br/><a href='"+lienOrg+"' title='View details of this organization'>"+org+"</a>"+
							"<br/>"+pays+
							"<br/><b>Lat.</b> = "+lat+" °<br/><b>Lon.</b> = "+lon+" °"+
						"</div>";
	}
}

//Fonction permettant d'afficher les infos sur une unité génétique
function afficherInfosGU(section,nat,lienNat,espece,lienEspece,org,lienOrg,pays,lat,lon,vitrine) {
	var part = document.getElementById(section);
	afficherSection(section,true);
	if (vitrine == 0) {
		part.innerHTML = "<div align='left' style='border:solid 1px blue; font-size:12px; width:160px;'>"+
							"<b>Genetic unit</b>"+
							"<br/><b><a href='"+lienNat+"' title='View details of this genetic unit'>"+nat+"</a></b>"+
							"<br/><a href='"+lienEspece+"' title='View details of this species'>"+espece+"</a>"+
							"<br/><a href='"+lienOrg+"' title='View details of this organization'>"+org+"</a>"+
							"<br/>"+pays+
							"<br/>"+lat+" °<br/>"+lon+" °"+
						"</div>";
	} else {
		part.innerHTML = "<div align='left' style='border:solid 1px blue; font-size:12px; width:160px;'>"+
							"<b>Genetic unit</b>"+
							"<br/><b>"+nat+"</b>"+
							"<br/>"+espece+
							"<br/><a href='"+lienOrg+"' title='View details of this organization'>"+org+"</a>"+
							"<br/>"+pays+
							"<br/>"+lat+" °<br/>"+lon+" °"+
						"</div>";		
	}
}

// Fonction permettant de montrer le système de filtres proposé
function montrerFiltre() {
	afficherSection("filtreOuvert",true);
	afficherSection("filtreFerme",false);
}

// Fonction permettant de cacher le système de filtres proposé
function cacherFiltre() {
	afficherSection("filtreFerme",true);
	afficherSection("filtreOuvert",false);
}

// Fonction permettant de décoder une adresse mail du type prenom.nom@truc1.truc2.truc3
function decode5(a,b,c,d,e){
	return a+"%2E"+b+"%40"+c+"%2E"+d+"%2E"+e;
}

// Fonction permettant de décoder une adresse mail du type nom@truc1.truc2.truc3
function decode4(a,b,c,d){
	return a+"%40"+b+"%2E"+c+"%2E"+d;
}

// Fonction permettant de décoder une adresse mail du type nom@truc1.truc2.truc3
function decode4Label(a,b,c,d){
	return a+"@"+b+"."+c+"."+d;
}

//Fonction permettant d'afficher une fenêtre de confirmation avant de déclencher une action si clic sur OK 
function confirmation(texte,action){
	var confirme = confirm(texte);
	if (confirme == true) {
		location.href = action;
	}
}

//Fonction permettant de passer un paramètre de tri à un formulaire
function sortSubmit(sort) {
	document.forms[0].sort.value = sort;
	document.forms[0].submit();
}

//Fonction permettant de réinitialiser le critère de tri
function initSort() {
	if (document.forms[0].sort != null) {
		document.forms[0].sort.value = "";
	}
}

// Fonction permettant de réinitialiser le formulaire de recherche sur les personnes
function resetSearchPerson(){
	document.forms[0].search_lname.value = "";
	document.forms[0].search_fname.value = "";
	document.forms[0].search_email.value = "";
	document.forms[0].search_institute.value = "0";
	document.forms[0].search_participant.value = "0";
	document.forms[0].search_pays.value = "";
	document.forms[0].search_principal.value = "0";
	document.forms[0].search_accesslevel.value = "0";
	document.forms[0].search_species.value = "";
	document.forms[0].search_keywords.value = "";
	initSort();
}

// Fonction permettant de réinitialiser le formulaire de recherche sur les fichiers de données
function resetSearchFile(){
	document.forms[0].search_nom.value = "";
	document.forms[0].search_type.value = "";
	document.forms[0].search_etat.value = "";
	document.forms[0].search_nomaut.value = "";
	initSort();
}

//Fonction permettant de réinitialiser le formulaire de recherche sur les documents
function resetSearchDocument(){
//	document.forms[0].search_nom.value = "";
//	document.forms[0].search_type.value = "";
	document.forms[0].search_global.value = "";
	initSort();
}

// Fonction permettant de réinitialiser le formulaire de recherche sur les données génétiques
function resetSearchData(){
	document.forms[0].search_org.value = "";
	document.forms[0].search_pays.value = "";
	document.forms[0].search_national.value = "";
	document.forms[0].search_national_test.value = "";
	document.forms[0].search_entry.value = "";
	document.forms[0].search_gu_type.value = "";
	document.forms[0].search_mating.value = "";
	document.forms[0].search_endangered.value = "";
	document.forms[0].search_trial_type.value = "";
	document.forms[0].search_design_ft.value = "";
	document.forms[0].search_mat_type.value = "";
	document.forms[0].search_latmin.value = "";
	document.forms[0].search_latmax.value = "";
	document.forms[0].search_lonmin.value = "";
	document.forms[0].search_lonmax.value = "";
	// Remise à zéro des variables climatiques
	document.forms[0].search_climvar.value = "";
	document.forms[0].search_bio1.checked = false;
	document.forms[0].search_bio2.checked = false;
	document.forms[0].search_bio3.checked = false;
	document.forms[0].search_bio4.checked = false;
	document.forms[0].search_bio5.checked = false;
	document.forms[0].search_bio6.checked = false;
	document.forms[0].search_bio7.checked = false;
	document.forms[0].search_bio8.checked = false;
	document.forms[0].search_bio9.checked = false;
	document.forms[0].search_bio10.checked = false;
	document.forms[0].search_bio11.checked = false;
	document.forms[0].search_bio12.checked = false;
	document.forms[0].search_bio13.checked = false;
	document.forms[0].search_bio14.checked = false;
	document.forms[0].search_bio15.checked = false;
	document.forms[0].search_bio16.checked = false;
	document.forms[0].search_bio17.checked = false;
	document.forms[0].search_bio18.checked = false;
	document.forms[0].search_bio19.checked = false;
	changerVarView(0,19,"bio");
	document.forms[0].search_bio1min.value = "";
	document.forms[0].search_bio1max.value = "";
	document.forms[0].search_bio2min.value = "";
	document.forms[0].search_bio2max.value = "";
	document.forms[0].search_bio3min.value = "";
	document.forms[0].search_bio3max.value = "";
	document.forms[0].search_bio4min.value = "";
	document.forms[0].search_bio4max.value = "";
	document.forms[0].search_bio5min.value = "";
	document.forms[0].search_bio5max.value = "";
	document.forms[0].search_bio6min.value = "";
	document.forms[0].search_bio6max.value = "";
	document.forms[0].search_bio7min.value = "";
	document.forms[0].search_bio7max.value = "";
	document.forms[0].search_bio8min.value = "";
	document.forms[0].search_bio8max.value = "";
	document.forms[0].search_bio9min.value = "";
	document.forms[0].search_bio9max.value = "";
	document.forms[0].search_bio10min.value = "";
	document.forms[0].search_bio10max.value = "";
	document.forms[0].search_bio11min.value = "";
	document.forms[0].search_bio11max.value = "";
	document.forms[0].search_bio12min.value = "";
	document.forms[0].search_bio12max.value = "";
	document.forms[0].search_bio13min.value = "";
	document.forms[0].search_bio13max.value = "";
	document.forms[0].search_bio14min.value = "";
	document.forms[0].search_bio14max.value = "";
	document.forms[0].search_bio15min.value = "";
	document.forms[0].search_bio15max.value = "";
	document.forms[0].search_bio16min.value = "";
	document.forms[0].search_bio16max.value = "";
	document.forms[0].search_bio17min.value = "";
	document.forms[0].search_bio17max.value = "";
	document.forms[0].search_bio18min.value = "";
	document.forms[0].search_bio18max.value = "";
	document.forms[0].search_bio19min.value = "";
	document.forms[0].search_bio19max.value = "";
	afficherSection("sel_climvar",false);
	// Remise à zéro des variables sol
	document.forms[0].search_soilvar.value = "";
	document.forms[0].search_soil1.checked = false;
	document.forms[0].search_soil2.checked = false;
	document.forms[0].search_soil3.checked = false;
	document.forms[0].search_soil4.checked = false;
	document.forms[0].search_soil5.checked = false;
	document.forms[0].search_soil6.checked = false;
	document.forms[0].search_soil7.checked = false;
	document.forms[0].search_soil8.checked = false;
	document.forms[0].search_soil9.checked = false;
	document.forms[0].search_soil10.checked = false;
	document.forms[0].search_soil11.checked = false;
	document.forms[0].search_soil12.checked = false;
	document.forms[0].search_soil13.checked = false;
	changerVarView(0,13,"soil");
	document.forms[0].search_so1.value = "";
	document.forms[0].search_so2.value = "";
	document.forms[0].search_so3.value = "";
	document.forms[0].search_so4.value = "";
	document.forms[0].search_so5.value = "";
	document.forms[0].search_so6.value = "";
	document.forms[0].search_so7.value = "";
	document.forms[0].search_so8.value = "";
	document.forms[0].search_so9.value = "";
	document.forms[0].search_so10.value = "";
	document.forms[0].search_so11.value = "";
	document.forms[0].search_so12.value = "";
	document.forms[0].search_so13.value = "";
	afficherSection("sel_soilvar",false);
	// Remise à zéro des espèces
	document.forms[0].search_all_species.value = "";
	var selSpecies = document.getElementById("sel_species");
	sel = selSpecies.getElementsByTagName("select");
	for (var i=0; i<sel[0].options.length; i++) {
		sel[0].options[i].selected = "";
	}
	afficherSection("sel_species",false);
	// Remise à zéro des genres
	document.forms[0].search_all_genus.value = "";
	var selGenus = document.getElementById("sel_genus");
	sel = selGenus.getElementsByTagName("select");
	for (var i=0; i<sel[0].options.length; i++) {
		sel[0].options[i].selected = "";
	}
	afficherSection("sel_genus",false);
	initSort();
}

// Fonction permettant de réinitialiser le formulaire de recherche sur les statistiques
function resetSearchStats(){
	document.forms[0].search_org.value = "";
	document.forms[0].search_pays.value = "";
	document.forms[0].search_gu_type.value = "";
	document.forms[0].search_trial_type.value = "";
	document.forms[0].search_mat_type.value = "";
	document.forms[0].search_output.value = "";
	// Remise à zéro des espèces
	document.forms[0].search_all_species.value = "";
	var selSpecies = document.getElementById("sel_species");
	sel = selSpecies.getElementsByTagName("select");
	for (var i=0; i<sel[0].options.length; i++) {
		sel[0].options[i].selected = "";
	}
	afficherSection("sel_species",false);
	// Remise à zéro des genres
	document.forms[0].search_all_genus.value = "";
	var selGenus = document.getElementById("sel_genus");
	sel = selGenus.getElementsByTagName("select");
	for (var i=0; i<sel[0].options.length; i++) {
		sel[0].options[i].selected = "";
	}
	afficherSection("sel_genus",false);
	initSort();
}

// Fonction permettant de réinitialiser le formulaire de recherche sur les cartes/requêtes
function resetSearchMap(){
	// Remise à zéro des espèces
	document.forms[0].search_all_species.value = "";
	var selSpecies = document.getElementById("sel_species");
	var sel = selSpecies.getElementsByTagName("select");
	for (var i=0; i<sel[0].options.length; i++) {
		sel[0].options[i].selected = "";
	}
	afficherSection("sel_species",false);
	// Remise à zéro des genres
	document.forms[0].search_all_genus.value = "";
	var selGenus = document.getElementById("sel_genus");
	sel = selGenus.getElementsByTagName("select");
	for (var i=0; i<sel[0].options.length; i++) {
		sel[0].options[i].selected = "";
	}
	afficherSection("sel_genus",false);
	document.forms[0].search_pays.value = "";
	document.forms[0].search_org.value = "";
	document.forms[0].search_gu_type.value = "";
	document.forms[0].search_genmin.value = "";
	document.forms[0].search_genmax.value = "";
	document.forms[0].search_trial_type.value = "";
	// Remise à zéro des variables climatiques
	document.forms[0].search_climvar.value = "";
	document.forms[0].search_bio1.checked = false;
	document.forms[0].search_bio2.checked = false;
	document.forms[0].search_bio3.checked = false;
	document.forms[0].search_bio4.checked = false;
	document.forms[0].search_bio5.checked = false;
	document.forms[0].search_bio6.checked = false;
	document.forms[0].search_bio7.checked = false;
	document.forms[0].search_bio8.checked = false;
	document.forms[0].search_bio9.checked = false;
	document.forms[0].search_bio10.checked = false;
	document.forms[0].search_bio11.checked = false;
	document.forms[0].search_bio12.checked = false;
	document.forms[0].search_bio13.checked = false;
	document.forms[0].search_bio14.checked = false;
	document.forms[0].search_bio15.checked = false;
	document.forms[0].search_bio16.checked = false;
	document.forms[0].search_bio17.checked = false;
	document.forms[0].search_bio18.checked = false;
	document.forms[0].search_bio19.checked = false;
	changerVarView(0,19,"bio");
	document.forms[0].search_bio1min.value = "";
	document.forms[0].search_bio1max.value = "";
	document.forms[0].search_bio2min.value = "";
	document.forms[0].search_bio2max.value = "";
	document.forms[0].search_bio3min.value = "";
	document.forms[0].search_bio3max.value = "";
	document.forms[0].search_bio4min.value = "";
	document.forms[0].search_bio4max.value = "";
	document.forms[0].search_bio5min.value = "";
	document.forms[0].search_bio5max.value = "";
	document.forms[0].search_bio6min.value = "";
	document.forms[0].search_bio6max.value = "";
	document.forms[0].search_bio7min.value = "";
	document.forms[0].search_bio7max.value = "";
	document.forms[0].search_bio8min.value = "";
	document.forms[0].search_bio8max.value = "";
	document.forms[0].search_bio9min.value = "";
	document.forms[0].search_bio9max.value = "";
	document.forms[0].search_bio10min.value = "";
	document.forms[0].search_bio10max.value = "";
	document.forms[0].search_bio11min.value = "";
	document.forms[0].search_bio11max.value = "";
	document.forms[0].search_bio12min.value = "";
	document.forms[0].search_bio12max.value = "";
	document.forms[0].search_bio13min.value = "";
	document.forms[0].search_bio13max.value = "";
	document.forms[0].search_bio14min.value = "";
	document.forms[0].search_bio14max.value = "";
	document.forms[0].search_bio15min.value = "";
	document.forms[0].search_bio15max.value = "";
	document.forms[0].search_bio16min.value = "";
	document.forms[0].search_bio16max.value = "";
	document.forms[0].search_bio17min.value = "";
	document.forms[0].search_bio17max.value = "";
	document.forms[0].search_bio18min.value = "";
	document.forms[0].search_bio18max.value = "";
	document.forms[0].search_bio19min.value = "";
	document.forms[0].search_bio19max.value = "";
	afficherSection("sel_climvar",false);
	// Remise à zéro des variables sol
	document.forms[0].search_soilvar.value = "";
	document.forms[0].search_soil1.checked = false;
	document.forms[0].search_soil2.checked = false;
	document.forms[0].search_soil3.checked = false;
	document.forms[0].search_soil4.checked = false;
	document.forms[0].search_soil5.checked = false;
	document.forms[0].search_soil6.checked = false;
	document.forms[0].search_soil7.checked = false;
	document.forms[0].search_soil8.checked = false;
	document.forms[0].search_soil9.checked = false;
	document.forms[0].search_soil10.checked = false;
	document.forms[0].search_soil11.checked = false;
	document.forms[0].search_soil12.checked = false;
	document.forms[0].search_soil13.checked = false;
	document.forms[0].search_soil14.checked = false;
	changerVarView(0,14,"soil");
	document.forms[0].search_so1.value = "";
	document.forms[0].search_so2.value = "";
	document.forms[0].search_so3.value = "";
	document.forms[0].search_so4.value = "";
	document.forms[0].search_so5.value = "";
	document.forms[0].search_so6.value = "";
	document.forms[0].search_so7.value = "";
	document.forms[0].search_so8.value = "";
	document.forms[0].search_so9.value = "";
	document.forms[0].search_so10.value = "";
	document.forms[0].search_so11.value = "";
	document.forms[0].search_so12.value = "";
	document.forms[0].search_so13.value = "";
	document.forms[0].search_soil_type.value = "";
	afficherSection("sel_soilvar",false);
	document.forms[0].search_latmin.value = "";
	document.forms[0].search_latmax.value = "";
	document.forms[0].search_lonmin.value = "";
	document.forms[0].search_lonmax.value = "";
	document.forms[0].search_altmin.value = "";
	document.forms[0].search_altmax.value = "";
	document.forms[0].search_platmin.value = "";
	document.forms[0].search_platmax.value = "";
	document.forms[0].search_plonmin.value = "";
	document.forms[0].search_plonmax.value = "";
	document.forms[0].search_paltmin.value = "";
	document.forms[0].search_paltmax.value = "";
	document.forms[0].search_regofprov.value = "";
	// Remise à zéro des paramètres mesurés
	document.forms[0].search_measured.value = "";
	var selTraits = document.getElementById("sel_traits");
	sel = selTraits.getElementsByTagName("select");
	for (var i=0; i<sel[0].options.length; i++) {
		sel[0].options[i].selected = "";
	}
	afficherSection("sel_traits",false);
	document.forms[0].search_national.value = "";
	document.forms[0].search_origcode.value = "";
	document.forms[0].search_comname.value = "";
	document.forms[0].search_patormat.checked = false;
	changerParents(false);
	document.forms[0].search_matparnat.value = "";
	document.forms[0].search_matparcou.value = "";
	document.forms[0].search_patparnat.value = "";
	document.forms[0].search_patparcou.value = "";
	document.forms[0].search_origdiff.checked = false;
	document.forms[0].search_provdiff.checked = false;
	document.forms[0].search_comprod.value = "";
	document.forms[0].search_regorprot.value = "";
	document.forms[0].search_endangered.value = "";
	document.forms[0].search_mating.value = "";
	initSort();
}

// Fonction permettant de réinitialiser le formulaire de modification du login/mot de passe
function resetLoginMdp(login){
	document.forms[0].login.value = login;
	document.forms[0].old_password.value = "";
	document.forms[0].new_password.value = "";
	document.forms[0].new_password2.value = "";
}

// Fonction permettant de réinitialiser le formulaire d'infos d'une personne
function resetPerson(titre,prenom,nom,email,login,phone,fax,part,resp,research,project,instit_resp,nat_resp,internat_resp,keyword,specie,accesslevel,hidedata){
	document.forms[0].title.value = titre;
	document.forms[0].fname.value = prenom;
	document.forms[0].lname.value = nom;
	document.forms[0].email.value = email;
	document.forms[0].login.value = login;
	document.forms[0].new_password.value = "";
	document.forms[0].new_password2.value = "";
	document.forms[0].phone.value = phone;
	document.forms[0].fax.value = fax;
	document.forms[0].participant.value = part;
	document.forms[0].site_resp.value = resp;
	document.forms[0].research.value = research;
	document.forms[0].project.value = project;
	document.forms[0].instit_resp.value = instit_resp;
	document.forms[0].nat_resp.value = nat_resp;
	document.forms[0].internat_resp.value = internat_resp;
	document.forms[0].keyword.value = keyword;
	document.forms[0].specie.value = specie;
	document.forms[0].accesslevel.value = accesslevel;
	document.forms[0].hidedata.value = hidedata;
}

// Fonction permettant de réinitialiser le formulaire d'ajout d'une personne
function resetNewPerson(){
	document.forms[0].title.value = "";
	document.forms[0].fname.value = "";
	document.forms[0].lname.value = "";
	document.forms[0].email.value = "";
	document.forms[0].phone.value = "";
	document.forms[0].fax.value = "";
	document.forms[0].participant.value = "No";
	document.forms[0].institute.value = "0";
	document.forms[0].site_resp.value = "No";
	document.forms[0].research.value = "";
	document.forms[0].project.value = "";
	document.forms[0].instit_resp.value = "";
	document.forms[0].nat_resp.value = "";
	document.forms[0].internat_resp.value = "";
	document.forms[0].keyword.value = "";
	document.forms[0].specie.value = "";
	document.forms[0].accesslevel.value = "1";
	document.forms[0].hidedata.value = "No";
}

// Fonction permettant de réinitialiser le formulaire d'infos d'une espèce
function resetSpecie(specie_num,name,auctor,english,synonym,genid){
	document.forms[0].specie_num.value = specie_num;
	document.forms[0].name.value = name;
	document.forms[0].genid.value = genid;
	document.forms[0].auctor.value = auctor;
	document.forms[0].english.value = english;
	document.forms[0].synonym.value = synonym;
}

// Fonction permettant de réinitialiser le formulaire d'ajout d'une espèce
function resetNewSpecie(){
	document.forms[0].specie_num.value = "";
	document.forms[0].name.value = "";
	document.forms[0].genid.value = "";
	document.forms[0].auctor.value = "";
	document.forms[0].english.value = "";
	document.forms[0].synonym.value = "";
}

//Fonction permettant de réinitialiser le formulaire d'infos d'un genre
function resetGenus(name,english){
	document.forms[0].name.value = name;
	document.forms[0].english.value = english;
}

// Fonction permettant de réinitialiser le formulaire d'ajout d'un genre
function resetNewGenus(){
	document.forms[0].name.value = "";
	document.forms[0].english.value = "";
}

// Fonction permettant de réinitialiser le formulaire d'infos du site
function resetSite(abrev,name,address,zip,city,codepays,phone,fax,website,lat,lon,prinpart,partners){
	document.forms[0].abrev.value = abrev;
	document.forms[0].name.value = name;
	document.forms[0].address.value = address;
	document.forms[0].zip.value = zip;
	document.forms[0].city.value = city;
	document.forms[0].codepays.value = codepays;
	document.forms[0].phone.value = phone;
	document.forms[0].fax.value = fax;
	document.forms[0].website.value = website;
	document.forms[0].latitude.value = lat;
	document.forms[0].longitude.value = lon;
	document.forms[0].principal_part.value = prinpart;
	document.forms[0].partners.value = partners;
}

// Fonction permettant de réinitialiser le formulaire de création du site
function resetNewSite(){
	document.forms[0].numsite.value = "";
	document.forms[0].abrev.value = "";
	document.forms[0].name.value = "";
	document.forms[0].address.value = "";
	document.forms[0].zip.value = "";
	document.forms[0].city.value = "";
	document.forms[0].codepays.value = "AD";
	document.forms[0].phone.value = "";
	document.forms[0].fax.value = "";
	document.forms[0].website.value = "";
	document.forms[0].latitude.value = "";
	document.forms[0].longitude.value = "";
	document.forms[0].principal_part.value = "No";
	document.forms[0].partners.value = "";
}

// Fonction permettant de réinitialiser le formulaire de dépôt
function resetUpload(){
	document.forms[0].type.value = "";
	document.forms[0].file.value = "";
}

// Fonction permettant de réinitialiser le formulaire d'infos d'une unité génétique
function resetGU(pays,nat,syncou,synnat,commercial,origcode,matparnat,matparcou,patparnat,patparcou,speid,typegu,mating,nature,
				comment,origcou,origloc,origprov,origlat,origlon,origalt,provcou,provloc,provreg,provlat,provlon,provalt,
				matexist,orgid,matacc,matrest,dataacc,datarest,surv,diam,heig,biom,budf,buds,flph,flqu,stem,bran,woan,woph,
				woch,bioi,biop,abiw,abic,abid,gend,mole,pedi,othe,desc,sellevel,tested,comprod,regorprot,endangered,generation){
	document.forms[0].pays.value = pays;
	document.forms[0].nat.value = nat;
	document.forms[0].commercial.value = commercial;
	document.forms[0].origcode.value = origcode;
	document.forms[0].matparnat.value = matparnat;
	document.forms[0].matparcou.value = matparcou;
	document.forms[0].patparnat.value = patparnat;
	document.forms[0].patparcou.value = patparcou;
	document.forms[0].speid.value = speid;
	document.forms[0].typegu.value = typegu;
	document.forms[0].mating.value = mating;
	document.forms[0].nature.value = nature;
	document.forms[0].comment.value = comment;
	document.forms[0].origcou.value = origcou;
	document.forms[0].origloc.value = origloc;
	document.forms[0].origprov.value = origprov;
	document.forms[0].origlat.value = origlat;
	document.forms[0].origlon.value = origlon;
	document.forms[0].origalt.value = origalt;
	document.forms[0].provcou.value = provcou;
	document.forms[0].provloc.value = provloc;
	document.forms[0].provreg.value = provreg;
	document.forms[0].provlat.value = provlat;
	document.forms[0].provlon.value = provlon;
	document.forms[0].provalt.value = provalt;
	document.forms[0].matexist[0].checked = (matexist == "Y");
	document.forms[0].matexist[1].checked = (matexist == "N");
	document.forms[0].matexist[2].checked = (matexist == "U");
	document.forms[0].orgid.value = orgid;
	document.forms[0].matacc[0].checked = (matacc == "Y");
	document.forms[0].matacc[1].checked = (matacc == "N");
	document.forms[0].matrest.value = matrest;
	document.forms[0].dataacc[0].checked = (dataacc == "Y");
	document.forms[0].dataacc[1].checked = (dataacc == "N");
	document.forms[0].datarest.value = datarest;
	document.forms[0].surv.checked = (surv == 'X');
	document.forms[0].diam.checked = (diam == 'X');
	document.forms[0].heig.checked = (heig == 'X');
	document.forms[0].biom.checked = (biom == 'X');
	document.forms[0].budf.checked = (budf == 'X');
	document.forms[0].buds.checked = (buds == 'X');
	document.forms[0].flph.checked = (flph == 'X');
	document.forms[0].flqu.checked = (flqu == 'X');
	document.forms[0].stem.checked = (stem == 'X');
	document.forms[0].bran.checked = (bran == 'X');
	document.forms[0].woan.checked = (woan == 'X');
	document.forms[0].woph.checked = (woph == 'X');
	document.forms[0].woch.checked = (woch == 'X');
	document.forms[0].bioi.checked = (bioi == 'X');
	document.forms[0].biop.checked = (biop == 'X');
	document.forms[0].abiw.checked = (abiw == 'X');
	document.forms[0].abic.checked = (abic == 'X');
	document.forms[0].abid.checked = (abid == 'X');
	document.forms[0].gend.value = gend;
	document.forms[0].mole.checked = (mole == 'X');
	document.forms[0].pedi.checked = (pedi == 'X');
	document.forms[0].othe.checked = (othe == 'X');
	document.forms[0].desc.value = desc;
	document.forms[0].sellevel.value = sellevel;
	document.forms[0].tested[0].checked = (tested == "Y");
	document.forms[0].tested[1].checked = (tested == "N");
	document.forms[0].tested[2].checked = (tested == "U");
	document.forms[0].comprod[0].checked = (comprod == "Y");
	document.forms[0].comprod[1].checked = (comprod == "N");
	document.forms[0].comprod[2].checked = (comprod == "U");
	document.forms[0].regorprot[0].checked = (regorprot == "Y");
	document.forms[0].regorprot[1].checked = (regorprot == "N");
	document.forms[0].endangered.value = endangered;
	document.forms[0].generation.value = generation;
}

// Fonction permettant de réinitialiser le formulaire de création d'une unité génétique
function resetNewGU(){
	document.forms[0].pays.value = "AT";
	document.forms[0].nat.value = "";
	document.forms[0].commercial.value = "";
	document.forms[0].origcode.value = "";
	document.forms[0].matparnat.value = "";
	document.forms[0].matparcou.value = "";
	document.forms[0].patparnat.value = "";
	document.forms[0].patparcou.value = "";
	document.forms[0].speid.value = "11";
	document.forms[0].typegu.value = "NAT";
	document.forms[0].mating.value = "";
	document.forms[0].nature.value = "I";
	document.forms[0].comment.value = "";
	document.forms[0].origcou.value = "";
	document.forms[0].origloc.value = "";
	document.forms[0].origprov.value = "";
	document.forms[0].origlat.value = "";
	document.forms[0].origlon.value = "";
	document.forms[0].origalt.value = "";
	document.forms[0].provcou.value = "";
	document.forms[0].provloc.value = "";
	document.forms[0].provreg.value = "";
	document.forms[0].provlat.value = "";
	document.forms[0].provlon.value = "";
	document.forms[0].provalt.value = "";
	document.forms[0].matexist[0].checked = false;
	document.forms[0].matexist[1].checked = false;
	document.forms[0].matexist[2].checked = false;
	document.forms[0].orgid.value = "1";
	document.forms[0].matacc[0].checked = false;
	document.forms[0].matacc[1].checked = false;
	document.forms[0].matrest.value = "";
	document.forms[0].dataacc[0].checked = false;
	document.forms[0].dataacc[1].checked = false;
	document.forms[0].datarest.value = "";
	document.forms[0].surv.checked = false;
	document.forms[0].diam.checked = false;
	document.forms[0].heig.checked = false;
	document.forms[0].biom.checked = false;
	document.forms[0].budf.checked = false;
	document.forms[0].buds.checked = false;
	document.forms[0].flph.checked = false;
	document.forms[0].flqu.checked = false;
	document.forms[0].stem.checked = false;
	document.forms[0].bran.checked = false;
	document.forms[0].woan.checked = false;
	document.forms[0].woph.checked = false;
	document.forms[0].woch.checked = false;
	document.forms[0].bioi.checked = false;
	document.forms[0].biop.checked = false;
	document.forms[0].abiw.checked = false;
	document.forms[0].abic.checked = false;
	document.forms[0].abid.checked = false;
	document.forms[0].gend.value = "";
	document.forms[0].mole.checked = false;
	document.forms[0].pedi.checked = false;
	document.forms[0].othe.checked = false;
	document.forms[0].desc.value = "";
	document.forms[0].sellevel.value = "";
	document.forms[0].tested[0].checked = false;
	document.forms[0].tested[1].checked = false;
	document.forms[0].tested[2].checked = false;
	document.forms[0].comprod[0].checked = false;
	document.forms[0].comprod[1].checked = false;
	document.forms[0].comprod[2].checked = false;
	document.forms[0].regorprot[0].checked = false;
	document.forms[0].regorprot[1].checked = false;
	document.forms[0].endangered.value = "";
	document.forms[0].generation.value = "";
}

// Fonction permettant de réinitialiser le formulaire d'infos d'un field trial
function resetFT(pays,nat,county,municipality,orgid,locality,forestdist,status,publis,keywords,
				speid,trialtype,yearplant,duration,area,soiltype,aspect,ageplants,latitude,longitude,altitude,
				seedsexprop,vegprop,spacing,nbofgu,nbofrept,nbofbl,nbofpp,nbofptu,designft,descdoth,
				surv,diam,heig,biom,budf,buds,flph,flqu,stem,bran,woan,woph,
				woch,bioi,biop,abiw,abic,abid,othe,desc){
	document.forms[0].pays.value = pays;
	document.forms[0].nat.value = nat;
	document.forms[0].county.value = county;
	document.forms[0].municipality.value = municipality;
	document.forms[0].orgid.value = orgid;
	document.forms[0].locality.value = locality;
	document.forms[0].status.value = status;
	document.forms[0].forestdist.value = forestdist;
	document.forms[0].publis[0].checked = (publis == "Y");
	document.forms[0].publis[1].checked = (publis == "N");
	document.forms[0].publis[2].checked = (publis == "U");
	document.forms[0].keywords.value = keywords;
	document.forms[0].speid.value = speid;
	document.forms[0].trialtype.value = trialtype;
	document.forms[0].yearplant.value = yearplant;
	document.forms[0].duration.value = duration;
	document.forms[0].area.value = area;
	document.forms[0].soiltype.value = soiltype;
	document.forms[0].aspect.value = aspect;
	document.forms[0].ageplants.value = ageplants;
	document.forms[0].latitude.value = latitude;
	document.forms[0].longitude.value = longitude;
	document.forms[0].altitude.value = altitude;
	document.forms[0].seedsexprop.checked = (seedsexprop == 'X');
	document.forms[0].vegprop.checked = (vegprop == 'X');
	document.forms[0].spacing.value = spacing;
	document.forms[0].nbofgu.value = nbofgu;
	document.forms[0].nbofrept.value = nbofrept;
	document.forms[0].nbofbl.value = nbofbl;
	document.forms[0].nbofpp.value = nbofpp;
	document.forms[0].nbofptu.value = nbofptu;
	document.forms[0].designft.value = designft;
	document.forms[0].descdoth.value = descdoth;
	document.forms[0].surv.checked = (surv == 'X');
	document.forms[0].diam.checked = (diam == 'X');
	document.forms[0].heig.checked = (heig == 'X');
	document.forms[0].biom.checked = (biom == 'X');
	document.forms[0].budf.checked = (budf == 'X');
	document.forms[0].buds.checked = (buds == 'X');
	document.forms[0].flph.checked = (flph == 'X');
	document.forms[0].flqu.checked = (flqu == 'X');
	document.forms[0].stem.checked = (stem == 'X');
	document.forms[0].bran.checked = (bran == 'X');
	document.forms[0].woan.checked = (woan == 'X');
	document.forms[0].woph.checked = (woph == 'X');
	document.forms[0].woch.checked = (woch == 'X');
	document.forms[0].bioi.checked = (bioi == 'X');
	document.forms[0].biop.checked = (biop == 'X');
	document.forms[0].abiw.checked = (abiw == 'X');
	document.forms[0].abic.checked = (abic == 'X');
	document.forms[0].abid.checked = (abid == 'X');
	document.forms[0].othe.checked = (othe == 'X');
	document.forms[0].desc.value = desc;
}

// Fonction permettant de réinitialiser le formulaire de création d'un field trial
function resetNewFT(){
	document.forms[0].pays.value = "AT";
	document.forms[0].nat.value = "";
	document.forms[0].county.value = "";
	document.forms[0].municipality.value = "";
	document.forms[0].orgid.value = "1";
	document.forms[0].locality.value = "";
	document.forms[0].status.value = "";
	document.forms[0].forestdist.value = "";
	document.forms[0].publis[0].checked = false;
	document.forms[0].publis[1].checked = false;
	document.forms[0].publis[2].checked = false;
	document.forms[0].keywords.value = "";
	document.forms[0].speid.value = "11";
	document.forms[0].trialtype.value = "";
	document.forms[0].yearplant.value = "";
	document.forms[0].duration.value = "L";
	document.forms[0].area.value = "";
	document.forms[0].soiltype.value = "";
	document.forms[0].aspect.value = "";
	document.forms[0].ageplants.value = "";
	document.forms[0].latitude.value = "";
	document.forms[0].longitude.value = "";
	document.forms[0].altitude.value = "";
	document.forms[0].seedsexprop.checked = false;
	document.forms[0].vegprop.checked = false;
	document.forms[0].spacing.value = "";
	document.forms[0].nbofgu.value = "";
	document.forms[0].nbofrept.value = "";
	document.forms[0].nbofbl.value = "";
	document.forms[0].nbofpp.value = "";
	document.forms[0].nbofptu.value = "";
	document.forms[0].designft.value = "CR";
	document.forms[0].descdoth.value = "";
	document.forms[0].surv.checked = false;
	document.forms[0].diam.checked = false;
	document.forms[0].heig.checked = false;
	document.forms[0].biom.checked = false;
	document.forms[0].budf.checked = false;
	document.forms[0].buds.checked = false;
	document.forms[0].flph.checked = false;
	document.forms[0].flqu.checked = false;
	document.forms[0].stem.checked = false;
	document.forms[0].bran.checked = false;
	document.forms[0].woan.checked = false;
	document.forms[0].woph.checked = false;
	document.forms[0].woch.checked = false;
	document.forms[0].bioi.checked = false;
	document.forms[0].biop.checked = false;
	document.forms[0].abiw.checked = false;
	document.forms[0].abic.checked = false;
	document.forms[0].abid.checked = false;
	document.forms[0].othe.checked = false;
	document.forms[0].desc.value = "";
}

// Fonction permettant de réinitialiser le formulaire d'infos d'un test material
function resetTM(pays,nat,entry,matparnat,matparcou,patparnat,patparcou,mtid,desc){
	document.forms[0].pays.value = pays;
	document.forms[0].nat.value = nat;
	document.forms[0].entry.value = entry;
	document.forms[0].matparnat.value = matparnat;
	document.forms[0].matparcou.value = matparcou;
	document.forms[0].patparnat.value = patparnat;
	document.forms[0].patparcou.value = patparcou;
	document.forms[0].mtid.value = mtid;
	document.forms[0].desc.value = desc;
}

// Fonction permettant de réinitialiser le formulaire de création d'un test material
function resetNewTM(){
	document.forms[0].pays.value = "AT";
	document.forms[0].nat.value = "";
	document.forms[0].entry.value = "";
	document.forms[0].matparnat.value = "";
	document.forms[0].matparcou.value = "";
	document.forms[0].patparnat.value = "";
	document.forms[0].patparcou.value = "";
	document.forms[0].mtid.value = "NAT";
	document.forms[0].desc.value = "";
}

// Fonction permettant de réinitialiser le formulaire d'infos d'un groupe de synonymes
function resetGroupSyn(groupname,desc,pays,nat,syncou,synnat,speid){
	document.forms[0].groupname.value = groupname;
	document.forms[0].speid.value = speid;
	document.forms[0].desc.value = desc;
	document.forms[0].pays.value = pays;
	document.forms[0].nat.value = nat;
	// Réinitialisation des synonymes
	var tableCadre = document.getElementById('cadreSyn');
	var lignes = tableCadre.getElementsByTagName('tr');
	var nbsynactuel = lignes.length;
	// On efface d'abord tous les synonymes
	for (var num = 0 ; num < nbsynactuel; num++) {
		supprimeSynonymClient(0);
	}
	// On copie les anciens synonymes
	var syn1 = syncou.split("|#|");
	var syn2 = synnat.split("|#|");
	document.getElementById("syncountry0").value = syn1[0];
	document.getElementById("synnational0").value = syn2[0];
	for (var num = 1 ; num < syn1.length; num++) {
		ajoutSynonymClient(num);
		document.getElementById("syncountry"+num).value = syn1[num];
		document.getElementById("synnational"+num).value = syn2[num];
	}
}

// Fonction permettant de réinitialiser le formulaire de création d'un groupe de synonymes
function resetNewGroupSyn(){
	document.forms[0].groupname.value = "";
	document.forms[0].speid.value = "11";
	document.forms[0].desc.value = "";
	document.forms[0].pays.value = "";
	document.forms[0].nat.value = "";
	// Réinitialisation des synonymes
	var tableCadre = document.getElementById('cadreSyn');
	var lignes = tableCadre.getElementsByTagName('tr');
	var nbsynactuel = lignes.length;
	// On efface tous les synonymes
	for (var num = 0 ; num < nbsynactuel; num++) {
		supprimeSynonymClient(0);
	}
}

//Fonction permettant de réinitialiser le formulaire d'infos d'une donnée climatique
function resetWC(latitude,longitude,bio1,bio2,bio3,bio4,bio5,bio6,bio7,bio8,bio9,bio10,bio11,bio12,bio13,bio14,bio15,bio16,bio17,bio18,bio19){
	document.forms[0].latitude.value = latitude;
	document.forms[0].longitude.value = longitude;
	document.forms[0].bio1.value = bio1;
	document.forms[0].bio2.value = bio2;
	document.forms[0].bio3.value = bio3;
	document.forms[0].bio4.value = bio4;
	document.forms[0].bio5.value = bio5;
	document.forms[0].bio6.value = bio6;
	document.forms[0].bio7.value = bio7;
	document.forms[0].bio8.value = bio8;
	document.forms[0].bio9.value = bio9;
	document.forms[0].bio10.value = bio10;
	document.forms[0].bio11.value = bio11;
	document.forms[0].bio12.value = bio12;
	document.forms[0].bio13.value = bio13;
	document.forms[0].bio14.value = bio14;
	document.forms[0].bio15.value = bio15;
	document.forms[0].bio16.value = bio16;
	document.forms[0].bio17.value = bio17;
	document.forms[0].bio18.value = bio18;
	document.forms[0].bio19.value = bio19;
}

//Fonction permettant de réinitialiser le formulaire de création d'une donnée climatique
function resetNewWC(){
	document.forms[0].latitude.value = "";
	document.forms[0].longitude.value = "";
	document.forms[0].bio1.value = "";
	document.forms[0].bio2.value = "";
	document.forms[0].bio3.value = "";
	document.forms[0].bio4.value = "";
	document.forms[0].bio5.value = "";
	document.forms[0].bio6.value = "";
	document.forms[0].bio7.value = "";
	document.forms[0].bio8.value = "";
	document.forms[0].bio9.value = "";
	document.forms[0].bio10.value = "";
	document.forms[0].bio11.value = "";
	document.forms[0].bio12.value = "";
	document.forms[0].bio13.value = "";
	document.forms[0].bio14.value = "";
	document.forms[0].bio15.value = "";
	document.forms[0].bio16.value = "";
	document.forms[0].bio17.value = "";
	document.forms[0].bio18.value = "";
	document.forms[0].bio19.value = "";
}

//Fonction permettant de réinitialiser le formulaire d'infos d'une donnée sol
function resetSO(latitude,longitude,soil1,soil2,soil3,soil4,soil5,soil6,soil7,soil8,soil9,soil10,soil11,soil12,soil13){
	document.forms[0].latitude.value = latitude;
	document.forms[0].longitude.value = longitude;
	document.forms[0].soil1.value = soil1;
	document.forms[0].soil2.value = soil2;
	document.forms[0].soil3.value = soil3;
	document.forms[0].soil4.value = soil4;
	document.forms[0].soil5.value = soil5;
	document.forms[0].soil6.value = soil6;
	document.forms[0].soil7.value = soil7;
	document.forms[0].soil8.value = soil8;
	document.forms[0].soil9.value = soil9;
	document.forms[0].soil10.value = soil10;
	document.forms[0].soil11.value = soil11;
	document.forms[0].soil12.value = soil12;
	document.forms[0].soil13.value = soil13;
}

//Fonction permettant de réinitialiser le formulaire de création d'une donnée sol
function resetNewSO(){
	document.forms[0].latitude.value = "";
	document.forms[0].longitude.value = "";
	document.forms[0].soil1.value = "";
	document.forms[0].soil2.value = "";
	document.forms[0].soil3.value = "";
	document.forms[0].soil4.value = "";
	document.forms[0].soil5.value = "";
	document.forms[0].soil6.value = "";
	document.forms[0].soil7.value = "";
	document.forms[0].soil8.value = "";
	document.forms[0].soil9.value = "";
	document.forms[0].soil10.value = "";
	document.forms[0].soil11.value = "";
	document.forms[0].soil12.value = "";
	document.forms[0].soil13.value = "";
}

//Fonction permettant de réinitialiser le formulaire d'infos d'un code sol
function resetSoilcode(paramid,codesol,abrevsol,defsol){
	document.forms[0].paramid.value = paramid;
	document.forms[0].codesol.value = codesol;
	document.forms[0].abrevsol.value = abrevsol;
	document.forms[0].defsol.value = defsol;
}

//Fonction permettant de réinitialiser le formulaire de création d'un code sol
function resetNewSoilcode(){
	document.forms[0].paramid.value = "";
	document.forms[0].codesol.value = "";
	document.forms[0].abrevsol.value = "";
	document.forms[0].defsol.value = "";
}

//Fonction permettant de réinitialiser le formulaire d'infos d'un document
function resetDocument(titre,desc,idaut,activite,lieu,annee,motscles){
	document.forms[0].titre.value = titre;
	document.forms[0].desc.value = desc;
	document.forms[0].idaut.value = idaut;
	document.forms[0].activite.value = activite;
	document.forms[0].lieu.value = lieu;
	document.forms[0].annee.value = annee;
	document.forms[0].motscles.value = motscles;
	document.forms[0].file.value = "";
	
}

// Fonction permettant d'afficher/cacher les champs des filtres de recherche de données selon le type choisi
function changerTypeDonnees(num) {
	initSort();
	var type;
	var typeAucun = "";
	var typeGU = "GU";
	var typeFT = "FT";
	var typeTM = "TM";
	var typeWC = "WC";
	var typeSO = "SO";
	// Pas de type sélectionné
	if (num == 0) {
		type = typeAucun;
	}
	// Genetic units
	else if (num == 1) {
		type = typeGU;
	}
	// Field trials
	else if (num == 2) {
		type = typeFT;
	}
	// Test material
	else if (num == 3) {
		type = typeTM;
	}
	// Climate
	else if (num == 4) {
		type = typeWC;
	}
	// Soil
	else if (num == 5) {
		type = typeSO;
	}
	// Si pas d'indice
	else {
		type = num;
	}
	// Aucun type : on cache tout
	if (type == typeAucun) {
		afficherSection("especes",false);
		afficherSection("genres",false);
		afficherSection("pays",false);
		afficherSection("organisation",false);
		afficherSection("national",false);
		afficherSection("national_test",false);
		afficherSection("entry",false);
		afficherSection("gu_type",false);
		afficherSection("mating",false);
		afficherSection("endangered",false);
		afficherSection("trial_type",false);
		afficherSection("design_ft",false);
		afficherSection("latitude",false);
		afficherSection("longitude",false);
		afficherSection("climvar",false);
		afficherSection("soilvar",false);
		afficherSection("mat_type",false);
		afficherSection("valid_form",false);
	}
	// Genetic units
	else if (type == typeGU) {
		afficherSection("especes",true);
		afficherSection("genres",true);
		afficherSection("pays",true);
		afficherSection("organisation",true);
		afficherSection("national",true);
		afficherSection("national_test",false);
		afficherSection("entry",false);
		afficherSection("gu_type",true);
		afficherSection("mating",true);
		afficherSection("endangered",true);
		afficherSection("trial_type",false);
		afficherSection("design_ft",false);
		afficherSection("latitude",false);
		afficherSection("longitude",false);
		afficherSection("climvar",false);
		afficherSection("soilvar",false);
		afficherSection("mat_type",false);
		afficherSection("valid_form",true);
	}
	// Field trials ou Climate ou Soil
	else if (type == typeFT || type == typeWC || type == typeSO) {
		afficherSection("especes",true);
		afficherSection("genres",true);
		afficherSection("pays",true);
		afficherSection("organisation",true);
		afficherSection("national",false);
		afficherSection("national_test",true);
		afficherSection("entry",false);
		afficherSection("gu_type",false);
		afficherSection("mating",false);
		afficherSection("endangered",false);
		afficherSection("trial_type",true);
		afficherSection("design_ft",true);
		afficherSection("latitude",true);
		afficherSection("longitude",true);
		if (type == typeFT) {
			afficherSection("climvar",false);
			afficherSection("soilvar",false);
		} else if (type == typeWC) {
			afficherSection("climvar",true);
			afficherSection("soilvar",false);
		} else {
			afficherSection("climvar",false);
			afficherSection("soilvar",true);
		}
		afficherSection("mat_type",false);
		afficherSection("valid_form",true);
	}
	// Test material
	else if (type == typeTM) {
		afficherSection("especes",true);
		afficherSection("genres",true);
		afficherSection("pays",true);
		afficherSection("organisation",true);
		afficherSection("national",false);
		afficherSection("national_test",true);
		afficherSection("entry",true);
		afficherSection("gu_type",false);
		afficherSection("mating",false);
		afficherSection("endangered",false);
		afficherSection("trial_type",true);
		afficherSection("design_ft",true);
		afficherSection("latitude",true);
		afficherSection("longitude",true);
		afficherSection("climvar",false);
		afficherSection("soilvar",false);
		afficherSection("mat_type",true);
		afficherSection("valid_form",true);
	}
}

// Fonction permettant d'afficher/cacher les champs des filtres de recherche de statistiques selon le type choisi
function changerTypeStats(num,vitrine) {
	initSort();
	var type;
	var typeAucun = "";
	var typeGUT = "GUT";
	var typeFTT = "FTT";
	var typeTMT = "TMT";
	var typeDS = "DS";
	var typeDO = "DO";
	// Pas de type sélectionné
	if (num == 0) {
		type = typeAucun;
	}
	// Genetic units grouped by type
	else if (num == 1) {
		type = typeGUT;
	}
	// Field trials grouped by type
	else if (num == 2) {
		type = typeFTT;
	}
	// Test Material grouped by type
	else if (num == 3) {
		type = typeTMT;
	}
	// Data grouped by species
	else if (num == 4) {
		type = typeDS;
	}
	// Data grouped by organization
	else if (num == 5) {
		type = typeDO;
	}
	// Si pas d'indice
	else {
		type = num;
	}
	// Aucun type : on cache tout
	if (type == typeAucun) {
		afficherSection("output",false);
		afficherSection("valid_form",false);
		if (vitrine == 0) {
			afficherSection("especes",false);
			afficherSection("genres",false);
			afficherSection("pays",false);
			afficherSection("organisation",false);
			afficherSection("gu_type",false);
			afficherSection("trial_type",false);
			afficherSection("mat_type",false);
		}
	}
	// Genetic units grouped by type
	else if (type == typeGUT) {
		afficherSection("output",false);
		afficherSection("valid_form",true);
		if (vitrine == 0) {
			afficherSection("especes",true);
			afficherSection("genres",true);
			afficherSection("pays",true);
			afficherSection("organisation",true);
			afficherSection("gu_type",true);
			afficherSection("trial_type",false);
			afficherSection("mat_type",false);
		}
	}
	// Field trials grouped by type
	else if (type == typeFTT) {
		afficherSection("output",true);
		afficherSection("valid_form",true);
		if (vitrine == 0) {
			afficherSection("especes",true);
			afficherSection("genres",true);
			afficherSection("pays",true);
			afficherSection("organisation",true);
			afficherSection("gu_type",false);
			afficherSection("trial_type",true);
			afficherSection("mat_type",false);
		}
	}
	// Test material grouped by type
	else if (type == typeTMT) {
		afficherSection("output",true);
		afficherSection("valid_form",true);
		if (vitrine == 0) {
			afficherSection("especes",true);
			afficherSection("genres",true);
			afficherSection("pays",true);
			afficherSection("organisation",true);
			afficherSection("gu_type",false);
			afficherSection("trial_type",false);
			afficherSection("mat_type",true);
		}
	}
	// Data grouped by species
	else if (type == typeDS) {
		afficherSection("output",false);
		afficherSection("valid_form",true);
		if (vitrine == 0) {
			afficherSection("especes",true);
			afficherSection("genres",true);
			afficherSection("pays",false);
			afficherSection("organisation",false);
			afficherSection("gu_type",false);
			afficherSection("trial_type",false);
			afficherSection("mat_type",false);
		}
	}
	// Data grouped by organization
	else if (type == typeDO) {
		afficherSection("output",false);
		afficherSection("valid_form",true);
		if (vitrine == 0) {
			afficherSection("especes",false);
			afficherSection("genres",false);
			afficherSection("pays",false);
			afficherSection("organisation",false);
			afficherSection("gu_type",false);
			afficherSection("trial_type",false);
			afficherSection("mat_type",false);
		}
	}
}

// Fonction permettant d'afficher/cacher les champs des filtres de recherche de carte/requêtes selon le type choisi
function changerTypeCarte(num,vitrine) {
	initSort();
	var idLat = document.getElementById("idlat");
	var idLon = document.getElementById("idlon");
	var idAlt = document.getElementById("idalt");
	var lat = document.createTextNode('Latitude');
	var lon = document.createTextNode('Longitude');
	var alt = document.createTextNode('Altitude');
	var olat = document.createTextNode('Origin latitude');
	var olon = document.createTextNode('Origin longitude');
	var oalt = document.createTextNode('Origin altitude');
	var type;
	var typeAucun = "";
	var typeGU = "GU";
	var typeFT = "FT";
	var typeGUFT = "GUFT";
	// Pas de type sélectionné
	if (num == 0) {
		type = typeAucun;
	}
	// Genetic units
	else if (num == 1) {
		type = typeGU;
	}
	// Field trials
	else if (num == 2) {
		type = typeFT;
	}
	// Genetic units + Field trials
	else if (num == 3) {
		type = typeGUFT;
	}
	// Si pas d'indice
	else {
		type = num;
	}
	// Aucun type : on cache tout
	if (type == typeAucun) {
		afficherSection("research",false);
		afficherSection("research2",false);
		afficherSection("especes",false);
		afficherSection("display",false);
		afficherSection("sortie",false);
		afficherSection("sortiesyn",false);
		afficherSection("sortie2",false);
		afficherSection("valid_form",false);
		if (vitrine == 0) {
			afficherSection("pays",false);
			afficherSection("organisation",false);
			afficherSection("genres",false);
			afficherSection("latitude",false);
			afficherSection("longitude",false);
			afficherSection("altitude",false);
			afficherSection("platitude",false);
			afficherSection("plongitude",false);
			afficherSection("paltitude",false);
			afficherSection("regofprov",false);
			afficherSection("generation",false);
			afficherSection("climvar",false);
			afficherSection("soilvar",false);
			afficherSection("measured",false);
			afficherSection("comprod",false);
			afficherSection("regorprot",false);
			afficherSection("endangered",false);
			afficherSection("mating",false);
			afficherSection("origdiff",false);
			afficherSection("provdiff",false);
			afficherSection("national",false);
			afficherSection("origcode",false);
			afficherSection("comname",false);
			afficherSection("matparnat",false);
			afficherSection("matparcou",false);
			afficherSection("patormat",false);
			afficherSection("patparnat",false);
			afficherSection("patparcou",false);
			afficherSection("gu_type",false);
			afficherSection("trial_type",false);
		}
	}
	// Genetic units
	else if (type == typeGU) {
		afficherSection("research",true);
		afficherSection("research2",false);
		afficherSection("especes",true);
		afficherSection("sortie2",false);
		afficherSection("valid_form",true);
		changerResearchCarte(document.forms[0].search_research.value,vitrine);
		if (vitrine == 0) {
			afficherSection("pays",true);
			afficherSection("organisation",true);
			afficherSection("genres",true);
			afficherSection("climvar",false);
			afficherSection("soilvar",false);
			afficherSection("matparnat",false);
			afficherSection("matparcou",false);
			afficherSection("patormat",false);
			afficherSection("patparnat",false);
			afficherSection("patparcou",false);
			afficherSection("gu_type",true);
			afficherSection("trial_type",false);
			// Affichage des 3 paramètres mesurés propre aux GU
			var selTraits = document.getElementById("sel_traits");
			var sel = selTraits.getElementsByTagName("select");
			if (sel[0].length == 19) {
				var option1 = document.createElement('option');
				var option2 = document.createElement('option');
				var option3 = document.createElement('option');
				var option4 = document.createElement('option');
				option1.value = "GEN";
				option1.innerHTML = "Gender";
				option2.value = "MOL";
				option2.innerHTML = 'Molecular ID';
				option3.value = "PED";
				option3.innerHTML = 'Pedigree';
				option4.value = 'OTH';
				option4.innerHTML = 'Other';
				sel[0].removeChild(sel[0].options[18]);
				sel[0].appendChild(option1);
				sel[0].appendChild(option2);
				sel[0].appendChild(option3);
				sel[0].appendChild(option4);
			}
			// Affichage du texte approprié pour les lat/lon/alt
			idLat.replaceChild(olat,idLat.firstChild);
			idLon.replaceChild(olon,idLon.firstChild);
			idAlt.replaceChild(oalt,idAlt.firstChild);
		}
	}
	// Field trials
	else if (type == typeFT) {
		afficherSection("research",false);
		afficherSection("research2",false);
		afficherSection("especes",true);
		afficherSection("display",false);
		afficherSection("sortie",true);
		afficherSection("sortiesyn",false);
		afficherSection("sortie2",false);
		afficherSection("valid_form",true);
		if (vitrine == 0) {
			afficherSection("pays",true);
			afficherSection("organisation",true);
			afficherSection("genres",true);
			afficherSection("latitude",true);
			afficherSection("longitude",true);
			afficherSection("altitude",true);
			afficherSection("platitude",false);
			afficherSection("plongitude",false);
			afficherSection("paltitude",false);
			afficherSection("regofprov",false);
			afficherSection("generation",false);
			afficherSection("climvar",true);
			afficherSection("soilvar",true);
			afficherSection("measured",true);
			afficherSection("comprod",false);
			afficherSection("regorprot",false);
			afficherSection("endangered",false);
			afficherSection("mating",false);
			afficherSection("origdiff",false);
			afficherSection("provdiff",false);
			afficherSection("national",false);
			afficherSection("origcode",false);
			afficherSection("comname",false);
			afficherSection("matparnat",false);
			afficherSection("matparcou",false);
			afficherSection("patparnat",false);
			afficherSection("patormat",false);
			afficherSection("patparcou",false);
			afficherSection("gu_type",false);
			afficherSection("trial_type",true);
			// Masquage des 3 paramètres mesurés propre aux GU
			var selTraits = document.getElementById("sel_traits");
			var sel = selTraits.getElementsByTagName("select");
			if (sel[0].options.length == 22) {
				sel[0].removeChild(sel[0].options[18]);		
				sel[0].removeChild(sel[0].options[18]);
				sel[0].removeChild(sel[0].options[18]);
			}
			// Affichage du texte approprié pour les lat/lon/alt
			idLat.replaceChild(lat,idLat.firstChild);
			idLon.replaceChild(lon,idLon.firstChild);
			idAlt.replaceChild(alt,idAlt.firstChild);
		}
	}
	// Genetic units + Field trials
	else if (type == typeGUFT) {
		afficherSection("research",false);
		afficherSection("research2",true);
		afficherSection("especes",true);
		afficherSection("display",false);
		afficherSection("sortie",false);
		afficherSection("sortiesyn",false);
		afficherSection("sortie2",true);
		afficherSection("valid_form",true);
		changerResearch2Carte(document.forms[0].search_research2.value,vitrine);
		if (vitrine == 0) {
			afficherSection("pays",true);
			afficherSection("organisation",true);
			afficherSection("genres",true);
			afficherSection("latitude",false);
			afficherSection("longitude",false);
			afficherSection("altitude",false);
			afficherSection("platitude",false);
			afficherSection("plongitude",false);
			afficherSection("paltitude",false);
			afficherSection("regofprov",false);
			afficherSection("generation",false);
			afficherSection("climvar",false);
			afficherSection("soilvar",false);
			afficherSection("measured",false);
			afficherSection("comprod",false);
			afficherSection("regorprot",false);
			afficherSection("endangered",false);
			afficherSection("mating",false);
			afficherSection("origdiff",false);
			afficherSection("provdiff",false);
			afficherSection("gu_type",false);
			afficherSection("trial_type",false);
		}
	}
}

//Fonction permettant d'afficher/cacher les variables
function changerVarView(num,nbvar,typevar) {
	var selView, variable;
	for (var i=1; i<=nbvar; i++) {
		// Num = 0 : action sur toutes les variables
		if (num == 0 || num == i) {
			variable = document.getElementsByName("search_"+typevar+i);
			// Case décochée, bornes invisibles
			if (!variable[0].checked) {
				afficherSection(typevar+"view"+i,false);
			}
			// Case cochée, bornes visibles
			else {
				afficherSection(typevar+"view"+i,true);
			}
		}
	}
}

// Fonction permettant d'afficher/cacher la sélection multiple
function changerSelMultiple(num, mult_sel_id) {
	var type;
	var typeTous = "";
	var typeSEL = "SEL";
	// Pas de sélection
	if (num == 0) {
		type = typeTous;
	}
	// 
	else if (num == 1) {
		type = typeSEL;
	}
	// Si pas d'indice
	else {
		type = num;
	}
	// Tous
	if (num == 0) {
		afficherSection(mult_sel_id, false);
	}
	// Sélection
	else {
		afficherSection(mult_sel_id, true);
	}
}

// Fonction permettant d'afficher/cacher les critères de recherche sur l'origine et la provenance
function changerDisplayCarte(choix) {
	initSort();
	// Affichage origine
	if (choix == "O") {
		afficherSection("latitude",true);
		afficherSection("longitude",true);
		afficherSection("altitude",true);
		afficherSection("platitude",false);
		afficherSection("plongitude",false);
		afficherSection("paltitude",false);
		afficherSection("regofprov",false);
	}
	// Affichage provenance
	else if (choix == "P") {
		afficherSection("latitude",false);
		afficherSection("longitude",false);
		afficherSection("altitude",false);
		afficherSection("platitude",true);
		afficherSection("plongitude",true);
		afficherSection("paltitude",true);
		afficherSection("regofprov",true);
	}
	// Affichage origine ET provenance
	else {
		afficherSection("latitude",true);
		afficherSection("longitude",true);
		afficherSection("altitude",true);
		afficherSection("platitude",true);
		afficherSection("plongitude",true);
		afficherSection("paltitude",true);
		afficherSection("regofprov",true);
	}
}

// Fonction permettant d'afficher/cacher les différents filtres de recherche des genetic units
function changerResearchCarte(num,vitrine) {
	initSort();
	var search;
	var searchSP = "SP";
	var searchSY = "SY";
	var searchST = "ST";
	var searchCR = "CR";
	// Recherche spécifique
	if (num == 0) {
		search = searchSP;
	}
	// Recherche de synonymes
	else if (num == 1) {
		search = searchSY;
	}
	// Recherche par statut
	else if (num == 2) {
		search = searchST;
	}
	// Recherche par croisement
	else if (num == 3) {
		search = searchCR;
	}
	// Si pas d'indice
	else {
		search = num;
	}
	// Recherche spécifique
	if (search == searchSP) {
		afficherSection("display",true);
		afficherSection("sortie",true);
		afficherSection("sortiesyn",false);
		if (vitrine == 0) {
			afficherSection("generation",true);
			afficherSection("measured",true);
			afficherSection("comprod",false);
			afficherSection("regorprot",false);
			afficherSection("endangered",false);
			afficherSection("mating",false);
			afficherSection("origdiff",false);
			afficherSection("provdiff",false);
			afficherSection("national",false);
			afficherSection("origcode",false);
			afficherSection("comname",false);
			if (document.forms[0].search_display[0].checked) {
				var search_display = "O";
			} else if (document.forms[0].search_display[1].checked) {
				var search_display = "P";
			} else {
				var search_display = "B";
			}
			changerDisplayCarte(search_display);
		}
	}
	// Recherche de synonymes
	else if (search == searchSY) {
		afficherSection("display",false);
		afficherSection("sortie",false);
		afficherSection("sortiesyn",true);
		if (vitrine == 0) {
			afficherSection("generation",false);
			afficherSection("latitude",false);
			afficherSection("longitude",false);
			afficherSection("altitude",false);
			afficherSection("platitude",false);
			afficherSection("plongitude",false);
			afficherSection("paltitude",false);
			afficherSection("regofprov",false);
			afficherSection("measured",false);
			afficherSection("comprod",false);
			afficherSection("regorprot",false);
			afficherSection("endangered",false);
			afficherSection("mating",false);
			afficherSection("origdiff",true);
			afficherSection("provdiff",true);
			afficherSection("national",true);
			afficherSection("origcode",true);
			afficherSection("comname",true);
		}
	}
	// Recherche par statut
	else if (search == searchST) {
		afficherSection("display",false);
		afficherSection("sortie",false);
		afficherSection("sortiesyn",false);
		if (vitrine == 0) {
			afficherSection("generation",false);
			afficherSection("latitude",false);
			afficherSection("longitude",false);
			afficherSection("altitude",false);
			afficherSection("platitude",false);
			afficherSection("plongitude",false);
			afficherSection("paltitude",false);
			afficherSection("regofprov",false);
			afficherSection("measured",false);
			afficherSection("comprod",true);
			afficherSection("regorprot",true);
			afficherSection("endangered",true);
			afficherSection("mating",false);
			afficherSection("origdiff",false);
			afficherSection("provdiff",false);
			afficherSection("national",false);
			afficherSection("origcode",false);
			afficherSection("comname",false);
		}
	}
	// Recherche par croisement
	else if (search == searchCR) {
		afficherSection("display",false);
		afficherSection("sortie",false);
		afficherSection("sortiesyn",false);
		if (vitrine == 0) {
			afficherSection("generation",true);
			afficherSection("latitude",false);
			afficherSection("longitude",false);
			afficherSection("altitude",false);
			afficherSection("platitude",false);
			afficherSection("plongitude",false);
			afficherSection("paltitude",false);
			afficherSection("regofprov",false);
			afficherSection("measured",false);
			afficherSection("comprod",false);
			afficherSection("regorprot",false);
			afficherSection("endangered",false);
			afficherSection("mating",true);
			afficherSection("origdiff",false);
			afficherSection("provdiff",false);
			afficherSection("national",false);
			afficherSection("origcode",false);
			afficherSection("comname",false);
		}
	}
}

//Fonction permettant d'afficher/cacher les différents filtres de recherche des GU + FT
function changerResearch2Carte(num,vitrine) {
	initSort();
	var search;
	var searchSY = "SY";
	var searchPA = "PA";
	// Recherche synonymes
	if (num == 0) {
		search = searchSY;
	}
	// Recherche parents
	else if (num == 1) {
		search = searchPA;
	}
	// Si pas d'indice
	else {
		search = num;
	}
	// Recherche synonymes
	if (search == searchSY && vitrine == 0) {
		afficherSection("national",true);
		afficherSection("origcode",true);
		afficherSection("comname",true);
		afficherSection("matparnat",false);
		afficherSection("matparcou",false);
		afficherSection("patormat",false);
		afficherSection("patparnat",false);
		afficherSection("patparcou",false);
	}
	// Recherche parents
	else if (search == searchPA && vitrine == 0) {
		afficherSection("national",false);
		afficherSection("origcode",false);
		afficherSection("comname",false);
		afficherSection("matparnat",true);
		afficherSection("matparcou",true);
		afficherSection("patormat",true);
		afficherSection("patparnat",true);
		afficherSection("patparcou",true);
	}
}

//Fonction permettant d'afficher/cacher les champs des filtres de recherche de carte/requêtes selon le type choisi
function changerParents(isChecked) {
	var idMatparnat = document.getElementById("idMatparnat");
	var idMatparcou = document.getElementById("idMatparcou");
	var idPatparnat = document.getElementById("idPatparnat");
	var idPatparcou = document.getElementById("idPatparcou");
	var matparnat = document.createTextNode('MATERNAL parent national ID contains');
	var patparnat = document.createTextNode('PATERNAL parent national ID contains');
	var matparcou = document.createTextNode('MATERNAL parent country');
	var patparcou = document.createTextNode('PATERNAL parent country');
	var matpatparnat = document.createTextNode('MATERNAL or PATERNAL parent national ID contains');
	var patmatparnat = document.createTextNode('PATERNAL or MATERNAL parent national ID contains');
	var matpatparcou = document.createTextNode('MATERNAL or PATERNAL parent country');
	var patmatparcou = document.createTextNode('PATERNAL or MATERNAL parent country');
	// Case cochée : Parent indifférent
	if (isChecked) {
		idMatparnat.replaceChild(matpatparnat,idMatparnat.firstChild);
		idMatparcou.replaceChild(matpatparcou,idMatparcou.firstChild);
		idPatparnat.replaceChild(patmatparnat,idPatparnat.firstChild);
		idPatparcou.replaceChild(patmatparcou,idPatparcou.firstChild);
	}
	// Case décochée : Parent unique
	else {
		idMatparnat.replaceChild(matparnat,idMatparnat.firstChild);
		idMatparcou.replaceChild(matparcou,idMatparcou.firstChild);
		idPatparnat.replaceChild(patparnat,idPatparnat.firstChild);
		idPatparcou.replaceChild(patparcou,idPatparcou.firstChild);
	}
}