 
	var sitioDestinos = '';
	var SimbDatos = '-?-';  //Consulta No Regreso Coincidencias
	if (typeof ajaxSitioDestinos != 'undefined' && ajaxSitioDestinos!= null ) {
		sitioDestinos = ajaxSitioDestinos  //tomo los  destinos del sitio
	}
	//Determina Si Existe el elemento
	function ajExistsObj(obj) { 
		if (typeof obj=='string' && obj=='undefined') {
			return false;
		} else if (typeof obj!='undefined' && obj!=null) { 
			return true; 
		} else { return false; } 
	}

 var _ajaxPrintSQL=''; 
 if (typeof ajaxPrintSQL != 'undefined' && ajaxPrintSQL != null ) { _ajaxPrintSQL = String(ajaxPrintSQL); }
 var AjPais = '';
 var anchoPapa;
 
addNamespace("MS.Web.AutoComplete");
MS.Web.AutoComplete = Class.create();
Object.extend(MS.Web.AutoComplete.prototype, {
	timer: null,
	count: 15,
	pos: 0,
	waitAfterInput: 300,  /// 230
	minChars: 1,          ///  parametro que indica hasta cuantos caracteres empieza hacer la busqueda
	children: null,
	AddArgsCall:'',
	setPositionObj: function(ele) {
		var obj = ele;	
		var curleft =0;  var curtop = 0;				
		if (obj.offsetParent) {
			curleft = obj.offsetLeft;
			curtop = obj.offsetTop;
			while (obj == obj.offsetParent) {
				curleft += obj.offsetLeft;
				curtop  += obj.offsetTop;
			}
		}				
		curleft =parseInt(curleft); curtop  =parseInt(curtop);
		return [curleft,curtop];
	},	
	changeHighlight: function() {				
		var l = this.getLength();				
		for(var i=0; i<this.count && i<l; i++) {
			if(i == this.pos) 
				this.div.childNodes[i].className = "item selected";				
			else 
				this.div.childNodes[i].className = "item";			
		}
	},	
	getItem: function(idx)	{ return null; },	
	getLength: function()	{ return 0; },
	getDisplay: function(item,pos) { return [item,pos]; },
	getImage:  function(item,pos)  { return [item,pos]; },
	getValue: function(item) { return item; },
	setCount: function(cuantos) {
		if (cuantos > 0) { this.count = cuantos; } else { if (this.count < 0) {this.count = 12; } }		
	},
	hide: function() {
		//return true;	    
		this.div.style.display = "none";  this.ele.style.background= "white";	 		
		var Version =navigator.appVersion.substring(22,25);
		Version = parseInt(Version);
		if (navigator.appName=="Microsoft Internet Explorer")
			if (Version < 7)
				Mostrar_Elementos();		
	},
	show: function() { 
		this.changeHighlight(); this.div.style.display = "inline"; 
	    var Version =navigator.appVersion.substring(22,25);
		Version = parseInt(Version); 
		if (navigator.appName=="Microsoft Internet Explorer") 
			if (Version < 7)
				Ocultar_Elementos();							
	},
	focusTextbox: function() {
		this.ele.focus();
	},
	select: function() {	
		if (!mandatory)  {
			this.ele.value = "";
			//this.pos = -1;
			return false;
		}					
		if(this.pos > -1) {			
			var v = this.getValue(this.getItem(this.pos));
					
			//  '-?-' = indicador del 1er Registro "No es Seleccionable" (Msg No Results)
			if (v == SimbDatos) { 
			    this.ele.value = descripcionGral; //Pongo mensaje de Inicio
			} else {				
			    if (v=="") v = this.ele.value;  //Paso su mismo valor obj.
			    if(v != this.ele.value) 
			    {				
				    this.ele.value = v; //Pongo valor seleccionado de la Lista
				    if(this.children != null)
					    for(var i=0; i<this.children.length; i++) {
						    this.children[i].onparentchange(v);
					    }
			    }
			}
		}
		this.hide();
		//document.writeln(cad);
	},
	onkeydown: function(e) {
		var key = MS.Keys.getCode(e);
		switch(key) {
			case MS.Keys.TAB:
			case MS.Keys.ENTER:
				this.select();
				if(key == MS.Keys.ENTER) MS.cancelEvent(e);
				break;

			case MS.Keys.ESC:			   
				//this.ele.style.background= "white"; //Original: this.ele.style.background= "";
				this.hide();
				break;

			case MS.Keys.KEYUP:
						
				if (this.pos <=0)
					//this.getLength() =  Numero de Elementos reales de la lista  
					this.pos =  (this.getLength() -1);  //0 - N  N= Total de elementos que queremos  
				else
					this.pos--;					
				this.changeHighlight();
				break;
				
				/*INICIO ANGEL*/
				/*if(this.pos > 0) this.pos--;
				this.changeHighlight();
				break;*/
				/*FIN ANGEL*/

			case MS.Keys.KEYDOWN:

				if (this.pos >= this.count -1  || this.pos >= this.getLength() -1  )  // 0 - N
					this.pos = 0;  //Si es la Ultima posicion paso al primero
				else
					this.pos++;
				
				this.changeHighlight();
				break;
				
				/*INICIO ANGEL*/
				/*if(this.pos < this.getLength() -1 && this.pos < this.count -1) this.pos++;
				this.changeHighlight();
				break;*/
				/*FIN ANGEL*/
		}
	},
	onkeyup: function(e) {
		switch(MS.Keys.getCode(e)) {
			case MS.Keys.TAB:
			case MS.Keys.ENTER:
			case MS.Keys.ESC:
			case MS.Keys.KEYUP:
			case MS.Keys.KEYDOWN:
			case MS.Keys.KEYLEFT:
			case MS.Keys.KEYRIGHT:
			case MS.Keys.ALT:
			case MS.Keys.SHIFT:
			case MS.Keys.CTRL:
				break;
			default:		
                //alert(MS.Keys.getCode(e));
				/* ***************************************************************************************/			
				/*               AL INTENTAR BUSCAR RECONSTRUYE NUEVAMENTE                             */
				/****************************************************************************************/			
				var r = MS.Position.getBounds(this.ele);								
				//Optengo la posicion del elemento
				var posElem = this.setPositionObj(this.ele);
				r.left = (posElem[0] + 23);   r.top  =  posElem[1];				
				this.ele.rect = r;	
				//Indicador de Reloj
				if(this.ele.value.length <= this.minChars) {
                    this.ele.style.background= "white";  return false; 
                } else { 
                    this.ele.style.background= "white url('/_Lib/Images/indicator.gif') no-repeat right";
                }
				//Tiempo que tarda para el mostrado de la lista	               		
				if(this.timer != null) {
					this.ele.style.background= "white"; clearTimeout(this.timer);
				}
						
				this.timer = setTimeout(this.getData.bind(this), this.waitAfterInput);
                //this.ele.style.background= "white";							
				break;
		}
	},
	onfocus: function(e) { 
		this.changeHighlight();
	},
	onblur: function(e) {
		this.select();
		setTimeout(this.hide.bind(this), 200);	// 200 msec for onclick event of item
	},
	onmouseover: function(e) { 		
		this.pos = MS.getTarget(e).idx;
		this.changeHighlight();
	},
	setArgsCall: function(args) { //MS.Web.AutoComplete.prototype.setArgs({Forma:'',Prueba:''})
		this.AddArgsCall = args; //Formato args: {Forma: '',Url:'',UrlGral: '',Tema:'',Cadena:'',ForzaRuta:true}
	},
	onclick: function(e) {
		mandatory = true;
		//if(this.ele.value != "") {this.getData(); this.updateList(); }
		this.pos = MS.getTarget(e).idx;
		//this.changeHighlight();//// esta funcion se ciclo cuando en la lista no nos regresa elemento
		this.select();
	},
	onclickReloadList: function(e) {
		if(this.ele.value != "") {this.getData(); this.updateList(); }		
	},	
	ondblclick: function(e) {
		if(this.ele.value == "")
			this.getData();
	},
	onchange: function(e) {			
		if(this.children != null)				
			for(var i=0; i<this.children.length; i++) {
				this.children[i].onparentchange(this.ele.value);
			}
	},
	onparentchange: function(v) {		   
		this.ele.value = "";
		//this.ele.style.display = "none";		//xx
	},	
	updateList: function() {
		var hayDatos =false;    //default No hay datos en la lista	
		var myData;             //Almaceno el valor que trae por Fila
		var l = this.getLength();
		var objPadre = this.ele;  //Objeto Padre (Tipo text ó Combo)
		var objLista = this.div;  //Objeto Lista de Datos  1.... n 
		var imgSrc = '';  var imgW='';  var imgH='';	
		var Tex1=''; var Tex2=''; var ActPrin = 0; var ImgVals = '';
		var ie = document.all ? true : false;		
		//Lleno el Div con los nombres de los Aereop y Banderitas		 
		//Para Firefox uso "minWidth" y para IE le asigno el "offsetWidth" del papa.
		objLista.style.minWidth = objPadre.offsetWidth;
		objLista.style.width = objPadre.offsetWidth;
			
		for(var i=0; i<l && i<this.count; i++) {			
			objLista.childNodes[i].innerHTML = "";  //limpio
			ImgVals =  this.getImage(this.getItem(i),i);		//Ruta de la Imagen (Background)
			if (typeof ImgVals.Imagen!='undefined') { imgSrc = (ImgVals.Imagen!='')? ImgVals.Imagen : ''; }			
			if (typeof ImgVals.Width !='undefined') { imgW	 = (ImgVals.Width!='')? ImgVals.Width : ''; }
			if (typeof ImgVals.Height!='undefined') { imgH   = (ImgVals.Height!='')? ImgVals.Height : ''; }			
			myData = this.getDisplay(this.getItem(i),i);  //Trae el valor de cada Fila (Aerp, Hoteles, etc... y Banderita)
			if (myData.Text1	  !='undefined') { Tex1 = (myData.Text1!='')? myData.Text1 : ''; }
			if (myData.Text2	  !='undefined') { Tex2 = (myData.Text2!='')? myData.Text2 : ''; }
			if (myData.Principal  !='undefined') { ActPrin = myData.Principal; } //Checa si Activa Destino
								
			//SI vienen con info al menos un elemento		
			if (Tex1!= "") hayDatos = true;   //Si hubo al menos un elemento por mostrar								
			if (hayDatos && i==0) objLista.style.display = 'block'; 			
			// obtenemos los datos del dataTable para pintarlos en la lista
			if (imgSrc  != "")  {		
						    
				var imgItm1 = document.createElement("img") ; 						// Imagen +  Texto
				imgItm1.id = "Col1_" + i;   imgItm1.idx = i;  imgItm1.col = 1;			//Imagen:  Nombre de Id		
				imgItm1.setAttribute('src',imgSrc);
				imgItm1.setAttribute('align','absmiddle');
				imgItm1.style.margin = "2px 1px 0px 2px"; //Arriba - Derecha - Abajo - Izquierda
				if (imgW!=''){imgItm1.style.width  = imgW;} if (imgH!=''){imgItm1.style.height = imgH;}
				if (!ie) { imgItm1.style.cssFloat = "left"; } else {imgItm1.style.styleFloat = "left";} //quitar
									
				var txtItm2 = document.createElement("span"); 					//contenedor del texto	
				txtItm2.id = "Col2_" + i;  txtItm2.idx = i;	txtItm2.col = 2	//Texto: Nombre de Id
				if (ActPrin == 1) { txtItm2.style.fontWeight = "bold"; } //0: es un destino papa
				
				if (Tex2!='') {
					if (!ie){txtItm2.style.cssFloat = "left"; } else {txtItm2.style.styleFloat = "left";} 
				} else {
					if (!ie){txtItm2.style.cssFloat = "left"; } else {txtItm2.style.styleFloat = "left";} 
				}		
				txtItm2.innerHTML = Tex1;
				objLista.childNodes[i].appendChild(imgItm1);  					//agrego la Imagen al Item HIJO 
				objLista.childNodes[i].appendChild(txtItm2);  	
				
				//Segunda Columna
				if (Tex2!='') {						
					var txtItm3 = document.createElement("span");	
					txtItm3.id = "Col3_" + i;  txtItm3.idx = i; txtItm3.col = 3;
					if (!ie) {txtItm3.style.cssFloat = "right"; } else {txtItm3.style.styleFloat = "right";} //quitar	
					txtItm3.style.textAlign="right";  
					//txtItm3.style.fontWeight = "bold";  //txtItm3.style.width = "24%"
					txtItm3.innerHTML = Tex2;
					objLista.childNodes[i].appendChild(txtItm3);
				} 																
							
			} else {
				var txtItm1 = document.createElement("span"); 					//contenedor del texto	
				txtItm1.id = "Col1_" + i;  txtItm1.idx = i; txtItm1.col = 1		//Texto: Nombre de Id
				//if (!ie) { txtItm1.style.cssFloat = "left"; } else {txtItm1.style.styleFloat = "left";} 
				txtItm1.innerHTML = Tex1;
				objLista.childNodes[i].appendChild(txtItm1);				
			}
			objLista.childNodes[i].style.display = 'block';	
		}
		//debugger;	
		if(this.pos > l) this.pos = this.getLength()-1;
				
		for(var i=l; i<this.count; i++) {	//oculto el resto
			//objLista.childNodes[i].innerHTML = "";
			objLista.childNodes[i].style.display = "none";													
		}	
							
		if(this.pos > l -1) {
			this.pos = l-1;
		}
		
		if (hayDatos == true) {  this.show();}
		
		var _Params = this.itemformato({ItemPapa:objPadre,Lista:objLista,AddWidth:12,TotRows:l})
				
		objLista.style.width = _Params.WRowMay;
		
		//AntWidth = _Params.WRowMay
		
		if (hayDatos == false) { this.hide(); }
			
	},
	getData: function() {
	},
	ondata: function() {
		this.updateList();
	},
	itemformato: function (params) {
		var MayWidth =0; var tempMay =0;var temp=0; var colW = new Array(0,0,0,0,0,0,0);
		try {
			//Oculta a los Hijos vacios				
			for(var i=0; i<params.TotRows && i<this.count; i++) {			
				tempMay = 0;
				if (params.Lista.childNodes[i].childNodes.length >=0){
					for(var j=0; j<params.Lista.childNodes[i].childNodes.length; j++) {					
						if (params.Lista.childNodes[i].childNodes[j].offsetWidth  > colW[j]){
							if (params.Lista.childNodes[i].childNodes[j].tagName.toLowerCase()!='img') {
								colW[j] = params.Lista.childNodes[i].childNodes[j].offsetWidth + params.AddWidth;
							} else {
								colW[j] = params.Lista.childNodes[i].childNodes[j].offsetWidth;
							}
						}
					}
					for(var j=0; j<params.Lista.childNodes[i].childNodes.length && j<colW.length; j++){
						tempMay += colW[j]; //Obtengo el mayor
					}				
				} else {
					tempMay = (params.Lista.childNodes[i].clientWidth!=0)? params.Lista.childNodes[i].clientWidth : params.Lista.childNodes[i].scrollWidth;
				}
				if (tempMay > MayWidth ) { MayWidth = tempMay; }			 
			}
			//Redimenciono a todos los elementos hijos de cada contenedor
			for(var i=0; i<params.TotRows && i<this.count; i++) {
				for(var j=0; j<params.Lista.childNodes[i].childNodes.length; j++) {	
					//es la misma posicion de Columna
					if (params.Lista.childNodes[i].childNodes[j].tagName.toLowerCase()!='img') {
						if (params.Lista.childNodes[i].childNodes[j].col == (j+1)) {
							params.Lista.childNodes[i].childNodes[j].style.width = colW[j];	
						}
					}				
				}
			}
			
		}catch(ex) {
			
		}finally{
			if (MayWidth < params.ItemPapa.offsetWidth) {MayWidth= params.ItemPapa.offsetWidth;}
		}		
		return {WRowMay:(MayWidth + params.AddWidth),ColumnsW:colW};		
	},
	onresize: function() {
		
		/* ***************************************************************************************/
		/*                  AL MINIMIZAR  O MAXIMIZAR RECONSTRUYE                               */
		/****************************************************************************************/
		
		var r = MS.Position.getBounds(this.ele);								
		//Optengo la posicion del elemento
		var posElem = this.setPositionObj(this.ele);
		r.left = (posElem[0] + 23); r.top  =  posElem[1]; this.ele.rect = r;		
	
		//MS.Position.setBounds(this.div, r);
		/*FIN ANGEL*/
		/* ***************************************************************************************/
			
	},
	
	/* ***************************************************************************************/
	/*              INITIALIZE ( CREA TODA LA ESTRUCTURA DE LOS "N" ELEMENTOS DEL DIV )     */
	/****************************************************************************************/
	initialize: function(id, count, parent) {
	
		this.ele = f$(id);
								
		if(this.ele == null || this.ele.tagName != "INPUT") throw "Control could not be found.";
		this.count = count != null && !isNaN(count) ? count : this.count;

		if(parent != null) {	// no the parent control, instance of MS.Web.AutoComplete
			parent.children = [];
			parent.children.push(this);
		}		
		var nameEl = (this.ele.id!='')? this.ele.id : this.ele.name;  //Elemento Lista
		var divs = document.getElementById(nameEl + "_list")		
		this.div = divs; if (this.div==null) { return false; }
		addEvent(this.ele, "keydown", this.onkeydown.bind(this));
		addEvent(this.ele, "keyup", this.onkeyup.bind(this));
		addEvent(this.ele, "blur", this.onblur.bind(this));
		addEvent(this.ele, "focus", this.onfocus.bind(this));
		addEvent(this.ele, "change", this.onchange.bind(this));
		addEvent(this.ele, "dblclick", this.ondblclick.bind(this));
		//addEvent(this.ele, "click", this.onclickReloadList.bind(this));
		
		this.div.style.display = "none";	
		//this.div.style.border = "1px solid #000000";  
		//this.div.className = this.ele.id + "_list";
				
		var r = MS.Position.getBounds(this.ele);	
		//Optengo la posicion del elemento
		var posElem = this.setPositionObj(this.ele);
		r.left = (posElem[0] + 23);
		r.top  =  posElem[1];
			   	    
		this.ele.rect = r;				
		anchoPapa = this.ele.offsetWidth;  //Tomo Ancho del Padre
	    //this.div.style.width =  anchoPapa + 20 + "px";  //Ancho Padre + 20  = Lista de Hoteles					
		this.div.style.height = "auto";
		//this.div.style.width = "auto";
		//this.div.style.height = (16 * this.count) + "px";
		this.div.style.position = "absolute"; 
		this.div.style.zIndex = 100; 	 
		//MS.Position.setBounds(this.div, r); // nota : posisiona al div a un nivel inferior de los combos
		for(var i=0; i<this.count; i++) {			
			var d = document.createElement("div");
			this.div.appendChild(d); //agrego cada item hijo al papa
			//d.style.overflow = "hidden";
			d.style.height = "15px";
			//d.style.width = "100%";
			d.id = this.ele.id + "_item" + i;  //nombre id de c/u elementos de la lista
			d.className = this.ele.id + "_item";  //Le pone el nombre de la clase a los hijitos			
			d.idx = i;
			d.style.borderBottom = "#CCCCCC dotted 1px";			
			addEvent(d, "mouseover", this.onmouseover.bind(this));
			addEvent(d, "click", this.onclick.bind(this));								
			//MS.setText(d, " ");					
		}						
		addEvent(window, "resize", this.onresize.bind(this));		
		//this.div.innerHTML="a<!--[if lte IE 6.5]><iframe></iframe><![endif]-->";
		delete r;
	}
}, false);


