//<script type="text/javascript">
		//variables fijas, no tocar
	/*	var d1;											//objetos date
		var d2;
		var c1 = new Calendar(1, d1, onSelect1, null);  //calendarios 	
		var c2 = new Calendar(1, d2, onSelect2, null);
		var arr_Precios1=new Array();					//arrays de precios inicilializados
		var arr_Precios2=new Array();	//Realizando búsqueda...
		var searchMsg = '<table class="horarios" summary="Horarios" cellspacing="0" border="1" align="center">'
						+ '<caption>Realizando búsqueda...</caption>'
						+ '<tbody></tbody></table>';	//mensaje de busqueda 		
		var searchMsgCalendar = '<strong>Buscando calendario de precios...</strong>';	//mensaje de busqueda 	
		var cabeceraVtaTxt = '<h4>Vuelo de vuelta</h4>';
		var v_tarificacionRT ='N';
		var julian_timida ='';
		var julian_timvta ='';
		var ofe_ida ='';
		var ofe_vta ='';

		var flashObject='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="275" height="80">'
			+'<param name="movie" value="swf/loading.swf" />'
			+'<param name="quality" value="high" />'
			+'<embed src="swf/loading.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="275" height="80">'+'</embed>'
			+'</object>';
		//pasajeros seleccion (combos)
		var numpaxida = null;		var numpaxvta = null;
		var today = new Date();  //fecha de carga para controlar eventos de seleccion de calendario  (Evento onSelect)
		today.setHours(0,0,0,0);
*/

/* ini */

var seleccion="seleccion2";
// listado de aeropuertos con Dto. Residente.
var list_apts_dtores ="PMI,IBZ,MAH,TFS,TFN,LPA,ACE,FUE,TCI";

// Array con la lista de paises, de mercados disponibles

var paises =new Array();

		paises['ES'] = "España";
		paises['FR'] = "France";
	  paises['IT'] = "Italia";
	  paises['UK'] = "United Kingdom";
	  paises['PT'] = "Portugal";
		paises['AR'] = "Argentina";
		paises['BR'] = "Brasil";
		paises['MX'] = "México";
		paises['VE'] = "Venezuela";
		paises['DO'] = "Rep. Dominicana";
		paises['US'] = "USA";
		paises['PE'] = "Perú";
		paises['OT'] = "Otros/Others";

var short_paises=new Array();

		short_paises['ES'] = "ES";
		short_paises['FR'] = "FR";
		short_paises['IT'] = "IT";
		short_paises['UK'] = "UK";
		short_paises['PT'] = "PT";
		short_paises['AR'] = "AR";
		short_paises['BR'] = "BR";
		short_paises['BR'] = "BR";
		short_paises['VE'] = "VE";
		short_paises['DO'] = "DO";
		short_paises['MX'] = "MX";
		short_paises['US'] = "US";
		short_paises['PE'] = "PE";		
    short_paises['OT'] = "OT";
		


// Array con la descripcion de todos los idiomas disponibles

var desc_idiomas =new Array();

		desc_idiomas['IT'] = "Italiano";
		desc_idiomas['FR'] = "Français";
		desc_idiomas['ES'] = "Español";
		desc_idiomas['CA'] = "Català";
		desc_idiomas['AR'] = "Argentino";
		desc_idiomas['BR'] = "Português";
		desc_idiomas['EN'] = "English";
		desc_idiomas['PT'] = "Português";

var short_desc_idiomas =new Array();

		short_desc_idiomas['Italiano'] = "IT";
		short_desc_idiomas['Français'] = "FR";
		short_desc_idiomas['Español'] = "ES";
		short_desc_idiomas['Català'] = "CA";
		short_desc_idiomas['Argentino'] = "AR";
		short_desc_idiomas['Português'] = "BR";
		short_desc_idiomas['English'] = "EN";
		short_desc_idiomas['Português'] = "PT";

var idiomas =new Array();

		idiomas['IT'] = [['IT'], ['ES']];
		idiomas['FR'] = [['FR'], ['ES']];
		idiomas['UK'] = [['ES'], ['EN']];
	  idiomas['ES'] = [['ES'], ['EN'],['CA']];
		idiomas['AR'] = [['ES'], ['EN']];
		idiomas['BR'] = [['BR'], ['ES']];
		idiomas['MX'] = [['ES'], ['EN']];
		idiomas['VE'] = [['ES'], ['EN']];
		idiomas['DO'] = [['ES'], ['EN']];
		idiomas['US'] = [['ES'], ['EN']];
		idiomas['PT'] = [['PT'], ['ES']];
		idiomas['PE'] = [['ES'], ['EN']];
		idiomas['OT'] = [['ES'], ['EN']];	// OT = otros
/* fin */

