
	var globalX;
	
	function filterSubcategory(id){
			
			// document.getElementById('rsWaiting').style.display='block'; // inserta cartel cargando
			x_getSubcategories(id, putSubcategories);
	}
	
	function putSubcategories(arr)
	{
		var tmp;
		tmp         = arr.substring(1); //Parche por que z viene con ":" adelate.
		eval("var customarray = " + tmp); // customarray se llama el arreglo mejorado

		controlToPopulate = 	window.document.getElementById('gdsId_genders');

		for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
		
		for ( x = 0 ; x < customarray['arr_id'].length  ; x++ )
		{
			if (typeof(customarray['arr_id']) != "undefined" &&  customarray['arr_id']!="")
			{

				controlToPopulate.options[controlToPopulate.options.length] =
				new Option(customarray['arr_values'][x],customarray['arr_id'][x]);
			}
		}				
		//document.getElementById('rsWaiting').style.display='none'; // quita cartel cargando
	}
	
	function create_options(){
	    
	    //Genero las opciones del select "memberList"
		controlToPopulate=document.forms['frm_abm'].elements['memberList'];

		for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
		
		for ( x = 0 ; x < arrItems.length  ; x++ )
		{
			if (typeof(arrItems[x]) != "undefined" &&  arrItems[x]!="")
			{
				controlToPopulate.options[controlToPopulate.options.length] =
				new Option(arrItems[x],arrItemsGrp[x]);
			//	alert(arrItems[x]);
			}
		}				
		document.getElementById('rsWaiting').style.display='none';
	}
	
	function put_items(z){

		var tmp;
		tmp         = z.substring(1); //Parche por que z viene con ":" adelate.
        arrItems    = Array();
        arrItemsGrp = Array();
		eval("var customarray = " + tmp);

		//actualizo los arreglos arrItems y arrItemsGrp
		for (i in customarray['val1']) {
		  arrItems[i]    = customarray['val1'][i]; //Palabras claves
		  arrItemsGrp[i] = customarray['val3'][i]; //ID de las palabras claves
		}
		//creo las options en el select
		create_options();
	}
	
	function items_filtrados(z){
        var valor;
		var tmp;
		var arrTmp = new Array();
		var arrTmpGrp = new Array();
  
		tmp = z.substring(1); //Parche por que z viene con ":" adelate.
		valor = arrItems.lenght;
		
		eval("var customarray = " + tmp);
		for (x in arrItems){
			arrTmp[x] = arrItems[x];
			arrTmpGrp[x] = arrItemsGrp[x];
		}
        arrItems =  Array();
        arrItemsGrp = Array();
		//actualizo los arreglos arrItems y arrItemsGrp
		for (i in customarray['val1']) {
          //verifico que el contenido este en arrItems
          
          for(x=0; x<arrTmp.length; x++){		
			if (customarray['val3'][i] == arrTmpGrp[x]){ 
		  		arrItems[i]    = customarray['val1'][i]; //Palabras claves
		  		arrItemsGrp[i] = customarray['val3'][i]; //ID de las palabras claves
		  	}
		  } 
		}
		
		//creo las options en el select
		create_options();
	}
		
	var globalGroup;
	var categoriesDownloaded = Array();
	function selectChange(group)
	{
        document.getElementById('rsWaiting').style.display='block';
	    
        //busco las palabras claves y cargo los arreglos arrItems y arrItemsGrp
	    select_model(group, put_items);
	}
	function ChangeContent(group)
	{ 

        document.getElementById('rsWaiting').style.display='block';
        //busco las palabras claves y cargo los arreglos arrItems y arrItemsGrp
	    x_select_content(group, put_items);

	}
	function deb(msg)
	{
		o = document.getElementById("dConsole");
		if(o){
			dbg= "["+msg+"]"+"\n";
			o.value =o.value+dbg;
		}
	}
	function do_detail_cb(z) 
	{
		eval("var customarray = "+z);
		deb("\n"+'Z:'+z);
		for(i in customarray['index2'])
		{
			arrDetails[customarray['index2'][i]]=customarray['val2'][i];
		}
		if(arrDetails[globalX])
			document.getElementById("details").innerHTML=arrDetails[globalX];
		else
			document.getElementById("details").innerHTML='';
		document.getElementById('rsWaiting').style.display='none';
	}



	function do_model() 
	{
        // get current value of serial number field
        x = document.getElementById("serial").value;
		x = 1;
		document.getElementById('rsWaiting').style.display='block';
        //if length of autocomplete is zero, send the callback
        //an empty array to fill the autocomplete with-- there
        //is nothing to match.
        if (x.length==0)
           {return;}
        x_select_model(x, do_model_cb);
    }
	
	function appendItem() {
		var x = 0;
		var ID = document.forms['frm_abm'].elements['memberList'].options[document.forms['frm_abm'].elements['memberList'].selectedIndex].value;
		while( x < selecItems.length){
	   		if (selecItems[x] == ID){return;}
	   		x++;
	   	}	
		selecItems[x] = ID;
		
		if(document.forms['frm_abm'].elements['similar'].length>=0 )
		{
			if (document.forms['frm_abm'].elements['memberList'].selectedIndex != -1) {
			    document.forms['frm_abm'].elements['similar'].options[document.forms['frm_abm'].elements['similar'].options.length] =
				new Option(document.forms['frm_abm'].elements['memberList'].options[document.forms['frm_abm'].elements['memberList'].selectedIndex].text, 
					document.forms['frm_abm'].elements['memberList'].options[document.forms['frm_abm'].elements['memberList'].selectedIndex].value)		
			} else {
				alert("Debe elegir un producto primero (lista izquierda)");
			}
		}else
		{
			alert("Error");
		}
	}
	
	function deleteItem(){

	if (document.frm_abm['similar[]'].selectedIndex != -1) {
			document.frm_abm['similar[]'].remove(document.frm_abm['similar'].selectedIndex);
			selecItems.splice(document.frm_abm['similar'].selectedIndex, 1);
		} else {
			alert("Debe elegir un elemento de la lista de la derecha para poder quitar"); //(d)
		}
	}
	
	function append_word(idKeyWord){
	
		var quanty = arrItems.length;
		arrItems[quanty] = document.frm_abm['keyWord'].value;
		arrItemsGrp[quanty] = idKeyWord;
		new Option(document.forms['frm_abm'].elements['memberList'].options[arrItems[quanty]], 
					document.forms['frm_abm'].elements['memberList'].options[arrItemsGrp[quanty]])
	}
	
	function append_word_new(z){
		var tmp;
		var obj, obj1;
		tmp = z.substring(1);
		eval("var id = " + tmp);	
	    obj = document.getElementById('memberList');	    
	    var quanty = obj.length;
		document.forms['frm_abm'].elements['memberList'].options[document.forms['frm_abm'].elements['memberList'].options.length] =
				new Option(document.forms['frm_abm'].elements['keyWord'].value,id);		
		document.forms['frm_abm'].elements['keyWord'].value="";			
	}
	
	function newKeyWord(){	
	    var keyWord = window.document.frm_abm.elements['keyWord'].value;
	    if (keyWord == ""){
		    alert("Debe ingresar una Palabra Clave");   
		}else{	
			x_select_detail(keyWord, append_word_new);
		}
	}

    function filtrar_contenidos(texto){		
          document.getElementById('rsWaiting').style.display='block';
          x_filtrar_contenidos(texto, items_filtrados);
	}
	
	function in_array (valor, matriz) {	
	  var texto = "¬" + matriz.join("¬") + "¬";	
	  var er = new RegExp ("¬" + valor + "¬", "gim");	
	  return ( (texto.match (er)) ? true : false );	
	}
	
	function agrup_items(z){
	    var tmp;
		tmp = z.substring(1);		
	    eval("var customarray = "+tmp);   	
        var arr = arrItemsGrp;
    	for(x in customarray['val1']){
	    	if (!in_array(arrItemsGrp, arrItemsGrp)){
	    	     tmp = arrItemsGrp; 
	    		 arrItemsKey.push(customarray['val3'][x]);
	    		 arrItemsNam.push(customarray['val1'][x]);	
	    	}
	    }	
	    mostrar_contenidos();
	}
	
	function mostrar_contenidos(){
	var conf;
	var arrTmp = new Array();
	var arrTmpGrp = new Array();
	var hasta = arrItemsGrp[0];
		
	
		//filtro
		for (x=0; x < hasta; x++){
		    conf = arrItems[x]; 
			arrTmp.push(conf);
			conf = arrItemsGrp[x];
			arrTmpGrp.push(conf);
		}
        arrItems =  Array();
        arrItemsGrp = Array();
		//actualizo los arreglos arrItems y arrItemsGrp
		for (i in arrItemsKey) {
          for(x=0; x<arrTmpGrp.length; x++){		
			if (arrItemsKey[i] == arrTmpGrp[x]){ 
		  		arrItems[i] = arrItemsNam[i]; //Palabras claves
		  		arrItemsGrp[i] = arrItemsKey[i]; //ID de las palabras claves
		  	}
		  } 
		}
	//----		
		create_options();
	}

   function nada(id){

    window.document.forms['frm_abm'].elements['titulo'].value = "";
	window.document.forms['frm_abm'].elements['file'].value = "";
	window.document.forms['frm_abm'].elements['link'].value = "";
	window.document.forms['frm_abm'].elements['short'].value = "";
   }		
	
	function filtrar_palabras(ids){
		  document.getElementById('rsWaiting').style.display='block';
		  arrItemsKey = new Array();
		  arrItemsNam = new Array();
		  //corto el string
		  arrIDs = ids.split(',');
		  for (x=0; x<arrIDs.length; x++){
          	x_filtrar_palabras(arrIDs[x], agrup_items);
          }
	}

	function getBanners(id){
		document.getElementById('rsWaiting').style.display='block';
	   
        //busco las palabras claves y cargo los arreglos arrItems y arrItemsGrp
	    x_select_banners(id, put_items);
	}
   
   function setCategoria(arr){
   	var tmp;
		tmp         = arr.substring(1); //Parche por que z viene con ":" adelate.
		eval("var customarray = " + tmp); // customarray se llama el arreglo mejorado

		controlToPopulate = 	window.document.getElementById('subcategoria');

		for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
		
		for ( x = 0 ; x < customarray['arr_id'].length  ; x++ )
		{
			if (typeof(customarray['arr_id']) != "undefined" &&  customarray['arr_id']!="")
			{

				controlToPopulate.options[controlToPopulate.options.length] =
				new Option(customarray['arr_values'][x],customarray['arr_id'][x]);
			}
		}			
   }
   
   function filtroCategoria(id){
   		x_getSubcategories(id, setCategoria);
   }
   
   function setSubCategoria(arr){
	var tmp;
		tmp         = arr.substring(1); //Parche por que z viene con ":" adelate.
		eval("var customarray = " + tmp); // customarray se llama el arreglo mejorado

		controlToPopulate = 	window.document.getElementById('technology');

		for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
		
		for ( x = 0 ; x < customarray['arr_id'].length  ; x++ )
		{
			if (typeof(customarray['arr_id']) != "undefined" &&  customarray['arr_id']!="")
			{

				controlToPopulate.options[controlToPopulate.options.length] =
				new Option(customarray['arr_values'][x],customarray['arr_id'][x]);
			}
		}			   
   }
   
   function filtroSubCategoria(id){
   		x_getTechnology(id, setSubCategoria);
   }
      
   function	new_SetSession(){   	
   		if (Edit=='New'){
	   		var block = window.document.forms['frm_abm'].elements['id_block'].value;
	   		var content = window.document.forms['frm_abm'].elements['memberList'].value;
	   		var titulo = window.document.forms['frm_abm'].elements['titulo'].value;
	   		var instance = window.document.forms['frm_abm'].elements['memberList'].options.selectedIndex;
	   		var path = window.document.forms['frm_abm'].elements['file'].value;
	   		var link = window.document.forms['frm_abm'].elements['link'].value;
	   		var sht = document.forms['frm_abm'].elements['short'].value;
	   		var title_content = window.document.forms['frm_abm'].elements['memberList'].options[window.document.forms['frm_abm'].elements['memberList'].options.selectedIndex].text;
   		}else{
	   		var block = window.document.forms['frm_abm'].elements['id_block'].value;
	   		var content = window.document.forms['frm_abm'].elements['similar'].value;
	   		var titulo = window.document.forms['frm_abm'].elements['titulo'].value;
	   		var instance = window.document.forms['frm_abm'].elements['similar'].options.selectedIndex;
	   		var path = window.document.forms['frm_abm'].elements['file'].value;
	   		var link = window.document.forms['frm_abm'].elements['link'].value;
	   		var sht = document.forms['frm_abm'].elements['short'].value;
	   		var title_content = window.document.forms['frm_abm'].elements['similar'].options[window.document.forms['frm_abm'].elements['similar'].options.selectedIndex].text;
   		}
   		var nuevo = new Array();   		   		
   		nuevo[0] = block;
   		nuevo[1] = content;
   		nuevo[2] = titulo;
   		nuevo[3] = instance + 1;
   		nuevo[4] = path;
   		nuevo[5] = link;
   		nuevo[6] = sht;
   		nuevo[7] = title_content;
   		
		x_setSessionVar(nuevo, nada);
   }
   
   function editData(campos){
	var tmp;
	tmp = campos.substring(1);
	eval("var customarray = " + tmp);	

	window.document.forms['frm_abm'].elements['titulo'].value = customarray.tittle;
	window.document.forms['frm_abm'].elements['file'].value = customarray.path_image;
	window.document.forms['frm_abm'].elements['link'].value = customarray.link_instance;
	window.document.forms['frm_abm'].elements['short'].value = customarray.description_short;
   }
   
   function loadDataInstance(id){   
		var id = window.document.forms['frm_abm'].elements['similar'].value;   
		var id_block = window.document.forms['frm_abm'].elements['id_block'].value;
 		x_loadDataInstance(id, id_block, editData);  
   }
   
   function postHidded(id){
   	var tmp;
   	var hidden = document.getElementById('ID');
   	var nbrHid = hidden.value;
	tmp = id.substring(1);
	eval("var customarray = " + tmp);	
	obj = document.getElementById(nbrHid);
	obj.value = customarray.id_module;
	obj.name = customarray.name_hidden;
   }
   
   function defaultFunction(id){
    return false;
   }
   
   function newModule(name){
		  //llamo una funcion que cree un modulo y modifique el valor del hidden
		  x_setHidden(name, postHidded);
   }
   
   function delete_Module(name){
   			var id_module = window.document.forms['frm_preview'].elements['id_module'+name].value;
	   		x_concatIdModule(id_module, defaultFunction);
   }
   
   function checkErrorFields(out){
   	 out = out.substring(1); 
   	 eval("var out = " + out); 
   	 if (out.length>0){ 
   	 	alert("Error | No se han completados los campos requeridos para los contenidos a publicar:\n Revise los items an la posición nro. "+out);
   	 }
		else{			
			closeWindow();			
		}

   }
   
   function fieldCheck(){
	 var id = window.document.forms['frm_abm'].elements['id_block'].value;	
   	 x_fieldCheck(id, checkErrorFields);
   }

   function create(){
 		controlToPopulate=document.forms['frm_banners'].elements['bnrId'];
		for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;		
		for ( x = 0 ; x < arrIdBanner.length  ; x++ )
		{
			if (typeof(arrNameBanner[x]) != "undefined" &&  arrNameBanner[x]!="")
			{
				controlToPopulate.options[controlToPopulate.options.length] =
				new Option(arrNameBanner[x],arrIdBanner[x]);
			//	alert(arrItems[x]);
			}
		}				
		document.getElementById('rsWaiting').style.display='none';
	}
   
   
   function setBanners(z){
   var tmp;
		tmp = z.substring(1); //Parche por que z viene con ":" adelate.
		eval("var customarray = " + tmp);		
		//actualizo los arreglos arrItems y arrItemsGrp
		for (i in customarray['val1']) {
		  arrIdBanner[i]    = customarray['val1'][i]; 
		  arrNameBanner[i]  = customarray['val2'][i];
		  arrTypeBanner[i]  = customarray['val3'][i];
		}
		//creo las options en el select
		create();
   }
   
   function filterCompany(id){
		document.getElementById('rsWaiting').style.display='block';
		x_filterCompany(id, setBanners);
   }	
   
   function filTBanner(){
   		document.getElementById('rsWaiting').style.display='block';
   		IDS = document.getElementById('spoId');
   		IDT = document.getElementById('tbnId');
   		var params = new Array();
   		params[0]= IDT.options[IDT.selectedIndex].value;
   		params[1]= IDS.options[IDS.selectedIndex].value;
		x_filterTypeBanner(params, setBanners);
   }
   

   	//*******************************************************************************
	//Jose
	//*******************************************************************************
	function sendSubscription(email,name,company){
		/*callBack resultSubscription in .html*/
		x_sendSubscriptionDB(email,name,company,resultSubscription);
	}


	function userExists(userName){
		x_userExistsDB(userName,resultUserExists);
	}
	
	function resultUserExists(rValue){

		if (rValue.substring(1,3)=="+:")
			rValue=rValue.substring(3,4);		
		else
		    if (rValue.substring(0,1)==":")
				rValue=rValue.substring(1);		
	
	
		if (rValue=="0"){
			prepareFields();
			document.forms[0].submit();
			//esta en modules/registration/templates/frontend_registration_gammers.html
		}
		else	{
			alert("El nombre de usuario ingresado ya existe o es inválido. Por favor ingrese otro.");	
			return false;
			}
	}