MS.Web.AutoCompleteDataTable = Class.create();
Object.extend(MS.Web.AutoCompleteDataTable.prototype, MS.Web.AutoComplete.prototype, true);

Object.extend(MS.Web.AutoCompleteDataTable.prototype, {
	dt: null,	
	getItem: function(idx) {
		if (this.dt != null)
			if(idx >= 0 && idx < this.dt.Rows.length)
				return this.dt.Rows[idx];
			return null;
	},
	getLength: function() {
		if(this.dt != null && this.dt.Rows != null) {
			return this.dt.Rows.length;
		}
		return 0;
	},			
	callback: function(res) {		
		var errorMsg;
					
		//Determina el Tipo de Error que hubo
		if(res.error != null) {		
			errorMsg = res.error.Message;  //recibo error (UnkDown) ó  "X" error			
			if (res.error.Type.toLowerCase() == "connectfailure") //Error de Conección	
				errorMsg = fdic.trad(disConnectFailure,null);
			
			var divError = document.getElementById("Error");
			//mensaje de error..
			errorMsg = "<img src='/_Lib/Images/indicator.gif' border='0'/> " + errorMsg;					
			if(divError!=null){
					//muestro y cambio error
					divError.style.display = '';
					divError.style.position = "absolute"; 
					divError.innerHTML = errorMsg;								
			} else {
				//creo elemento
				divError = document.createElement("Div");				
				divError.setAttribute("id","Error");
				divError.style.position = "absolute"; 
				divError.innerHTML = errorMsg;
				document.body.appendChild(divError);				
			}			
			//setPositionElement(this.ele.id,divError,"add","",0,22);
			
			var r = MS.Position.getBounds(this.ele);								
			//Optengo la posicion del elemento
			var posElem = this.setPositionObj(this.ele);
			divError.style.left = posElem[0];
			divError.style.top  = (posElem[1] + 22);
						
			setTimeout("document.getElementById('Error').style.display='none';",400); //240
			
			return;
		}
		//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		//Ejs: Return [DataTable, SQL] [M] = Multiples)
		//     Return [DataTable] [S] = Un Solo Valor)
		if (typeof res.value.aDT == "object"){
			this.dt = res.value.aDT;  //[M]
		} else {
			this.dt = res.value;  //[S]
		}
		//solo si existe y regresa consulta 
		if (typeof res.value.aSQL == "string"){
			if (res.value.aSQL != '') {CallData(this.ele,'acronym',res.value.aSQL,'SQL-A');}
		}	
		this.ondata();
	}
	
}, true);
function CallData(elem,id,llamada,tit) {
	//" <acronym id="acronym" title=""sSql"" style=""color:red;"">SQL</acronym> 
    var objtmp=null;
    var elems = document.getElementsByTagName(id); var ii=0; 
    for (ii=0; ii<elems.length;ii++) {
        if (elems[ii].id==elem.name && elems[ii].innerHTML.toLowerCase()==tit.toLowerCase()) {
           objtmp = elems[ii];
        }
    }
    //objtmp = document.getElementById(id);
	if(objtmp ==null){ 
        objtmp = document.createElement(id);
        objtmp.setAttribute('id',elem.name);
    }        
	objtmp.setAttribute("title",llamada); 
	objtmp.style.color = "red";    objtmp.innerHTML = tit;	
	var cntp = (ajExistsObj(elem)==true) ? elem.parentNode : '';
	if (ajExistsObj(cntp)==true) { cntp.appendChild(objtmp)} else { document.body.appendChild(objtmp);}
}
 /* ------------------------------------	TEMAS - CADENAS	------------------------------------ */
  
	var Tipo_Servicio;	
	var Sitio;	
		
	//Valido que existe el Objeto pbCiudades
	if (document.getElementById('pbCiudades') == null)	
		Sitio = 0
	else
		Sitio  = document.getElementById('pbCiudades').value;   //Destinos ó Ciudades del AJAX
			
	/*Funcion que carga los destinos por cadena*/	
	function Carga_Destino_Cadenas(destino,hotel,Idioma,sitioDestinos){
		var Cadena = ''; var elemCadena;
		var radio = document.getElementById("RadioH");
       
        if (radio.type=='input' || radio.type=='hidden') {
            Tipo_Servicio = radio.value;
        }else {
		    if (radio.checked==true) { Tipo_Servicio ='H'; } else { Tipo_Servicio ='HF'; }
        }
		
		var elemCbo;		
		if (Tipo_Servicio =='HF') {elemCbo = document.getElementById("ciudades"); } else {elemCbo = document.getElementById("Destino"); }
		if (ajExistsObj(elemCbo)==false){ return false;}		
		if (elemCbo.type !="select-one") { return false;}			
		if (Tipo_Servicio =='HF') { 
			elemCadena = document.getElementById("CadenaHF"); 
		} else {
			elemCadena = document.getElementById("CadenaH");
		}		
		// Verificamos que tipo de Objeto es, para saber sonde debemos obtener el valor de la cadena 
		/// Combo o del Hidden
		if (elemCadena.type =="select-one") 
			Cadena = elemCadena.options[elemCadena.selectedIndex].value;
		else
			Cadena = elemCadena.value;

         var aPais = document.getElementById("Pais_Producto");
         aPais = (typeof aPais!='undefined' && aPais!=null)? aPais.value:'';
      			
		//Obtengo el valor del elemento Nota: getValueElems (Esta en diccionario.js)
		Idioma = fdic.lang(Idioma);
		var dtCad;	
		var dt = AutoComplete.search_Destino_Cadena(Tipo_Servicio,Cadena,Idioma,sitioDestinos,aPais,_ajaxPrintSQL).value;

		//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		//Ejs: Return [DataTable, SQL] [M] = Multiples)
		//     Return [DataTable] [S] = Un Solo Valor)
		if (typeof dt.aDT == "object"){
			dtCad = dt.aDT;  //[M]		
		}
		//solo si existe y regresa consulta 
		if (typeof dt.aSQL == "string"){
			if (dt.aSQL != '') {CallData(elemCadena,'acronym',dt.aSQL,'SQL-A');}
		}	
		if 	(dtCad == null)				
			return;
			
		// objeto en donde vamos a almacenar la informacion		
		if (ajExistsObj(elemCbo)== false) {return false;}
					
		$RemoveOptions (elemCbo);
		//primer opcion del combo		
		elemCbo.options[0] = new Option(fdic.trad(disAllDestination,Idioma), 0);
		
		//var grupo;
		var tgrupo='';
		var abrio=false;
		var optGroup;
		//var sOption;
		var opt;
		//Lleno el Combo con los Destinos
		for (var i=0; i<dtCad.Rows.length; i++){
		    		
		    //genero el nuevo grupo
            if (tgrupo.toLowerCase()!= dtCad.Rows[i].Clav_Pais.toLowerCase() && abrio==true ) {
                elemCbo.appendChild(optGroup);  //Agrego grupo al combo principal
                abrio =false;
            }
            if (tgrupo.toLowerCase()!= dtCad.Rows[i].Clav_Pais && abrio==false) {
                optGroup = document.createElement("optgroup"); 
                optGroup.label = dtCad.Rows[i].Nombre_Pais_Id;
                tgrupo = dtCad.Rows[i].Clav_Pais;
                abrio = true;
            }            
            // create options and attach to optgroups
            opt = document.createElement("option");  
            opt.innerHTML = dtCad.Rows[i].Nombre_Destino;  
            opt.value = dtCad.Rows[i].Clav_Destino;  
            if (dtCad.Rows[i].Clav_Destino == destino) {
                opt.selected = true;
            }else {
                opt.selected = false;
            }            
            optGroup.appendChild(opt); //Agrego opciones al Grupo
                           
            
            /*
		     
		     if (tgrupo.toLowerCase()!=dtCad.Rows[i].Clav_Pais.toLowerCase() && abrio==true) { 
		        elemCbo.appendChild(grupo);
		        abrio=false; 
		     }		        
		     if (tgrupo.toLowerCase()!=dtCad.Rows[i].Clav_Pais.toLowerCase() && !abrio) {
		        grupo = document.createElement('optgroup');
		        grupo.label=dtCad.Rows[i].Nombre_Pais_Id;
		        tgrupo = dtCad.Rows[i].Clav_Pais ;
		        abrio=true; 		     
		     }
		     if (dtCad.Rows[i].Clav_Destino == destino) {
		        sOption = new Option(dtCad.Rows[i].Nombre_Destino,dtCad.Rows[i].Clav_Destino,true,true); //Opcion seleccionada
		     }else {
		       sOption = new Option(dtCad.Rows[i].Nombre_Destino,dtCad.Rows[i].Clav_Destino,false,false); //No seleccionadas
		     }		     
		     grupo.appendChild(sOption);
		    */			
			
		    					  
		}
		if (abrio==true) {
		      elemCbo.appendChild(optGroup);
		      //elemCbo.appendChild(grupo);
		}
				
		if (Tipo_Servicio =='H') {
 
		    Carga_Hoteles_Cadenas(hotel)
		}   
	}

	/*Carga los Hoteles por cadena*/		
	function Carga_Hoteles_Cadenas(hotel,Idioma,sitioDestinos){	
 
		var Cadena = ''; var Combo;			
		//var Combo  = document.getElementById("CadenaH");
		var radio = document.getElementById("RadioH");
        if (radio!='undefined' && radio!=null){
            if (radio.type=='unput' || radio.type=='hidden') {
                if (radio.value.toUpperCase()=="H"){		
			        Combo = document.getElementById("CadenaH");
			        Tipo_Servicio ='H';
                }
            }else {
                if (radio.checked==true){		
			        Combo = document.getElementById("CadenaH");
			        Tipo_Servicio ='H';
		        }else{
			       Combo = document.getElementById("CadenaHF");
			       Tipo_Servicio ='HF';
		        }
            }

        }		
			
		if (Combo.type =="select-one") 
			Cadena = Combo.options[Combo.selectedIndex].value;
		else
			Cadena = Combo.value;		
		
		var elDestino='';
		var Combo  = document.getElementById("Destino");
		elDestino = (typeof Combo !='undefined' && Combo !=null) ? Combo.value : '';
		if (elDestino == '') {
			Combo  = document.getElementById("ajDestino");
			elDestino = (typeof Combo !='undefined' && Combo !=null) ? Combo.value : '';
		}
						
		// objeto en donde vamos a almacenar la informacion						
		var cbo  = document.getElementById("_Nombre");
        cbo = (typeof cbo!='undefined' && cbo!=null) ? cbo : document.getElementById("_Clav_Hotel")
					
		//Obtengo el valor del elemento Nota: getValueElems (Esta en ValidationRates.js)
		Idioma = fdic.lang(Idioma);

         var aPais = document.getElementById("Pais_Producto");
         aPais = (typeof aPais!='undefined' && aPais!=null)? aPais.value:'';
					
		var dt;   //_ajaxPrintSQL ='true';
		var dtTemp= AutoComplete.search_Hoteles_Cadenas(Tipo_Servicio,Cadena,elDestino,Idioma,sitioDestinos,aPais,_ajaxPrintSQL,'sinUSAR1').value;

		//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		//Ejs: Return [DataTable, SQL] [M] = Multiples)
		//     Return [DataTable] [S] = Un Solo Valor)
		if (typeof dtTemp.aDT == "object"){
			dt = dtTemp.aDT;  //[M]		
		}
		//solo si existe y regresa consulta 
		if (typeof dtTemp.aSQL == "string"){
			if (dtTemp.aSQL != '') {CallData(Combo,'acronym',dtTemp.aSQL,'SQL-A');}
		}	
		
		if 	(dt == null)				
			return;

        if (cbo.type !="select-one") { return false;}
		$RemoveOptions (cbo);
              		
		//Primer Opcion del Combo de Hoteles
		cbo.options[0] = new Option(fdic.trad(disAllHotels,Idioma), '');
			
		//Lleno el Combo de Hoteles
		for (var i=0; i<dt.Rows.length; i++){

            if (isNaN(parseInt(hotel))) { //Se va por nombres
                //Valido si la Clave que me envian es igual a la de los Datos Si es Igual lo Selecciono
			    if (dt.Rows[i].Nombre_Hotel.toLowerCase() == hotel.toLowerCase()) { 	
				    cbo.options[i+1] = new Option(dt.Rows[i].Nombre_Hotel, dt.Rows[i].Nombre_Hotel,true,true); //El Seleccionado
			    }else{
				    cbo.options[i+1] = new Option(dt.Rows[i].Nombre_Hotel, dt.Rows[i].Nombre_Hotel,false,false);	//No Seleccionados	
                }
            }else {
                    //Valido si la Clave que me envian es igual a la de los Datos Si es Igual lo Selecciono
			    if (dt.Rows[i].Clav_Hotel == hotel) {
				    cbo.options[i+1] = new Option(dt.Rows[i].Nombre_Hotel, dt.Rows[i].Clav_Hotel,true,true); //El Seleccionado
			    }else{
				    cbo.options[i+1] = new Option(dt.Rows[i].Nombre_Hotel, dt.Rows[i].Clav_Hotel,false,false);	//No Seleccionados	
                }
            
            }				
								
		}
		
	}
	
	//--------------------------------------Temas---------------------------------------------

	/*Funcion que carga los destinos por cadena*/	
	function Carga_Destino_Temas(destino,Idioma,sitioDestinos){			
					
		var radio = document.getElementById("RadioH");
		if (radio.checked==true)
			Tipo_Servicio ='H';
		else
			Tipo_Servicio ='HF';
		
		var combo;
		if (Tipo_Servicio =='HF')
			Combo  = document.getElementById("TemaHF");
		else
			Combo  = document.getElementById("TemaH");
		
		//Obtengo el valor del elemento Nota: getValueElems (Esta en Diccionario.js)
		Idioma = fdic.lang(Idioma);
		
		var dt;	
		var dtTemp = AutoComplete.search_destino_temas(Tipo_Servicio,Combo.value,Idioma,sitioDestinos,AjPais,_ajaxPrintSQL).value;

		//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		//Ejs: Return [DataTable, SQL] [M] = Multiples)
		//     Return [DataTable] [S] = Un Solo Valor)
		if (typeof dtTemp.aDT == "object"){
			dt = dtTemp.aDT;  //[M]		
		}
		//solo si existe y regresa consulta 
		if (typeof dtTemp.aSQL == "string"){
			if (dtTemp.aSQL != '') {CallData(Combo,'acronym',dtTemp.aSQL,'SQL-A');}
		}	

		if 	(dt == null)				
			return;
		
		// objeto en donde vamos a almacenar la informacion
		//var cbo  = document.getElementById("Destino");
		var cbo  = document.getElementById("Destino");
					
		$RemoveOptions (cbo);
			
		//Primer Opcion del Combo de Destinos
		cbo.options[0] = new Option(fdic.trad(disAllDestination,Idioma), 0);
				
		//Lleno el combo de Temas de Hotel 
		for (var i=0; i<dt.Rows.length; i++){
		
			//Seleccciono cuando sean igual el valor del destino
		    if (dt.Rows[i].Clav_Destino == destino)
				cbo.options[i+1] = new Option(dt.Rows[i].Nombre_Destino, dt.Rows[i].Clav_Destino,true,true);
		    else 		    
				cbo.options[i+1] = new Option(dt.Rows[i].Nombre_Destino, dt.Rows[i].Clav_Destino,false,false);
			
		}
		
		
	}

	/*Carga los Hoteles por cadena*/		
	function Carga_Hoteles_Temas(hotel,Idioma,sitioDestinos){
							
		var CboDestino;
		var CboTema;
		
		if (Tipo_Servicio =='HF')
			CboTema  = document.getElementById("TemaHF");
		else
			CboTema  = document.getElementById("TemaH");
				
		CboDestino  = document.getElementById("Destino");
		///Destino = Combo.options[Combo.selectedIndex].value;

		// objeto en donde vamos a almacenar la informacion						
		var cbo  = document.getElementById("_Nombre");
				
		//obj.type = select-one  (es un combo)	//obj.type = text  (es un Text)		
		//Obtengo el valor del elemento Nota: getValueElems (Esta en Diccionario.js)
		Idioma = fdic.lang(Idioma);
		
		//Es un Combo ? 
		if (obj.type == "select-one") {
				
			var dt;
			var dtTemp = AutoComplete.search_Hoteles_Cadenas(Tipo_Servicio,CboTema.value,CboDestino.value,Idioma,sitioDestinos,AjPais,_ajaxPrintSQL,'sinISAR1').value;
			
			//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
			//Ejs: Return [DataTable, SQL] [M] = Multiples)
			//     Return [DataTable] [S] = Un Solo Valor)
			if (typeof dtTemp.aDT == "object"){
				dt = dtTemp.aDT;  //[M]		
			}
			//solo si existe y regresa consulta 
			if (typeof dtTemp.aSQL == "string"){
				if (dtTemp.aSQL != '') {CallData(CboTema,'acronym',dtTemp.aSQL,'SQL-A');}
			}	
						
			//Si hay Datos
			if 	(dt == null)				
				return;
			$RemoveOptions (cbo);
		
			//Primer Opcion del Combo de Hoteles
			cbo.options[0] = new Option(fdic.trad(disAllHotels,Idioma),'');	
		
			//dt.Rows[i].Clav_Hotel
			for (var i=0; i<dt.Rows.length; i++){
				//Si el nombre es igual al que le envie lo selecciona
				if (dt.Rows[i].Nombre_Hotel == hotel)
					cbo.options[i] = new Option(dt.Rows[i].Nombre_Hotel, dt.Rows[i].Nombre_Hotel,true,true);
				else		
					cbo.options[i] = new Option(dt.Rows[i].Nombre_Hotel, dt.Rows[i].Nombre_Hotel,false,false);
				
			}		
		
		
		}else  //Para Tipo Text
		{
			
			
		}
				
	}  
		
	
	/*					SECCION DE BUSCADOR DE DEALS  (CARGA DESTINOS POR CADENA DE HOTELES)					*/
	
	/*Funcion que carga los destinos por cadena*/	
	function Carga_Destino_Cadenas_Deals(destino,hotel,Idioma,sitioDestinos){					
		var Cadena = ''; var cboFil;	var cboAct;
		Tipo_Servicio ='H';	  //Tipo de Servicio	
		cboFil = document.getElementById("CadenaH");		
		// Verificamos que tipo de Objeto es, para saber sonde debemos obtener el valor de la cadena 
		/// Combo o del Hidden
		if (cboFil.type =="select-one"){
			Cadena = cboFil.options[cboFil.selectedIndex].value;
		}else{
			Cadena = cboFil.value;
		}				
		if (Tipo_Servicio =='HF') {		
			cboAct = document.getElementById("ciudades");
		}else{
			cboAct = document.getElementById("Destino");
		}
		if (ajExistsObj(cboAct)==false) { return false; }
		if (cboAct.type !="select-one"){ return false; }
		//Obtengo el valor del elemento Nota: getValueElems (Esta en ValidationRates.js)
		Idioma = fdic.lang(Idioma);		
		var dt = AutoComplete.search_Destino_Cadena(Tipo_Servicio,Cadena,Idioma,sitioDestinos,AjPais,_ajaxPrintSQL).value;

		//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		//Ejs: Return [DataTable, SQL] [M] = Multiples)
		//     Return [DataTable] [S] = Un Solo Valor)
		var dtCad;
		//[M]
		if (typeof dt.aDT == "object"){ dtCad = dt.aDT; }
		//solo si existe y regresa consulta 
		if (typeof dt.aSQL == "string"){
			if (dt.aSQL != '') {CallData(cboAct,'acronym',dt.aSQL,'SQL-A');}
		}		
		if 	(dtCad == null)	{ return false; }							
		$RemoveOptions (cboAct); 
		
		//Primer Opcion del Combo de Destinos
		cboAct.options[0] = new Option(fdic.trad(disAllDestination,Idioma), 0);
		
		//Lleno el Combo con los Destinos
		for (var i=0; i<dtCad.Rows.length; i++){				
			//Valido si la clave del Destino es la Misma seleccionada Anteriormente
		    if (dtCad.Rows[i].Clav_Destino == destino)
				cboAct.options[i+1] = new Option(dtCad.Rows[i].Nombre_Destino,dtCad.Rows[i].Clav_Destino,true,true); //Opcion seleccionada
		    else
				cboAct.options[i+1] = new Option(dtCad.Rows[i].Nombre_Destino,dtCad.Rows[i].Clav_Destino,false,false); //No seleccionadas
		    					  
		}			    
	}

	/*		CARGA LAS CIUDADES DEL DESTINO */
	/*caso 1: Ciudades del Destino Seleccionado */
	/*caso 2: Todas las Ciudades cuando tiene Select Destination */
	
	/*Funcion que carga los destinos por cadena*/	
	function Carga_Ciudades_x_Destino(cbodestino,cbociudad,sitiodestinos,pciudad,Idioma){
	
		//si no existe el elemento Ciudad lo saco
		if (typeof cbociudad == "undefined" || cbociudad == null )
			return;
			
		//tomo el valor del Elemento Combo "Destino"
		if (cbodestino.type =="select-one") //es combo ?
				cbodestino = cbodestino.options[cbodestino.selectedIndex].value;
		else
				cbodestino = cbodestino.value;
					
		// objeto en donde vamos a almacenar la informacion							
		$RemoveOptions (cbociudad);
		
		//Obtengo el valor del elemento Nota: getValueElems (Esta en ValidationRates.js)
		Idioma = fdic.lang(Idioma);
		
		var rReturn = ajEnabledElem(cbociudad,Idioma); //activa el objeto
				
		//Primer Opcion del Combo de Ciudades
		cbociudad.options[0] = new Option(fdic.trad(disAllCities,Idioma), '');
		
		var dtCiudades;
		var dtCdad= AutoComplete.Search_Ciudades_x_Destino(cbodestino,sitiodestinos,Idioma,AjPais,_ajaxPrintSQL,'sinUSAR1').value;

		//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		//Ejs: Return [DataTable, SQL] [M] = Multiples)
		//     Return [DataTable] [S] = Un Solo Valor)
		if (typeof dtCdad.aDT == "object"){
			dtCiudades = dtCdad.aDT;  //[M]		
		}
		//solo si existe y regresa consulta 
		if (typeof dtCdad.aSQL == "string"){
			if (dtCdad.aSQL != '') {CallData(cbociudad,'acronym',dtCdad.aSQL,'SQL-A');}
		}	
		
		//verifico si regreso algun valor
		if 	(dtCiudades == null) {				
			return;
		}				
						
		//Lleno el Combo con los Destinos
		for (var i=0; i<dtCiudades.Rows.length; i++){
				
			//Valido si la clave del Destino es la Misma seleccionada Anteriormente
		    if (dtCiudades.Rows[i].Clav_Ciudad.toUpperCase() == pciudad.toUpperCase())
				cbociudad.options[i+1] = new Option(dtCiudades.Rows[i].Nombre_Ciudad_Id,dtCiudades.Rows[i].Clav_Ciudad,true,true); //Opcion seleccionada
		    else
				cbociudad.options[i+1] = new Option(dtCiudades.Rows[i].Nombre_Ciudad_Id,dtCiudades.Rows[i].Clav_Ciudad,false,false); //No seleccionadas
		    					  
		}
			    
	}
		
	/*Funcion que carga los Categorias o Clasificadores de Tours por Destino Seleccionado*/
	function Carga_CategoriasTour_x_Destino(cbodestino,sitiodestinos,cbocateg,categoria,Idioma){
		//debugger;
		//si no existe el elemento Ciudad lo saco
		if (typeof cbocateg == "undefined" || cbocateg == null )
			return; 
		var valdestino='';
		//tomo el valor del Elemento Combo "Destino"
		if (cbodestino.type =="select-one") //es combo ?
				valdestino = cbodestino.options[cbodestino.selectedIndex].value;
		else
				valdestino = cbodestino.value;		
					
		// objeto en donde vamos a almacenar la informacion							
		$RemoveOptions (cbocateg);
				
		//Obtengo el valor del elemento Nota: getValueElems (Esta en ValidationRates.js)
		Idioma = fdic.lang(Idioma);
		
		//Primer Opcion del Combo de Ciudades
		cbocateg.options[0] = new Option(fdic.trad(disAllCategories,Idioma), '');	
				
		var dtClasif;	
		var _dtClasif= AutoComplete.Search_ClasificadoresTour_x_Destino(valdestino,sitiodestinos,Idioma,AjPais,_ajaxPrintSQL,'sinUSAR1').value;
		
		//si no regresa nada lo saco
		if (_dtClasif == null) { return false;}
		
		//Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		//Ejs: Return [DataTable, SQL] [M] = Multiples)
		//     Return [DataTable] [S] = Un Solo Valor)
		if (typeof _dtClasif.aDT == "object"){
			dtClasif = _dtClasif.aDT;  //[M]		
		}
		//solo si existe y regresa consulta 
		if (typeof _dtClasif.aSQL == "string"){
			if (_dtClasif.aSQL != '') {CallData(cbocateg,'acronym',_dtClasif.aSQL,'SQL-A');}
		}	
		
		//verifico si regreso algun valor
		if 	(dtClasif == null) {				
			return;
		}				
						
		//Lleno el Combo con los Destinos
		for (var i=0; i<dtClasif.Rows.length; i++){
				
			//Valido si la clave del Destino es la Misma seleccionada Anteriormente
		    if (dtClasif.Rows[i].Clav_Clasificador.toUpperCase() == categoria.toUpperCase())
				cbocateg.options[i+1] = new Option(dtClasif.Rows[i].Nombre_Clasificador_Id, dtClasif.Rows[i].Clav_Clasificador,true,true); //Opcion seleccionada
		    else
				cbocateg.options[i+1] = new Option(dtClasif.Rows[i].Nombre_Clasificador_Id, dtClasif.Rows[i].Clav_Clasificador,false,false); //No seleccionadas
		    					  
		}
			
			    
	}

