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 AfficheListeDepartVille(){

	//Evite le lancement répétitif
	if (document.getElementById('DivDepartVillePatiente').style.visibility=='visible') return;
	document.getElementById('DivDepartVillePatiente').style.visibility='visible';

	var xhr = getXhr()
	var reponse;
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){

			reponse=xhr.responseText;
			document.getElementById('DivDepartVille').innerHTML=reponse;
			if(reponse == ''){
				document.getElementById('DivDepartVille').className='p_lvhd';
			}
			else{
				document.getElementById('DivDepartVille').className='p_lvfull';
			}
			document.getElementById('DivDepartVillePatiente').style.visibility='hidden';
		}
	}
	document.getElementById('DivDepartVille').style.left='550px';
	xhr.open("POST","ListeDepartArriveePays2/ListeDepartVille.asp",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send('');
}

function ValideDepartVille(ville,iata){
	//document.location='./?o=toutes&DepartPays='+pays+'#o';
	if (document.location.href.indexOf('.html')>=0)
		document.location='.?o=toutes&DepartVille='+ville+'&Depart='+iata+'&rnd='+Math.random()+'#o';	//cas des pages en .html (exemple : billet-avion-Sri-Lanka.html)
	else
		document.location='?o=toutes&DepartVille='+ville+'&Depart='+iata+'&rnd='+Math.random()+'#o';	//cas normal
}

function CacheDivDepartVille(){
	document.getElementById('DivDepartVille').className='p_lvhd';
	document.getElementById('DivDepartVille').innerHTML='';
}