var xhr_object = null;
// Appel Ajax
if(window.XMLHttpRequest) //Firefox
	xhr_object = new XMLHttpRequest ();
else if (window.ActiveXObject) // IE
	xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else 	{ // Navigateur ne supporte pas
 alert("Votre navigateur ne supporte pas les objets XMLHTTPREQUEST ...");
}
//http://maps.google.com/mapfiles/ms/micons/
//icon_normal="medias/red-dot.png";
icon_normal_depart="images/icon_normal_depart.png";
icon_normal_arrivee="images/icon_normal_depart.png";
icon_openjaw="images/icon_openjaw.png";
icon_addon="images/icon_addon.png";
icon_mixte="images/icon_mixte.png";
icon_shadow="";

couleur_normal="#9E0E21";
couleur_openjaw="#84C5DF";
couleur_addon="#A1CB86";
couleur_mixte="#B17DD4";

var map ;
var nb_segments;
var avec_map;
var baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.image = icon_normal_depart;
baseIcon.shadow = icon_shadow;
/*baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);*/
function initialize(nb_seg,am) {
	nb_segments = nb_seg;
	if (am == undefined)
		avec_map = 1;
	else
		 avec_map = am;
	
	if (avec_map == 0)
		return false;
  	if (GBrowserIsCompatible()) 
	{
		map = new GMap2(document.getElementById("map_canvas"));
		map.enableScrollWheelZoom() ;
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(27.6891666667,84.3133333333), 2);
		
		  
        map.hideControls();

	}
}