function getFlashObj(h,w){
			var flashTxt='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">'
			+'<param name="movie" value="swf/loading.swf" />'
			+'<param name="quality" value="high" />'
			+'<embed src="swf/loading.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'">'+'</embed>'	+'</object>';
			return flashTxt;
		}
		function generaCombosPax(){
			//genera los combos de pasajeros a partir de la disponibilidad seleccionada
			numpaxida = (isNaN(numpaxida)||numpaxida==null)? 9 : numpaxida;			//en caso de valor no valido o numpax nulo 
			numpaxvta = (isNaN(numpaxvta)||numpaxvta==null)? 9 : numpaxvta;
			if (numpaxida < numpaxvta){					paxcombo = numpaxida;
			}else{										paxcombo = numpaxvta;		}
			var posCombo = 0;
			document.getElementById('comboinf').options.length = 0;				
			document.getElementById('comboadl').options.length = 0;				
			document.getElementById('combochd').options.length = 0;				
			for (numpax=0;numpax<=paxcombo;numpax++){
				if (numpax > 0)		  generaOpcionCombo(numpax,numpax,'comboadl', posCombo -1);	  //el 0 no existe para adultos
				if (numpax < paxcombo)generaOpcionCombo(numpax,numpax,'combochd', posCombo);  //uno menos que adulto
				generaOpcionCombo(numpax,numpax,'comboinf', posCombo);						  //infants => todos
				posCombo++;
			}
		}

		function showInfoPrecioMenu(valor){
			if (valor == 1){	changeVisibility('publicidad','hide');	changeVisibility('infoViaje','show');	//lo mostramos
			}else{				changeVisibility('infoViaje','hide');	changeVisibility('publicidad','show');	//lo ocultamos
			}
		}


		//variables de importes (suma total para usuario)
	/*	var l_impfee   =0;	var l_imptaxtotal=0;	
		var l_imptaxida=0;	var l_imptaxvta=0;
		var l_impbaseida=0;	var l_impbasevta=0;
		var l_imptotal=0;
		var l_coddiv;
		var ptos_ida=0;
		var ptos_vta=0;
		//
		var l_resfee   =0;
		var l_resida   =0;
		var l_resvta   =0;
		*/
		//function setInfoTime(horasalida,horallegada,coste,divisa,sentido)
		//function setInfoCostes(tasas,sfee,total,divisa,residente)
		function setVueloV3(hdep,harr,impbase,imptax,impfee,impfeeRes,impbaseRes,puntos,coddiv,codvuelo,codcla,codfb,sentido,info_adic,plazas,milis,seqofe){	
		 //l_resvta=0;
		 //l_impbasevta=0; // AQUI CHANGE
		 //l_impbaseida=0;
		 //alert('impbase:'+impbase);
		 //alert('codvuelo:'+codvuelo);
		 if (puntos!=''){v_puntos=parseInt(puntos);
			}else{			v_puntos=0;			}
/*			alert(hdep + ' - ' + harr + '\n'
			+	codvuelo + '-'+codcla + '-' + codfb + '-'+sentido+'\n'
			+	impbase + '-'+ impbaseRes + '-'+ impfee +'-'+ impfeeRes+ '-'+ imptax);*/
			setInfoTime(hdep,harr,impbase,coddiv,sentido,info_adic);		//set del vuelo seleccionado en el menu
			putPlazasDia(sentido,plazas);									//redimensionamos combos y escribimos plazas
			if (sentido =='ida'){	
				ptos_ida=v_puntos;
				numpaxida	 = parseFloat(plazas.replace(',','.'));	
				l_impbaseida = parseFloat(impbase.replace(',','.'));						
				l_imptaxida	 = parseFloat(imptax.replace(',','.'));	
				//document.getElementById('codbloqida').value=codvuelo;		//set del formulario de bloqueo
				document.foBloqVuelos.p_codtraida.value=codvuelo;
				julian_timida =parseFloat(milis.replace(',','.'));						
				ofe_ida =seqofe;
				if (impbaseRes!=''){//se trata de dcto residente
					l_resida = parseFloat(impbaseRes.replace(',','.'));						
					l_resfee = parseFloat(impfeeRes.replace(',','.'));						
				}else{
					l_resida = 0;						
					l_resfee = 0;						
				}
			}else{				
				ptos_vta=v_puntos;			
				numpaxvta	 = parseFloat(plazas.replace(',','.'));	
				l_impbasevta = parseFloat(impbase.replace(',','.'));						
				l_imptaxvta	 = parseFloat(imptax.replace(',','.'));		
				//document.getElementById('codbloqvta').value=codvuelo;		//set del formulario de bloqueo
				document.foBloqVuelos.p_codtravta.value=codvuelo;
				julian_timvta =parseFloat(milis.replace(',','.'));						
				ofe_vta =seqofe;
				if (impbaseRes!=''){//se trata de dcto residente
					l_resvta = parseFloat(impbaseRes.replace(',','.'));						
					l_resfee = parseFloat(impfeeRes.replace(',','.'));						
				}else{
					l_resvta = 0;						
					l_resfee = 0;						
				}
			}
			l_impfee	  = parseFloat(impfee.replace(',','.'));	
			l_coddiv	  =	coddiv;
			showtotal();
			showInfoPuntos();
			generaCombosPax();														//generamos combo a partir de seleccion de usuario
		}
		
		function limpiarImpVta(){
		 l_impbasevta=0; // AQUI CHANGE
		 l_imptaxvta=0; // AQUI CHANGE
		}
    

		function showInfoPuntos(){
			/*if ((ptos_vta + ptos_ida)>0){
				var divinfoPuntos = '';
				divinfoPuntos= '<div id="infoTotal">';
				divinfoPuntos+='<h4>Para cada titular<br/>'+parseInt(ptos_vta + ptos_ida)+'&#160;ptos Fidelitas</h4>';
				divinfoPuntos+='</div>';
				writeObj(divinfoPuntos,'infoPuntos');
			}else{
				writeObj('','infoPuntos');
			}*/
		}
	
		function valida_horasvuelos(){  //&&
			//if(document.getElementById('codbloqida').value != '' && document.getElementById('codbloqvta')!='' && radio_button_checker('document.foTiptra.rbtn_tiptra') =='RT'){
			if(document.foBloqVuelos.p_codtraida.value != '' && document.foBloqVuelos.p_codtravta!='' && radio_button_checker('document.foTiptra.rbtn_tiptra') =='RT'){	
				if (julian_timida > julian_timvta){			return false;
				}else{										return true;
				}
			}
			return true;
		}


		function valida_seleccion(){//&&
			if(radio_button_checker('document.foTiptra.rbtn_tiptra') =='RT'){
			  if (document.getElementById('combo_aptdep').value=='' || document.getElementById('combo_aptarr').value==''){
			     alert('- Debe seleccionar un aeropuerto de origen y destino');
			     return false;
			    }
				//if (document.getElementById('codbloqida').value != '' && document.getElementById('codbloqvta').value !=''){ return true;
  		     	if (document.foBloqVuelos.p_codtraida.value != '' && document.foBloqVuelos.p_codtravta.value !=''){return true;
				}else{return false;}
			}else{
				    if (document.getElementById('combo_aptdep').value=='' || document.getElementById('combo_aptarr').value==''  || document.getElementById('combo_aptarr').value=='0' || document.getElementById('combo_aptdep').value=='0'){
				        alert('- Debe seleccionar un aeropuerto de origen y destino');					
				        return false;
				    }
				   // if (document.getElementById('codbloqida').value != ''){return true;
	   				if (document.foBloqVuelos.p_codtraida.value != ''){return true;				
				    }else{return false;}
			}
		}

		function valida_ofertas(){//&&
			if(radio_button_checker('document.foTiptra.rbtn_tiptra') =='RT'){
				if (ofe_ida != '' && (ofe_vta == '' || ofe_vta == null)){	return false;			}
				if ((ofe_ida == '' || ofe_ida == null) && ofe_vta != ''){	return false;			}	
				return true;
			}
			return true;
		}

        function cargaIdiomas(paisId, idiomaId){
		 var posComboIdioma=0;
		 var aptPai= document.getElementById(paisId).value;
		 var l_idioma = idiomas[aptPai];
		 //var nomIdioma;
		 document.getElementById(idiomaId).options.length=0;
		 //generaOpcionCombo('...',0,comboId,0);
		 generaOpcionCombo('...',0,idiomaId,0);
		 for(listaIdioma in l_idioma){
		 //alert('entra en bucle');
		 var arrIdioma=l_idioma[listaIdioma];
		 posComboIdioma++;
		 nomIdioma=desc_idiomas[arrIdioma[0]];
		 generaOpcionCombo(nomIdioma,arrIdioma[0],idiomaId,posComboIdioma);
		 }
		}
		
		function showDctoResi(total,coddiv,dcto){
			var divinfoResi = '';
			divinfoResi= '<div id="infoTotal">';
			divinfoResi+='<strong id="descuento">'+total+' '+coddiv+' <br/>(-'+dcto+'% dto. residente)'+'</strong>'
			divinfoResi +='</div>';
			writeObj(divinfoResi,'infoCosteResi');
		}

		function showtotal(){
		  // tasas totales:
		  //alert("showtotal:"+l_imptotal);
		 // l_imptotal=0;
		  //l_imptaxtotal=0;
		  l_imptaxtotal = l_imptaxida   + l_imptaxvta;
		  // Si no está activada la variable de visualización de SFEE
		  if (l_vis_sfee=='N') {
		    //	alert('l_imptotal1:'+l_imptotal);
			   l_imptotal	  = l_imptaxtotal + l_impbaseida + l_impbasevta;
			   var l_impsfee=0;
			}else{
				//alert('l_imptotal2:'+l_imptotal);
        //calculo con sfee:
			   l_imptotal	  = l_imptaxtotal + l_impfee + l_impbaseida + l_impbasevta;
			   var l_impsfee= l_impfee.toFixed(2);
      }
			//mostramos info costes asociados
			//alert('l_impsfee:'+l_impsfee);
			//alert('l_imbaseida:'+l_impbaseida);
     		//alert('l_imbasevta:'+l_impbasevta);
     	// llamaos a info costes 
			setInfoCostes(l_imptaxtotal.toFixed(2),l_impsfee,l_imptotal.toFixed(2),l_coddiv,'n');
      //------------------------------------	
			if (l_resida!=0){	
  			 if (l_vis_sfee=='N') {
  				l_impresidente = l_resida + l_resvta + l_imptaxtotal;
  			}else{
         	l_impresidente = l_resfee + l_resida + l_resvta + l_imptaxtotal;
  			}
			  showDctoResi(l_impresidente.toFixed(2),l_coddiv,'50');
			}else{
				writeObj('','infoCosteResi');
			}
		}

		//
		function setDisponibilidad(content,opener){			
			var divId;		//guarda el contenido lanzado en el iframe sobre el marco de disponibilidad de la ventana
			if (opener =='ifDispoI'){
				divId='dispoBox1';
				/*Andres: ida cargada.Desbloqueamos calendario ida */
				setClassName('calendarcontainer_ow', 'cont_cal');
				c1.bloqCalendar=false;
				changeVisibility('loadingIda','hide');
			}
			if (opener =='ifDispoV'){
				divId='dispoBox2';
				/*Andres: ida cargada.Desbloqueamos calendario vuelta */
				setClassName('calendarcontainer_rt', 'cont_cal');
				c2.bloqCalendar=false;
				changeVisibility('loadingVta','hide');
				if (document.getElementById("sec_ida").style.display=='block'){
					setClassName('calendarcontainer_ow', 'cont_cal');
					c1.bloqCalendar=false;
					changeVisibility('loadingIda','hide');
				}
			}
			writeObj(content,divId);			
		}


		function submit_SearchV3(){			//realiza la busqueda de calendario, e inicializa la reserva
			resetAll();
			v_swida  = radio_button_checker('document.foTiptra.rbtn_tiptra');
			v_tipcab = radio_button_checker('document.foTiptra.rbtn_tipcab');
			v_aptdep = document.getElementById('combo_aptdep').value;
			v_aptarr = document.getElementById('combo_aptarr').value;	
			if (v_aptarr=='0' || v_aptdep=='0' || v_aptarr=='' || v_aptdep==''){		
        return false;		

      }else{
  			var descAptDep = getAptName(v_aptdep);
  			var descAptArr = getAptName(v_aptarr);			
  			// creamos el trayecto en el menu derecha
  			var txtIda = '<span class="destacado">Ida: </span><strong>'+descAptDep+' > '+descAptArr+'</strong>'
  			var txtVta = '<span class="destacado">Vuelta: </span><strong>'+descAptArr+' > '+descAptDep+'</strong>'
  			writeObj(txtIda,'descripTraIda');
  			if (v_swida == 'RT'){	writeObj(txtVta,'descripTraVta');		
  			}else{					writeObj('<br/> ','descripTraVta');
  			}
  			//
  			document.foCalendario.p_aptdep.value=v_aptdep;
  			document.foCalendario.p_aptarr.value=v_aptarr;
  			document.foCalendario.p_swiv.value=v_swida;
  			document.foCalendario.p_tipcab.value=v_tipcab;
  			document.foCalendario.xsid.value = document.foLogin.xsid.value;
  			document.foCalendario.submit();
  			//
  		/*	document.foCalendarioDebug.p_aptdep.value=v_aptdep;
  			document.foCalendarioDebug.p_aptarr.value=v_aptarr;
  			document.foCalendarioDebug.p_swiv.value=v_swida;
  			document.foCalendarioDebug.p_tipcab.value=v_tipcab;
  			document.foCalendarioDebug.submit();*/
  
  			setInfoApts(v_aptdep,v_aptarr,descAptDep,descAptArr,v_swida);			//mostramos la primera fase de menu
  			showInfoPrecioMenu(1);
  			document.getElementById('calendarInfo').style.height='20px';
  			writeObj(searchMsgCalendar,'calendarInfo');						
        }
		}

   		function putPlazasDia(sentido,plazas){			
		//escribe mensaje con las plazas restantes en una disponibilidad
			var txt1 ='<span class="destacado">Reserva ya:&nbsp;</span>Solo quedan <strong>';
			var txt2 =' plazas</strong> con esta tarifa';
			var txtnot1='<span class="label">Si desea reservar un vuelo para m&aacute;s de <strong>';
			var txtnot2='</strong> personas, puede hacer dos reservas: una con esta tarifa y otra con una tarifa superior para el resto de viajeros.'
			var msg='';
			var msg2='';
			if (plazas<=3){
				msg= txt1 + plazas + txt2;
				msg2= txtnot1+plazas+txtnot2;
			}		
			writeObj(msg2,'plazasnota');			
			if (sentido=='ida'){		
			writeObj(msg,'plazasida');
			}else{
			writeObj(msg,'plazasvta');
			}					
		}

		/*
		function putPlazasDia(sentido,plazas){			//escribe mensaje con las plazas restantes en una disponibilidad
			var txt1 ='<span class="destacado">Reserva ya:&nbsp;</span>Solo quedan <strong>';
			var txt2 =' plazas</strong> con esta tarifa';
			var msg='';
			if (plazas !=''){msg= txt1 + plazas + txt2;		}
			if (sentido=='ida'){		writeObj(msg,'plazasida');
			}else{						writeObj(msg,'plazasvta');
			}					
			}   
		*/
		function set_CalendarsData(arrida,arrvta){			//reconstruye los calendarios de precios en base a los datos pasados
			//borramos contenido 
			arr_Precios1 = arrida;		c1.refresh();			c1.show();
			arr_Precios2 = arrvta;		c2.refresh();			c2.show();
			writeObj('','calendarInfo');		
			document.getElementById('calendarInfo').style.height='0px';
		}
		
		function comasxpunto(cadena,sepold,sepnew) {
      var result="";
      var str = cadena.split('');
      for(i=0; i<=str.length-1; i++) {
        if (str[i]==sepold) {
          result+=sepnew;
        } else {
          result+=str[i];
        }
      }
      return result;
    }

		function set_calendarIda(){			
			// generamos el calendario asociado a la ida (constructor)
			c1 = new Calendar(1, d1, onSelect1, null,"c1"); 
			c1.setDateFormat("%d/%m/%Y");
			c1.setRange(d1.getFullYear(), d1.getFullYear()+1);
			c1.weekNumbers = false;
			c1.yearStep = 1;
			c1.bloqCalendar=false; 
			c1.getDateStatus = function(date) {
				var min = new Date(); 
				var max = new Date();				// Márgen de funcionamiento: desde hoy hasta dentro de un año (365 días)
				min.addDays(-1);
				max.addDays(365);
				if (date.getTime() < min.getTime() || date.getTime() > max.getTime()) return true; 
				else return false; 
			}
			c1.getDateText = function (date, iday) {			//añadido por mi
				var txt  = '<div class="precio">&#160;</div>';
				if (typeof(arr_Precios1[date.print("%d/%m/%Y")]) != "undefined"){
				    var num = parseInt(comasxpunto(arr_Precios1[date.print("%d/%m/%Y")][0],",","")); 
				    if (num<1000) {
					       txt = '<div class="precio">' + arr_Precios1[date.print("%d/%m/%Y")][0]	+'</div>';
					  }else{
                 txt = '<div class="precio2">' + comasxpunto(arr_Precios1[date.print("%d/%m/%Y")][0],",",".")	+'</div>';
            }     
				}
				return '<div class="dia">' + iday + '</div>' + txt ;
				//return iday;
			}
			c1.create(document.getElementById("cal1"));
//			c1.hide();
			c1.show();
		}	

		function set_calendarVta(){
			// generamos el calendario asociado a la vta (constructor)
			// Calendario DOS
			c2 = new Calendar(1, d2, onSelect2, null,"c2");
			c2.setDateFormat("%d/%m/%Y");
			c2.setRange(d1.getFullYear(), d1.getFullYear()+1);
			c2.weekNumbers = false;
			c2.yearStep = 1;
			c2.bloqCalendar=false;
			c2.getDateStatus = function(date) {				// Márgen de funcionamiento: desde hoy hasta dentro de un año (365 días)
				var min = new Date(); 
				var max = new Date();
				min.addDays(-1);
				max.addDays(365);
				if (date.getTime() < min.getTime() || date.getTime() > max.getTime() || date.getTime() < c1.date.getTime()) return true; 
				else return false; 
			}
			c2.getDateText = function (date, iday) {			//añadido por mi
				var txt  = '<div class="precio">&#160;</div>';
				if (typeof(arr_Precios2[date.print("%d/%m/%Y")]) != "undefined"){
				    var num = parseInt(comasxpunto(arr_Precios2[date.print("%d/%m/%Y")][0],",","")); 
				    if (num<1000) {
					       txt = '<div class="precio">' + arr_Precios2[date.print("%d/%m/%Y")][0]	+'</div>';
					  } else {
                 txt = '<div class="precio2">' + comasxpunto(arr_Precios2[date.print("%d/%m/%Y")][0],",",".") +'</div>';
            }
				}
				return '<div class="dia">' + iday + '</div>' + txt ;
			}
			c2.electric=false;
			c2.create(document.getElementById("cal2"));
//			c2.hide();
			c2.show();
		}
		 		
		function onSelect1(calendar, date) {
		/* (Jacin, 15/01/2008): Limpiamos la lista de vuelos de la ida */      
		fLimpiarVueloIda();
		/* Limpiamos la lista de los vuelos de la vuelta y la información de costes de la vuelta */
		fLimpiarVueloVta();
			if (c1.dateClicked){
				var newdate = new Date(c1.date.getTime());
				//alert('new:'+newdate + '\nold:' + today );
				if (newdate < today ) {
					writeObj('','dispoBox1');		writeObj('','plazasida');	//fecha incorrecta, quitamos datos adicionales
				}else{
					if (document.getElementById('divTiptraH').style.display=='none')
					//if (document.getElementById('combo_aptarr').value.substr(0,1) != 'O')
					//if (document.getElementById('combo_aptarr').options.length == 4)
					{
						datediff = c2.date.getTime() - c1.date.getTime();
						 fOcultarIda();	
						 //ANDRES
							if (radio_button_checker('document.foTiptra.rbtn_tiptra') =='RT'){
								 if (c2.date.getTime() < c1.date.getTime())
								 {  c2.setDate(newdate);
									setInfoDate(c2.date.print("%d-%m-%Y"),'vta');
									c2.dateClicked='';
								 }else{
									 if (c2.dateClicked){
										//alert('1 enviamos pet ida');
										enviaPeticionDispo('ida');
									}
								 }
							}else {
								c2.refresh();
								//if (c2.dateClicked) {
									//alert('1 enviamos pet ida');
									enviaPeticionDispo('ida');
								//}
								//creamos peticion y lanzamos;
								setInfoDate(c1.date.print("%d-%m-%Y"),'ida');
								//setInfoDate(c2.date.print("%d-%m-%Y"),'vta');//generamos info en menu derecha
								writeObj('','plazasida');
								writeObj('','infoCoste');
								writeObj('','infoCosteResi');
								document.getElementById('codbloqida').value='';
							}          
				     }
				c2.refresh(); 
				}
			}else{		
				c1.currentDateEl.className="day";//deshabilitamos el boton de seleccionado
				writeObj('','plazasida');
				writeObj('','infoCoste');
				writeObj('','infoCosteResi');
				writeObj('','dispoBox1');				//borramos todo lo relacionado con anterior seleccion
				writeObj('','infoPuntos');
				document.getElementById('codbloqida').value='';
			}	
		}
        
	function onSelect2(calendar, date) {
	    var v_aptarr = document.getElementById('combo_aptarr').value;
		  //JMP, sólo se tiene en cuenta el calendario c2 si tipo de trayecto es ida y vuelta
    	if (radio_button_checker('document.foTiptra.rbtn_tiptra') =='RT'){
      	 /* (Jacin, 15/01/2008): Limpiamos la lista de vuelos de la ida */
    		 fLimpiarVueloVta();
    		 fLimpiarVueloIda();
    			if (c2.dateClicked){
    				//if (document.getElementById('divTiptraH').style.display=='none'){
    				if ( (document.getElementById('combo_aptarr').value.substr(0,1) != 'O') ||
    				     (document.getElementById('combo_aptarr').value.substr(0,1) == 'O') && (v_aptarr.length==3) 
    				   )
    				{
    					if (radio_button_checker('document.foTiptra.rbtn_tiptra') =='RT'){
    						if ((c2.date.getTime() < today) || (c2.date.getTime() < c1.date.getTime())) {
    							writeObj('','dispoBox2');	writeObj('','plazasvta');	//fecha incorrecta, quitamos datos adicionales
    						}else{
    							datediff = c2.date.getTime() - c1.date.getTime();
    							fOcultarVta();
    							if (c1.dateClicked) {
    								// alert('2 enviamos pet ida');
    									 enviaPeticionDispo('ida');
    									 writeObj('','plazasida');
    							}
    							setInfoDate(c2.date.print("%d-%m-%Y"),'vta');
    							setInfoDate(c1.date.print("%d-%m-%Y"),'ida');//generamos info en menu derecha
    							writeObj('','plazasvta');
    							writeObj('','infoCoste');
    							writeObj('','infoCosteResi');
    							document.getElementById('codbloqvta').value='';
    				        }
    				    }
    				}
    			}else{	
    				c2.currentDateEl.className="day";
    				writeObj('','plazasvta');
    				writeObj('','infoCoste');
    				writeObj('','infoCosteResi');
    				writeObj('','dispoBox2');				//borramos todo lo relacionado con anterior seleccion
    				writeObj('','infoPuntos');
    				document.getElementById('codbloqvta').value='';
    			}
    	}
		}
		
		function enviaPeticionDispo(sentido){
			if (v_tarificacionRT == 'N') {
				//mostramos la informacion en el campo de disponibilidad
				var txtBox = (sentido == 'ida')?'dispoBox1':'dispoBox2';//buscamos el campo adecuado para mostrar 
				document.getElementById(txtBox).style.height='auto';    //cambiamos altura para mostar mensaje
				writeObj('',txtBox);								//borramos todo lo relacionado con anterior seleccion
				writeObj('','infoPuntos');
				//hacemos el set de los campos del formulario y submitamos
				v_swida  = radio_button_checker('document.foTiptra.rbtn_tiptra');
				v_tipcab = radio_button_checker('document.foTiptra.rbtn_tipcab');
				v_aptdep = document.getElementById('combo_aptdep').value;
				v_aptarr = document.getElementById('combo_aptarr').value;
				////////////////////////////////////////////
				if (v_swida=='OW'){ //SOLO IDA
				    //alert('entra por OW');
					changeVisibility('loadingIda','show');
					if ((v_aptdep!=0) && (v_aptarr!=0) ){		
						setClassName('calendarcontainer_ow', 'cont_cal_oneway');
						c1.bloqCalendar=true;
					}
					document.getElementById("paramfechaida").value=c1.date.print("%d/%m/%Y");  //campo del formulario
					document.getElementById("paramfechavta").value='';
					document.foDispoIda.p_auxaptdep.value=v_aptdep;
					document.foDispoIda.p_auxaptarr.value=v_aptarr;
					document.foDispoIda.p_auxtipcab.value=v_tipcab;
					document.foDispoIda.p_auxswiv.value	 =v_swida;
					document.foDispoIda.xsid.value = document.foLogin.xsid.value;
					document.foDispoIda.submit();	
					document.getElementById('codbloqida').value='';
					c1.dateClicked='';

				}else{ //IDA Y VUELTA
					//click en tarifa de ida --> carga tarifas vuelta
					if ((sentido=='vta')&&(document.getElementById("sec_ida").style.display=='block')){ 
							changeVisibility('loadingVta','show');
							/* Andres:cargando vuelta.comprobamos si estan seleccionados aeropuerto salida y aeropuerto llegada
							 si ambos estan seleccionados bloqueamos calendario mientras efectua la búsqueda.*/
							if ((v_aptdep!=0) && (v_aptarr!=0) ){
									setClassName('calendarcontainer_rt', 'cont_cal_oneway');
									c2.bloqCalendar=true;
									setClassName('calendarcontainer_ow', 'cont_cal_oneway');
									c1.bloqCalendar=true;
							}
							document.getElementById("paramfechaida2").value=c1.date.print("%d/%m/%Y");
							document.getElementById("paramfechavta2").value=c2.date.print("%d/%m/%Y");
							document.foDispoVta.p_auxaptdep.value=v_aptdep;
							document.foDispoVta.p_auxaptarr.value=v_aptarr;
							document.foDispoVta.p_auxtipcab.value=v_tipcab;
							document.foDispoVta.p_auxswiv.value	 =v_swida;
							document.foDispoVta.xsid.value = document.foLogin.xsid.value;
							document.foDispoVta.submit();
							document.getElementById('codbloqvta').value='';
							//c2.dateClicked='';
					}else{
							changeVisibility('loadingIda','show');
							changeVisibility('loadingVta','show');
							/* Andres:cargando ida.comprobamos si estan seleccionados aeropuerto salida y aeropuerto llegada
							 si ambos estan seleccionados bloqueamos calendario mientras efectua la búsqueda.*/
							if ((v_aptdep!=0) && (v_aptarr!=0) ){		
								setClassName('calendarcontainer_ow', 'cont_cal_oneway');
								c1.bloqCalendar=true;
								setClassName('calendarcontainer_rt', 'cont_cal_oneway');
								c2.bloqCalendar=true;
								}
							document.getElementById("paramfechaida").value=c1.date.print("%d/%m/%Y");  //campo del formulario
							document.getElementById("paramfechavta").value=c2.date.print("%d/%m/%Y");  //campo del formulario
							document.foDispoIda.p_auxaptdep.value=v_aptdep;
							document.foDispoIda.p_auxaptarr.value=v_aptarr;
							document.foDispoIda.p_auxtipcab.value=v_tipcab;
							document.foDispoIda.p_auxswiv.value	 =v_swida;
							document.foDispoIda.xsid.value = document.foLogin.xsid.value;
							document.foDispoIda.submit();	
							document.getElementById('codbloqida').value='';
							document.getElementById("paramfechavta2").value=c2.date.print("%d/%m/%Y");
							document.getElementById("paramfechaida2").value=c1.date.print("%d/%m/%Y");
							document.foDispoVta.p_auxaptdep.value=v_aptdep;
							document.foDispoVta.p_auxaptarr.value=v_aptarr;
							document.foDispoVta.p_auxtipcab.value=v_tipcab;
							document.foDispoVta.p_auxswiv.value	 =v_swida;
							document.foDispoVta.xsid.value = document.foLogin.xsid.value;
							document.foDispoVta.submit();
							document.getElementById('codbloqvta').value='';
							c2.dateClicked='';
					}
				}
			
			}
		}
		//**************************envia el formulario hacia la web Halcon *************************************************************************
    function enviaPeticionHalcon(){
      
  		var foi=document.foHalconIda;
  		var fov=document.foHalconVuelta;
  		var v_dispoCia="";
  		if(document.getElementById('combo_aptarr').value.length>4){
        v_dispoCia='UX';
      }
  		var v_vueloDestino= document.getElementById('combo_aptarr').value.substr(1,3);
  		var txterr='';
  		var objForm=document.foApiAma;
  		//------------------------------------------------------------------
  		// Control del formato de Fechas 
			var fecha = new Date();
			var anyo = fecha.getUTCFullYear();
			var anyo2 = fecha.getUTCFullYear();
			var mes = fecha.getMonth() + 1 ;
			var b_fecha_1;
			var b_fecha_2;
  		//
			function formatAno(anyo) 
			{
				if (anyo.length<4) anyo='20'+ anyo.substring(1,3);
				return anyo;				
			}	
  		//
  		if (mes > objForm.B_MES_1.value) anyo ++;
      
		//	b_fecha_1 = objForm.B_DIA_1.value + "/" + objForm.B_MES_1.value + "/" + formatAno(anyo) ;
			
			b_fecha_1 = formatAno(anyo)  + objForm.B_MES_1.value + objForm.B_DIA_1.value  ;
			
			if (mes > objForm.B_MES_2.value) anyo2 ++;
			
			b_fecha_2 = formatAno(anyo2)  + objForm.B_MES_2.value +  objForm.B_DIA_2.value ;
    
			if (b_fecha_1 > b_fecha_2) {
				alert('La fecha de regreso no es válida');
				return false
			}
      b_fecha_1 = objForm.B_DIA_1.value + "/" + objForm.B_MES_1.value + "/" + formatAno(anyo) ;
      b_fecha_2 = objForm.B_DIA_2.value + "/" + objForm.B_MES_2.value + "/" + formatAno(anyo2) ;
      
      //------------------------------------------------------------------
		  if(document.getElementById('rbtn_rt').checked==true)
		   {
				  //--- cargamos formulario halcon vuelta ---------
				  if((document.getElementById('combo_aptdep').value=='') || (document.getElementById('combo_aptdep').value=='0')) {
						    txterr='- Debe introducir un aeropuerto de origen'+ ' \n';					   
					}
				  if (document.getElementById('combo_aptarr').value=='' || document.getElementById('combo_aptarr').value=='0' || document.getElementById('combo_aptarr').value=='-- Destino --'){
						     txterr+='- Debe introducir un aeropuerto de destino '+ ' \n';					    
					}
				  //if(c1.date.print("%d/%m/%Y")==''){
					//	     txterr+='- Debe introducir una fecha de ida'+ ' \n';
				  //}
				  if (txterr!=''){
						   alert(txterr);
		   				  return 0;
					}   
				  changeVisibility('idCont3pasos','hide');		
				  changeVisibility('idCont','hide');
				  changeVisibility('idCont_central','hide');
				  changeVisibility('ifHalcon','show');				
          changeVisibility('barcelo','hide');	               		
				  fov.p_vueloIdaVuelta.value="SI";
			    fov.p_vueloOrigen.value=document.getElementById('combo_aptdep').value;				
				  fov.p_descripcionOrigen.value=document.getElementById('combo_aptdep').options[document.getElementById('combo_aptdep').selectedIndex].text;
				  fov.p_vueloDestino.value=v_vueloDestino;
				  fov.p_descripcionDestino.value=document.getElementById('combo_aptarr').options[document.getElementById('combo_aptarr').selectedIndex].text;
				  fov.p_vueloFechaIda.value=b_fecha_1;//c1.date.print("%d/%m/%Y");
				  fov.p_vueloFechaVuelta.value=b_fecha_2;//c2.date.print("%d/%m/%Y");
		      fov.p_vueloNumAdultos.value=document.getElementById('comboadl').value;
				  fov.p_vueloNumNinos.value=document.getElementById('combochd').value;
				  fov.p_vueloNumBebes.value=document.getElementById('comboinf').value;
				  fov.p_vueloCodCia.value=v_dispoCia;
				//alert('numbebes'+fov.vueloNumBebes.value );
          /*
				  alert('DEFAULT LACOMBA RT idavuelta:'+fov.p_vueloIdaVuelta.value+'-'+
				        'vueloorigen:'+fov.p_vueloOrigen.value+
				        'desorigen:'+fov.p_descripcionOrigen.value+'-'+
				        'vuelodestino:'+fov.p_vueloDestino.value+'-'+
				        'descdestino'+ fov.p_descripcionDestino.value+'-'+
				        'fechaida:'+fov.p_vueloFechaIda.value+'-'+
				        'fechavuelta'+fov.p_vueloFechaVuelta.value+'-'+
				        'nuamdl:'+fov.p_vueloNumAdultos.value+'-'+
				        'numninos'+fov.p_vueloNumNinos.value+'-'+
				        'numbebes'+fov.p_vueloNumBebes.value);				
          */
		      	  fov.submit();
	    	} else{
				 if(document.getElementById('combo_aptdep').value=='' || document.getElementById('combo_aptdep').value=='0')
					{
						    txterr='- Debe introducir un aeropuerto de origen'+ ' \n';					   
					}
					if (document.getElementById('combo_aptarr').value=='' || document.getElementById('combo_aptarr').value=='0'|| document.getElementById('combo_aptarr').value=='-- Destino --')
					{
						     txterr+='- Debe introducir un aeropuerto de destino'+ ' \n';					    
					}
					if(c1.date.print("%d/%m/%Y")=='')
					{
						     txterr+='- Debe introducir una fecha de ida'+ ' \n';
				  	}
					if (txterr!=''){
					   alert(txterr);
		   				  return 0;
					}  
				  changeVisibility('idCont3pasos','hide');		
				  changeVisibility('idCont','hide');
				  changeVisibility('idCont_central','hide');
				  changeVisibility('ifHalcon','show');
          changeVisibility('barcelo','hide');					  
          foi.p_vueloIdaVuelta.value="NO";
          foi.p_vueloSoloIda.value="SI";	
          foi.p_vueloOrigen.value=document.getElementById('combo_aptdep').value;
          foi.p_descripcionOrigen.value=document.getElementById('combo_aptdep').options[document.getElementById('combo_aptdep').selectedIndex].text;
          foi.p_vueloDestino.value=v_vueloDestino;
          foi.p_descripcionDestino.value=document.getElementById('combo_aptarr').options[document.getElementById('combo_aptarr').selectedIndex].text;
          foi.p_vueloFechaIda.value=b_fecha_1;//c1.date.print("%d/%m/%Y");
          foi.p_vueloNumAdultos.value=document.getElementById('comboadl').value;
          foi.p_vueloNumNinos.value=document.getElementById('combochd').value;
          foi.p_vueloNumBebes.value=document.getElementById('comboinf').value;			
          foi.p_vueloCodCia.value=v_dispoCia;
          /*
				  alert('DEFAULT LACOMBA OW idavuelta:'+fov.p_vueloIdaVuelta.value+'-'+
				        'vueloorigen:'+fov.p_vueloOrigen.value+
				        'desorigen:'+fov.p_descripcionOrigen.value+'-'+
				        'vuelodestino:'+fov.p_vueloDestino.value+'-'+
				        'descdestino'+ fov.p_descripcionDestino.value+'-'+
				        'fechaida:'+fov.p_vueloFechaIda.value+'-'+
				        'fechavuelta'+fov.p_vueloFechaVuelta.value+'-'+
				        'nuamdl:'+fov.p_vueloNumAdultos.value+'-'+
				        'numninos'+fov.p_vueloNumNinos.value+'-'+
				        'numbebes'+fov.p_vueloNumBebes.value);				
          */
				  // alert('idavuelta:'+foi.vueloIdaVuelta.value+'-'+'ida:'+foi.vueloSoloIda.value+'-'+'vueloorigen:'+foi.vueloOrigen.value+'desorigen:'+foi.descripcionOrigen.value+'-'+'vuelodestino:'+foi.vueloDestino.value+'-'+'descdestino'+ foi.descripcionDestino.value+'-'+'fechaida:'+foi.vueloFechaIda.value+'-'+'nuamdl:'+foi.vueloNumAdultos.value+'-'+'numninos'+foi.vueloNumNinos.value+'-'+'numbebes'+foi.vueloNumBebes.value);
     	    foi.submit(); 				  
		    }
		 } 
		//***************************************************************************************************************************************  
	
				function cambia_tiptra(){ 
			//lanzado en cada click de cambio de tipo de billete (i/v y tur/bus) 
			v_swida  = radio_button_checker('document.foTiptra.rbtn_tiptra');
			v_swidah = radio_button_checker('document.foTiptraH.rbtn_tiptra');
			resetAtps();
			resetAll();
      //
			 if (document.getElementById('divTiptra').style.display=="inline"){
				if (v_swida == 'RT'){	//oculta o visualiza el calendario en el cambio de tipo de trayecto (y datos dependientes)
					writeObj(cabeceraVtaTxt,'cabeceraVta'); //mostramos el texto de menu derecha relacionado con vuelta
					setClassName('calendarcontainer_rt', 'cont_cal');
				}else{						
					writeObj('','cabeceraVta');				//borramos dicho texto (nada depende de el) solo visualizacion
					setClassName('calendarcontainer_rt', 'cont_cal_oneway');
				}
			}else{
			     if (v_swidah == 'RT'){	//oculta o visualiza el calendario en el cambio de tipo de trayecto (y datos dependientes)
					writeObj(cabeceraVtaTxt,'cabeceraVta'); //mostramos el texto de menu derecha relacionado con vuelta
					setClassName('calendarcontainer_rt', 'cont_cal');
				}else{						
					writeObj('','cabeceraVta');				//borramos dicho texto (nada depende de el) solo visualizacion
					setClassName('calendarcontainer_rt', 'cont_cal_oneway');
			       }
				}  
			}
		
			function Cambiavuelo(){
			  if (document.getElementById('divTiptra').style.display=="inline"){
			  document.getElementById('divTiptra').style.display="none"; 
			  document.getElementById('divTiptraH').style.display="inline";	
			  document.getElementById('publibannerH').style.display="inline";
			  document.getElementById('publibanner').style.display="none";
			  changeVisibility('expl_paso2AEA','hide');
			  changeVisibility('expl_paso2H','show');
			  //alert(document.foTiptra.rbtn_rt.value);
			  document.foTiptra.rbtn_rt.checked=true;
			  cambia_tiptra();
			  resetAll();
			  resetAtps();
		      fLimpiarVueloIda();
		      fLimpiarVueloVta();
			  return 0;
			  }
			  if(document.getElementById('divTiptraH').style.display=="inline"){		  		
			     document.getElementById('divTiptraH').style.display="none";
				 document.getElementById('divTiptra').style.display="inline";	
	             document.getElementById('publibannerH').style.display="none"; 			 
				 document.getElementById('publibanner').style.display="inline"; 
				 changeVisibility('expl_paso2H','hide');
				 changeVisibility('expl_paso2AEA','show');
				 //alert(document.foTiptraH.rbtn_rth.value);
				 document.foTiptraH.rbtn_rth.checked=true;
				 cambia_tiptra();
	             resetAll(); 			
				 resetAtps();
		         fLimpiarVueloIda();
		         fLimpiarVueloVta();
			    }
			}	


		function resetAll(){
			/*borra todo el contenido de la pantalla visualizado por el usuario 
			(en todo momento existen dichos objetos en el arbol DOM de la pagina)
			asi como variables js internas que se mantienen en todo momento		*/
			v_tarificacionRT ='N';//suponemos este valor de ante mano
			arr_Precios1=new Array();			arr_Precios2=new Array();
			c1.refresh();						c2.refresh();
			changeVisibility('loadingIda','hide');
			changeVisibility('loadingVta','hide');
			changeVisibility('notatiptar','hide');
			changeVisibility('notatiprt','hide');
			changeVisibility('tarifasabado','hide'); //RAFA: añadida nueva nota en la página principal
			writeObj('','infoPuntos');
			ptos_vta = 0;
			ptos_ida = 0;
			writeObj('','infoCoste');
			writeObj('','infoCosteResi');			
			writeObj('','infoAptIda');			writeObj('','infoDateIda');			writeObj('','infoTimIda');
			writeObj('','infoAptVta');			writeObj('','infoDateVta');			writeObj('','infoTimVta');			
			writeObj('','descripTraIda');		writeObj('','descripTraVta');					
			writeObj('','dispoBox1');			writeObj('','dispoBox2');	
			document.getElementById('codbloqvta').value='';
			document.getElementById('codbloqida').value='';
			document.getElementById('dispoBox1').style.height='0px';
			document.getElementById('dispoBox2').style.height='0px';
			writeObj('','plazasida');			writeObj('','plazasvta');			
			writeObj('','plazasnota');
			l_impbaseida = 0;					l_imptaxida	 = 0;						
			l_impbasevta = 0;					l_imptaxvta	 = 0;
			l_impfee	 = 0;					l_coddiv	 = '';
			l_imptaxtotal=0;					l_imptotal=0;
			//reset de selecciones
			document.foBloqVuelos.p_numpaxadl.value='';
			document.foBloqVuelos.p_numpaxchd.value='';
			document.foBloqVuelos.p_numpaxinf.value='';
			julian_timida ='';
			julian_timvta ='';
			ofe_ida ='';
			ofe_vta ='';
		}

		function resetCombo(){
			/*borra todo el contenido de la pantalla visualizado por el usuario 
			(en todo momento existen dichos objetos en el arbol DOM de la pagina)
			asi como variables js internas que se mantienen en todo momento		*/
			v_tarificacionRT ='N';//suponemos este valor de ante mano
			arr_Precios1=new Array();			arr_Precios2=new Array();
			c1.refresh();						c2.refresh();
			writeObj('','infoPuntos');
			ptos_vta = 0;
			ptos_ida = 0;
			writeObj('','infoCoste');
			writeObj('','infoCosteResi');			
			writeObj('','infoAptIda');			writeObj('','infoDateIda');			writeObj('','infoTimIda');
			writeObj('','infoAptVta');			writeObj('','infoDateVta');			writeObj('','infoTimVta');			
			writeObj('','descripTraIda');		writeObj('','descripTraVta');					
			writeObj('','dispoBox1');			writeObj('','dispoBox2');	
			document.getElementById('codbloqvta').value='';
			document.getElementById('codbloqida').value='';
			document.getElementById('dispoBox1').style.height='0px';
			document.getElementById('dispoBox2').style.height='0px';
			writeObj('','plazasida');			writeObj('','plazasvta');			
			writeObj('','plazasnota');
			l_impbaseida = 0;					l_imptaxida	 = 0;						
			l_impbasevta = 0;					l_imptaxvta	 = 0;
			l_impfee	 = 0;					l_coddiv	 = '';
			l_imptaxtotal=0;					l_imptotal=0;
			//reset de selecciones
			document.foBloqVuelos.p_numpaxadl.value='';
			document.foBloqVuelos.p_numpaxchd.value='';
			document.foBloqVuelos.p_numpaxinf.value='';
			julian_timida ='';
			julian_timvta ='';
			ofe_ida ='';
			ofe_vta ='';
		}


		function resetAtps(){
			/*Resetea las opciones elegidas de aeropuertos*/
			document.getElementById('combo_aptdep').selectedIndex = 0;
			document.getElementById('combo_aptarr').options.length = 0;	
			generaOpcionCombo('Seleccione..',0,'combo_aptarr', 0);
			document.getElementById('combo_aptarr').selectedIndex = 0;
      document.getElementById('combotable_input').value = "Escriba o seleccione un origen...";
      document.getElementById('combotable2_input').value = "Escriba o seleccione un destino...";
      document.getElementById('combotable_input').style.color = "gray";
      document.getElementById('combotable2_input').style.color = "gray";
			showInfoPrecioMenu(0);
		}

		function errorDisponibilidad(windowName){			
			if (windowName == 'ifDispoI'){	
				document.getElementById('dispoBox1').style.height='0px'; 
				writeObj('','dispoBox1');		
				changeVisibility('loadingIda','hide');
			}
			if (windowName == 'ifDispoV'){	
				document.getElementById('dispoBox2').style.height='0px';
				writeObj('','dispoBox2');		
				changeVisibility('loadingVta','hide');
			}
			showInfoPrecioMenu(0); //mostramos la publicidad
		}

    function bloquea_reserva(){
      //
	    var v_aptarr = document.getElementById('combo_aptarr').value;
		  v_errtxt='';
	    //	alert('x:'+document.getElementById('divTiptra').style.display);
      //if (document.getElementById('divTiptra').style.display=='inline')
			if ( (document.getElementById('combo_aptarr').value.substr(0,1) != 'O') ||
			     (document.getElementById('combo_aptarr').value.substr(0,1) == 'O') && (v_aptarr.length==3) 
			   )
      {		
				if (v_tarificacionRT == 'N') 
				{
					v_errtxt ='';				
					if (valida_seleccion()== false || valida_horasvuelos() == false){ v_errtxt += '- Verifique los horarios de salida y llegada de los vuelos seleccionados. \n';}				
			    //
					if(v_errtxt!=''){ alert(v_errtxt);return 0;}
					//
					if (v_errtxt == '')
					{
						document.foBloqVuelos.p_numpaxadl.value=document.getElementById('comboadl').value;
						document.foBloqVuelos.p_numpaxchd.value=document.getElementById('combochd').value;
						document.foBloqVuelos.p_numpaxinf.value=document.getElementById('comboinf').value;
						document.foBloqVuelos.p_auxaptdep.value=document.getElementById('combo_aptdep').value;
						document.foBloqVuelos.p_auxaptarr.value=document.getElementById('combo_aptarr').value;
						document.foBloqVuelos.p_auxtipcab.value=radio_button_checker('document.foTiptra.rbtn_tipcab');
						document.foBloqVuelos.p_auxswiv.value  =radio_button_checker('document.foTiptra.rbtn_tiptra');
						document.foBloqVuelos.p_auxfecdep.value=c1.date.print("%d/%m/%Y");
						document.foBloqVuelos.p_auxfecarr.value=c2.date.print("%d/%m/%Y");
						document.foBloqVuelos.xsid.value = document.foLogin.xsid.value;
						
						/*	document.foBloqVuelos.p_codtraida.value='0';document.foBloqVuelos.p_codtravta.value='0';*/
						//trayectos solicitados ya insertados					
						if (valida_ofertas()==false)
						{
							if (confirm('Uno de sus vuelos seleccionados no cumple con las condiciones de la oferta.\n ¿Desea continuar sin aplicar la oferta ?'))
							{		
								document.foBloqVuelos.submit();			
							}
						}
						else
						{	
							document.foBloqVuelos.submit();			
						}					
					} 
					else 
					{ 
						alert(v_errtxt);
					}
				} 
				else 
				{
					document.foDispoRT.p_fecdep.value=c1.date.print("%d/%m/%Y");
					document.foDispoRT.p_fecarr.value=c2.date.print("%d/%m/%Y");
					document.foDispoRT.p_numpaxadl.value=document.getElementById('comboadl').value;
					document.foDispoRT.p_numpaxchd.value=document.getElementById('combochd').value;
					document.foDispoRT.p_numpaxinf.value=document.getElementById('comboinf').value;
					document.foDispoRT.p_auxaptdep.value=document.getElementById('combo_aptdep').value;
					document.foDispoRT.p_auxaptarr.value=document.getElementById('combo_aptarr').value;
					document.foDispoRT.p_auxtipcab.value=radio_button_checker('document.foTiptra.rbtn_tipcab');
					document.foDispoRT.p_auxswiv.value  =radio_button_checker('document.foTiptra.rbtn_tiptra');
					document.foDispoRT.xsid.value = document.foLogin.xsid.value;				
					document.foDispoRT.submit();								
					document.getElementById('bloqSub').style.display='none';
					writeObj(searchMsgBloq,'bloqLoad');						
				}
	  	}
	  	else
	  	{
		    enviaPeticionHalcon();
		  }
		}
		//-------------
		function fallobloqueoOW(){
			// 1. Limpiamos las listas de disponibilidades
			 fLimpiarListas(); 
		  
			//lanzamos las peticiones de disponibilidad la IDA
			enviaPeticionDispo('ida');
			
			// Si estabamos buscando IDA+VUELTA, entonces lanzamos la petición de disponibilidad también para la vuelta
			if (radio_button_checker('document.foTiptra.rbtn_tiptra') == 'RT'){							
			    enviaPeticionDispo('vta');
			}
		}

		function cambiaIdioma(valor) {	
			document.foSesionParam.xsid.value=document.foLogin.xsid.value;
			document.foSesionParam.p_codmer.value=valor;
			document.foSesionParam.p_codidi.value=valor;
			document.foSesionParam.submit();
		}

		
		
		function init_default(){		
			/*Lanzado al cargar la pagina*/
			// COOKIES : PAIS E IDIOMA
			var l_entro = "0";
		  var fechaExp = new Date();			// Estable una fecha desde la cual se va a calcular la fecha final para la caducidad de la cookie 
	    fechaExp.setTime(calculaFechaExpiracion());
	    // Comprobamos si tenemos creado una cookie para el idioma 
      if (leerCookie(seleccion) == null) {
      //if (leerCookie(selecIdi) == null) {
        l_entro = "1";
        cargaPaises('combo_aptpai');	// Cargamos el combo de paises
      } else {
        actualizarCookie(seleccion, leerCookie(seleccion), fechaExp, "/");
        //actualizarCookie(selecIdi, leerCookie(selecIdi), fechaExp, "/");
        l_cadena = leerCookie(seleccion).split("@");
        if (l_cadena[0]=="0") {
        //if ((leerCookie(selecEnt)==null) || (leerCookie(selecEnt)=="0")) {
          l_entro = "1";
          l_cookie = "1@"+l_cadena[1]+"@"+l_cadena[2]+"@"+l_cadena[3]+"@"+l_cadena[4];
          establecerCookie(seleccion ,l_cookie, fechaExp,"/");
          //establecerCookie(selecEnt ,"1", fechaExp);
  		    cargaPaises('combo_aptpai');
          document.getElementById('combo_aptpai').value=l_cadena[1].substring(0,2);
          //document.getElementById('combo_aptpai').value=leerCookie(selecIdi).substring(0,2);
          cargaIdiomas('combo_aptpai','combo_aptidi');
          document.getElementById('combo_aptidi').value=l_cadena[1].substring(3,5);
  		    //document.getElementById('combo_aptidi').value=leerCookie(selecIdi).substring(3,5);
        } else {
          if (l_cadena[0]=="1") {
          //if (leerCookie(selecEnt)=="1") {
            l_cookie = "0@"+l_cadena[1]+"@"+l_cadena[2]+"@"+l_cadena[3]+"@"+l_cadena[4];
            establecerCookie(seleccion ,l_cookie, fechaExp,"/");
            //establecerCookie(selecEnt ,"0", fechaExp);
            l_idi = leerCookie(seleccion).split("@");
            l_dat = l_idi[1].split("-");
            cargaHomeCookie(l_dat[0]+"/"+l_dat[1]);
          }
        }
      }
      if (l_entro=="1") {
			  fun_ready();
			  //cargaOrigenes('combo_aptdep');						//cargamos el combo de ida
			  Date.prototype.addDays = function(days) {			// Añadimos un método al objeto JS estándar date
				  msecInDay=1000*60*60*24;
				  days=days*msecInDay;
				  this.setTime(this.getTime()+days);
			  }
			  d1 = new Date();			// inicializamos las fechas del calendario y la diferencia entre ellas
			  d1.addDays(0);
			  d2 = new Date();
			  d2.addDays(0);
			  var datediff = d2.getTime() - d1.getTime();
			  set_calendarIda();//creamos calendario de ida
			  set_calendarVta();//creamos calendario de vta
			  resetAll();		  //borramos contenido
			  generaCombosPax();//inicializamos los combos de pasajeros al cargar, para poder continuar la ejecucion en RTs
			  //init_page();      //carga la combo de los paises
			  //document.foDatosSesion.submit();
			}
		}

		function verLogin(){
			generaOverWinSize('Login','Cerrar',document.getElementById('textoLogin').innerHTML,'centinela','480','100',100,200);
		}
		/*function setIdses(valor){
		    parent.document.foLogin.xsid.value = valor;
		}*/

		//----------------VICKY: 26/06/06---------------------------------------
		// verNota(id,nota):
		// nota--> nombre del div.
		// id=0 then -->Oculta.
		// id=1 then -->Muestra.
		//----------------------------------------------------------------------
		function verNota(id,nota){
			if (id==1){
				changeVisibility(nota,'show');				
			}else{
				changeVisibility(nota,'hide');
			}
		}
		
		// inicio eladio
		function init_page() {
	    cargaPaises('combo_aptpai');	// Cargamos el combo de paises
		}
    
		function cargaHome(paisId, idiomaId){
		  var fechaExp = new Date();			// Estable una fecha desde la cual se va a calcular la fecha final para la caducidad de la cookie
      fechaExp.setTime(calculaFechaExpiracion());
		  var aptIdi=document.getElementById(idiomaId).value;
		  var aptPai=document.getElementById(paisId).value;
		  document.foDatosSesion.p_codidi.value=aptIdi;
		  document.foDatosSesion.p_codmer.value=aptPai;
		  if(aptPai!='0' && aptIdi!='0'){
		    l_cadena = leerCookie(seleccion);
		    if ((l_cadena!=null) && (l_cadena!="")) {
		      l_cadena = l_cadena.split("@");
		      l_cookie = "0@"+aptPai+"-"+aptIdi+"@"+l_cadena[2]+"@"+l_cadena[3]+"@"+l_cadena[4];
		      establecerCookie(seleccion ,l_cookie, fechaExp,"/");
		      //establecerCookie(selecIdi ,aptPai+"/"+aptIdi, fechaExp,"/");
  			  //establecerCookie(selecEnt ,"0", fechaExp); 
        } else {
          l_cookie = "0@"+aptPai+"-"+aptIdi+"@@@";
          establecerCookie(seleccion,l_cookie,fechaExp,"/");
        }
			  document.foDatosSesion.submit();
		  }else{
			  alert('Por favor, especifique el país y/o el idioma.');
		  }
		}

    function cargaPaises(comboId){
			var posCombo = 0;
			var txt = '';
			var value = '';
			//borramos contenido
			document.getElementById(comboId).options.length = 0;			
			//añadimos un elemento centinela ?->	
			generaOpcionCombo('...',0,comboId, 0);				
			for(pai in paises)
			{
				posCombo++;
				txt=paises[pai];
				generaOpcionComboPaises(txt, short_paises[pai], comboId, posCombo);
			}
		}
		
		function generaOpcionCombo(txt,value,idCombo,pos) {
    	oOption = document.createElement("OPTION");
    	oOption.text = txt;
    	oOption.value = value;
    	//asi se puede acceder al browser que sea
    	if (value=='ES'){
    		oOption.selected = "Español";
    	}
    	document.getElementById(idCombo).options[pos] = oOption;
    }
    
    // Genera las opciones para el combobox de paises dejando seleccionado por defecto el España
    function generaOpcionComboPaises(txt,value,idCombo,pos) {
    	oOption = document.createElement("OPTION");
    	oOption.text = txt;
    	oOption.value = value;
    	document.getElementById(idCombo).options[pos] = oOption;
    }
    
		// fin eladio
	function fRestarFechas(diamesano1,diamesano2){
      var ano1;
      var mes1;
      var dia1;
      var ano2;
      var mes2;
      var dia2;
      var resta;

      if (diamesano1 != '' && diamesano2 != ''){             		
        ano1 = diamesano1.substr(6,4);
        mes1 = diamesano1.substr(3,2);
        dia1 = diamesano1.substr(0,2);
        ano2 = diamesano2.substr(6,4);
        mes2 = diamesano2.substr(3,2);
        dia2 = diamesano2.substr(0,2);
        		  
        fecha1=new Date(ano1,mes1-1,dia1);
        fecha2=new Date(ano2,mes2-1,dia2);
		resta = (fecha2-fecha1)/1000/3600/24;                              
      } else {
        resta = -1;
      }
      return resta;  
    }    
