	
///  setTimeout(this.getData.bind(this), this.waitAfterInput);
//// setTimeout Method
//// Evaluates an expression after a specified number of milliseconds has elapsed. 
//// setTimeout(,0);	 
//// iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])


//// vCode			Required. Variant that specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed.
//// iMilliSeconds	Required. Integer that specifies the number of milliseconds.
//// sLanguage		Optional. String that specifies one of the following values:
//// 				JScript	Language is JScript.
//// 				VBScript	Language is VBScript.
//// 				JavaScript	Language is JavaScript.

var pIdioma='ING';  //Idioma para cuando no exista el objeto
var pbCiudades;  //Zona de busqueda de Ciudades 0 = Todas
var espacios = '&nbsp;';
var existeArrayFormHTAV = false; var existeArrayFormSAV = false;
var tipConn=0;
function ajEnabledElem(elem,idioma){ 
	idioma = fdic.lang(idioma);
	try {		
		if (elem.disabled) { elem.disabled=false; } 
		if (elem.tagName == "INPUT") {
			var desc = fdic.trad(disLoading,idioma); 		
			desc = (desc.toLowerCase()== elem.value.toLowerCase())? '': elem.value;
			elem.value = desc;
		}
	}catch(ex) { }	
	return {Idioma:idioma};	
}