function mise_ajour_map(nb_segments,le_n)
{
	
	if (avec_map == 0)
		return false;
	verifier_aller_retour();
	try{map.clearOverlays();}catch(err){err=1};
	var last_arrivee = 0;
	var parcours = ""
	for (j=1; j<=nb_segments;j++)
	{
		//////////Ville de départ
		if(document.getElementById('ville_depart_' + j).value != '' && document.getElementById('lat_ville_depart_' + j).value != '' && document.getElementById('lat_ville_depart_' + j).value != 999 && document.getElementById('lang_ville_depart_' + j).value != '' && document.getElementById('lang_ville_depart_' + j).value != 999)
			{
				var lat_dep=document.getElementById('lat_ville_depart_' + j).value;
				var lang_dep=document.getElementById('lang_ville_depart_' + j).value;
				
				var nom_ville_dep=document.getElementById('ville_depart_' + j).value;
				
				var newIcon = new GIcon(baseIcon)
				newIcon.image = icon_normal_depart;
				newIcon.shadow = icon_shadow;				
				markerOptions = { icon:newIcon,title:nom_ville_dep };
				map.addOverlay(new GMarker(new GLatLng(lat_dep,lang_dep), markerOptions));
				
				
				
			}
		//////////Ville d'arrivée
		if(document.getElementById('ville_arrivee_' + j).value != '' && document.getElementById('lat_ville_arrivee_' + j).value != '' && document.getElementById('lat_ville_arrivee_' + j).value != 999 && document.getElementById('lang_ville_arrivee_' + j).value != '' && document.getElementById('lang_ville_arrivee_' + j).value != 999)
			{
				var lat_arr=document.getElementById('lat_ville_arrivee_' + j).value;
				var lang_arr=document.getElementById('lang_ville_arrivee_' + j).value;
				var type_carte_arr=document.getElementById('type_carte_ville_arrivee_' + j).value;
				var zoom_arr=document.getElementById('zoom_ville_arrivee_' + j).value;
				
				var nom_ville_arr=document.getElementById('ville_arrivee_' + j).value ;
				
				var newIcon = new GIcon(baseIcon)
				newIcon.image = icon_normal_arrivee;
				newIcon.shadow = icon_shadow;	
				markerOptions = { icon:newIcon,title:nom_ville_arr }; 
				map.addOverlay(new GMarker(new GLatLng(lat_arr,lang_arr), markerOptions));
				
				map.setCenter(new GLatLng(lat_arr,lang_arr), parseInt(zoom_arr),eval(type_carte_arr));
				
			}
		//////////Ligne du trajet
		if(document.getElementById('ville_depart_' + j).value != '' && document.getElementById('lat_ville_depart_' + j).value != '' && document.getElementById('lat_ville_depart_' + j).value != 999 && document.getElementById('lang_ville_depart_' + j).value != '' && document.getElementById('lang_ville_depart_' + j).value != 999)
		{
			if(document.getElementById('ville_arrivee_' + j).value != '' && document.getElementById('lat_ville_arrivee_' + j).value != '' && document.getElementById('lat_ville_arrivee_' + j).value != 999 && document.getElementById('lang_ville_arrivee_' + j).value != '' && document.getElementById('lang_ville_arrivee_' + j).value != 999)
			{
				var polyOptions = {geodesic:true};
				var polyline = new GPolyline([new GLatLng(lat_dep,lang_dep),new GLatLng(lat_arr,lang_arr)], couleur_normal, 2, 1, polyOptions);
				map.addOverlay(polyline);	
			}
		}
		//////////Parcours Vols
		if(document.getElementById('ville_arrivee_' + j).value != '' && document.getElementById('code_ville_arrivee_' + j).value != ''  && document.getElementById('ville_depart_' + j).value != '' && document.getElementById('code_ville_depart_' + j).value != '')
		{
			var nom_ville_dep=document.getElementById('ville_depart_' + j).value;
			var nom_ville_arr=document.getElementById('ville_arrivee_' + j).value ;
			
			der=parcours;
			if(parcours.split('-')[parcours.split('-').length-1].length)
				der=parcours.split('-')[parcours.split('-').length-1];
			if(der.split('/')[der.split('/').length-1].length)
				der=der.split('/')[der.split('/').length-1];
			//alert();
			if(der == nom_ville_dep)
				parcours += "/" + nom_ville_arr // + ' (' + der + ')'
			else
				parcours +=  '  -  ' + nom_ville_dep + "/" + nom_ville_arr
			last_arrivee = j;	
		}
	}	
	//document.getElementById('td_openjaw').innerHTML=''
	//document.getElementById('td_addon').innerHTML=''
	//alert(j)
	/*alert(nom_ville_arr)
	alert(document.getElementById('ville_arrivee_' + (Number(j)+1)).value)
	alert(j)
	if(document.getElementById('ville_arrivee_' + (Number(j)+1)).value != '')
		last_arrivee = j-1;
	else
		
	
	alert(last_arrivee)*/
	//if(last_arrivee == 2)
		
	
	//alert(last_arrivee)
	if(last_arrivee>0)
	{
		if(document.getElementById('code_ville_depart_1').value == document.getElementById('code_ville_arrivee_' + last_arrivee).value)
			last_arrivee = last_arrivee-1
		var code_ville_depart=document.getElementById('code_ville_depart_1').value
		var code_ville=document.getElementById('code_ville_arrivee_' + last_arrivee).value
		//alert(code_ville_depart + ' ' + code_ville + ' ' + last_arrivee);
		if (code_ville_depart != code_ville)
		{		
			
			var code_ville_arrivee = document.getElementById('code_ville_arrivee_' + last_arrivee).value;
			var lib_ville_arrivee = document.getElementById('ville_arrivee_' + last_arrivee).value;
			var lat_ville_arrivee = document.getElementById('lat_ville_arrivee_' + last_arrivee).value;
			var lang_ville_arrivee = document.getElementById('lang_ville_arrivee_' + last_arrivee).value;
			var type_ville_arrivee = document.getElementById('type_carte_ville_arrivee_' + last_arrivee).value;
			var zoom_ville_arrivee = document.getElementById('zoom_ville_arrivee_' + last_arrivee).value;	
			
			var lib_ville_depart = document.getElementById('ville_depart_' + last_arrivee).value;
			liste_autres_villes(code_ville_arrivee,lib_ville_arrivee,lat_ville_arrivee,lang_ville_arrivee,type_ville_arrivee,zoom_ville_arrivee,last_arrivee,le_n,lib_ville_depart)
			map.setCenter(new GLatLng(lat_ville_arrivee,lang_ville_arrivee), parseInt(zoom_ville_arrivee),eval(type_ville_arrivee));
			//alert(code_ville_arrivee  + last_arrivee);
		}
		else
		{
			
			avant_last=last_arrivee-1;
			var code_ville_arrivee_avant_last = document.getElementById('code_ville_arrivee_' + avant_last).value;
			var lib_ville_arrivee_avant_last = document.getElementById('ville_arrivee_' + avant_last).value;
			var lat_ville_arrivee_avant_last = document.getElementById('lat_ville_arrivee_' + avant_last).value;
			var lang_ville_arrivee_avant_last = document.getElementById('lang_ville_arrivee_' + avant_last).value;
			var type_ville_arrivee_avant_last = document.getElementById('type_carte_ville_arrivee_' + avant_last).value;
			var zoom_ville_arrivee_avant_last = document.getElementById('zoom_ville_arrivee_' + avant_last).value;
			
			map.setCenter(new GLatLng(lat_ville_arrivee_avant_last,lang_ville_arrivee_avant_last), parseInt(zoom_ville_arrivee_avant_last),eval(type_ville_arrivee_avant_last));
		}
	}
	//if(parcours.length)
		//document.getElementById('td_parcours').innerHTML='<b>Vous avez choisi un vol </b><span class="texte3"><b>' + parcours.substring(1,10000) + '</b></span>';
}