/**Envia el arreglo JS de rutas de imagenes
	function checkImagesSizes(section,images){
		x_checkImagesSizesPHP(section,images,resultCheckImagesSizesPHP);
	}
	
	function resultCheckImagesSizesPHP(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		
		
		if(rValue=="")
		{	//window.document.forms[0].submit();
						
			document.forms[0].submit();
		}
		else 
			alert(rValue);	
	}
*/	
	/**Envia el arreglo JS de rutas de imagenes para la creacion de usuario*/
	function checkImagesSizesUser(section,images){
		x_checkImagesSizesPHP(section,images,resultCheckImagesSizesUserPHP);
	}
	
	function resultCheckImagesSizesUserPHP(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		

		if(rValue=="")
			loginForo();
		else 
			alert(rValue);	
	}
		
		
	function create_options2control(controlToPopulate){
	    
		for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;
		
		for ( x = 0 ; x < arrItemsRBR.length  ; x++ )
		{
			if (typeof(arrItemsRBR[x]) != "undefined" &&  arrItemsRBR[x]!="")
			{
				controlToPopulate.options[controlToPopulate.options.length] =
				new Option(arrItemsRBR[x],arrItemsGrpRBR[x]);
			}
		}				
		document.getElementById('rsWaiting').style.display='none';
	}
	
	//carga el combo de rubros desde php
	function populate_rubros(z){//agregado
		
		//vacio los rubros actuales:
		remAllSelect(document.getElementById('rbrId'));

		//cargo los rubros nuevos
		var tmp;
		//tmp = z.substring(1); //Parche por que z viene con ":" adelate.
		if (z.substring(1,3)=="+:")
			tmp=z.substring(3);	

        arrItemsRBR = Array();
		eval("var customarray = " + tmp);
		
		//actualizo los arreglos arrItems y arrItemsGrp
		for (i in customarray['val1']) {
		  arrItemsRBR[i]    = customarray['val1'][i]; //Palabras claves
		  arrItemsGrpRBR[i] = customarray['val3'][i]; //ID de las palabras claves
		}
				
		//creo las options en el select de rubro
		create_options2control(document.getElementById('rbrId'));
		
		document.getElementById('rsWaitingRubros').style.display='none';
	}
	
	/*
	function remAllSelect(sel) //agregado
		{ 
		var len=sel.length;
		while(len>=0)  sel[len--] = null;
	}
	*/
	
	
	/********************************************
		FREEWAY
	*********************************************/
		
	function changeSelect(selectName,selectedValue){
		var argArray= new Array(2) 
			argArray[0]=selectName; 
			argArray[1]=selectedValue;
		x_changeSelectPHP(argArray,resultChangeSelect);
	}
	
	function resultChangeSelect(rValue){
			if (rValue.substring(1,3)=="+:")
				rValue=rValue.substring(3,4);		
			else
			    if (rValue.substring(0,1)==":")
					rValue=rValue.substring(1);	

			document.getElementById("resultTable").innerHTML=rValue;
	}
		
	
	/**Envia el arreglo JS de rutas de imagenes*/
	function checkMapaCircuito(images){
		//alert("checkMapaCircuito");
		x_checkImagesSizesPHP("mapaCircuito",images,resultCheckMapaCircuitoPHP);
	}
	
	function resultCheckMapaCircuitoPHP(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		
		if(rValue=="")
		{	//window.document.forms[0].submit();
			document.forms[0].submit();
			//checkImagesAndSubmit();
		}
		else 
			alert(rValue);	
	}
	
	/**Envia el arreglo JS de rutas de imagenes*/
	function checkImagesSizes(section,images){
		x_checkImagesSizesPHP(section,images,resultCheckImagesSizesPHP);
	}
	
	function resultCheckImagesSizesPHP(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		
		if(rValue=="")
		{	//window.document.forms[0].submit();
			//document.forms[0].submit();
			alert("volvio");
		}
		else 
			alert(rValue);	
	}

	function selectOutboundFlight(region, segment){
			x_assignADW_return(region, segment,  viewInboundFlight);
	}
	
	function viewInboundFlight(rValue)
	{	

		document.getElementById("resultTable").style.display="none";
		document.getElementById("resultReturn").style.display="block";
		document.getElementById("resultReturn").innerHTML=rValue;
		

		//document.form_selection.submit();
	
	}
	
	/*dada una region, obtiene los paises asociados*/		
	function getCountries(region){
			x_getCountriesPHP(region, resultGetCountries);
	}

 
	function resultGetCountries(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		//reemplazo caracteres utf8 por los caracteres correspondientes
		rValue=rValue.replace(/\\u00d1/g,"Ñ");//"&Ntilde;");
			
		var sel=document.getElementById('paises');
		remAllSelect(sel);
		if(rValue!="{}")
			appendOption2(sel,"0","Seleccione un país");		
		populateSelectJson(sel,rValue,false);	
		
	}

	/*obtiene todo los paises*/		
	function getAllCountries(){
			x_getCountriesPHP("",resultGetAllCountries);
	}

	function resultGetAllCountries(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
	
		populateSelectJson(document.getElementById('filtroPaises'),rValue,true);	
	}	

	/*dado un pais, obtiene las ciudades asociadas*/		
	function getCities(region){
			x_getCitiesPHP(region, resultGetCities);
	}

	function resultGetCities(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		populateSelectJson(document.getElementById('ciudades'),rValue,true);	
	}
	
	/*dado un pais de la tabla de hoteles, obtiene las ciudades asociadas*/		
	function getCitiesHotels(region){
			x_getCitiesHotelsPHP(region, resultGetCitiesHotels);
	}

	function resultGetCitiesHotels(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		

		rValue=rValue.replace(/\\/g,"");//"&Ntilde;");
		//populateSelectJson(document.getElementById('ciudad'),rValue,true);	
		
		var sel=document.getElementById('ciudad');
		remAllSelect(sel);
		if(rValue!="{}")
			appendOption2(sel,"0","Seleccione una ciudad");		
		populateSelectJson(sel,rValue,false);	
		
	}
	
	/*dado un pais de la tabla de hoteles, obtiene las ciudades asociadas*/		
	function getCitiesHotelsHome(region){
			x_getCitiesHotelsPHP(region, resultGetCitiesHotelsHome);
	}

	function resultGetCitiesHotelsHome(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		populateSelectJson(document.getElementById('ciudad'),rValue,true);	
	}
	
	
	/*dado un pais de la tabla de excursiones, obtiene las ciudades asociadas*/		
	function getCitiesExc(region){
			x_getCitiesExcPHP(region, resultGetCitiesHotels);
			//devuelve igual que el buscador de ciudades de los hoteles
	}
	
	/*dado un pais de la tabla de trasaldos, obtiene las ciudades asociadas*/		
	function getCitiesTraslados(region){
			x_getCitiesTrasladosPHP(region, resultGetCitiesHotels);
			//devuelve igual que el buscador de ciudades de los hoteles
	}
	
	
	function getCitiesProgramas(region){
			x_getCitiesProgramasPHP(region, resultGetCitiesProgramas);
	}

	function resultGetCitiesProgramas(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		populateSelectJson(document.getElementById('ciudades'),rValue,true);	
	}
	
	//Marcelo Aguero (11/05/06)
	//function of charge in Combobox the value @params idPais
	var paisId
	function chargeCombobox(idPais){ 
		var comboboxRegion = document.getElementById("region");		
				//var combobox = document.getElementById("region").value;		
//		alert(" este es el parametro q recibe, comboboxRegion: " +combobox);
		x_getCitiesProgramasPHP(comboboxRegion.value, resultGetCitiesProgramas);
		paisId = idPais;
	}
	
		var paisId
	function chargeComboboxProg(idPais){
		var comboboxCiudad = document.getElementById("ciudades");		
		x_getCountriesPHP(comboboxCiudad.value, resultGetCitiesProgramas);
		paisId = idPais;
	}
	
	/*dada una region, obtiene los paises asociados*/		
	function resultGetCountries2(rValue){
		if (rValue.substring(1,3)=="+:")
		rValue=rValue.substring(3,4);		
		else
	    if (rValue.substring(0,1)==":")
		rValue=rValue.substring(1);		
		
		//reemplazo caracteres utf8 por los caracteres correspondientes
		rValue=rValue.replace(/\\u00d1/g,"Ñ");//"&Ntilde;");
			
		var sel=document.getElementById('paises');
		remAllSelect(sel);
		if(rValue!="{}")
			appendOption2(sel,"0","Seleccione un país");		
		populateSelectJson(sel,rValue,false);	
		selectItemById("paises",paisId);
	}	

