 function cargaEdad(v)
    {    
        var o = getO("edad_" + v);    
        o.options.length=0;
        for (var p=0; p<99;p++)
        {
	        o.options[o.options.length] = new Option(p,p,false,false)        
        }
        o.value = 30;
    }
    function cargaNoches()
    {
        var o = getO("selNoches");
        o.options.length=0;
        for (var p=1; p<20;p++)
        {
            o.options[o.options.length] = new Option(p,p,false,false)        
        }
        o.value = 7;
    }
    
    function verEdad(p)
    {
        var p = parseInt(p,10);
        for (var i=1;i<=p;i++)
            getO("edad_" + i).style.display = "";		    
        for (i=p+1;i<=9;i++)
            getO("edad_" + i).style.display = "none";		            
    }
    
   function activarTdSolohotel()
    {        
        getO("tdCiudad").style.display = "";
        getO("tdCiudadC").style.display = "";
        getO("tdFecha").style.display = "";
        getO("tdFechaC").style.display = "";    
        getO("tdPax1").style.display = "";
        getO("tdPax2").style.display = "";
        getO("tdHab").style.display = "";
        getO("tdHabC").style.display = "";        
        getO("tdBusc").style.display = "";
        getO("tdEd1").style.display = "";
        getO("tdEd2").style.display = "";                
        
        //actualizaHeightCentral();
        
    }

    function actualizaHeightCentral()
    {
        var central = getO("central");
        var lateral = getO("lateral");
        if(central!=undefined && lateral.offsetHeight>10){
	        central.style.height = lateral.offsetHeight;
        }
    }

    function desactivarProgramas()
    {
        var oProg = document.getElementById("tdPaDestinos");        
         oProg.style.display = "none";
         var oProgT = document.getElementById("textoPrograma");        
         oProgT.style.display = "none";
         
    }
    function activarProgramas()
    {
         var oProg = document.getElementById("tdPaDestinos");        
         oProg.style.display = "";
         var oProgT = document.getElementById("textoPrograma");        
         oProgT.style.display = "";
       
    }


    function desactivarSoloHotel()
    {
        var o = document.getElementById("selCiudad");        
        o.options.length = 0;
        getO("tdCiudad").style.display = "none";
        getO("tdCiudadC").style.display = "none";
        getO("tdFecha").style.display = "none";
        getO("tdFechaC").style.display = "none";    
        getO("tdPax1").style.display = "none";
        getO("tdPax2").style.display = "none";
        getO("tdEd1").style.display = "none";
        getO("tdEd2").style.display = "none";
        getO("tdHab").style.display = "none";
        getO("tdHabC").style.display = "none";
        getO("tdBusc").style.display = "none";        
       
    }

    function cargaFormularioSHSelect(slt, val) {
        try{         
            val =parseInt(val); 
            for(i=0;i<slt.options.length;i++){
                if( slt.options[i].value == val ) slt.options[i].selected = true;
         }
        }catch(e){}
    }

     function actualizaAltura(idDest, idOri)
    {
        document.getElementById(idDest).height = document.getElementById(idOri).offsetHeight
    }

    function seleccionaCiudad(val,idfrm)
    {
        var aNom = new Array();
        aNom = val.split('#');

        var idForm = "fhoteles_"+idfrm;
        var form = document.getElementById(idForm);
        form.zona.value = aNom[0];
        form.nombreZona.value = aNom[1];
        form.ciudad.value = aNom[2];
        form.nombreCiudad.value = aNom[3];
    }
  
    function cargarDestinosPlagiat()
    {
        
         var l;
        var o = document.getElementById("selDestino");
        var nocarga = false;
        if (o.value=="")
        {
           desactivarSoloHotel();   
           desactivarProgramas();
           return;          
        }
        
        desactivarSoloHotel();   
        activarProgramas();  
        
        var codD = o.value.split("#")[0];
        var codA = o.value.split("#")[1];              
        oCombo = new xmlTreeCombo("comboDestinos");
        oCombo.contenedorID = "tdPaDestinos";
        var dm = window.location.protocol+"//"+window.location.hostname;
        if(window.location.port!=80)
	    dm += ":"+window.location.port;
	    
        oCombo.xmlURL = dm+"/contenidos/xml_agregadorPaquete/minimos/es/" + codA + ".xml";        
        oCombo.xmlNichoURL = dm+"/esqui/agrupacionNichos.xml";
        
        if (idioma == "es" || idioma =="ES")
            oCombo.textoDefecto = "&nbsp;Selecciona un programa";
        else        
            oCombo.textoDefecto = "&nbsp;Selecione um programa";
        
        oCombo.PathIcoDropDown = "/images/icono_desplegable_selector.gif";
        oCombo.PathIcoMas = "/images/icono_desplegable_mas.gif";
        oCombo.PathIcoMenos = "/images/icono_desplegable_menos.gif";
        oCombo.cssClass = "verdana7";
        oCombo.ancho = 300;
        oCombo.altoDesplegable = 210;
        oCombo.flagOcultaTags = 0;                
        oCombo.render();                
    }
    
    
    function cargaFormularioSH(idfrm) {
        var idForm = "fhoteles_"+idfrm;
        var form = document.getElementById(idForm);
      
        var frm_fechaEntrada=form.frm_fechaEntrada.value; 
      
        try{
	        var frm_diaE=(form.frm_diaE.value =='')? frm_fechaEntrada.substring(0,2): form.frm_diaE.value;
	        var slt = document.getElementById("diaE_"+idfrm);
	        cargaFormularioSHSelect(slt, frm_diaE)
       
	        var frm_mesE=(form.frm_mesE.value =='')? frm_fechaEntrada.substring(3,5): form.frm_mesE.value;
	        var slt = document.getElementById("mesE_"+idfrm); 
	        cargaFormularioSHSelect(slt, frm_mesE);

	        var frm_noches=form.frm_noches.value;
	        var slt = document.getElementById("selNoches"); 
	        cargaFormularioSHSelect(slt, frm_noches);

	        var frm_numHab=form.frm_numHab.value;
	        var slt = document.getElementById("numHab"); 
	        cargaFormularioSHSelect(slt, frm_numHab);
        }catch(e){
        //alert(e.message);
        }
    }   