function liste_autres_villes(code_ville_depart,lib_ville_depart,lat_ville_depart,lang_ville_depart,type_ville_depart,zoom_ville_depart,last_arrivee,courant,lib_ville_depart_vrai){	
	if(document.getElementById('isopen').value==0)
		Afficher_popup=1
	else
		Afficher_popup=0
	
	
	
	var fileColdFusion = "Vol_Ajax_liste_ville_alt_map.cfm";
	var data = Math.random();	
	data += '&lib_ville='+	lib_ville_depart;

	fileColdFusion += "?"+data; // passer les param
	
	xhr_object.open("GET", fileColdFusion, true); //initialisation de la requete
		xhr_object.onreadystatechange = function() {
		if( xhr_object.readyState == 4) {
				var ReturnedValue = xhr_object.responseText;
				if (ReturnedValue.length)
				{
					liste_ONPENJAW = ReturnedValue.split('##')[0];
					liste_ADDON = ReturnedValue.split('##')[1];
					
					var liste_code_openjaw="";
					var liste_code_mixt="";
					for (i=0;i<liste_ONPENJAW.split('|').length-1;i++)
					{
						liste_code_openjaw += liste_ONPENJAW.split('|')[i].split('&')[1] + '|';
					}
					
					for (i=0;i<liste_ADDON.split('|').length-1;i++)
					{
						code = liste_ADDON.split('|')[i].split('&')[1]
						if (liste_code_openjaw.match(code))
							liste_code_mixt+= code+ '|';		 
					}
					
					index_lettre = 0
					
					parc='';		
					if(lib_ville_depart_vrai.length)
						parc=lib_ville_depart_vrai + ' / ';
					//alert(parc)	
					parc+=lib_ville_depart;
					
					document.getElementById('popupville_parcours_' + courant).innerHTML=parc;
					var lettre_suggest='B'
					//montrediv(le_n);
					//******************************************************************* Les OPENJAW
					var liste_openjaw_haut=""
					for (i=0;i<liste_ONPENJAW.split('|').length-1;i++)
					{
						une_ville=liste_ONPENJAW.split('|')[i];
						ville_ONPENJAW=une_ville.split('&')[0];
						code_ville_ONPENJAW=une_ville.split('&')[1];
						lat_arr=une_ville.split('&')[2];
						lang_arr=une_ville.split('&')[3];
						type_arr=une_ville.split('&')[4];
						zoom_arr=une_ville.split('&')[5];
						
						if(lat_arr != '' && lat_arr != 999 && lang_arr != '' && lang_arr != 999)
						{
							//***************************** Marker dans la carte
							if (!liste_code_mixt.match(code_ville_ONPENJAW))
							{	
								createMarker('openjaw',code_ville_depart,lib_ville_depart,lat_ville_depart,lang_ville_depart,type_ville_depart,zoom_ville_depart,code_ville_ONPENJAW,ville_ONPENJAW,lat_arr,lang_arr,type_arr,zoom_arr,courant);
								index_lettre++
		
								var polyOptions = {geodesic:true};
								var polyline = new GPolyline([new GLatLng(lat_ville_depart,lang_ville_depart),new GLatLng(lat_arr,lang_arr)], couleur_openjaw, 2, 1, polyOptions);
								map.addOverlay(polyline);	
							}
							liste_openjaw_haut +='&nbsp;&nbsp;&nbsp;<a title="Cliquez ici pour continuer vers ' + ville_ONPENJAW + '" onclick="Ajout_openjaw(';
							liste_openjaw_haut += "'" + code_ville_ONPENJAW + "',"
							liste_openjaw_haut += "'" + ville_ONPENJAW + "',"
							liste_openjaw_haut += "'" + lat_arr + "',"
							liste_openjaw_haut += "'" + lang_arr + "',"
							liste_openjaw_haut += "'" + type_arr + "',"
							liste_openjaw_haut += "'" + zoom_arr + "',"
							liste_openjaw_haut += "'" + courant + "');"
							
							liste_openjaw_haut += '" style="cursor:pointer;" ><span class="listeNom"><u>' + ville_ONPENJAW + '</u></span></a><br>';
	
						}
						
					}
					
					if(liste_openjaw_haut.length)
					{
						document.getElementById('popupville_titre_openjaw_' + courant).style.display = 'block';
						document.getElementById('popupville_ville_openjaw_' + courant).style.display = 'block';
						
						document.getElementById('popupville_titre_openjaw_' + courant).innerHTML="<br><u>" + lettre_suggest + "/ Repartir de :</u>"
						lettre_suggest = "C";
						document.getElementById('popupville_ville_openjaw_' + courant).innerHTML=liste_openjaw_haut;						
						
						
						//alert('map 252' +  document.getElementById('isopen').value);
						// test si des propositions home ==> pas de popup
						var afficher_pp = 1;
						try{
							if (document.getElementById('isTophome').value == 1)
								 afficher_pp = 0
							}catch(err){err=1};
							//alert(afficher_pp)
						if(afficher_pp == 0) Afficher_popup = 0;
						if(Afficher_popup==1)
						{
							document.getElementById('popupville_' + courant).style.zindex = 1000;
							document.getElementById('popupville_' + courant).style.display = 'block';						
						}
					}
					else
					{
						document.getElementById('popupville_titre_openjaw_' + courant).style.display = 'none';
						document.getElementById('popupville_ville_openjaw_' + courant).style.display = 'none';
						
						document.getElementById('popupville_titre_openjaw_' + courant).innerHTML='';
						document.getElementById('popupville_ville_openjaw_' + courant).innerHTML='';
					}
					//******************************************************************* Les ADDON
					var liste_addon_haut=""
					for (i=0;i<liste_ADDON.split('|').length-1;i++)
					{
						une_ville=liste_ADDON.split('|')[i];
						ville_ADDON=une_ville.split('&')[0];
						code_ville_ADDON=une_ville.split('&')[1];
						lat_arr=une_ville.split('&')[2];
						lang_arr=une_ville.split('&')[3];	
						type_arr=une_ville.split('&')[4];
						zoom_arr=une_ville.split('&')[5];
							
						if(lat_arr != '' && lat_arr != 999 && lang_arr != '' && lang_arr != 999)
						{
							
							if (!liste_code_mixt.match(code_ville_ADDON))
							{	
									
								createMarker('addon',code_ville_depart,lib_ville_depart,lat_ville_depart,lang_ville_depart,type_ville_depart,zoom_ville_depart,code_ville_ADDON,ville_ADDON,lat_arr,lang_arr,type_arr,zoom_arr,courant);
								index_lettre++
		
								var polyOptions = {geodesic:true};
								var polyline = new GPolyline([new GLatLng(lat_ville_depart,lang_ville_depart),new GLatLng(lat_arr,lang_arr)], couleur_addon, 2, 1, polyOptions);
								map.addOverlay(polyline);	
							}
							liste_addon_haut +='&nbsp;&nbsp;&nbsp;<a title="Cliquez ici pour revenir de ' + ville_ADDON + '" onclick="Ajout_addon(';
							liste_addon_haut += "'" + code_ville_depart + "',";
							liste_addon_haut += "'" + lib_ville_depart + "',";
							liste_addon_haut += "'" + lat_ville_depart + "',";
							liste_addon_haut += "'" + lang_ville_depart + "',";
							liste_addon_haut += "'" + type_ville_depart + "',";
							liste_addon_haut += "'" + zoom_ville_depart + "',";
							
							liste_addon_haut += "'" + code_ville_ADDON + "',";
							liste_addon_haut += "'" + ville_ADDON + "',";
							liste_addon_haut += "'" + lat_arr + "',";
							liste_addon_haut += "'" + lang_arr + "',";
							liste_addon_haut += "'" + type_arr + "',";
							liste_addon_haut += "'" + zoom_arr + "',";
							liste_addon_haut += "'" + courant + "');";
							liste_addon_haut += '" style="cursor:pointer;" ><span class="listeNom"><u>' + ville_ADDON + '</u></span></a><br>';
						}
						
					}
					if(liste_addon_haut.length)
					{
						document.getElementById('popupville_titre_addon_' + courant).style.display = 'block';
						document.getElementById('popupville_ville_addon_' + courant).style.display = 'block';
						
						document.getElementById('popupville_titre_addon_' + courant).innerHTML="<br><u>" + lettre_suggest + "/ Continuer vers :</u>"
						document.getElementById('popupville_ville_addon_' + courant).innerHTML=liste_addon_haut;						
						
						//alert('map 316' +  document.getElementById('isopen').value);
						// test si des propositions home ==> pas de popup
						var afficher_pp = 1;
						try{
							if (document.getElementById('isTophome').value == 1)
								 afficher_pp = 0
							}catch(err){err=1};
						//alert(afficher_pp)
						if(afficher_pp == 0) Afficher_popup = 0;
						
						if(Afficher_popup==1)
						{
							document.getElementById('popupville_' + courant).style.zindex = 1000;
							document.getElementById('popupville_' + courant).style.display = 'block';						
						}
					}
					else
					{
						document.getElementById('popupville_titre_addon_' + courant).style.display = 'none';
						document.getElementById('popupville_ville_addon_' + courant).style.display = 'none';
						
						document.getElementById('popupville_titre_addon_' + courant).innerHTML='';
						document.getElementById('popupville_ville_addon_' + courant).innerHTML='';
					}
					
					document.getElementById('isopen').value=0;
					//******************************************************************* Les MIXTE
					for (i=0;i<liste_ONPENJAW.split('|').length-1;i++)
					{
						une_ville=liste_ONPENJAW.split('|')[i];
						ville_ONPENJAW=une_ville.split('&')[0];
						code_ville_ONPENJAW=une_ville.split('&')[1];
						
						if (liste_code_mixt.match(code_ville_ONPENJAW))
						{
							lat_arr=une_ville.split('&')[2];
							lang_arr=une_ville.split('&')[3];
							type_arr=une_ville.split('&')[4];
							zoom_arr=une_ville.split('&')[5];
							if(lat_arr != '' && lat_arr != 999 && lang_arr != '' && lang_arr != 999)
							{
								createMarker('mixte',code_ville_depart,lib_ville_depart,lat_ville_depart,lang_ville_depart,type_ville_depart,zoom_ville_depart,code_ville_ONPENJAW,ville_ONPENJAW,lat_arr,lang_arr,type_arr,zoom_arr,courant);
								index_lettre++
		
								var polyOptions = {geodesic:true};
								var polyline = new GPolyline([new GLatLng(lat_ville_depart,lang_ville_depart),new GLatLng(lat_arr,lang_arr)], couleur_mixte, 2, 1, polyOptions);
								map.addOverlay(polyline);	
							}
						}
					}
				}
			}
		}  
	xhr_object.send(null);
	
}

