
		var focus = false;
		var current_id_focus = 0;
		var current_search = '';
		var current_nbr = 0;
		var search_id = new Array('-1');
		var search_mot_liste = new Array('-1');
		var border_no_foc = '';
		var background_color_no_foc = '';
		var background_color_foc = '';
		var border_foc = '';
		var file_ref;
		var id_trouve = 0; //Je renseigne l'identifiant si un mot cle complet dans liste est égal au mot cle saisi
		var witch_form = '';
		var mot_a_rechercher;
		var cacher_auto_completion = false;
		
		/**
		  *		Permet d'initialiser les variables de config javascript
		  *		Cf. config.php  pour les significations des variables
		  *
		  */
		function autoCompletion_init(border_no_foc,border_foc,background_color_no_foc,background_color_foc,file_ref)
		{
			this.border_no_foc = border_no_foc;
			this.border_foc = border_foc;
			this.background_color_no_foc = background_color_no_foc;
			this.background_color_foc = background_color_foc;
			this.file_ref = file_ref;
		}
		
		
		/**
		  *		Fonction controlant les actions a faire en fonction de la valeur du code de l'event "KeyUp"
		  *		Permet la navigation clavier dans la liste dynamique
		  *		
		  *		@ param : value => valeur du champ de texte principal
		  *			       event => l'evenement associe au KeyUp
		  */
		function event_capture(value,event)
		{
			///this.current_search = document.recherche_haut.mot.value;
			if(witch_form == 'haut')
				this.current_search = document.recherche_haut.mot.value;
			
			if(witch_form == 'bas')
				this.current_search = document.recherche_bas.mot.value;
			
			/*
				Normalement le " event.keyCode " n'est utilise que par IE et pas par Mozilla et Firefox qui eux utilisent "which"
				Mais a ma grande stupefaction apres un test sous firefox .... cela marche ossi... alors pourquoi aller mettre du code en plus...
			*/
			switch (event.keyCode)
			{
				// TOUCHE " FLECHE BAS "
				case 40 :
								if ( current_id_focus > 0 && current_id_focus < current_nbr) loose_focus_style(current_id_focus);
								if ( current_id_focus < current_nbr )
								{
									give_focus_style(current_id_focus+1);
									current_id_focus++;
								}
								break;
								
				// TOUCHE " FLECHE HAUT "
				case 38 :
								if ( current_id_focus >= 1 )
								{
									loose_focus_style(current_id_focus);
									if ( current_id_focus >= 2 ) give_focus_style(current_id_focus-1);
									this.current_id_focus--;
								}
								break;
								
				// TOUCHES " FLECHE GAUCHE " et " FLECHE DROITE " desactivees
				case 37 : 		break;
				case 39 : 		break;
				
				// TOUCHE " ENTRER "
				//case 13 :		if ( value != '' ) {
				//	valideRefConstr(document.recherche_haut.mot.value,'haut');
				//}
				// redirect();
				
				// TOUTES LES AUTRES TOUCHES
				default :
								if ( value == '' )
								{
									current_id_focus = 0;
									current_nbr = 0;
									hide_list();
								}
								else AJAX(value);
								break;
			}
		}
		
		/**
		  *		Permet la redirection apres un click ou l'appui sur "entrer"
		  *		 - si on click sur un element de la liste ou que l'on appui sur "entrer" sur un des elements => mode fiche => id en parametre ( id=X )
		  *		 - si on appui sur "entrer" dans le champ texte principal => mode recherche => valeur de la recherche en parametre ( search=xxx )
		  */
		function redirect()
		{
			id_categorie = Array();
			//if(current_id_focus > 0){
				id_categorie = (''+search_id[current_id_focus]).split(';');
			/*}else{
				id_categorie = (''+search_id[id_trouve]).split(';');
			}*/
			
			if(witch_form == 'haut'){
				document.recherche_haut.id_cat.value = id_categorie[0];
				document.recherche_haut.type_cat.value = id_categorie[1];
				
				
				//tab_mots = (''+document.recherche_haut.mot.value).split(' ');
				//document.recherche_haut.nb_mots_cherches.value = tab_mots.length;
				
				///var obj = document.getElementByName('recherche_haut');
				//window.document.recherche_haut.submit();
				//window.location.href = current_id_focus != 0 ?file_ref+'?id='+search_id[current_id_focus]	:file_ref+'?search='+current_search;
				
				///alert(file_ref+'?id_cat='+ id_categorie[0] + '&type_cat=' + id_categorie[1] + '&mot=' + document.recherche_haut.mot.value + '&nb_mots_cherches=' + document.recherche_haut.nb_mots_cherches.value + '&is_refpc21='+document.recherche_haut.is_refpc21.value );
				//document.recherche_haut.submit();
				window.location.href = 'http://www.pc21.fr/' + file_ref+'?id_cat='+ id_categorie[0] + '&type_cat=' + id_categorie[1] + '&mot=' + document.recherche_haut.mot.value + '&nb_mots_cherches=' + document.recherche_haut.nb_mots_cherches.value + '&is_refpc21='+document.recherche_haut.is_refpc21.value + '&formulaire_haut=' + document.recherche_haut.formulaire_haut.value ;
			}
			
			if(witch_form == 'bas'){
				document.recherche_bas.id_cat.value = id_categorie[0];
				document.recherche_bas.type_cat.value = id_categorie[1];
				//tab_mots = (''+document.recherche_haut.mot.value).split(' ');
				//document.recherche_haut.nb_mots_cherches.value = tab_mots.length;
				
				///var obj = document.getElementByName('recherche_haut');
				//window.document.recherche_haut.submit();
				//window.location.href = current_id_focus != 0 ?file_ref+'?id='+search_id[current_id_focus]	:file_ref+'?search='+current_search;
				
				///alert(file_ref+'?id_cat='+ id_categorie[0] + '&type_cat=' + id_categorie[1] + '&mot=' + document.recherche_haut.mot.value + '&nb_mots_cherches=' + document.recherche_haut.nb_mots_cherches.value + '&is_refpc21='+document.recherche_haut.is_refpc21.value );
				//document.recherche_bas.submit();
				window.location.href = 'http://www.pc21.fr/' + file_ref+'?id_cat='+ id_categorie[0] + '&type_cat=' + id_categorie[1] + '&mot=' + document.recherche_bas.mot.value + '&nb_mots_cherches=' + document.recherche_bas.nb_mots_cherches.value + '&is_refpc21='+document.recherche_bas.is_refpc21.value + '&formulaire_haut=' + document.recherche_haut.formulaire_haut.value ;
			}
			
		}
		
		/**
		  *		Permet avec l'outil ajax d'effectuer dynamiquement des requetes
		  *
		  *		@ param value : valeur de la recherche courante
		  *
		  */
		function AJAX(value)
		{
			mot_a_rechercher = value;
			this.current_id_focus = 0;
			
			// On cree l'objet AJAX
			if(document.all)
			{
				//Internet Explorer
				var AJAX = new ActiveXObject("Microsoft.XMLHTTP");
			}
			else
			{
			    //Mozilla
				var AJAX = new XMLHttpRequest();
			}
			
			// On defini le fichier appele lors de l'envoie
			AJAX.open("POST", '/autocompletion/php_required/autoCompletion_answer.php',true);
				
			//Fonction appelee automatiquement lors de la fin des transferts asynchrones
			// C'est ici que l'on dit ce qu'il va se passer apres le renvoie
			AJAX.onreadystatechange = function()
			{
				if (AJAX.readyState == 4 && AJAX.status == 200) 
				{
					/* 
						ici j'ai choisi une structure simple.
						Par exemple pour un dictionnaire : si on tape "abc"
						la reponse sera par exemple pour un affichage de 5 elements : 
							X=>abcisse|||X=>abcisses|||X=>abcede|||X=>abcedent|||X=>abces
						X signifie l'id du mot dans la table =>  permet lors d'un click ou de l'appui sur la touche "entree" sur
												une recherche d'envoyer l'id par exemple ici pour aller a la 
												page de la definition de ce mot
					*/
					// Enlever le commentaire de l'alert pour voir dans une fenetre la reponse AJAX
					//alert(AJAX.responseText);
					
					// On appelle la fonction d'ecriture des input avec la reponse d'ajax en parametre
					write_div(AJAX.responseText);
				}
			}
			
			// On declare le type des donnees echangees => ici du texte
			// On pourait utiliser du XML mais ici cela est très peu utile par le petite quantite de donnee echangee
			AJAX.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			AJAX.send('post='+value);
		}
		
		/**
		  *		Permet d'ecrire le code html de la div de recherche rapide
		  *
		  *		@ param : fields => chaine de caractere de la reponse ajax
		  *		@ return : //
		  */
		function write_div(fields)
		{
			var max_item = 10; //JE fixe un nombre d'articles maximum
			if(witch_form == 'haut'){
				
				////alert(fields);
			
				var div = document.getElementById('autoCompletion_answer'); // Block d'affichage
				var obj_mot = document.getElementById('mot');
				
				var eps = 0;
				
				if(screen.width <= 1024){
					eps = 6;
				}else{
					if(screen.width <= 1280){
						eps = 8;
					}else{
						eps = 10;
					}
				}
				posAutoCompletionY = obj_mot.offsetTop;
				posAutoCompletionX = obj_mot.offsetLeft;
				h = obj_mot.offsetHeight;
				div.style.top= (posAutoCompletionY + h + 162) + 'px';
				div.style.left= (posAutoCompletionX + eps) + 'px';
				
				// On extrait la reponse ajax, on enregistre le nombre de resultats
				var tmp = fields.split('|||');
				var tmp_length = tmp.length == 1 && tmp[0] == '' ? 0 : tmp.length;
				if(max_item <= tmp_length)
					tmp_length = max_item;
					
				current_nbr = tmp_length;
				
				// On cree le code html que l'on va inserer dans la div
				//var output = '<select name="id_cat" style="width:'+div.offsetWidth+'px" size="11" onChange=\"focus_off();\" >';
				
				var output = '';
				
				if(!cacher_auto_completion){
					if(tmp_length > 0)
						output += '<table name="id_cat" width="100%" style="border-color:#000099; border-style:solid; border-width:1px " >';
					
						///alert(output);
					for(var i=0;i<tmp_length;i++)
					{
						var id = i + 1;
						///alert(id);
						tmp2 = tmp[i].split('=>');
						this.search_id[id] = tmp2[0];
						this.search_mot_liste[id] = tmp2[1];
						
						if(id == 1){
							output += '<tr><td width="100%" style=\"background-color:'+background_color_no_foc+';border:'+border_no_foc+';\"    type=text align="right" ><a class="lien" href="javascript:HideAutoCompletion();" >Fermer</a></td></tr>';
						}
						
						//output += '<input style=\"background-color:'+background_color_no_foc+';border:'+border_no_foc+';\" onBlur=\"focus_off();\" onClick="redirect();" onMouseOver=\"give_focus_style('+id+',1);\"  readonly=\"readonly\" type=text id=\"list'+id+'\" value="'+tmp2[1]+'">';
						//output += '<tr><td width="100%" style=\"background-color:'+background_color_no_foc+';border:'+border_no_foc+';\" onBlur=\"focus_off();\" onClick="redirect();" onMouseOver=\"give_focus_style('+id+',1);\"   type=text id=\"list'+id+'\">'+getTitreMenu(''+tmp2[1],''+mot_a_rechercher)+'</td></tr>';
						output += '<tr><td width="100%" style=\"background-color:'+background_color_no_foc+';border:'+border_no_foc+';\" onBlur=\"focus_off();\" onClick="redirect();" onMouseOver=\"give_focus_style('+id+',1);\"   type=text id=\"list'+id+'\">'+tmp2[1]+'</td></tr>';
						//alert(output);
						//output += '<option style=\"background-color:#FFFFFF;border:#FFFFFF;\" onChange=\"focus_off();\" onClick="redirect();"  value="'+tmp2[0]+'">'+tmp2[1]+'</option>';
						///output += '<option style=\"background-color:#FFFFFF;border:#FFFFFF;\" onMouseOver=\"give_focus_style('+id+',1);\"   onClick="redirect();"  value="'+tmp2[0]+'">'+tmp2[1]+'</option>';
						
						//if(Trim(''+tmp2[1].toUpperCase()) == Trim(obj_mot.value.toUpperCase())){
						//	id_trouve = id;
						//}
						
						
					}
				}
				if(tmp_length > 0 && !cacher_auto_completion){
					//tab_mots = (''+document.recherche_haut.mot.value).split(' ');
					//document.recherche_haut.nb_mots_cherches.value = tab_mots.length;
					output += '</table>';
				}else{
					document.recherche_haut.id_cat.value = 0;
					document.recherche_haut.type_cat.value = 0;
					output = '';
					div.innerHTML = output;
					div.style.display = 'none';
					document.recherche_haut.is_refpc21.value = (isRefPC21(Trim(""+obj_mot.value))?1:0);
					///valideRefConstr(document.recherche_haut.mot.value,'haut');
				}
				
				//alert(output);
				/*
				if(id_trouve > 0){
					if(tmp[id_trouve] != null){
						tmp2 = tmp[id_trouve].split('=>');
						///this.search_id[id] = tmp2[0];
						id_categorie = (''+this.search_id[id_trouve]).split(';');
						document.recherche_haut.id_cat.value = id_categorie[0];
						document.recherche_haut.type_cat.value = id_categorie[1];
						
						tab_mots = Trim(''+this.search_mot_liste[id_trouve]).split(' ');
						document.recherche_haut.nb_mots_cherches.value = tab_mots.length;
					}else{
						id_trouve = 0;
					}
				}
				*/
				
				// Ma signature... 
				///output += '<div class=\"signature\" onClick=\"document.autoCompletion.autoCompletion_input.focus();\" onBlur=\"focus_off();\"><p class=\"p2\">by \< The Rubik\'s Man \></p></div>';
				//alert(output);
				// Si la reponse ajax n'est pas vide on affiche, sinon on efface
				if(!cacher_auto_completion){
					if ( Trim(''+fields) != '' )
					{
						div.innerHTML = output;
						div.style.display = 'block';
					}
					else hide_list();
					
					if((Trim(''+obj_mot.value)).length==0){
						document.recherche_haut.id_cat.value = 0;
						document.recherche_haut.type_cat.value = 0;
					}
				
				
				}else{
					document.recherche_haut.id_cat.value = 0;
					document.recherche_haut.type_cat.value = 0;
				}
				
				
			}
			
			
			
			if(witch_form == 'bas'){
			
				var div = document.getElementById('autoCompletion_answer_bas'); // Block d'affichage
				var obj_mot = document.getElementById('mot_bas');
				posAutoCompletionY = obj_mot.offsetTop;
				//alert(posAutoCompletionY);
				//alert(obj_mot.style.top);
				posAutoCompletionX = obj_mot.offsetLeft;
				
				h = obj_mot.offsetHeight;
				
				
				///alert(document.body.clientHeight);
				// On extrait la reponse ajax, on enregistre le nombre de resultats
				var tmp = fields.split('|||');
				var tmp_length = tmp.length == 1 && tmp[0] == '' ? 0 : tmp.length;
				current_nbr = tmp_length;
				
				// On cree le code html que l'on va inserer dans la div
				//var output = '<select name="id_cat" style="width:'+div.offsetWidth+'px" size="11" onChange=\"focus_off();\" >';
				
				var output = '';
				
				if(tmp_length > 0)
					output += '<table name="id_cat" width="100%" style="border-color:#000099; border-style:solid; border-width:3px " >';
				
				for(var i=0;i<tmp_length;i++)
				{
					var id = i + 1;
					tmp2 = tmp[i].split('=>');
					this.search_id[id] = tmp2[0];
					this.search_mot_liste[id] = tmp2[1];
					//output += '<input style=\"background-color:'+background_color_no_foc+';border:'+border_no_foc+';\" onBlur=\"focus_off();\" onClick="redirect();" onMouseOver=\"give_focus_style('+id+',1);\"  readonly=\"readonly\" type=text id=\"list'+id+'\" value="'+tmp2[1]+'">';
					output += '<tr><td width="100%" style=\"background-color:#FFFFCC;	border:0px solid #FFFFFF;\" onBlur=\"focus_off();\" onClick="redirect();" onMouseOver=\"give_focus_style('+id+',1);\"   type=text id=\"list_bas'+id+'\">'+tmp2[1]+'</td></tr>';
					//output += '<option style=\"background-color:#FFFFFF;border:#FFFFFF;\" onChange=\"focus_off();\" onClick="redirect();"  value="'+tmp2[0]+'">'+tmp2[1]+'</option>';
					///output += '<option style=\"background-color:#FFFFFF;border:#FFFFFF;\" onMouseOver=\"give_focus_style('+id+',1);\"   onClick="redirect();"  value="'+tmp2[0]+'">'+tmp2[1]+'</option>';
					
					if(Trim(''+tmp2[1].toUpperCase()) == Trim(obj_mot.value.toUpperCase())){
						id_trouve = id;
					}
					
					
				}
				if(tmp_length > 0){
					//tab_mots = (''+document.recherche_haut.mot.value).split(' ');
					//document.recherche_haut.nb_mots_cherches.value = tab_mots.length;
					output += '</table>';
				}else{
					document.recherche_bas.is_refpc21.value = (isRefPC21(obj_mot.value)?1:0);
				}
				
				if(id_trouve > 0){
					tmp2 = tmp[id_trouve].split('=>');
					///this.search_id[id] = tmp2[0];
					id_categorie = (''+this.search_id[id_trouve]).split(';');
					document.recherche_bas.id_cat.value = id_categorie[0];
					document.recherche_bas.type_cat.value = id_categorie[1];
					
					tab_mots = Trim(''+this.search_mot_liste[id_trouve]).split(' ');
					document.recherche_bas.nb_mots_cherches.value = tab_mots.length;
				}
				
				
				// Ma signature... 
				///output += '<div class=\"signature\" onClick=\"document.autoCompletion.autoCompletion_input.focus();\" onBlur=\"focus_off();\"><p class=\"p2\">by \< The Rubik\'s Man \></p></div>';
				
				
				// Si la reponse ajax n'est pas vide on affiche, sinon on efface
				if ( fields != '' )
				{
					div.innerHTML = output;
					div.style.display = 'block';
				}
				else hide_list();
				
				if((Trim(''+obj_mot.value)).length==0){
					document.recherche_bas.id_cat.value = 0;
					document.recherche_bas.type_cat.value = 0;
				}
				
				div.style.top= (posAutoCompletionY + document.body.ClientHeight + 104) + 'px';
				div.style.left= (posAutoCompletionX+14) + 'px';
			}
			
		}
	
		/**
		  *		Permet de controler que l'on est dans une recherche
		  *		Cela permet de ne pa effacer la liste si un 
		  *		click est porte au niveau de la liste, alors qu'elle sera effacee si on click ailleur
		  *		C'est un systeme de bidouille... mais j'ai trouve que ca pour palier ce probleme sans intercepter
		  *		tous les evenements souris de javascript ce qui serait beaucoup plus lourd en code
		  */
		function focus_on(position_formulaire)
		{
			witch_form = position_formulaire;
			focus = true;
		}
		function focus_off()
		{
			focus = false;
		}
		document.onclick = function ()
						   {
								if ( focus == false ) hide_list();
						   };
		function hide_list()
		{
			if(witch_form == 'haut' && !cacher_auto_completion){
				document.getElementById('autoCompletion_answer').style.display='none';
			}
			
			if(witch_form == 'bas'){
				document.getElementById('autoCompletion_answer_bas').style.display='none';
			}
		}
		
		
		
		/**
		  *		Permet de changer le style des inputs
		  *		
		  *		Changement de style par javascript car en css :hover sur <input> ou <div> ne fonctionne pas sous IE
		  *		Puis pour les changements de focus par entree clavier necessite du javascript
		  *
		  *		@ param : id => id de l'input text a changer le style
		  *			       control => permet suivant les cas l'activation de certaines operations
		  *
		  */
		function give_focus_style(id,control)
		{
			
				
			if(witch_form == 'haut' && !cacher_auto_completion){	
				if ( id != 0 && id != current_id_focus)
				{
					//Initialisation des identifiant de catégorie pour la recherche
					id_categorie = (''+search_id[id]).split(';');
					document.recherche_haut.id_cat.value = id_categorie[0];
					document.recherche_haut.type_cat.value = id_categorie[1];
					var saisie_recherche = document.recherche_haut.mot;
					
					
					
					var input_hidden = document.getElementById('list'+id);
					input_hidden.style.backgroundColor = background_color_foc;
					input_hidden.style.border = border_foc;
					input_hidden.style.cursor = 'pointer'; // Pour IE qui ne prend pas en compte les :hover sur les div en CSS
					
					saisie_recherche.value = input_hidden.innerHTML;
					
					tab_mots = Trim(''+this.search_mot_liste[id]).split(' ');
					document.recherche_haut.nb_mots_cherches.value = tab_mots.length;
					
				}
			}
			
			if(witch_form == 'bas'){	
				if ( id != 0 && id != current_id_focus)
				{
					//Initialisation des identifiant de catégorie pour la recherche
					id_categorie = (''+search_id[id]).split(';');
					document.recherche_bas.id_cat.value = id_categorie[0];
					document.recherche_bas.type_cat.value = id_categorie[1];
					var saisie_recherche = document.recherche_bas.mot;
					
					
					
					var input_hidden = document.getElementById('list_bas'+id);
					input_hidden.style.backgroundColor = background_color_foc;
					input_hidden.style.border = border_foc;
					input_hidden.style.cursor = 'pointer'; // Pour IE qui ne prend pas en compte les :hover sur les div en CSS
					
					saisie_recherche.value = input_hidden.innerHTML;
					
					tab_mots = Trim(''+this.search_mot_liste[id]).split(' ');
					document.recherche_bas.nb_mots_cherches.value = tab_mots.length;
					
				}
			}
			
			
			if ( control == 1 && id != current_id_focus)
			{
				loose_focus_style(current_id_focus);
				current_id_focus = id;
			}
		}
		
		
		/**
		  *		Permet d'enlever le style focus et de remettre le style normal
		  *		Fonction appelee depuis " give_focus_style " avant de mettre le style focus au nouveau input courant
		  *
		  *		@ param : id => id de l'input text a desactiver le style focus
		  */
		function loose_focus_style(id)
		{
			if ( current_id_focus != 0 && !cacher_auto_completion)
			{
				if(witch_form == 'haut' ){
					var input_hidden = document.getElementById('list'+id);
					input_hidden.style.backgroundColor = background_color_no_foc;
					input_hidden.style.border = border_no_foc;
				}
				
				if(witch_form == 'bas'){
					var input_hidden = document.getElementById('list_bas'+id);
					input_hidden.style.backgroundColor = background_color_no_foc;
					input_hidden.style.border = border_no_foc;
				}
			}
		}
		
		
		/**
		
		Vérification de la présence du format de référence PC21
		
		*/

		function isRefPC21(chaine){
			chaine = ""+chaine;
			exprReg = /^[a-zA-Z3]{3}[\-]{1}[0-9]{4,5}$/;
			if(chaine!=""){
				if(chaine.match(exprReg)){
					return true;
				}else{
					return false;
				}
			}else{
				return false;
			}
		}
		
		//Supprime les espace avant et après la chaine de caractères
		function Trim(chaine){
			chaine = chaine.replace(/(^\s*)|(\s*$)/g,"");
			return chaine;
		}
		
		
		function getTitreMenu(titre,mot_cherche){
			premier_mot_trouve = 0;
			partie_affichee = '';
			titre = Trim(''+titre);
			mot_cherche = ''+Trim(mot_cherche);
			pos = 0;
			//pos = titre.indexOf(' '); //au moins 2 mots 
			
			//alert(mot_cherche);
			
			pos = titre.toLowerCase().indexOf(mot_cherche.toLowerCase());
			
			//alert('pos : ' + pos);
			partie_affichee = titre.substr(pos,200);
			
			//alert(partie_affichee);
			/*
			
			if(pos > -1){
				tab_mots = titre.split(' ');
				///alert('traitement titre');
				for(j = 0; j < tab_mots.length ; j++){
					mot_recherche_maj = mot_cherche.toLowerCase();
					titre_contenant_maj = tab_mots[j].toLowerCase();
					alert(tab_mots[j]);
					if(titre_contenant_maj.indexOf(mot_recherche_maj) > -1 ){
						alert('premier mot trouvé');
						premier_mot_trouve = 1;
					}
					
					if(premier_mot_trouve == 1 && tab_mots[j] != null){
						
						partie_affichee += ' ' + tab_mots[j];
					}
				}
			}else{
				partie_affichee = titre;
			}
			*/
			
		return Trim(partie_affichee);
		
	}
		
	
	function valideRefConstr(valeur,position_formulaire)
	{
		
		this.current_id_focus = 0;
		
		// On cree l'objet AJAX
		if(document.all)
		{
			//Internet Explorer
			var xhrRef = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			//Mozilla
			var xhrRef = new XMLHttpRequest();
		}
		
		// On defini le fichier appele lors de l'envoie
		xhrRef.open("POST", '/autocompletion/php_required/valide_ref_constr.php',true);
			
		//Fonction appelee automatiquement lors de la fin des transferts asynchrones
		// C'est ici que l'on dit ce qu'il va se passer apres le renvoie
		xhrRef.onreadystatechange = function()
		{
			if (xhrRef.readyState == 4 && xhrRef.status == 200) 
			{
				if(position_formulaire == "haut"){
					document.recherche_haut.is_refconstr.value = xhrRef.responseText;
				}
				
				if(position_formulaire == "bas"){
					document.recherche_bas.is_refconstr.value = xhrRef.responseText;
				}
			}
		}
		
		// On declare le type des donnees echangees => ici du texte
		// On pourait utiliser du XML mais ici cela est très peu utile par le petite quantite de donnee echangee
		xhrRef.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xhrRef.send('ref_recherche='+valeur);
	}
	
	
	function HideAutoCompletion(){
		div = document.getElementById("autoCompletion_answer");
		div.style.visibility='hidden';
		document.recherche_haut.id_cat.value = 0;
		document.recherche_haut.type_cat.value = 0;
		document.recherche_haut.formulaire_haut.value = 1;
		saisie = document.getElementById("mot");
		saisie.focus();
		cacher_auto_completion = true;
	}
		
	function ValideReferencePC21(obj){
		document.recherche_haut.is_refpc21.value = isRefPC21(Trim(""+obj.value))?1:0;
	}