
/* pour l'affichage des tags existants */
			function afficher_tags_existants(){
				getXhr();
				xhr.onreadystatechange = function(){
					if(xhr.readyState == 4 && xhr.status == 200){
						leselect = xhr.responseText;
						// On se sert de innerHTML pour rajouter les options a la liste
						document.getElementById('resultats_tags').style.display = "none";
						  document.getElementById('bouton_ajout_mot_cle').disabled = true;
						if (leselect!="#") {
						  document.getElementById('resultats_tags').style.display = "block";
						  document.getElementById('bouton_ajout_mot_cle').disabled = true;
						}else{						  
						  document.getElementById('bouton_ajout_mot_cle').disabled = false;
						}
						document.getElementById('resultats_tags').innerHTML = leselect;						
					}
				}
				xhr.open("POST","xmlhttprequest_suggest_mots_cle.php",true);
				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				sel = document.getElementById('saisie_mot_cle');
				tags = sel.value;
				if (tags.length>3) xhr.send("tag="+tags); //else document.getElementById('bouton_ajout_mot_cle').disabled = true;
			}
			function ajouter_tag_bdd(){
				getXhr();
				xhr.onreadystatechange = function(){
					if(xhr.readyState == 4 && xhr.status == 200){
						leselect = xhr.responseText;
						document.getElementById('resultats_tags').style.display = "none";
						if (leselect!="#") document.getElementById('resultats_tags').style.display = "block";
						document.getElementById('resultats_tags').innerHTML = leselect;
						AjouterOption(leselect,leselect);
					}
				}
				xhr.open("POST","xmlhttprequest_ajout_mot_cle.php",true);
				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				sel = document.getElementById('saisie_mot_cle');
				tags = sel.value;
				xhr.send("tag="+tags);
			}
			function valide(txt){
			  AjouterOption (txt);
			}
	function AjouterOption(txt,id){
	  document.forms.f.elements["saisie_mot_cle"].value='';
  	  if (document.getElementById) document.getElementById("resultats_tags").style.display = "none";
  	  txt_comp=txt;//txt;//f.elements["mot_cle"].value
  	  nouveau=true;
  
  	  for (i=0; i<document.forms.f.tab_saisie_mot_cle.options.length; i++) {
  	  if (txt_comp==document.forms.f.tab_saisie_mot_cle.options[i].value) nouveau=false;
  	  }

  	  if (nouveau){ 
    	    document.forms.f.tab_saisie_mot_cle.options[document.forms.f.tab_saisie_mot_cle.options.length] = new Option(txt_comp,txt_comp)
  	  }
	}

	function SupprimerOption(){
	  sel = document.getElementById('tab_saisie_mot_cle');
	  if (sel.options.selectedIndex>=0) {
	    sel.options[sel.options.selectedIndex]=null;}
	  document.getElementById('bouton_supprimer_option').disabled=true;	  
	}

	function js_CreerMotsCles(){
  	  document.forms.f.tags.value=document.forms.f.tab_saisie_mot_cle.options[0].value + ";";
  	  for (i=1; i<document.forms.f.tab_saisie_mot_cle.options.length; i++){
    	    document.forms.f.elements["tags"].value=document.forms.f.elements["tags"].value+document.forms.f.tab_saisie_mot_cle.options[i].value+";";
  	  }
	}	
	function js_Valider(){
  	  js_CreerMotsCles();
  	  document.forms.f.submit();
  	  
	}
/* */







function activerOnglet(onglet) {
	document.getElementById('resultats_images').style.display = "none";
	document.getElementById('bouton_images').style.background = "#D5D5D5";
	document.getElementById('resultats_presse').style.display = "none";
	document.getElementById('bouton_presse').style.background = "#D5D5D5";
	document.getElementById('resultats_articles').style.display = "none";
	document.getElementById('bouton_articles').style.background = "#D5D5D5";
	document.getElementById('resultats_bibliographie').style.display = "none";
	document.getElementById('bouton_bibliographie').style.background = "#D5D5D5";
	document.getElementById('resultats_multimedia').style.display = "none";
	document.getElementById('bouton_multimedia').style.background = "#D5D5D5";
	var id = 'resultats_'+ onglet;
	document.getElementById(id).style.display = "block";
	document.getElementById('bouton_' + onglet).style.background = "white";
}

function bouge(valeur) {   // Déplacement du DIV
   p=document.getElementById('trombi');
   p.scrollTop += valeur;
}


			var xhr = null; 
	 
			function getXhr(){
				if(window.XMLHttpRequest)
				   xhr = new XMLHttpRequest(); 
				else if(window.ActiveXObject){
				   try {
			                xhr = new ActiveXObject("Msxml2.XMLHTTP");
			            } catch (e) {
			                xhr = new ActiveXObject("Microsoft.XMLHTTP");
			            }
				}
				else {
				   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
				   xhr = false; 
				} 
			}
			function affiche_details(num){
				getXhr();
				xhr.onreadystatechange = function(){
					if(xhr.readyState == 4 && xhr.status == 200){
						leselect = xhr.responseText;
						document.getElementById('document_details').innerHTML = leselect;						
					}
				}
				xhr.open("POST","./infos_document.php",true);
				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				xhr.send("num_document="+num);
			}