function despliegaEdadesHab(numHab, numNin){
	if (numHab>0){
		contNumNin = 1;
		if (numNin==0){
			document.getElementById("h"+numHab+"e").style.display ="none";
			while (contNumNin<=5){
				document.getElementById("h"+numHab+"n"+contNumNin+"e").style.display ="none";
				contNumNin++;
			}
		}else{
			if (numNin>0){
				document.getElementById("h"+numHab+"e").style.display ="inline";
				while (contNumNin<=numNin){
					document.getElementById("h"+numHab+"n"+contNumNin+"e").style.display ="inline";
					contNumNin++;
				}
				while(contNumNin<=5){
					document.getElementById("h"+numHab+"n"+contNumNin+"e").style.display ="none";
					contNumNin++;
				}
			}
		}
	}
}

function plegarTfasRes(){
	document.getElementById("h1destarifa1").style.display ="none";
	document.getElementById("h1destarifa3").style.display ="none";
	}

function TfasResOff(){
		document.getElementById("ah1tarifa1").className ="promoOff";
		document.getElementById("ah1tarifa2").className ="promoOff";
		document.getElementById("ah1tarifa3").className ="promoOff";
	}

function activarTfa(pobj){
	var menu_clase=pobj.className;
	var menu=pobj;
		menu.className="promoActiva"; 
}

function abrirTfa(pobj){
		document.getElementById(pobj).style.display ="inline";
}

function abrirMasPromos (pobj){
		document.getElementById(pobj).style.display ="inline";
	}
/*RESULTADOS DE BÃšSQUEDA ABRIR Y CERRAR PROMOCIONES 2*/
/*PLEGAR TODAS LAS TARIFAS DE RESULTADOS 2*/
function plegarTfasRes2(){
	document.getElementById("h2destarifa1").style.display ="none";
	}
/*PLEGAR TODAS LAS TARIFAS DE RESULTADOS 2*/
function TfasResOff2(){
		document.getElementById("ah2tarifa1").className ="promoOff";
		document.getElementById("ah2tarifa2").className ="promoOff";
	}
/*ABRIR LA TARIFA 2*/
function abrirTfa2(pobj){
		document.getElementById(pobj).style.display ="inline";
}
/*FONDOS ON Y OFF*/
function fondoOn(pobj){
	var fondo_clase=pobj.className;
	var fondo=pobj;
		if (fondo_clase=="promoActiva"){fondo.className="promoActiva";}
		if (fondo_clase=="promoOff"){fondo.className="promoOn";}
		if (fondo_clase=="promoOn"){fondo.className="promoOn";}
	}
function fondoOff(pobj){
	var fondo_clase=pobj.className;
	var fondo=pobj;
		if (fondo_clase=="promoActiva"){fondo.className="promoActiva";}
		if (fondo_clase=="promoOff"){fondo.className="promoOff";}
		if (fondo_clase=="promoOn"){fondo.className="promoOff";}
	}

function trfah1p1(){document.getElementById("tarifa1").innerHTML="100 &euro;";}
function trfah1p2(){document.getElementById("tarifa1").innerHTML="110 &euro;";}
function trfah1p3(){document.getElementById("tarifa1").innerHTML="115 &euro;";}
function trfah2p1(){document.getElementById("tarifa2").innerHTML="120 &euro;";}
function trfah2p2(){document.getElementById("tarifa2").innerHTML="125 &euro;";}

function leermasOn(pobj){
	var menu_clase=pobj.className;
	var menu=pobj;
		menu.className="linkGenBOn"; 
}
function leermasOff(pobj){
	var menu_clase=pobj.className;
	var menu=pobj;
		menu.className="linkGenBOff"; 
}
function leermas(numLM) {
	document.getElementById("link_leermas"+numLM).style.display ="none";
	if (document.getElementById("texto_res"+numLM)!=null){
		document.getElementById("texto_res"+numLM).style.display ="none";
	}
	//document.getElementById("fhpromo"+numLM).style.display ="none";
	document.getElementById("fhpromo"+numLM+"des").style.display ="inline";

}
function cerrardes(numCD) {
	document.getElementById("link_leermas"+numCD).style.display ="inline";
	if (document.getElementById("texto_res"+numCD)!=null){
		document.getElementById("texto_res"+numCD).style.display ="inline";
	}
	//document.getElementById("fhpromo"+numCD).style.display ="inline"; 
	document.getElementById("fhpromo"+numCD+"des").style.display ="none";
}