//    
	function fExisteFinde(diamesano1,diamesano2) {
		var ano1;
		var mes1;
		var dia1;
		var ano2;
		var mes2;
		var dia2;
		var f1;
		var f2;
		var l_dif1;
		var l_dif2;	
		
		if (diamesano1 != '' && diamesano2 != ''){ 
			mes1 = diamesano1.substr(3,2);
			dia1 = diamesano1.substr(0,2);
			ano1 = diamesano1.substr(6,4);	  
    		dia2 = diamesano2.substr(0,2);
			mes2 = diamesano2.substr(3,2);
			ano2 = diamesano2.substr(6,4);
			f1=new Date(ano1,mes1-1,dia1);
			f2=new Date(ano2,mes2-1,dia2);
			l_dif1= (f2-f1)/1000/3600/24;
			l_dif2 =(l_dif1/7);
			if (l_dif2>=1){
				return true;
			}else{
				dia1=f1.getDay();
				dia2=f2.getDay();
				if (dia2 < dia1){
					return true;
				}else{
					return false;
				}
			}
		 }else{
		  return false;
		 }  
  }
//     
  function mostrar_api(p_mostrar) {
    if (p_mostrar=='S') {
      changeVisibility('cab_1','hide');
      changeVisibility('cuerpo_res','hide');
      changeVisibility('pie_1','hide');
      changeVisibility('tarifasabado','hide');
      changeVisibility('bot_res','hide');
      cargaFecha(document.getElementById('B_DIA_1'),document.getElementById('B_DIA_2'),document.getElementById('B_MES_1'),document.getElementById('B_MES_2'));
      changeVisibility('cuerpo_api_ama','show');
      changeVisibility('bot_api','show');
      document.getElementById('id_oculto').style.height = '240px';
      if ((document.getElementById('combo_aptarr').value.substr(0,1)) == 'O') {
        document.foTiptra.rbtn_tipcab[0].disabled="true";
        document.foTiptra.rbtn_tipcab[1].disabled="true";
      } else {
        document.foTiptra.rbtn_tipcab[0].removeAttribute("disabled");
        document.foTiptra.rbtn_tipcab[1].removeAttribute("disabled");
      }
    } else {
      changeVisibility('dtores','hide');
      changeVisibility('cab_1','show');
      changeVisibility('cuerpo_res','show');
      changeVisibility('pie_1','show');
      changeVisibility('bot_res','show');
      changeVisibility('cuerpo_api_ama','hide');
      changeVisibility('bot_api','hide');
      document.getElementById('id_oculto').style.height = '0px';
      document.foTiptra.rbtn_tipcab[0].removeAttribute("disabled");
      document.foTiptra.rbtn_tipcab[1].removeAttribute("disabled");
    }
    resetAll();
		v_swida  = radio_button_checker('document.foTiptra.rbtn_tiptra');
		v_tipcab = radio_button_checker('document.foTiptra.rbtn_tipcab');
		v_aptdep = document.getElementById('combo_aptdep').value;
		v_aptarr = document.getElementById('combo_aptarr').value;			
		var descAptDep = getAptName(v_aptdep);
		var descAptArr = getAptName(v_aptarr);			
		// creamos el trayecto en el menu derecha
		var txtIda = '<span class="destacado">Ida: </span><strong>'+descAptDep+' > '+descAptArr+'</strong>'
		var txtVta = '<span class="destacado">Vuelta: </span><strong>'+descAptArr+' > '+descAptDep+'</strong>'
		writeObj(txtIda,'descripTraIda');
		if (v_swida == 'RT'){	
      writeObj(txtVta,'descripTraVta');
      //document.objForm.TRIP_TYPE.value = 'R';
		}else{					
      writeObj('<br/> ','descripTraVta');
      //document.objForm.TRIP_TYPE.value = 'O';
		}
		if (v_aptarr.length==4){
		  v_aptarr=v_aptarr.substring(1,4);
		  setInfoApts(v_aptdep,v_aptarr,descAptDep,descAptArr,v_swida);			//mostramos la primera fase de menu
		  showInfoPrecioMenu(1);
    }
    //if (v_tipcab=='TUR') {
    //  document.objForm.CABIN.value = 'E';
    //} else {
    //  document.objForm.CABIN.value = 'B';
    //}
	
  }

  function empezar_reserva_api() {
    changeVisibility('idCont3pasos','hide');
    changeVisibility('idCont','hide');
    changeVisibility('idCont_central','hide');
	  changeVisibility('barcelo','hide');
   	changeVisibility('pie','hide');
   	changeVisibility('menu_inf','hide');
    changeVisibility('loadingapi','show');
    changeVisibility('if_api_ama','show');
   	
  }