/* Limpiamos los combos para volverlos a llenar */
	function $RemoveOptions(combo){
        var i=0;
		//Limpio las Opciones del Combo	
		if (typeof combo != 'undefined' &&  combo !=null) {
			if (combo.tagName.toLowerCase() == 'select') {
                var itms = combo.getElementsByTagName("optgroup");
                if (itms.length > 0) {
                    //remuevo del ultimo al primero
                    for (i=itms.length-1; i>=0;i--) {
                        combo.removeChild(itms.item(i));                    
                    }
                }else {
                    while (combo.options.length > 0) {
					    combo.options[0] = null;
				    }
                }				
			}
		}
	}


	/*Llama esta funcion en caso de error y asi podamos hacer cual fue la causa*/									
	/*Nota: Esta funcion se tiene que anexar al final de cada llamada al procedimiento*/
	/*Ejemplo */											
	/* AutoComplete.search_Destino_Cadena(Tipo_Servicio, Cadena, Idioma, Sitio, ServerSideAdd_CallBack ).value; */
	//-----------------------------------------------------------------------------------^
	function ServerSideAdd_CallBack(response){
		if (response.error != null){
			alert (response.error.Message); 
			return;
		}	
	}

	/*Oculta el combo de Hotel*/
	function Oculta_Hotel(){			
		var radio = document.getElementById("RadioH");
		if (radio.checked==true)
			Tipo_Servicio ='H';
		else
			Tipo_Servicio ='HF';
			
		var cbo  = document.getElementById("Nombre");
		
		if (Tipo_Servicio == 'HF')
			cbo.style.visibility='hidden';
		else
			cbo.style.visibility='visible';				
		
		Carga_Destino_Cadenas();
		Carga_Hoteles_Cadenas('');
	}

