<!--
		// Aucun accent 
		function noaccent(chaine) 
		{
			var		temp = '';
			
			temp = chaine.replace(/[\u00C1\u00C2\u00C3\u00C0\u00C5\u00E1\u00E0\u00E2\u00E4\u00E3\u00E5]/gi,"a");
			temp = temp.replace(/[\u00C9\u00CA\u00C8\u00CB\u00E9\u00E8\u00EA\u00EB]/gi,"e");
			temp = temp.replace(/[\u00CD\u00CC\u00CF\u00CE\u00EE\u00EF\u00ED\u00EC]/gi,"i");
			temp = temp.replace(/[\u00D3\u00D4\u00D2\u00D5\u00D6\u00F2\u00F4\u00F6\u00F3]/gi,"o");
			temp = temp.replace(/[\u00DA\u00DB\u00D9\u00DC\u00F9\u00FB\u00FC\u00FA]/gi,"u");
			temp = temp.replace(/[\u00E7\u00C7]/gi,"c");
			return temp;
		}
		
		var					position_liste = -1; // NOUS PERMETTRA DE SAVOIR LE CHOIX SUR LEQUEL NOUS SOMMES DANS LA COMPLETION
		
		// FONCTION QUI PERMETTRA DE GERER LES EVENEMENTS DE LA SOURIS DANS LES CHOIX DONNES PAS LA COMPLETION
		function			souris(selection, option)
		{
			if (option == 0) // EN CAS DE CLICK SUR UN CHOIX DONNE PAR LA COMPLETION
			{
				document.getElementById("commune").value = selection.firstChild.data; // ON REMPLIT LE CHAMPS PAR LE CHOIX 
				document.getElementById("select_commune").innerHTML = ""; // ON VIDE LA LISTE DE CHOIX
				document.getElementById('select_commune').style.display = "none"; // ON CACHE LA LISTE DE CHOIX
				verifCommune(document.getElementById("commune"));
			}
			else if (option == 1) // SI LA SOURIS EST SUR UN CHOIX DONNE PAR LA COMPLETION
			{
				if (position_liste >= 0 && position_liste < document.getElementById("select_commune").getElementsByTagName('p').length) // SI LON EST SUR LA LISTE DE COMPLETION
					document.getElementById("select_commune").getElementsByTagName('p')[position_liste].style.backgroundColor = ""; // ON MET LE CHAMPS SUR LEQUEL NOUS ETIONS AVEC LE CLAVIER EN BLANC
				selection.style.backgroundColor = "#71cae9"; // ON MET LE CHAMPS SUR LEQUEL NOUS SOMMES AVEC LA SOURIS EN BLEU
			}
			else // SI LA SOURIS QUITTE UN CHAMPS DONNEšPAR LA COMPLETION
				selection.style.backgroundColor = ""; // ON REMET SON FOND EN BLANC
		}
		
		function			request_commune_auto(evenement)
		{
			var				xhr = null;
			var				commune = null;
			var 			key;
			var				selection = null;

			// ON RECUPERE LA TOUCHE ENFONCEE
			key = window.event ? evenement.keyCode : evenement.which;
			// SI TOUCHE HAUTE (38) ou TOUCHE BASSE (40) OU TOUCHE DROITE (39) OU ENTRER (13)
			if (key==40 || key==38 || key==39 || key==13)
			{
				selection = document.getElementById("select_commune").getElementsByTagName('p'); // TABLEAU LISTANT TOUS LES BALISES P
				if (key==38 && position_liste >= 0)	// HAUT
				{
					if (position_liste < selection.length)
						selection[position_liste].style.backgroundColor = "";
					position_liste = position_liste - 1; 
				}
				else if (key==40 && (position_liste + 1) < selection.length) // BAS
				{
					if (position_liste >= 0)
						selection[position_liste].style.backgroundColor = "";
					position_liste = position_liste + 1;
				}
				if (position_liste >= 0 && position_liste < selection.length) /// DANS LA LISTE
				{
					selection[position_liste].style.backgroundColor = "#71cae9";
					if (key == 13 || key==39) // ON DECIDE DE SELECTIONNER LE CHAMPS SUR LEQUEL ON EST
					{
						document.getElementById("commune").value = selection[position_liste].firstChild.data;
						document.getElementById("select_commune").innerHTML = "";
						document.getElementById('select_commune').style.display = "none";
					}
				}
			}
			else if (document.getElementById("commune").value.length <= 3)
			{
				document.getElementById('select_commune').style.display = "none";
			}
			else// ON VA RECUPERER LES COMMUNES COMPORTANT LA CHAINE CONTENU DANS LE CHAMPS "COMMUNE"
			{
				position_liste = -1;
				xhr = getXMLHttpRequest();
				xhr.onreadystatechange = function()
				{
					if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0))
						readData_commune_auto(xhr.responseText);
				};
				commune = encodeURIComponent(noaccent(document.getElementById("commune").value));
				xhr.open("GET", "../fichier_js/ajax_completion_commune.php?commune="+commune, true);
				xhr.send(null);
			}
			
		}

		// ON RECUPERE LES DONNES RENVOYES PAR LE SERVEUR
		function			readData_commune_auto(donnees)
		{
			var				position = 0;
			var				select_commune = null;
			var				$option = "";
			var				tableau = null;
			
			select_commune = document.getElementById("select_commune");
			if (donnees == 'aucune') // AUCUNE VILLE TROUVEE --> ON MET LE FOND EN ORANGE ET ON CACHE LA LISTE DEROULANTE
			{
				select_commune.style.display = "none";
				document.getElementById("commune").style.backgroundColor = "orange";
			}
			else // VILLE TROUVEE --> ON AFFICHE LA LISTE DEROULANTE AVEC LES SUGGESTIONS POUR LA COMPLETION
			{
				select_commune.style.display = "block";
				document.getElementById("commune").style.backgroundColor = "";
				select_commune.innerHTML = "";
				position = donnees.lastIndexOf('=');
				if (position >= 0)
				{
					tableau = donnees.split('=');
					// ON ENVOIE A LA FONCTION SOURIS 
					for(var i=0; i < tableau.length; i++)
						$option += "<p onclick='souris(this, 0)'; onmouseover='souris(this, 1)'; onmouseout='souris(this, 2)';>"+tableau[i]+"</p>";
					select_commune.innerHTML = $option;
				}
				else
					select_commune.innerHTML = "<p onclick='souris(this, 0)'; onmouseover='souris(this, 1)'; onmouseout='souris(this, 2)';>"+donnees+"</p>";
			}
		}
-->