//	</script>

  // FUNCIONES COOKIES:
  //-----------------------------------
  
  // Funcion que se encargara de calcular una fecha de expiracion 4 meses despues de la fecha actual
  function calculaFechaExpiracion(){
	 var fechaAct= new Date();	// Establece una fecha desde la cual se va a calcular la fecha final para la caducidad de la cookie
	 var MSxDia=24*60*60*1000;	// Cantidad de milisegundos que tiene un dia
	 var fechaFin = new Date(fechaAct.getTime()+MSxDia*120);	// 
	 return fechaFin;
  }
  
  // Lee el contenido de una cookie para posteriormente, realizar las gestiones pertinentes
  function leerCookie(name){
    var cname = name + "=";               
    var dc = document.cookie;             
    if (dc.length > 0) {              
      begin = dc.indexOf(cname);       
      if (begin != -1) {           
        begin += cname.length;       
        end = dc.indexOf(";", begin);
        if (end == -1) end = dc.length;
          return unescape(dc.substring(begin, end));
      } 
    }
    return null;
  }
  
  // Crea una cooki en funcion de la seleccion del usuarios respecto al idioma y el pais
  // para que el navegador se acuerde en ocasiones venideras, de dicha seleccion.
  function establecerCookie (name, value, expires, path, domain, secure){
    document.cookie = name + "=" + escape(value) + 
    ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    ((secure == null) ? "" : "; secure");
  }

  function actualizarCookie (name, value, expires, path, domain, secure){
    //alert('actualizarCookie -> '+value);
    document.cookie = name + "=" + escape(value) + 
    ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    ((secure == null) ? "" : "; secure");
  }

  function borrarCookie (name,path,domain) {
    //if (getCookie(name)) {
      document.cookie = name + "=" +
      ((path == null) ? "" : "; path=" + path) +
      ((domain == null) ? "" : "; domain=" + domain) +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    //}
  }
  
  //Funcion cargaHomeCookie
  function cargaHomeCookie(redireccion){
	if (redireccion=='BR/ES'||redireccion=='BR/BR'||redireccion=='AR/ES'||redireccion=='AR/EN'||redireccion=='DO/EN'||redireccion=='DO/ES'||redireccion=='VE/EN'||redireccion=='VE/ES'||redireccion=='MX/EN'||redireccion=='MX/ES'||redireccion=='US/ES'||redireccion=='US/EN'||redireccion=='PT/ES'||redireccion=='PT/PT'||redireccion=='PE/ES'||redireccion=='PE/EN'){
		if (redireccion=='BR/ES'){
			document.foDatosSesion.p_codmer.value='BR';
			document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='BR/EN'){
			document.foDatosSesion.p_codmer.value='BR';
			document.foDatosSesion.p_codidi.value='BR';
		}else if (redireccion=='AR/ES'){
			document.foDatosSesion.p_codmer.value='AR';
			document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='AR/EN'){
			document.foDatosSesion.p_codmer.value='AR';
			document.foDatosSesion.p_codidi.value='EN';
		}else if (redireccion=='VE/ES'){
			document.foDatosSesion.p_codmer.value='DO';
			document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='DO/RN'){
			document.foDatosSesion.p_codmer.value='DO';
			document.foDatosSesion.p_codidi.value='EN';
		}else if (redireccion=='DO/ES'){
			document.foDatosSesion.p_codmer.value='MX';
			document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='VE/EN'){
			document.foDatosSesion.p_codmer.value='MX';
			document.foDatosSesion.p_codidi.value='EN';
		}else if (redireccion=='MX/ES'){
			document.foDatosSesion.p_codmer.value='VE';
			document.foDatosSesion.p_codidi.value='EN';
		}else if (redireccion=='MX/EN'){
			document.foDatosSesion.p_codmer.value='VE';
			document.foDatosSesion.p_codidi.value='EN';
		}else if (redireccion=='US/ES'){
			document.foDatosSesion.p_codmer.value='US';
			document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='US/EN'){
			document.foDatosSesion.p_codmer.value='US';
			document.foDatosSesion.p_codidi.value='EN';
		}else if (redireccion=='UK/ES'){
			 document.foDatosSesion.p_codmer.value='UK';
			 document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='UK/EN'){
			 document.foDatosSesion.p_codmer.value='UK';
			 document.foDatosSesion.p_codidi.value='EN';
    }else if (redireccion=='PT/ES'){
			document.foDatosSesion.p_codmer.value='PT';
			document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='PT/PT'){
			document.foDatosSesion.p_codmer.value='PT';
			document.foDatosSesion.p_codidi.value='PT';
		}else if (redireccion=='PE/ES'){
			 document.foDatosSesion.p_codmer.value='PE';
			 document.foDatosSesion.p_codidi.value='ES';
		}else if (redireccion=='PE/EN'){
			 document.foDatosSesion.p_codmer.value='PE';
			 document.foDatosSesion.p_codidi.value='EN';
    }
		if (redireccion=='US/ES'|| redireccion=='US/EN' || redireccion=='UK/ES'|| redireccion=='UK/EN'|| redireccion=='PT/ES'|| redireccion=='PT/PT'||redireccion=='PE/ES'||redireccion=='PE/EN')
    {
    redireccion=redireccion.toLowerCase();
		document.location="http://www.aireuropa.com/"+redireccion+"/default.html";
    }else{
		redireccion=redireccion.toLowerCase();
		document.location="http://www.aireuropa.com/"+redireccion+"/default_amadeus.html";
	  }
	}else{
		if (redireccion=='ES/ES'){
			document.foDatosSesion.p_codmer.value='ES';
			document.foDatosSesion.p_codidi.value='ES';
      document.location.href="http://www.aireuropa.com/es/default.html";
		}else if (redireccion=='ES/EN'){
			document.foDatosSesion.p_codmer.value='ES';
			document.foDatosSesion.p_codidi.value='EN';
			document.location="http://www.aireuropa.com/en/default.html";			
		}else if (redireccion=='ES/CA'){
			document.foDatosSesion.p_codmer.value='ES';
			document.foDatosSesion.p_codidi.value='CA';
			document.location="http://www.aireuropa.com/ca/default.html";
		}else if (redireccion=='FR/FR'){
			document.foDatosSesion.p_codmer.value='FR';
			document.foDatosSesion.p_codidi.value='FR';
			document.location="http://www.aireuropa.com/fr/default.html";
		}else if (redireccion=='FR/ES'){
			document.foDatosSesion.p_codmer.value='FR';
			document.foDatosSesion.p_codidi.value='FR';
			document.location="http://www.aireuropa.com/es/default.html";
		}else if (redireccion=='IT/IT'){
			document.foDatosSesion.p_codmer.value='IT';
			document.foDatosSesion.p_codidi.value='IT';
			document.location="http://www.aireuropa.com/it/default.html";
		}else if (redireccion=='IT/ES'){
			document.foDatosSesion.p_codmer.value='IT';
			document.foDatosSesion.p_codidi.value='ES';
			document.location="http://www.aireuropa.com/es/default.html";
		}else if (redireccion=='OT/EN'){
			document.foDatosSesion.p_codmer.value='OT';
			document.foDatosSesion.p_codidi.value='EN';
			document.location="http://www.aireuropa.com/en/default.html";
		}else{
			document.foDatosSesion.p_codmer.value='OT';
			document.foDatosSesion.p_codidi.value='ES';
			document.location="http://www.aireuropa.com/es/default.html";
		}
	 }
  }