/*Funcion que carga los Categorias o Clasificadores de Tours por Destino Seleccionado*/
	function Carga_Ciudades_Rentadoras(pais,rentadora,objciudad,ciudad,sucursal,sitiodestinos,idioma,tipo){
        try {
            
            //si no existe el elemento Ciudad lo saco
		    if (typeof objciudad == "undefined" || objciudad == null ) { return false; }

            objciudad.style.background= "url('/_Lib/Images/indicator.gif') no-repeat left";

		    var valdestino='';
		    //No es combo ?
		    if (objciudad.type !="select-one") { return;} //saco				
    					
		    // objeto en donde vamos a almacenar la informacion							
		    $RemoveOptions (objciudad);

            			
		    //Obtengo el valor del elemento Nota: getValueElems (Esta en ValidationRates.js)
            if (typeof idioma == 'undefined') { idioma = fdic.lang(idioma); }
    		
		    //Primer Opcion del Combo de Ciudades E = EntregaEn  D= DevuelveEn
            if (tipo=='D') {
                if (ciudad=='') {
                    objciudad.options[0] = new Option(fdic.trad(disCarSameasPickUp,idioma), '',true,true); //Opcion seleccionada
                }else {
                    objciudad.options[0] = new Option(fdic.trad(disCarSameasPickUp,idioma), '',false,false); //Opcion NO seleccionada		        
                }
            }

            //Obtengo la Rentadora seleccionada
            rentadora = (typeof rentadora!='undefined' && rentadora!=null)? rentadora.value : 0;
    				
		    var dtCiudadRent;	
		    var _dtCiudadRent= AutoComplete.search_Ciudades_Rentadora(pais,rentadora,sitiodestinos,idioma,tipo,'','',_ajaxPrintSQL).value;
    		
		    //Para Cuando la Funcion Regresa Varios Tipos de Datos Return 
		    //Ejs: Return [DataTable, SQL] [M] = Multiples)
		    //     Return [DataTable] [S] = Un Solo Valor)
		    if (typeof _dtCiudadRent.aDT == "object"){
			    dtCiudadRent = _dtCiudadRent.aDT;  //[M]		
		    }
		    //solo si existe y regresa consulta 
		    if (typeof _dtCiudadRent.aSQL == "string"){
			    if (_dtCiudadRent.aSQL != '') {
                    if (tipo=='E') {
                        CallData(objciudad,'acronym',_dtCiudadRent.aSQL,'SQL-A-Pick');
                    }else {
                        CallData(objciudad,'acronym',_dtCiudadRent.aSQL,'SQL-A-Drop');
                    }
                }
		    }	
    		
		    //verifico si regreso algun valor
		    if 	(dtCiudadRent == null) { return; }					    
            var tempDest = ''; var optGroup = ''; var opt =''; var abrio=false
		    //Lleno el Combo con los Destinos
		    for (var i=0; i<dtCiudadRent.Rows.length; i++){

                //tomo la primer ciudad y sucursal solo en EntregaEn
                if ((ciudad=='' || sucursal=='') && tipo=='E') { ciudad = dtCiudadRent.Rows[i].Clav_Ciudad; sucursal = dtCiudadRent.Rows[i].Clav_Sucursal;}

                //genero el nuevo grupo
                if ((tempDest!= dtCiudadRent.Rows[i].Clav_Ciudad && abrio==true) || i==(dtCiudadRent.Rows.length-1)) {
                    objciudad.appendChild(optGroup);  //Agrego grupo al combo principal
                    abrio =false;
                }
                if (tempDest!= dtCiudadRent.Rows[i].Clav_Ciudad && abrio==false) {
                    optGroup = document.createElement("optgroup"); optGroup.label = dtCiudadRent.Rows[i].Nombre_Destino_Id;
                    tempDest = dtCiudadRent.Rows[i].Clav_Ciudad;
                    abrio = true;
                }            
                // create options and attach to optgroups
                opt = document.createElement("option");  
                opt.innerHTML = dtCiudadRent.Rows[i].Nombre_Sucursal;  
                opt.value = dtCiudadRent.Rows[i].Clav_Ciudad +'|' + dtCiudadRent.Rows[i].Clav_Sucursal;  
                if 	(ciudad.toLowerCase()==dtCiudadRent.Rows[i].Clav_Ciudad.toLowerCase() && String(sucursal).toLowerCase()==String(dtCiudadRent.Rows[i].Clav_Sucursal).toLowerCase()) {
                    opt.selected = true;
                }else {
                    opt.selected = false;
                }            
                optGroup.appendChild(opt); //Agrego opciones al Grupo
               
		    }
		
        } catch (ex) {

        } finally {
            if (typeof objciudad!="undefined" && objciudad!=null) { 
                objciudad.style.background= "";
            }            
        }	
		var x=1;	    
	}
	
	