function createMarker(type,code_dep,lib_dep,lat_dep,lang_dep,type_dep,zoom_dep,code_arr,lib_arr,lat_arr,lang_arr,type_arr,zoom_arr,courant)
{    
   	var newIcon = new GIcon(baseIcon);
	if(type =='openjaw')
		newIcon.image = icon_openjaw;
	if(type =='addon')
		newIcon.image = icon_addon;
	if(type =='mixte')
		newIcon.image = icon_mixte;
   	newIcon.shadow = icon_shadow;
	
	// Set up our GMarkerOptions object
	//markerOptions = { title:nom_ville_dep };
	markerOptions = { icon:newIcon,title:lib_arr };      
	
	var HTML_openjaw =  '<div align="left"><a onclick="Ajout_openjaw(';
	HTML_openjaw += "'" + code_arr + "',"
	HTML_openjaw += "'" + lib_arr + "',"
	HTML_openjaw += "'" + lat_arr + "',"
	HTML_openjaw += "'" + lang_arr + "',"
	HTML_openjaw += "'" + type_arr + "',"
	HTML_openjaw += "'" + zoom_arr + "',"
	HTML_openjaw += "'" + courant + "');"
	HTML_openjaw += '" style="cursor:pointer;" ><span class="texte4">Cliquez ici pour repartir de </span><span class="texte3"><b>' + lib_arr + '</b></span></a></div>';
	 
	var HTML_addon =  '<div align="left"><a onclick="Ajout_addon(';
	HTML_addon += "'" + code_dep + "',"
	HTML_addon += "'" + lib_dep + "',"
	HTML_addon += "'" + lat_dep + "',"
	HTML_addon += "'" + lang_dep + "',"
	HTML_addon += "'" + type_dep + "',"
	HTML_addon += "'" + zoom_dep + "',"
	
	HTML_addon += "'" + code_arr + "',"
	HTML_addon += "'" + lib_arr + "',"
	HTML_addon += "'" + lat_arr + "',"
	HTML_addon += "'" + lang_arr + "',"
	HTML_addon += "'" + type_arr + "',"
	HTML_addon += "'" + zoom_arr + "',"
	HTML_addon += "'" + courant + "');"
	
	HTML_addon += '" style="cursor:pointer;" ><span class="texte4">Cliquez ici pour choisir <span class="texte3"><b>' + lib_arr + '</b></span> en contunation de <span class="texte3"><b>' + lib_dep + '</b></span></span></a></div>';
	 
	if(type =='openjaw')
		var HTML = '<br>' + HTML_openjaw;
	if(type =='addon')
		var HTML = '<br>' + HTML_addon;
	if(type =='mixte')
		var HTML = HTML_openjaw + '' + HTML_addon;
	var point = new GLatLng(lat_arr,lang_arr);	
	var marker = new GMarker(point, markerOptions);
	
	GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(HTML);});
	map.addOverlay(marker); 
}
function supprimer_tout(courant)
{
	
	//supprimer_vol(courant+1);
	var nb_seg = parseInt(document.frm_recherche.nb_seg.value);
	for (i=nb_seg; i>courant;i--)
	{
		supprimer_vol(i);
	}
	//alert(document.frm_recherche.allerretour.value);
	/*if (document.frm_recherche.allerretour.value==1)
	{
		//alert(document.frm_recherche.ville_depart_2.value);
		if(document.frm_recherche.ville_depart_2.value =='')
		{
			//alert('supp');
			
		}
	}*/
	
}
function Ajout_openjaw(code_dep,lib_dep,lat_dep,lang_dep,type_dep,zoom_dep,courant)
{
	document.getElementById('isopen').value=1;
	supprimer_tout(courant);
	ajouter_vol(nb_segments,0);
	num=parseInt(document.frm_recherche.nb_seg.value);
	document.getElementById('ville_depart_' + num).style.borderBottom = "2px #009933 solid";
	
	document.getElementById('ville_depart_' + num).value=lib_dep;
	document.getElementById('code_ville_depart_' + num).value=code_dep;
	document.getElementById('lat_ville_depart_' + num).value=lat_dep;
	document.getElementById('lang_ville_depart_' + num).value=lang_dep;		
	document.getElementById('type_carte_ville_depart_' + num).value=type_dep;
	document.getElementById('zoom_ville_depart_' + num).value=zoom_dep;
	document.getElementById('ville_depart_' + num).focus();	
	GInfoWindow = map.getInfoWindow()
	GInfoWindow.hide();
	mise_ajour_cie(num)	
	cachediv();
}
function Ajout_addon(code_dep,lib_dep,lat_dep,lang_dep,type_dep,zoom_dep,code_arr,lib_arr,lat_arr,lang_arr,type_arr,zoom_arr,courant)
{
	
	supprimer_tout(courant);
	ajouter_vol(nb_segments,0);
	num=parseInt(document.frm_recherche.nb_seg.value);
	
	document.getElementById('ville_depart_' + num).style.borderBottom = "2px #009933 solid";
	
	document.getElementById('ville_depart_' + num).value=lib_dep;
	document.getElementById('code_ville_depart_' + num).value=code_dep;
	document.getElementById('lat_ville_depart_' + num).value=lat_dep;
	document.getElementById('lang_ville_depart_' + num).value=lang_dep;		
	document.getElementById('type_carte_ville_depart_' + num).value=type_dep;
	document.getElementById('zoom_ville_depart_' + num).value=zoom_dep;
	
	
	document.getElementById('ville_arrivee_' + num).style.borderBottom = "2px #009933 solid";
	
	document.getElementById('ville_arrivee_' + num).value=lib_arr;
	document.getElementById('code_ville_arrivee_' + num).value=code_arr;
	document.getElementById('lat_ville_arrivee_' + num).value=lat_arr;
	document.getElementById('lang_ville_arrivee_' + num).value=lang_arr;		
	document.getElementById('type_carte_ville_arrivee_' + num).value=type_arr;
	document.getElementById('zoom_ville_arrivee_' + num).value=zoom_arr;
	document.getElementById('ville_arrivee_' + num).focus();
	GInfoWindow = map.getInfoWindow()
	GInfoWindow.hide();
	//alert('courant');
	
	cachediv();
	le_suiv=parseInt(courant)+1;
	mise_ajour_map(nb_segments,le_suiv);	
	mise_ajour_cie(num);
}