function cargar_trayecto() {
  l_cadena = leerCookie(seleccion);
  if (l_cadena != null) {
    l_cadena = l_cadena.split("@");
    if (l_cadena[0]=="1") {
      if (l_cadena[2]!="") {
        l_tray = l_cadena[2].split("-");
        if (l_cadena[3]=='RT') {
          document.foTiptra.rbtn_tiptra[0].checked=true;
        } else {
          document.foTiptra.rbtn_tiptra[1].checked=true;
        }
        if (l_cadena[4]=='TUR') {
          document.foTiptra.rbtn_tipcab[0].checked=true;
        } else {
          document.foTiptra.rbtn_tipcab[1].checked=true;
        }
        cambia_tiptra();
        document.getElementById('combo_aptdep').value=l_tray[0];//.substring(0,3);
   		  document.getElementById('combotable_input').style.color = "#000000";
   		  document.getElementById('combotable_input').value=parent.getAptName(l_tray[0]);//l_tray.substring(0,3));
   		  document.getElementById('cod_or').innerHTML=l_tray;//.substring(0,3);
   		  cargaDestinos('combo_aptdep','combo_aptarr');
   		  rellenaDestino();
       		
        document.getElementById('combo_aptarr').value=l_tray[1];//.substring(4,7);
   		  document.getElementById('combotable2_input').style.color = "#000000";
   		  document.getElementById('combotable2_input').value=getAptName(l_tray[1]);//l_tray.substring(4,7));
        document.getElementById('cod_des').innerHTML=l_tray[1];//.substring(4,7);

        resetAll();
   		  fLimpiarVueloIda();
   		  fLimpiarVueloVta();
   		  if (l_tray[1].length>=4) {
   		    mostrar_api('S');
   		    // Check de descuento de Residente Marca Blanca Amadeus.
   		    if (document.getElementById('combo_aptarr').value.substr(0,1) == 'A'){
   		    // Tratamos destino para controlar los valores enviados en el parámetro
		        var ori =    new RegExp(document.getElementById('combo_aptdep').value);
		        var dest_aux = document.getElementById('combo_aptarr').value.substr(1,3);
            var dest =   new RegExp(dest_aux);
		        if(ori.test(list_apts_dtores)|| dest.test(list_apts_dtores))
		        {
              changeVisibility('dtores','show');
		        }else{
		          changeVisibility('dtores','hide');
            }
          }else{
          changeVisibility('dtores','hide');
          }
   		    if (l_cadena[3]=='RT') {
   		      document.getElementById('B_DIA_2').disabled = false;
			      document.getElementById('B_MES_2').disabled = false;
          } else {
            document.getElementById('B_DIA_2').disabled = true;
			      document.getElementById('B_MES_2').disabled = true;
          }
          //cargar_dispoH();
        } else {
          mostrar_api('N');
          submit_SearchV3();
        }
      }
    }
  }
}