function New()
	{  //debugger;
		//Valida que arrayForm exista y que tenga valores. SE LLENA EN EL COMPONENTE!!! Ej.: arrayForm[0] = nombre de formulario
		
		//Nota:  Suponemos que 
		//posicion [0] =  Hotel + Avion (Leavingfrom, Ciudades, etc.)
		//posicion [1] =  Solo Avion    por Id (bLeavingfrom, bCiudades, bXXXX, etc...)
		
		var PaqTypeHTAV = "??";  //valor de defualt (No existen)
		var PaqTypeSAV = "??";  //valor de defualt (No existen)		
		var valPaqType = "??";  
		var tempObj;		
		var formNameSAV = "";
		var formNameHTAV ="";
		
		
		//debugger;
		if (ajExistsObj(typeof arrayForm)==true) {
				//Solo Avion			
				if (ajExistsObj(arrayForm[0])==true) {
					PaqTypeSAV = eval("document." + arrayForm[0] + ".PackageType.value"); existeArrayFormSAV = true;
				} 
				//Hotel + Avion	
				if (ajExistsObj(arrayForm[1])==true) {
					PaqTypeHTAV = eval("document." + arrayForm[1] + ".PackageType.value"); existeArrayFormHTAV = true;			
				} 
							
		} else {					
			//Barro los todos los Inputs para Buscar 
			for (var i=0; i<=document.forms.length -1; i++){
				Elementos = document.forms[i];  //.getElementsByTagName("input");
				for (var j=0; j<=Elementos.length-1; j++){
					if (Elementos[j].tagName.toLowerCase() == 'input') {
						if (Elementos[j].name == 'PackageType'){	//Busco PackaType define si (Hotel + Avion | Solo Avion)
							//tomo su valor del elemento
							switch (Elementos[j].value.toUpperCase()) {
								case "SAV":  //solo avion
										PaqTypeSAV = Elementos[j].value; formNameSAV = document.forms[i].name;
										j = Elementos.length-1;								 
										break;
								case "HTAV": //hotel + avion
										PaqTypeHTAV = Elementos[j].value; formNameHTAV = document.forms[i].name; 
										j = Elementos.length-1;
										break;
								default: 
							}									
						}
					}	
				}
			}						
		}		
		
		// ------------------------------------------------------------------------------------------														
		//                              LLENA COMBO DE AEREOPUERTO [ HOTEL + AVION ] leavingFrom
		// ------------------------------------------------------------------------------------------
		
		var CodeAirport; var Leavingfrom; //var ajaxOnA = true;
		
		if (existeArrayFormHTAV && PaqTypeHTAV.toUpperCase() == "HTAV") {			    		    
				    
			CodeAirport = eval("document." + arrayForm[1] + ".CodeAirport");
			Leavingfrom = eval("document." + arrayForm[1] + ".Leavingfrom");
		}
		else if(formNameHTAV != "" && PaqTypeHTAV.toUpperCase() == "HTAV")  {
			CodeAirport = eval("document." + formNameHTAV + ".CodeAirport");
			Leavingfrom = eval("document." + formNameHTAV + ".Leavingfrom");
			
		}else if(PaqTypeHTAV.toUpperCase() == "HTAV"){			
			CodeAirport = document.getElementById("CodeAirport");
			Leavingfrom = document.getElementById("Leavingfrom");
		}       
		if (CodeAirport!= null &&  Leavingfrom != null)	{			
			
			/// instanciamos la variable (x) para porder accesar a la clase AutoCompleteDataTable
			/// pasandole como paramatros nombre el input y TOP de registros.
			///AutoCompleteDataTable("input", 20  )
			
			var rReturn = ajEnabledElem(Leavingfrom,null);
			var pIdioma = rReturn.Idioma;
					
			if (Leavingfrom.tagName == "INPUT"){   //Si es Combo lo saco			
		        //return false;	
		        
					//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax        
					if (Leavingfrom.alt.toLowerCase() == "ajax.off")
						return false;
		       
					var ajaxA = new MS.Web.AutoCompleteDataTable(Leavingfrom, this.count );									
	                var ajaxAFiltroPais = document.getElementById("Pais"); //Pais del Navegador
                    if (ajExistsObj(ajaxAFiltroPais)==false) {
                        ajaxAFiltroPais = document.getElementById("zLeaving");	
                    }                   
					if (ajExistsObj(ajaxAFiltroPais)==true)
						ajaxAFiltroPais = ajaxAFiltroPais.value;
					else	
						ajaxAFiltroPais = '';
						
					/// Funcion que ejecuta el Procedimeinto del lado del servidor		
					ajaxA.getData = function() {	
						this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";						
						AutoComplete.search_airport(this.ele.value, pIdioma, this.count, ajaxAFiltroPais,_ajaxPrintSQL,'sinUSAR1',this.callback.bind(this));
					}
					////despliega la lista de los valores en un div para su visualizacion
					/// se llena tantos Registros encuentre
					ajaxA.getDisplay = function(item,pos){
						var textDisp='';																			
						//Cuando Realmente no hay Datos Mando "??"						
						//Clav_Pais Valores Regreso en Consulta:   
						//				    00 =(No tiene clave de Pais)
						//			    Dif 00 =(Tiene Pais y pone su banderita)
						//				    ?? =(No hay datos (Con Mensaje Personalizado) )
               			if (item != null) {
							if( item.Clav_Pais != "00") {  //Si COD. Pais
								if( item.Clav_Pais == "??") { //No coincidencias (No Resultados)
               						textDisp = (item != null ? item.Airport  : "");
               					}else {													
									if (item.Code.length>3)
										textDisp = (item != null ? item.CityName + " (" + item.Airport + ")" + " (" + item.Code + ") " : "");
									else
										textDisp = (item != null ? item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
								}	
							} else {							
								textDisp = (item != null ?  item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
							}																	
						} else { textDisp = ""; }
						return 	{Text1:(espacios + textDisp),Text2:'',Principal:0};
					}
					ajaxA.getImage = function (item,pos) {
						var Ruta = '';
						//Si Clav_Pais = ??  ó 00  No hay datos o Coincidencias			
						if (item != null)
							if (item.Clav_Pais == "??" || item.Clav_Pais == "00")
								Ruta = '';
							else
								Ruta = '/_lib/vimages/Flags/' + item.Clav_Pais + '.gif';						
						return {Imagen:Ruta,Width:16,Height:11};
					}
					/// obtiene los valores de los dataTable y los almacena el los input		
					ajaxA.getValue = function(item)	{	    
						if (item != null) {
							if (item.Status == SimbDatos) {
								CodeAirport.value = "";  //limpio la variable
								return item.Status;		//Regreso el estatus
							} else {							    
								CodeAirport.value = item.Code; //paso su codigo de aeropuerto
								//Cuando no hay ningun concidencia de Aeropuertos
								if( item.Clav_Pais == "??")
									return (item != null ?  item.Airport: ""); //Mensaje de no datos
								else 
									return (item != null ? item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
							}
						} else {					
							if (this.ele.value != "")
								return ""; //forzo a tomar su propio valor que tenia
							else 
								return SimbDatos;     //forzo que tome Mensaje Inicial										
						}					
					}
			  }  
		}
		
		
		// ------------------------------------------------------------------------------------------														
		//                              LLENA COMBO DE AEREOPUERTO [ SOLO AVION ] leavingFrom
		// ------------------------------------------------------------------------------------------
		
		var bCodeAirport; var bLeavingfrom; //var _ajaxOnA = true;
			 
		if (existeArrayFormSAV && PaqTypeSAV.toUpperCase() == "SAV") {			
			//Solo Avion
			bCodeAirport = eval("document." + arrayForm[0] + ".CodeAirport");
			bLeavingfrom = eval("document." + arrayForm[0] + ".Leavingfrom");					
		}
		else if(formNameSAV != "" && PaqTypeSAV.toUpperCase() == "SAV")  {
			bCodeAirport = eval("document." + formNameSAV + ".CodeAirport");
			bLeavingfrom = eval("document." + formNameSAV + ".Leavingfrom");			
		}else if(PaqTypeSAV.toUpperCase() == "SAV"){			
			bCodeAirport = document.getElementById("bCodeAirport");
			bLeavingfrom = document.getElementById("bLeavingfrom");
		}       
		if (bCodeAirport!= null &&  bLeavingfrom != null)	{				
			///AutoCompleteDataTable("input", 20  )				
			var rReturn = ajEnabledElem(bLeavingfrom,null);
			var pIdioma = rReturn.Idioma;					
			if (bLeavingfrom.tagName == "INPUT"){   //Si es Combo lo saco
		        //return false;			       
					//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax
         			if (bLeavingfrom.alt.toLowerCase() == "ajax.off")
         				return false;			
				
					var _ajaxA = new MS.Web.AutoCompleteDataTable(bLeavingfrom, this.count );									
					var _ajaxAFiltroPais = document.getElementById("zLeaving");	
					if (ajExistsObj(_ajaxAFiltroPais)==true)
						_ajaxAFiltroPais = _ajaxAFiltroPais.value;	 
					else	
						_ajaxAFiltroPais = '';
													
					/// Funcion que ejecuta el Procedimeinto del lado del servidor		
					_ajaxA.getData = function()
					{	
						this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";									
						AutoComplete.search_airport(this.ele.value, pIdioma, this.count, ajaxAFiltroPais,_ajaxPrintSQL,'sinUSAR1',this.callback.bind(this));
												
					}					
					////despliega la lista de los valores en un div para su visualizacion
					_ajaxA.getDisplay = function(item,pos){	 var textDisp='';			
																			
						//Cuando Realmente no hay Datos Mando "??"
						
						//Clav_Pais Valores Regreso en Consulta:   
						//				    00 =(No tiene clave de Pais)
						//			    Dif 00 =(Tiene Pais y pone su banderita)
						//				    ?? =(No hay datos (Con Mensaje Personalizado) )
		               	
               			if (item != null) {                		
							if( item.Clav_Pais != "00") //Si COD. Pais 
							{
								if( item.Clav_Pais == "??") { //No coincidencias (No Resultados)
               						textDisp = (item != null ? item.Airport  : "");
               					}else {													
									if (item.Code.length>3)
										textDisp = (item != null ? item.CityName + " (" + item.Airport + ")" + " (" + item.Code + ") " : "");
									else
										textDisp = (item != null ? item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
								}	
							} else {							
								textDisp = (item != null ?  item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
							}																	
						} else {
							textDisp = "";
						}
						return 	{Text1:(espacios + textDisp),Text2:'',Principal:0};									
					}
					_ajaxA.getImage = function (item,pos){ var Ruta = '';
						//Clav_Pais = ?? ó 00 (No hay datos)			
						if (item != null)
							if (item.Clav_Pais == "??" || item.Clav_Pais == "00")
								Ruta = '';
							else							
								Ruta = '/_lib/vimages/Flags/' + item.Clav_Pais + '.gif';						
						return {Imagen:Ruta,Width:16,Height:11};
					}
					/// obtiene los valores de los dataTable y los almacena el los input		
					_ajaxA.getValue = function(item)	{	    
						if (item != null) {
							if (item.Status == SimbDatos) {
								bCodeAirport.value = "";  //limpio la variable
								return item.Status;		//Regreso el estatus
							} else {							    
								bCodeAirport.value = item.Code; //paso su codigo de aeropuerto
								//Cuando no hay ningun concidencia de Aeropuertos
								if( item.Clav_Pais == "??")
									return (item != null ?  item.Airport: ""); //Mensaje de no datos
								else 
									return (item != null ? item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
							}
						} else {					
							if (this.ele.value != "")
								return ""; //forzo a tomar su propio valor que tenia
							else 
								return SimbDatos;     //forzo que tome Mensaje Inicial										
						}					
					}
			  } 					
		}
		
				
		// ------------------------------------------------------------------------------------------														
		//                              LLENA COMBO DE CIUDADES [ HOTEL + AVION ]  CIUDADES
		// ------------------------------------------------------------------------------------------
		/*
		var Clave_ciudad; var ciudades;	//var ajaxOnB = true;
							
		//Pregunto Existela varible ARRAY en el HTML		
		if (existeArrayFormHTAV && PaqTypeHTAV.toUpperCase() == "HTAV") {
			Clave_ciudad = eval("document." + arrayForm[1] + ".Clav_Ciudad");
			ciudades = eval("document." + arrayForm[1] + ".ciudades");		
		}
		else if(formNameHTAV != "" && PaqTypeHTAV.toUpperCase() == "HTAV")  {
			Clave_ciudad = eval("document." + formNameHTAV + ".Clav_Ciudad");
			ciudades = eval("document." + formNameHTAV + ".ciudades");			
		}else if(PaqTypeHTAV.toUpperCase() == "HTAV"){	
			Clave_ciudad = document.getElementById("Clav_Ciudad");			
			ciudades = document.getElementById("ciudades");							
		}
			
		if (Clave_ciudad!= null && ciudades!= null){					
			var rReturn = ajEnabledElem(ciudades,null);
			var pIdioma = rReturn.Idioma;			
			if (ciudades.tagName== "INPUT"){ //debe ser tipo Text
				//return false;
								
				//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax
				if (ciudades.alt.toLowerCase() == "ajax.off")
					return false;
								
				var ajaxB = new MS.Web.AutoCompleteDataTable(ciudades, this.count);	
										
				/// Funcion que ejecuta el Procedimeinto del lado del servidor		
				ajaxB.getData = function()
				{
					this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";
					//debugger;
					//Tomara la Ciudades segun sitio    			
					var pbCiudad  =	document.getElementById("pbCiudades");
					if ( pbCiudad ==null)
						pbCiudades = 0;  //si viene en nulo le asigno un defualt
					else
						pbCiudades = pbCiudad.value;  //Idioma del Objeto 
											    				
					var radio = document.getElementById("RadioH");
					var clasif = '';									
					if (radio != null) //Si existe
					{	
						var obj2 = document.getElementById("TemaH");
						if (obj2 != null) { //Si existe 				        				        				    
							if (BuscadorSelect = 2 && radio.checked==true)
								clasif  = obj2.value;  
							else	 
								clasif  = document.getElementById("TemaHF").value; 						        
						}
					}								    			
					AutoComplete.search_ciudades(this.ele.value,pIdioma,sitioDestinos,this.count,clasif,'',_ajaxPrintSQL,tipConn,this.callback.bind(this));
				}				
				////despliega la lista de los valores en un div para su visualizacion
				/// se llena tantos Registros encuentre		
				ajaxB.getDisplay = function(item,pos) { 
					var textDisp = (item != null ? item.nombre_ciudad_real  : "");
					return 	{Text1:textDisp,Text2:'',Principal:0}	
				}				
				ajaxB.getImage = function (item,pos) {	
					
					//var tipo_categoria = document.getElementById("tipo_categoria"); //Imagen de la categoria Estrellas o Maletas					
					return {Imagen:'',Width:'',Height:''};			
				}				
				/// obtiene los valores de los dataTable y los almacena el los input		
				ajaxB.getValue = function(item) 
				{											
					if (item != null) {
						if (item.Status == SimbDatos) {
							Clave_ciudad.value = "";	//Limpio la clave de ciudad oculta
							return item.Status;			//Regreso el estatus (NO Datos)
						}else {
							if (item.clav_iata == 'sin') //No regresa coincidencias por lo tanto clave Iata no es real
								Clave_ciudad.value = '';
							else
								Clave_ciudad.value = item.clav_iata;	
							return (item != null ? item.nombre_ciudad_real.toString().trimRight() : "");
						}	
					} else {
						if (this.ele.value != "")
							return "";			//forzo a tomar su propio valor que tenia
						else 
							return SimbDatos;	//forzo que tome Mensaje Inicial
					}	
				}
	       }
		}
					
	*/
	
		// ------------------------------------------------------------------------------------------														
		//     INI:   LLENA AEropuerto de  - CIUDAD "USADO EN HOTEL + AVION COMBO {CIUDADES}"
		// ------------------------------------------------------------------------------------------
		
		var oDestino; var Clave_ciudad; var ciudades;	//var ajaxOnB = true;
		var oForzaLocateHTAV; //var oTerminaLocateHTAV;
		
		//Pregunto Existela varible ARRAY en el HTML		
		if (existeArrayFormHTAV && PaqTypeHTAV.toUpperCase() == "HTAV") {
			Clave_ciudad = eval("document." + arrayForm[1] + ".Clav_Ciudad");
			ciudades = eval("document." + arrayForm[1] + ".ciudades");
			oForzaLocateHTAV = 	eval("document." + arrayForm[1] + ".termina");	
		}
		else if(formNameHTAV != "" && PaqTypeHTAV.toUpperCase() == "HTAV")  {
			Clave_ciudad = eval("document." + formNameHTAV + ".Clav_Ciudad");
			ciudades = eval("document." + formNameHTAV + ".ciudades");
			oForzaLocateHTAV = 	eval("document." + formNameHTAV + ".termina");			
		}else if(PaqTypeHTAV.toUpperCase() == "HTAV"){	
			Clave_ciudad = document.getElementById("Clav_Ciudad");			
			ciudades = document.getElementById("ciudades");
			oForzaLocateHTAV = 	document.getElementById("terminaHTAV");							
		} 
		HADestino = document.getElementById("HADestino");
				
		if (ciudades!= null)	{
		
			var rReturn = ajEnabledElem(ciudades,null);
			var pIdioma = rReturn.Idioma;	
			
			//alert(typeof HADestino);
			
			/// instanciamos la variable (x) para porder accesar a la clase AutoCompleteDataTable
			/// pasandole como paramatros nombre el input y TOP de registros.
			///AutoCompleteDataTable("input", 20  )					
			if (ciudades.tagName == "INPUT"){   //Si es Combo lo saco			        		        
					//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax        
					if (ciudades.alt.toLowerCase() == "ajax.off")
						return false;
		       
					//var est = new MS.Web.AutoComplete.initialize(ovDestino.id, this.count,3);
					var ajaxDes = new MS.Web.AutoCompleteDataTable(ciudades,this.count);
																		
					/// Funcion que ejecuta el Procedimeinto del lado del servidor		
					ajaxDes.getData = function() {					
						this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";
						//[1] = Buscar por Destinos - Ciudades, [2] = Attracciones
						//var oCercaDe = document.getElementById("CercaDe"); oCercaDe = (ajExistsObj(oCercaDe)==true) ? oCercaDe.value : 1;
						//var _args = MS.Web.AutoComplete.prototype.AddArgsCall;
						//if (18 > 0) { this.initialize(this.ele,18,arguments);}
						var ajjPais = '';						
						var NoResul = fdic.trad(disNoResults,pIdioma);
						AutoComplete.Search_FiltraHotel(this.ele.value,'','',pIdioma,ajjPais,_ajaxPrintSQL,this.count,'1','','',tipConn,NoResul,this.callback.bind(this));						
					}					
					//Valor que Muestra al Usuario					
					ajaxDes.getDisplay = function(item,pos) { var textDisp='';var textDisp2=''; var esPrinc = 0;
						//Hubo un Error
               			//try {
							if (item != null) { 					               				
								if (item.Status != '') {
									textDisp = item.Status;
								} else { 
																		
									if (item.Orden > 0) { esPrinc = 1} //reviso si es un destino cab.
									var band=false;
									if (item.Nombre_Destino_Id!='') { 
										if (band) {textDisp += ', ';}
										if (esPrinc==0) {textDisp += '&nbsp;&nbsp;&nbsp;';}
										textDisp += item.Nombre_Destino_Id; band=true;
									}							
									if (item.Nombre_Ciudad_Id!='') { 
										if (band) {textDisp += ', ';}
										textDisp += item.Nombre_Ciudad_Id; band=true;
									}																		
									if (item.Nombre_Pais_Id!=''){ 
										if (band) {textDisp += ', ';}
										textDisp += item.Nombre_Pais_Id; band=true;
									}								
									//Total de Hoteles
									if (item.Total_Hoteles>0) { 
										textDisp2 = '&nbsp;' + item.Total_Hoteles + '&nbsp;';
										if (item.Total_Hoteles > 1) {
											textDisp2 += fdic.trad(disHotels,pIdioma);
										}else {
											textDisp2 += 'Hotel';
										}															
									}								
								}
							}						
						return 	{Text1:textDisp,Text2:textDisp2,Principal:esPrinc}; //{Text1:textDisp,Text2:textDisp2}						
																		
					}
					//Sin Imagen
					ajaxDes.getImage = function (item,pos) { //Regreso si tiene Aeropuerto
						if (item.Status != '') {
							return {Imagen:'',Width:'',Height:''};
						} else {						
							if (item != null) { 
								var imgA = '/_lib/images/bestday/spacer.gif';
								if (item.Nombre_Ciudad_Id.toLowerCase().indexOf("airport") > -1 || item.Nombre_Ciudad_Id.toLowerCase().indexOf("aeropuerto") > -1 || item.Nombre_Destino_Id.toLowerCase().indexOf("airport") > -1 || item.Nombre_Destino_Id.toLowerCase().indexOf("aeropuerto") > -1) {
								  imgA = '/_lib/images/bestday/iconMiniAirport.gif'; 
								} 
								return {Imagen:imgA,Width:14,Height:14}; //  Imagen, Width, Height
							}
							return {Imagen:'/_lib/images/bestday/spacer.gif',Width:14,Height:14}; //  Imagen, Width, Height
						}
						return {Imagen:'',Width:'',Height:''};				
					}					 
					/// obtiene los valores de los dataTable y los almacena el los input		
					ajaxDes.getValue = function(item)	{ var RetVal='';
						if (item != null) {							
							//[1] = Buscar por Destinos - Ciudades, [2] = Attracciones
							
							//var oCarpDest = document.getElementById("Carpeta_Destino"); 
							/*if (ajExistsObj(oCarpDest)==true) { 
								oCarpDest.value = (item.Carpeta_Destino_Id!='') ? item.Carpeta_Destino_Id : '';
								var _args = MS.Web.AutoComplete.prototype.AddArgsCall;
								//Forza Cambio de Ruta
								if (_args.ForzaRuta == true) {
									ChangeActionHotel(_args.Forma,null,_args.Url,_args.UrlGral,oCarpDest.value,null,null);
								}									
							}*/
													
							HADestino.value = item.Clav_Destino; 
							if (ajExistsObj(Clave_ciudad)==true) { Clave_ciudad.value = item.Clav_Ciudad; }
							RetVal = item.Nombre_Destino_Id;
							if (item.Nombre_Ciudad_Id!='') { RetVal += ', ' + item.Nombre_Ciudad_Id; }
							
							//este codigo permite  redirecccionar a lapagina de locate  aunque use ajax && true == false
							if (ajExistsObj(oForzaLocateHTAV)==true){
								oForzaLocateHTAV.value = true;
								var codes = item.Code.split(',');							
								if (codes.length > 1) { oForzaLocateHTAV.value = false; } //forza a mostrar locate
							}
																
							if (item.Status != '') {
								return '';
							} else { 
								return RetVal;
							}
							
						} else {
							return '';
						}								
					}
			  }  
		}
		//---------------------------------------------------  FIN: DESTINOS
	
		
        // ------------------------------------------------------------------------------------------														
		//        LLENA COMBO DE AEREOPUERTO DESTINOS [ SOLO AVION ] BCIUDADDES
		// ------------------------------------------------------------------------------------------

		var bClave_ciudad; var bciudades; //var _ajaxOnB = true;
			
		//Pregunto Existela varible ARRAY en el HTML		
		if (existeArrayFormSAV && PaqTypeSAV.toUpperCase() == "SAV") {
			bClave_ciudad = eval("document." + arrayForm[0] + ".Clav_Ciudad");
			bciudades = eval("document." + arrayForm[0] + ".ciudades");		
		}
		else if(formNameSAV != "" && PaqTypeSAV.toUpperCase() == "SAV")  {
			bClave_ciudad = eval("document." + formNameSAV + ".Clav_Ciudad");
			bciudades = eval("document." + formNameSAV + ".ciudades");			
			bClave_ciudad = document.getElementById("bClav_Ciudad");			
			bciudades = document.getElementById("bciudades");							
		}
											
		if (bClave_ciudad!= null && bciudades != null)	{		
			var rReturn = ajEnabledElem(bciudades,null);
			var pIdioma = rReturn.Idioma;						
			if (bciudades.tagName == "INPUT"){  //Si es Combo lo saco
			
				//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax
		 		if (bciudades.alt.toLowerCase() == "ajax.off")
					return false;
					        			
				var _ajaxB = new MS.Web.AutoCompleteDataTable(bciudades, this.count );
				var _ajaxBFiltroPais = document.getElementById("zCiudades");	
					if (ajExistsObj(_ajaxBFiltroPais)==true)
						_ajaxBFiltroPais = _ajaxBFiltroPais.value;	 
					else	
						_ajaxBFiltroPais = '';	 
														
				/// Funcion que ejecuta el Procedimeinto del lado del servidor		
				_ajaxB.getData = function()
				{								
					this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";				
					AutoComplete.search_airport(this.ele.value,pIdioma,this.count,ajaxAFiltroPais,_ajaxPrintSQL,'sinUSAR1',this.callback.bind(this));
								
				}				
				////despliega la lista de los valores en un div para su visualizacion
				_ajaxB.getDisplay = function(item,pos)	{ var textDisp='';							
																	
					//Cuando Realmente no hay Datos Mando "??"					
					//Clav_Pais Valores Regreso en Consulta:   
					//				    00 =(No tiene clave de Pais)
					//			    Dif 00 =(Tiene Pais y pone su banderita)
					//				    ?? =(No hay datos (Con Mensaje Personalizado) )
			        
               		if (item != null) {                		
						if( item.Clav_Pais != "00") //Si COD. Pais 
						{
							if( item.Clav_Pais == "??") { //No coincidencias (No Resultados)
               					textDisp = (item != null ? item.Airport  : "");
               				}else {													
								if (item.Code.length>3)
									textDisp = (item != null ? espacios + item.CityName + " (" + item.Airport + ")" + " (" + item.Code + ") " : "");
								else
									textDisp = (item != null ? espacios +item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
							}	
						} else {							
							textDisp = (item != null ?  espacios + item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
						}															
					} else { textDisp = ""; }					
					return 	{Text1:textDisp,Text2:'',Principal:0};
				}			
				_ajaxB.getImage = function (item,pos) { var Ruta = '';					
					//Si Clav_Pais = ??  ó 00  (No hay datos o coincidencias)					
					if (item != null) {													
					   if (item.Clav_Pais == "??" || item.Clav_Pais == "00")
					  	 Ruta = '';
					   else	
						 Ruta = '/_lib/vimages/Flags/' + item.Clav_Pais + '.gif';
					}					
					return {Imagen:Ruta,Width:'',Height:''};				 
				}				 
				/// obtiene los valores de los dataTable y los almacena el los input		
				_ajaxB.getValue = function(item) {	   
					if (item != null) {
						if (item.Status == SimbDatos) {
							bClave_ciudad.value = "";  //limpio la variable
							return item.Status;		//Regreso el estatus
						} else {							    
							bClave_ciudad.value = item.Code; //paso su codigo de aeropuerto
							//Cuando no hay ningun concidencia de Aeropuertos
							if( item.Clav_Pais == "??")
								return (item != null ?  item.Airport: ""); //Mensaje de no datos
							else 
								return (item != null ? item.CityName + " (" + item.Code + ") " + " (" + item.Airport + ")" : "");
						}
					} else {					
						if (this.ele.value != "")
							return ""; //forzo a tomar su propio valor que tenia
						else 
							return SimbDatos;     //forzo que tome Mensaje Inicial											
					}					
				}
			}
		}
			

       	// ------------------------------------------------------------------------------------------														
		//                              LLENA COMBO DE HOTEL #1
		// ------------------------------------------------------------------------------------------
		
		var Clav_Hotel = document.getElementById("Clav_Hotel");		
		var aNombre = document.getElementById("Nombre");	//Si existe nombre 
		//var ajaxOnC = true;
			
		if (Clav_Hotel!= null && aNombre !=null)	{
		
			var rReturn = ajEnabledElem(aNombre,null);
			var pIdioma = rReturn.Idioma;								
		    if (aNombre.tagName == "INPUT"){ //debe ser tipo Text
		    
				//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax
				if (aNombre.alt.toLowerCase() == "ajax.off")
					return false
		    		        
				var ajaxC = new MS.Web.AutoCompleteDataTable(aNombre, this.count );									
				var Ruta_Imagen = document.getElementById("Ruta_Imagen");				
				var tipo_categoria = document.getElementById("tipo_categoria"); //Imagen de la categoria Estrellas o Maletas
				/// Funcion que ejecuta el Procedimeinto del lado del servidor		
				ajaxC.getData = function()
				{
					this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";								
					var mCuidad  =	document.getElementById("Clav_Ciudad");	
					if (typeof mCuidad!='undefined' && mCuidad!=null) { mCuidad = mCuidad.value; }else {mCuidad='';}		
					AutoComplete.search_hotel(this.ele.value,Ruta_Imagen.value,pIdioma,mCuidad,this.count,tipo_categoria.value,AjPais,_ajaxPrintSQL,'sinUSAR1',this.callback.bind(this));
					
				}
				/// se llena tantos Registros encuentre		
				ajaxC.getDisplay = function(item,pos){ 
					var textDisp = (item != null ? espacios + item.Nombre_Hotel  : "");
					return 	{Text1:textDisp,Text2:'',Principal:0};
					
				}			
				ajaxC.getImage = function (item,pos) {  var Ruta = ''; var tipo_categoria = 'Cat_';				
					if (item != null && item.Clav_Categoria != '')
						Ruta = Ruta_Imagen.value + '/' + tipo_categoria +  item.Clav_Categoria + '_' + pIdioma + '.gif';									
					return {Imagen:Ruta,Width:'',Height:''};				 
				}				 
				/// obtiene los valores de los dataTable y los almacena el los input		
				ajaxC.getValue = function(item) {	
					if (item != null) {	
						if (item.Status == SimbDatos)
							return item.Status;		//Regreso el estatus (NO Datos)
						else			
							return (item != null ? item.Nombre_Hotel.toString().trimRight() : "");
					}else {
						if (this.ele.value != "")
							return "";			//forzo a tomar su propio valor que tenia
						else 
							return SimbDatos;	//forzo que tome Mensaje Inicial
					}
				}
			}
		}

		// ------------------------------------------------------------------------------------------														
		//                              LLENA COMBO DE HOTEL  #2
		// ------------------------------------------------------------------------------------------
		
		var _Clav_Hotel = document.getElementById("_Clav_Hotel");
		var _Nombre = document.getElementById("_Nombre");	//Si existe nombre
		//var _ajaxOnC = true;
					
		if (_Clav_Hotel!= null && _Nombre!=null) {
		
			var rReturn = ajEnabledElem(_Nombre,null);
			var pIdioma = rReturn.Idioma;	
							
			if (_Nombre.tagName == "INPUT"){ //debe ser Tipo Text
								
				 //Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax
				if (_Nombre.alt.toLowerCase() == "ajax.off")
					return false;
					        			
				var _ajaxC = new MS.Web.AutoCompleteDataTable(_Nombre, this.count );				
				var Ruta_Imagen = document.getElementById("Ruta_Imagen");						
				var tipo_categoria = document.getElementById("tipo_categoria"); //Imagen de la categoria Estrellas o Maletas								
																	
				/// Funcion que ejecuta el Procedimeinto del lado del servidor		
				_ajaxC.getData = function()
				{
					this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";				
					var miCuidad  =	document.getElementById("Clav_Ciudad");
					if (typeof miCuidad!='undefined' && miCuidad!=null) { miCuidad = miCuidad.value; }else {miCuidad='';}		
					AutoComplete.search_hotel(this.ele.value,Ruta_Imagen.value,pIdioma,miCuidad,this.count,tipo_categoria.value,AjPais,_ajaxPrintSQL,'sinUSAR1',this.callback.bind(this));
					
				}
				
				////despliega la lista de los valores en un div para su visualizacion
				/// se llena tantos Registros encuentre		
				_ajaxC.getDisplay = function(item,pos) {
					var textDisp = (item != null ? espacios + item.Nombre_Hotel  : "");
					return 	{Text1:textDisp,Text2:'',Principal:0};
				}
				_ajaxC.getImage = function (item,pos) {
					/*var Ruta = ''; var tipo_categoria = 'Cat_';
					if (item != null && item.Clav_Categoria != '')
						Ruta = Ruta_Imagen.value + '/' + tipo_categoria +  item.Clav_Categoria + '_' + pIdioma + '.gif';
					else
						Ruta = '';		*/					
					return {Imagen:'',Width:'',Height:''};				 
				}
				/// obtiene los valores de los dataTable y los almacena el los input		
				_ajaxC.getValue = function(item){	
					if (item != null) {				
						if (item.Status == SimbDatos)
							return item.Status;  //Regreso el estatus (NO Datos)
						else
							return (item != null ? item.Nombre_Hotel.toString().trimRight() : "");
					} else {
						if (this.ele.value != "")
							return "";			//forzo a tomar su propio valor que tenia
						else 
							return SimbDatos;	//forzo que tome Mensaje Inicial
					}	
				}
			}
		}	
		
		
		
		// ------------------------------------------------------------------------------------------														
		//                           INI:   LLENA DESTINO - CIUDAD "USADO EN HOTELES COMBO {DESTINO}"
		// ------------------------------------------------------------------------------------------
		
		var oDestino; var oClav_Ciudad;			
		ofCercaDe = document.getElementById("fCercaDe"); 
		oDestino = document.getElementById("ajDestino"); oClav_Ciudad = document.getElementById("ajCiudad");		             
		if (ofCercaDe!= null)	{
		
			var rReturn = ajEnabledElem(ofCercaDe,null);
			var pIdioma = rReturn.Idioma;	
			
			/// instanciamos la variable (x) para porder accesar a la clase AutoCompleteDataTable
			/// pasandole como paramatros nombre el input y TOP de registros.
			///AutoCompleteDataTable("input", 20  )					
			if (ofCercaDe.tagName == "INPUT"){   //Si es Combo lo saco			        		        
					//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax        
					if (ofCercaDe.alt.toLowerCase() == "ajax.off")
						return false;
		       
					//var est = new MS.Web.AutoComplete.initialize(ovDestino.id, this.count,3);
					var ajaxDes = new MS.Web.AutoCompleteDataTable(ofCercaDe,this.count);
																		
					/// Funcion que ejecuta el Procedimeinto del lado del servidor		
					ajaxDes.getData = function() {					
						this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";
						//[1] = Buscar por Destinos - Ciudades, [2] = Attracciones
						var oCercaDe = document.getElementById("CercaDe"); oCercaDe = (ajExistsObj(oCercaDe)==true) ? oCercaDe.value : 1;
						var _args = MS.Web.AutoComplete.prototype.AddArgsCall;
						//if (18 > 0) { this.initialize(this.ele,18,arguments);}
						var ajjPais = '';	
						var NoResul = fdic.trad(disNoResults,pIdioma);
						AutoComplete.Search_FiltraHotel(this.ele.value,'','',pIdioma,ajjPais,_ajaxPrintSQL,this.count,oCercaDe,_args.Tema,_args.Cadena,tipConn,NoResul,this.callback.bind(this));						
					}					
					//Valor que Muestra al Usuario					
					ajaxDes.getDisplay = function(item,pos) { var textDisp='';var textDisp2=''; var esPrinc = 0;
						//Hubo un Error
               			//try {
							if (item != null) { 					               				
								if (item.Status != '') {
									textDisp = item.Status;
								} else { 
									//[1] = Buscar por Destinos - Ciudades, [2] = Attracciones
									var oCercaDe = document.getElementById("CercaDe"); oCercaDe = (ajExistsObj(oCercaDe)==true) ? oCercaDe.value : 1;
									if (oCercaDe == 1){ //Cerca de una Ciudad
									
										if (item.Orden > 0) { esPrinc = 1} //reviso si es un destino cab.
										var band=false;
										if (item.Nombre_Destino_Id!='') { 
											if (band) {textDisp += ', ';}
											if (esPrinc==0) {textDisp += '&nbsp;&nbsp;&nbsp;';}
											textDisp += item.Nombre_Destino_Id; band=true;
										}							
										if (item.Nombre_Ciudad_Id!='') { 
											if (band) {textDisp += ', ';}
											textDisp += item.Nombre_Ciudad_Id; band=true;
										}																		
										if (item.Nombre_Pais_Id!=''){ 
											if (band) {textDisp += ', ';}
											textDisp += item.Nombre_Pais_Id; band=true;
										}               						
									} else { //Cerca de un Punto de Interes
										textDisp = item.Nombre_Punto_Interes_Id;
										if (item.Nombre_Destino_Id!='') { textDisp += ', ' + item.Nombre_Destino_Id; }
									} 
									//Total de Hoteles
									if (item.Total_Hoteles>0) { 
										textDisp2 = '&nbsp;' + item.Total_Hoteles + '&nbsp;';
										if (item.Total_Hoteles > 1) {
											textDisp2 += (pIdioma.toLowerCase()=='esp') ? 'Hoteles' : 'Hotels';
										}else {
											textDisp2 += 'Hotel';
										}															
									}								
								}
							}						

						/*} catch (e){
							textDisp = ''; textDisp2 = '';
						} finally {
							return 	{Text1:textDisp,Text2:''} //{Text1:textDisp,Text2:textDisp2}
						}*/
						return 	{Text1:textDisp,Text2:textDisp2,Principal:esPrinc};  //{Text1:textDisp,Text2:textDisp2}						
																		
					}
					//Sin Imagen
					ajaxDes.getImage = function (item,pos) { //Regreso si tiene Aeropuerto
						if (item.Status != '') {
							return {Imagen:'',Width:'',Height:''};
						} else {
							//[1] = Buscar por Destinos - Ciudades, [2] = Attracciones
							//if (pos == 2 || pos ==8) { item.Tiene_Aeropuerto = 1;} else {item.Tiene_Aeropuerto = 0;}
							var oCercaDe = document.getElementById("CercaDe"); oCercaDe = (ajExistsObj(oCercaDe)==true) ? oCercaDe.value : 1;
							if (oCercaDe == 1) {
								if (item != null) { 
									var imgA = (item.Tiene_Aeropuerto) ? '/_lib/images/bestday/iconMiniAirport.gif' : '/_lib/images/bestday/spacer.gif'; 
									return {Imagen:imgA,Width:14,Height:14}; //  Imagen, Width, Height
								}
								return {Imagen:'/_lib/images/bestday/spacer.gif',Width:14,Height:14}; //  Imagen, Width, Height
							} 
						}
						return {Imagen:'',Width:'',Height:''};				
					}					 
					/// obtiene los valores de los dataTable y los almacena el los input		
					ajaxDes.getValue = function(item)	{ var RetVal='';
						if (item != null) {							
							//[1] = Buscar por Destinos - Ciudades, [2] = Attracciones
							var oCercaDe = document.getElementById("CercaDe"); oCercaDe = (ajExistsObj(oCercaDe)==true) ? oCercaDe.value : 1;
							var oCarpDest = document.getElementById("Carpeta_Destino"); 
							if (ajExistsObj(oCarpDest)==true) { 
								oCarpDest.value = (item.Carpeta_Destino_Id!='') ? item.Carpeta_Destino_Id : '';
								var _args = MS.Web.AutoComplete.prototype.AddArgsCall;
								//Forza Cambio de Ruta
								if (_args.ForzaRuta == true) {
									ChangeActionHotel(_args.Forma,null,_args.Url,_args.UrlGral,oCarpDest.value,null,null);
								}									
							}
							var oIdInteres = document.getElementById("ajIdInteres"); //Id Interes
							if (oCercaDe == 1) { //Destinos - Ciudades
								oDestino.value = item.Clav_Destino; 
								if (ajExistsObj(oClav_Ciudad)==true) { oClav_Ciudad.value = item.Clav_Ciudad; }
								if (ajExistsObj(oIdInteres)==true) { oIdInteres.value = ''; }
								RetVal = item.Nombre_Destino_Id;
								if (item.Nombre_Ciudad_Id!='') { RetVal += ', ' + item.Nombre_Ciudad_Id; }
							} else if (oCercaDe == 2) { //Attracciones
								if (ajExistsObj(oIdInteres)==true) { oIdInteres.value = item.Id_Interes; }
								oDestino.value = item.Clav_Destino; 
								if (ajExistsObj(oClav_Ciudad)==true) { oClav_Ciudad.value = ''; }
								RetVal = item.Nombre_Punto_Interes_Id;								
							}
							if (item.Status != '') {
								return '';
							} else { 
								var cambiar = false;
								if (cambiar) {
									//var cadTemp = ConvertHTMLCode(RetVal,cambiar);  RetVal = cadTemp[1];
									RetVal = fGbl.replaceCharsDecHex(RetVal,'','','',''); 
								}								
								return RetVal;
							}
							
						} else {
							return '';
						}								
					}
			  }  
		}
		//---------------------------------------------------  FIN: DESTINOS

        // ---------------------------------------------------------------------------------------						
		//         INI:        AJAX AUTOS:  PICK-UP (CIUDAD DE ENTREGA)
		// ---------------------------------------------------------------------------------------
		var ajEntregaEn = document.getElementById("ajEntregaEn"); //busqueda
        var oEntregaEn = document.getElementById("fEntregaEn"); //Aqui paso ciudad y sucursal
        var oPaisSucursalPick = document.getElementById("Pais_Sucursal_PickUp"); //Solo traigo sucursales dropoof, segun el pais del pickups
        var oCiudadHotel = document.getElementById("CiudadHotel"); //Clave de la Ciudad del Hotel: Ciudades solo del Hotel Ajax de autos
		
		if (ajEntregaEn!= null && oEntregaEn!= null)	{			
			
			/// instanciamos la variable (x) para porder accesar a la clase AutoCompleteDataTable
			/// pasandole como paramatros nombre el input y TOP de registros.
			///AutoCompleteDataTable("input", 20  )
			
			var entReturn = ajEnabledElem(ajEntregaEn,null);
			var pIdioma = entReturn.Idioma;
            var oAeropuerto = document.getElementById("pBAereopuerto_Destino")
            oAeropuerto = (oAeropuerto!='undefined' && oAeropuerto!=null)? oAeropuerto.value:'';  
					
			if (ajEntregaEn.tagName == "INPUT"){   //Si es Combo lo saco			
		        //return false;	
		        
					//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax        
					if (ajEntregaEn.alt.toLowerCase() == "ajax.off") { return false; }		       
					var ajaxPICKUP = new MS.Web.AutoCompleteDataTable(ajEntregaEn,this.count);	                					
					/// Funcion que ejecuta el Procedimeinto del lado del servidor		
					ajaxPICKUP.getData = function() {	
						this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";
                        var oPaisSucursalPickUp = document.getElementById("Forza_Pais_Sucursal"); //Forza Pais para .travel
                        oPaisSucursalPickUp = (oPaisSucursalPickUp!='undefined' && oPaisSucursalPickUp!=null)? oPaisSucursalPickUp.value:'';
                        var _CiudadHotel = (oCiudadHotel!='undefined' && oCiudadHotel!=null)? oCiudadHotel.value:'';
                        AutoComplete.searchCars_CiudadesSucursales(this.ele.value,oPaisSucursalPickUp,sitioDestinos,pIdioma,'E',_CiudadHotel,this.count,'',_ajaxPrintSQL,oAeropuerto,'','',this.callback.bind(this));						
					}
					////despliega la lista de los valores en un div para su visualizacion
					/// se llena tantos Registros encuentre
					ajaxPICKUP.getDisplay = function(item,pos){
						var textDisp='';					
               			if (item != null) {
                            if (item.Principal==1) {
                               textDisp = item.Nombre_Destino_Id;
                            }else {
                                textDisp = '&nbsp;&nbsp;&nbsp;' +  item.Nombre_Sucursal;
                            }							
						} else { textDisp = ""; }
						return 	{Text1:textDisp,Text2:'',Principal:item.Principal};
					}
					ajaxPICKUP.getImage = function (item,pos) {
						var Ruta = '';
						//Si Clav_Pais = ??  ó 00  No hay datos o Coincidencias			
						if (item != null){
                            if (item.Principal==1) {
                                if (item.Clav_Pais!= '') { Ruta = '/_lib/vimages/Flags/' + item.Clav_Pais + '.gif'; } else { Ruta = ''; }
							    //Ruta = '/_lib/vimages/Flags/00.gif';
                            } else {
                              Ruta ='';// '/_lib/vimages/Flags/00.gif';
                            }
                        }
						return {Imagen:Ruta,Width:16,Height:11};
					}
					/// obtiene los valores de los dataTable y los almacena el los input		
					ajaxPICKUP.getValue = function(item)	{	                        
						if (item != null) {                            
                            if (typeof oPaisSucursalPick!='undefined' && oPaisSucursalPick !=null) { oPaisSucursalPick.value=item.Pais_Sucursal;} else {oPaisSucursalPick='';}
                            //No seleccionables
                            if (item.Principal ==-1 || item.Principal ==1) { 
                               ajEntregaEn.value = ''; oEntregaEn.value = ''; return ""; 
                            } else  {
                                oEntregaEn.value = item.Sucursales;  return item.Nombre_Sucursal;
                            }
						} else {					
							if (this.ele.value !="")
								return ""; //forzo a tomar su propio valor que tenia
							else 
								return SimbDatos;//forzo que tome Mensaje Inicial										
						}					
					}
			  }  
		}
		// ---------------------------------------------------------------------------------------						
		//         FIN:        AJAX AUTOS:  PICK-UP (CIUDAD DE ENTREGA)
		// ---------------------------------------------------------------------------------------
		

        // ---------------------------------------------------------------------------------------						
		//         INI:        AJAX AUTOS:  DROP-OFF (CIUDAD DE DEVOLUCION)
		// ---------------------------------------------------------------------------------------
		var ajDevuelveEn = document.getElementById("ajDevuelveEn"); //busqueda
        var oDevuelveEn = document.getElementById("fDevuelveEn"); //Aqui paso ciudad y sucursal
        		
		if (ajDevuelveEn!= null && oDevuelveEn!= null)	{			
			
			/// instanciamos la variable (x) para porder accesar a la clase AutoCompleteDataTable
			/// pasandole como paramatros nombre el input y TOP de registros.
			///AutoCompleteDataTable("input", 20  )
			//pone leyenda mismo que pickup
            if (ajDevuelveEn.value =='') { ajDevuelveEn.value=fdic.trad(disCarSameasPickUp,pIdioma)}
			var devReturn = ajEnabledElem(ajDevuelveEn,null);
			var pIdioma = devReturn.Idioma;
            var oAeropuerto = document.getElementById("pBAereopuerto_Destino")
            oAeropuerto = (oAeropuerto!='undefined' && oAeropuerto!=null)? oAeropuerto.value:'';            				
			if (ajDevuelveEn.tagName == "INPUT"){   //Si es Combo lo saco			
		        //return false;	
		        
					//Checo si tengo que llenar con ajax  'True:  Lleno con ajax;  False: Sin ajax        
					if (ajDevuelveEn.alt.toLowerCase() == "ajax.off") { return false; }		       
					var ajaxDROPOFF = new MS.Web.AutoCompleteDataTable(ajDevuelveEn,this.count);	                					
					/// Funcion que ejecuta el Procedimeinto del lado del servidor		
					ajaxDROPOFF.getData = function() {	
						this.ele.style.background= "url('/_Lib/Images/indicator.gif') no-repeat right";
                        var oPaisSucursalDropoff = document.getElementById("Pais_Sucursal_PickUp"); //Solo traigo sucursales dropoof, segun el pais del pickup
                        oPaisSucursalDropoff = (oPaisSucursalDropoff!='undefined' && oPaisSucursalDropoff!=null)? oPaisSucursalDropoff.value:'';
                        var _CiudadHotel = (oCiudadHotel!='undefined' && oCiudadHotel!=null)? oCiudadHotel.value:'';                        
                        AutoComplete.searchCars_CiudadesSucursales(this.ele.value,oPaisSucursalDropoff,sitioDestinos,pIdioma,'D',_CiudadHotel,this.count,'',_ajaxPrintSQL,oAeropuerto,'','',this.callback.bind(this));							}
					////despliega la lista de los valores en un div para su visualizacion
					/// se llena tantos Registros encuentre
					ajaxDROPOFF.getDisplay = function(item,pos){
						var textDisp='';					
               			if (item != null) {
                            if (item.Principal==1) {
                               textDisp = item.Nombre_Destino_Id;
                            }else {
                                textDisp = '&nbsp;&nbsp;&nbsp;' +  item.Nombre_Sucursal;
                            }							
						} else { textDisp = ""; }
						return 	{Text1:textDisp,Text2:'',Principal:item.Principal};
					}
					ajaxDROPOFF.getImage = function (item,pos) {
						var Ruta = '';
						//Si Clav_Pais = ??  ó 00  No hay datos o Coincidencias			
						if (item != null){
                            if (item.Principal==1) {
                                if (item.Clav_Pais!='') { Ruta = '/_lib/vimages/Flags/' + item.Clav_Pais + '.gif'; } else {Ruta='';}
							    //Ruta = '/_lib/vimages/Flags/00.gif';
                            } else {
                               //if (item.Pais_Sucursal == '') { Ruta = ''; } else { Ruta = '/_lib/vimages/Flags/' + item.Pais_Sucursal + '.gif'; }
                               Ruta = ''; //'/_lib/vimages/Flags/00.gif';
                            }
                        }
						return {Imagen:Ruta,Width:16,Height:11};
					}
					/// obtiene los valores de los dataTable y los almacena el los input		
					ajaxDROPOFF.getValue = function(item)	{	                        
						if (item != null) {
                            //No seleccionables                            
                            if (item.Principal ==-1 || item.Principal ==1) { 
                                oDevuelveEn.value = '';  return fdic.trad(disCarSameasPickUp,null); 
                            } else  {
                                oDevuelveEn.value = item.Sucursales;  return item.Nombre_Sucursal;
                            }
						} else {					
							if (this.ele.value !="")
								return ""; //forzo a tomar su propio valor que tenia
							else 
								return SimbDatos;//forzo que tome Mensaje Inicial										
						}					
					}
			  }  
		}
		// ---------------------------------------------------------------------------------------						
		//         FIN:        AJAX AUTOS:  DROP-OFF (CIUDAD DE DEVOLUCION)
		// ---------------------------------------------------------------------------------------
		      
				
	}	//FIN  NEW

//setTimeout(New,1);
//addEvent(window, "load", New); // el codigo Javascript no corre hasta que se descarguen todas las imagenes
//if (typeof $$ =='function') {	
$$(document).ready(function(){New();}); // Revisa el documento y espera a que este listo para manipularlo
//} else {
//	addEvent(window, "load", New); 
//}		
	
	
	