function clignotement(){
    
	if(navigator.appName == 'Microsoft Internet Explorer')
	{
		document.getElementById("span_td_conseil").style.display="none";
		document.getElementById("span_td_conseil2").style.display="";
	}
	else
	{
		document.getElementById("span_td_conseil").style.textDecoration ="blink";
	}
	
	//setTimeout("finclignotement()", 2000); 
} 
function finclignotement(){
	if(navigator.appName == 'Microsoft Internet Explorer')
	{
		document.getElementById("span_td_conseil").style.display="";
		document.getElementById("span_td_conseil2").style.display="none";
	}
	else
	{
		document.getElementById("span_td_conseil").style.textDecoration ="none";
	}	
} 


function verifier_aller_retour(){
	
	
	frm=document.frm_recherche;
	if (frm.nb_seg.value == 2)
	{
		vill_d=	frm.ville_depart_1.value;
		vill_a=	frm.ville_arrivee_2.value;
		//alert(vill_d.length + ' _____ ' + vill_a.length)
		if (vill_d.length > 0 && vill_a.length > 0)
		{
			if (vill_d == vill_a)
			{
				document.getElementById('titre_vol_1').innerHTML='&nbsp;&nbsp;&nbsp;<strong>Vol aller</strong>';
				document.getElementById('titre_vol_2').innerHTML='&nbsp;&nbsp;&nbsp;<strong>Vol retour </strong>';
			}
			else
			{
				//alert(vill_d + ' ' + vill_a)
				document.getElementById('titre_vol_1').innerHTML='&nbsp;&nbsp;&nbsp;<strong>1er trajet</strong>';
				document.getElementById('titre_vol_2').innerHTML='&nbsp;&nbsp;&nbsp;<strong>2&egrave;me trajet</strong>';		
			}
		}
	}
} 