//integer numPromo = indice de la iteración de promociones (indice del bucle)
//integer numHot   = indice de la iteración de hoteles (indice del bucle)
//integer totalPromos  = total de promociones (hotel.vectorPromos.length)
//boolean esPromoCalendario = indica si el precio es el precio normal (true) o precio promocionado (false)
//String  codHot = código del hotel
//String  newPrecio = Precio que se tiene que subir para actualizar en la parte superior
//String  nombreTRP = Nombre del tipo de la promocion
//String  newIcoTPR = Ruta de la imagen del icono del tipo de promocion, puede ser null.
//String  txtIcoTPR = Texto alternativo del icono del tipo de promocion, puede ser null.
//String  idioma = idioma de la sesion.
//String  codPromo = Codigo de la promocion.
function marcarPromoActiva (numPromo, numHot, totalPromos, esPromoCalendario, codHot, newPrecio, newIcoTPR, txtIcoTPR, nombreTRP, idioma, codPromo,paquete) {
	
	for (i=0;i<totalPromos;i++) {
		if (i==numPromo){
			if (document.getElementById('textoCaja_'+numHot+'_promo_'+i)!=null) {
				document.getElementById('textoCaja_'+numHot+'_promo_'+i).style.display='none';
			}
		}else{
			if (document.getElementById('textoCaja_'+numHot+'_promo_'+i)!=null) {
				document.getElementById('textoCaja_'+numHot+'_promo_'+i).style.display='';
			}
		}
	}

	//Ponemos fondo diferente a la promo marcada
	for (i=0;i<totalPromos;i++) {
		if (i==numPromo){
			if (document.getElementById('hotel_'+numHot+'_promo_'+i)!=null) {
				document.getElementById('hotel_'+numHot+'_promo_'+i).className='promoActiva';
			}
		}else{
			if (document.getElementById('hotel_'+numHot+'_promo_'+i)!=null) {
				document.getElementById('hotel_'+numHot+'_promo_'+i).className='promoOff';
			}
		}
	}
	
	if (!esPromoCalendario) {
		document.getElementById('hotel_'+numHot+'_promo_'+numPromo+'_ext').style.display='';
		//alert('No Ha sido promo de calendario');
	}
	
	document.getElementById("frameActualizador").src="../jsp/actualizaDatosContenedor.jsp?num="+numHot+"&hotel="+codHot+"&precio="+newPrecio+"&rutIco="+newIcoTPR+"&textIco="+txtIcoTPR+"&tipo="+nombreTRP+"&idioma="+idioma+"&codpromo="+codPromo+"&esPaquete="+paquete;
	
	//ocultar las descripciones extensas de las promociones
	for (j=0; j<totalPromos; j++) {
		if (j!=numPromo){
			if (document.getElementById('hotel_'+numHot+'_promo_'+j+'_ext')!=null) {
			document.getElementById('hotel_'+numHot+'_promo_'+j+'_ext').style.display='none';
			}
		}
	}	
}

function actualizarContenedorSesion(codhot, tipo, imagen, texto,precio,idioma){
	document.getElementById("frameActualizador").src="../jsp/actualizaContenedorPrecioHotel.jsp?codhot="+codhot+"&tipo="+tipo+"&precio="+precio+"&img="+imagen+"&idioma="+idioma+"&text="+texto;
}

function guardarPromoSesion(codpro, tipo,img,precio,idioma,codsup){
	document.getElementById("frameActualizador").src="../jsp/actualizaPromocionCompra.jsp?codpro="+codpro+"&tipo="+tipo+"&precio="+precio+"&img="+img+"&idioma="+idioma+"&codsup="+codsup;
}

function guardarPaqueteSesion(codpaq, tipo,img,precio,idioma,codcta){
	document.getElementById("frameActualizador").src="../jsp/actualizaPaqueteCompra.jsp?codpaq="+codpaq+"&tipo="+tipo+"&precio="+precio+"&img="+img+"&idioma="+idioma+"&codcta="+codcta;
}

function guardarPrecioCompraSesion(hotel, hab,reg,precio,idioma){
	document.getElementById("frameActualizador").src="../jsp/actualizaPrecioCompra.jsp?codhot="+hotel+"&codtha="+hab+"&precio="+precio+"&codreg="+reg+"&idioma="+idioma;
}

function guardarPaqueteSesionNuevo(codpaq,precio,idioma,codcta){
	document.getElementById("frameActualizador").src="/hotel/jsp_utils/actualizaPaqueteCompra.jsp?codpaq="+codpaq+"&precio="+precio+"&idioma="+idioma+"&codcta="+codcta;
	setTimeout('espera()',50000);
}

function guardarPromoSesionNuevo(codpro,precio,idioma,codsup){
	document.getElementById("frameActualizador").src="/hotel/jsp_utils/actualizaPromocionCompra.jsp?codpro="+codpro+"&precio="+precio+"&idioma="+idioma+"&codsup="+codsup;
}

function guardarPrecioCompraSesionNuevo(hotel, hab,reg,precio,idioma){
	document.getElementById("frameActualizador").src="/hotel/jsp_utils/actualizaPrecioCompra.jsp?codhot="+hotel+"&codtha="+hab+"&precio="+precio+"&codreg="+reg+"&idioma="+idioma;
}

function guardarFechasPromoSesionNuevo(diaIni, mes_anoIni,diaFin, mes_anoFin,idi){
	document.getElementById("frameactualizaDuracionMin").src="/hotel/jsp_utils/actualizarFechasPromo.jsp?diaIni="+diaIni+"&mes_anoIni="+mes_anoIni+"&diaFin="+diaFin+"&mes_anoFin="+mes_anoFin+"&idi="+idi;
}
