	function mostrar_detalles(xIdEdificio, xMsg, xConBoton) {
		
		var c1 = 0;
		var c2 = 0;
		var xPrecio = 0;
		var x = new String();
		var y = new String();
		var xRetorno = new String();
		var xnHab = 0;
		// Le cambiamos el estado, para ver qué toca toca toca.
		ar_edificios[xIdEdificio]["mostrar"] = !ar_edificios[xIdEdificio]["mostrar"];
		xRetorno = "";
		if(ar_edificios[xIdEdificio]["mostrar"]) {
			for(var xIdReg in ar_divs[xIdEdificio]) {
				//alert(filtro_regimen);
				if(xIdReg!=filtro_regimen && filtro_regimen!='0') continue;
				// Nombre del régimen.
				x += "<tr >\n";
				x += "<td   rowspan=\"rs-c1\">"
				x += "<input type=\"hidden\" name=\"hd_regimen_" + xIdReg + "\" + value=\"" + ar_regimenes[xIdReg] + "\" />";
				x += ar_regimenes[xIdReg];
				x += "</td>\n";
				c1 = 0;
		
				xPrecio = 0;
				for(xnHab in ar_habs[xIdEdificio][xIdReg]) 
					xPrecio += ar_habs[xIdEdificio][xIdReg][xnHab];
				xPrecio = Math.round(xPrecio * 100) / 100;
				
				for(var xnHab in ar_divs[xIdEdificio][xIdReg]) {
					if(c1 != 0) x += "<tr>\n";		// Controla el salto de línea por régimen.
					c2 = 0;
					y = "";
					xPrimeraAco = "";
					xS = "";
					for(xIdAco in ar_divs[xIdEdificio][xIdReg][xnHab]) {
						xS = xS + " - " + xIdAco;
						c1 ++;
						c2 ++;
						if(c2 != 1) y += "<tr>\n";
						y += "<td>";
						
						if(xPrimeraAco == "")
							xPrimeraAco = ar_divs[xIdEdificio][xIdReg][xnHab][xIdAco]["nombre"];
						
						<!-- Radiobuttons de las acomodaciones -->
						y += "<input type=\"radio\" name=\"rb_" + (xIdEdificio + "_" + xIdReg + "_" + xnHab) + "\" ";
						y += "id=\"rb_" + (xIdEdificio + "_" + xIdReg + "_" + xnHab) + "\" ";
						y += "value=\"" + xIdAco + "\" " + (c2 == 1 ? "checked" : "") + " ";
						y += "onclick=\"recalcular(" + xIdEdificio + ", '" + xIdReg + "', " + xnHab + ", " + xIdAco + ", '" + xMsg + "', " + xConBoton + ")\" />";
						y += ar_divs[xIdEdificio][xIdReg][xnHab][xIdAco]["nombre"];
						y += "</td>\n";
						
						<!-- El precio -->
						y += "<td><span style=\"font-size:16px;\">" + FormatNumerico(ar_divs[xIdEdificio][xIdReg][xnHab][xIdAco]["precio"], "", ".", 2) + " &euro;</span></td>\n";
						
						if((c1 == 1) && (c2 == 1)) {
							y += "<td align=\"right\" rowspan=\"rs-c1\">";

							if(xConBoton) 
								y += "<input type=\"submit\" class=\"botRed\" name=\"bt_" + (xIdEdificio + "_" + xIdReg) + "\" id=\"bt_" + (xIdEdificio + "_" + xIdReg) + "\" value=\"Reservar\" />";
							else {
								y += "<input type=\"radio\" name=\"rb_eleccion\" id=\"rb_elec" + (xIdEdificio + "_" + xIdReg) + "\" value=\"" + xIdReg + "\" onclick=\"hotel_elegido(" + xIdEdificio + ", '" + xIdReg + "')\" />";
								y += "<span id=\"sp_elec" + (xIdEdificio + "_" + xIdReg) + "\" >Reservar";
							}

							y += "<input type=\"hidden\" name=\"hd_" + (xIdEdificio + "_" + xIdReg) + "\" id=\"hd_" + (xIdEdificio + "_" + xIdReg) + "\" value=\"" + FormatNumerico(xPrecio, "", ".", 2) + "\" />";
							y += "</td>\n";
						}
						
						y += "</tr>\n";
					}
					
					x += "<td  rowspan=\"" + c2 + "\">";
					x += "<input type=\"hidden\" id=\"hd_" + xIdReg + "_" + xnHab + "\" ";
					x += "name=\"hd_" + xIdReg + "_" + xnHab + "\" + value=\"" + xPrimeraAco + "\" />";
					x += "</td>\n" + y;//"Habitación " + (parseInt(xnHab) + 1) + 
				}
				
				// Ponemos el rowspan de verdad.
				c2 = 10;		// máximo número de vueltas.
				y = x.replace("rs-c1", c1);
				while((x != y) && (c2 != 0)) {
					x = y;
					y = x.replace("rs-c1", c1);
					c2 --;
				}
			}

	
			xRetorno = "<div  style=\"width:680px; float:left;clear:left; padding:10px;\"><table   class=\"table_border_collapse\" cellpadding=\"2px\" cellspacing=\"2px\" >\n" + x + "</table></div>\n";
		} 

//alert(xRetorno);
		document.getElementById("div_" + xIdEdificio).innerHTML = xRetorno;
		
		
	}
	

	function recalcular(IdEdificio, IdReg, nHab, xIdAcomod, xMsg, xConBoton) {
		var xPrecio = 0;
		
		// Nos quedamos con el nuevo precio.
		ar_habs[IdEdificio][IdReg][nHab] = ar_divs[IdEdificio][IdReg][nHab][xIdAcomod]["precio"];
		
		// Ahora sumamos el total.
		for(var xNHab in ar_habs[IdEdificio][IdReg]) 
			xPrecio += ar_habs[IdEdificio][IdReg][xNHab];

//		document.getElementById("hd_precio_hotel").value = Math.round(xPrecio * 100) / 100;

		// Informamos a la gente.
		if(!xConBoton) {
			document.getElementById("sp_elec" + IdEdificio + "_" + IdReg).innerHTML = "Reservar por  " + FormatNumerico(Math.round(xPrecio * 100) / 100, "", ".", 2) + xMsg;
		} else { 
			document.getElementById("bt_" + IdEdificio + "_" + IdReg).value = "Reservar por " + FormatNumerico(Math.round(xPrecio * 100) / 100, "", ".", 2) + xMsg;
			document.getElementById("hd_" + IdEdificio + "_" + IdReg).value = FormatNumerico(Math.round(xPrecio * 100) / 100, "", ".", 2);
			document.getElementById("hd_" + IdReg + "_" + nHab).value = ar_divs[IdEdificio][IdReg][nHab][xIdAcomod]["nombre"];
		}


//		document.getElementById("hd_id_nombre_acomod_hotel").value = ar_divs[IdEdificio][IdReg][nHab][xIdAcomod]["nombre"];
//		document.getElementById("hd_precio_hotel").value = FormatNumerico(Math.round(xPrecio * 100) / 100, "", ".", 2);
	}



	// Calcula la fecha de salida del hotel en función de la fecha de entrada y el número de noches.
	// Es utilizada en BUSCADOR_HOTELES.PHP y FICHA_HOTEL.PHP
	function fecha_salida() {
		var xFch_entrada = document.getElementById("fch_entrada").value;
		var xNNoches = document.getElementById("sl_noches").value;
		var c = (mi_isDigit(xFch_entrada.charAt(2)) ? xFch_entrada.charAt(1) : xFch_entrada.charAt(2));

	    var array_fecha = xFch_entrada.split(c)

		//si el array no tiene tres partes, la fecha es incorrecta
		xRetorno = "FCH ERROR";
		if (array_fecha.length == 3) {
			var ano = parseInt(array_fecha[2]);
			var mes = parseInt(array_fecha[1]);
			var dia = parseInt(array_fecha[0]);
			
		    if (!isNaN(ano) && !isNaN(mes) && !isNaN(dia)) 
				document.getElementById("fch_salida").value = dateAdd(xFch_entrada, xNNoches);
		}
	}

