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 AfficheListeDepartArriveePays(Div){

	//Evite le lancement répétitif
	if (document.getElementById(Div+'Patiente').style.visibility=='visible') return;
	document.getElementById(Div+'Patiente').style.visibility='visible';

	var xhr = getXhr()
	var reponse;
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){

			reponse=xhr.responseText;
			document.getElementById(Div).innerHTML=reponse;
			if(reponse == ''){
				document.getElementById(Div).className='p_lvhd';
			}
			else{
				document.getElementById(Div).className='p_lvfull';
			}
			document.getElementById(Div+'Patiente').style.visibility='hidden';
		}
	}
	//CacheDivMois();
	//CacheDivSens();
	if (Div=='DivDepartPays')
	{
		document.getElementById(Div).style.left='300px';
		//CacheDivDepartArriveePays('DivArriveePays');
		xhr.open("POST","ListeDepartArriveePays2/ListeDepartPays.asp",true);
	}
	if (Div=='DivArriveePays')
	{
		document.getElementById(Div).style.left='640px';
		//CacheDivDepartArriveePays('DivDepartPays');
		xhr.open("POST","ListeDepartArriveePays2/ListeArriveePays.asp",true);
	}
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send('');
}

function ValideDepartPays(pays){
	//document.location='./?o=toutes&DepartPays='+pays+'#o';
	if (document.location.href.indexOf('.html')>=0)
		document.location='.?o=toutes&DepartPays='+pays+'&rnd='+Math.random()+'#o';	//cas des pages en .html (exemple : billet-avion-Sri-Lanka.html)
	else
		document.location='?o=toutes&DepartPays='+pays+'&rnd='+Math.random()+'#o';	//cas normal
}

function ValideArriveePays(pays){
	//document.location='.?o=toutes&ArriveePays='+pays+'#o';
	//alert(document.location.pathname);
	//document.location=document.location.pathname+'?o=toutes&ArriveePays='+pays+'#o';
	//document.location='?o=toutes&ArriveePays='+pays+'#o';
	if (document.location.href.indexOf('.html')>=0)
		document.location='.?o=toutes&ArriveePays='+pays+'&rnd='+Math.random()+'#o';	//cas des pages en .html (exemple : billet-avion-Sri-Lanka.html)
	else
		document.location='?o=toutes&ArriveePays='+pays+'&rnd='+Math.random()+'#o';	//cas normal
}

function CacheDivDepartArriveePays(zone){
	document.getElementById(zone).className='p_lvhd';
	document.getElementById(zone).innerHTML='';
}