function getXhr(){
	var xhr = null; 
	if(window.XMLHttpRequest)
	   xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){
	   try {
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
	}
	else {
	   xhr = false; 
	} 
	return xhr
}

function AfficheListeArriveeVille(){

	//Evite le lancement répétitif
	if (document.getElementById('DivArriveeVillePatiente').style.visibility=='visible') return;
	document.getElementById('DivArriveeVillePatiente').style.visibility='visible';

	var xhr = getXhr()
	var reponse;
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){

			reponse=xhr.responseText;
			document.getElementById('DivArriveeVille').innerHTML=reponse;
			if(reponse == ''){
				document.getElementById('DivArriveeVille').className='p_lvhd';
			}
			else{
				document.getElementById('DivArriveeVille').className='p_lvfull';
			}
			document.getElementById('DivArriveeVillePatiente').style.visibility='hidden';
		}
	}
	document.getElementById('DivArriveeVille').style.left='550px';
	xhr.open("POST","ListeDepartArriveePays2/ListeArriveeVille.asp",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send('');
}

function ValideArriveeVille(ville,iata){
	//if (document.location.href.indexOf('.html')>=0)
	//	document.location='.?o=toutes&ArriveeVille='+ville+'&Arrivee='+iata+'&rnd='+Math.random()+'#o';	//cas des pages en .html (exemple : billet-avion-Sri-Lanka.html)
	//else
		document.location='?o=toutes&ArriveeVille='+ville+'&Arrivee='+iata+'&rnd='+Math.random()+'#o';	//cas normal
}

function CacheDivArriveeVille(){
	document.getElementById('DivArriveeVille').className='p_lvhd';
	document.getElementById('DivArriveeVille').innerHTML='';
}