function cargar_dispo() {
  l_cadena = leerCookie(seleccion).split("@");
  if ((l_cadena[5]!=null) && (l_cadena[5]!="")) {
    c1.dateClicked=true;
    c1.parseDate(l_cadena[5]);
    c1._init2(1,Date.parseDate(l_cadena[5],"%d/%m/%Y"));
    onSelect1('c1',l_cadena[5]);
    if (l_cadena[6]!='') {
      c2.dateClicked=true;
      c2.parseDate(l_cadena[6]);
      c2._init2(1,Date.parseDate(l_cadena[6],"%d/%m/%Y")); 
      onSelect2('c2',l_cadena[6]);
    }
  }
}

function cargar_dispoH() {
  l_cadena = leerCookie(seleccion).split("@");
  if ((l_cadena[5]!=null) && (l_cadena[5]!="")) {
    l_dat = l_cadena[5].split("-");
    document.getElementById('B_DIA_1').value=l_dat[0];
    document.getElementById('B_MES_1').value=l_dat[1];
    if (l_cadena[6]!='') {
      l_dat = l_cadena[6].split("-");
      document.getElementById('B_DIA_2').value=l_dat[0];
      document.getElementById('B_MES_2').value=l_dat[1];
    }
  }
}

/*function guardar_dispoH(){
  var fechaExp = new Date();			// Estable una fecha desde la cual se va a calcular la fecha final para la caducidad de la cookie
	fechaExp.setTime(calculaFechaExpiracion());
  l_cadena = leerCookie(seleccion).split("@");
  if (l_cadena[3]=='RT') {
    l_dispo = document.getElementById('B_DIA_1').value+'-'+document.getElementById('B_MES_1').value+'@'+document.getElementById('B_DIA_2').value+'-'+document.getElementById('B_MES_2').value;
  } else {
    l_dispo = document.getElementById('B_DIA_1').value+'-'+document.getElementById('B_MES_1').value+'@';
  }
  l_cookie = l_cadena[0]+'@'+l_cadena[1]+'@'+l_cadena[2]+'@'+l_cadena[3]+'@'+l_cadena[4]+'@'+l_dispo;
  parent.establecerCookie(seleccion ,l_cookie, fechaExp, "/"); 
}*/