/*
  SIGMA - Servicios de Ingeniería y Gestión para la Mejora de Actividades, S.L.
  http://www.sigmabcn.com

  Copyright (c) 2006 SIGMA, S.L.
*/

function registra_user_pas0(formulari_send) {
	var objFormSend = myGetElementById(formulari_send);
	
	var objMes = myGetElementById('ro_mes');
	var objDesti = myGetElementById('ro_desti');
	
	if(objDesti != null) {
		var mes = myGetInnerTextFromObj(objMes.options[objMes.selectedIndex]);
		var dest = myGetInnerTextFromObj(objDesti.options[objDesti.selectedIndex]);
		
		if((mes!='' && mes!='Seleccione Un Mes'&& mes!='Seleccione un mes') && (dest!='' && dest!='Seleccione Un Mes' && dest!='Seleccione un mes')) {
			var objRegMesSel = myGetElementById('ro_reg_mes_sel');
			var objRegDestSel = myGetElementById('ro_reg_dest_sel');
			
			objRegMesSel.value = mes;
			objRegDestSel.value = dest;
		}
	}
	
	objFormSend.submit();
}

function registra_user_pas1(formulari_send, formulari_fields) {
	var objFormSend = myGetElementById(formulari_send);
	
	var objForm = myGetElementById(formulari_fields);
	
	var objRegFamCod = myGetElementById('ro_reg_famcod');
	var objRegProdCod = myGetElementById('ro_reg_prodcod');
	var objRegFecVal = myGetElementById('ro_reg_fecval');
	
	if(objForm.selecc_ofe.length != null) {
		// Si tenemos más de una oferta
		for(counter = 0; counter < objForm.selecc_ofe.length; counter++) {
			if(objForm.selecc_ofe[counter].checked) {
				index_datos = counter + 1;
				nom_datos_ofe = "datos_ofe"+index_datos+"";
				nom_datos_fecval = "fec_val"+index_datos+"";
				
				valor_datos = eval('objForm.'+nom_datos_ofe+'.value');
				array_datos = valor_datos.split("_");
				objRegFamCod.value = array_datos[0];
				objRegProdCod.value = array_datos[1];
				objRegFecVal.value = eval('objForm.'+nom_datos_fecval+'.value');
			}
		}
	} else {
		// Si tenemos una sóla oferta
		if(objForm.selecc_ofe.checked) {
			nom_datos_ofe = "datos_ofe1";
			nom_datos_fecval = "fec_val1";
			
			valor_datos = eval('objForm.'+nom_datos_ofe+'.value');
			array_datos = valor_datos.split("_");
			objRegFamCod.value = array_datos[0];
			objRegProdCod.value = array_datos[1];
			objRegFecVal.value = eval('objForm.'+nom_datos_fecval+'.value');
		}
	}
	
	objFormSend.submit();
}

function registra_user_valida(formulari_send) {
	var objFormSend = myGetElementById(formulari_send);
	
	objFormSend.submit();
}

function valida_busq_pas0_sig(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objMes = myGetElementById('ro_mes');
	var objDesti = myGetElementById('ro_desti');
	
	// Para evitar el error javascript que se produciría si el usuario pulsara el botón
	// "Siguiente" para ir al paso 1 mientras se está cargando el select de destinos a
	// través de la consulta AJAX
	if(objDesti != null) {
		var mes = myGetInnerTextFromObj(objMes.options[objMes.selectedIndex]);
		var dest = myGetInnerTextFromObj(objDesti.options[objDesti.selectedIndex]);
		
		if((mes!='' && mes!='Seleccione un mes') && (dest!='' && dest!='Seleccione un mes')) {
			var objMesSel = myGetElementById('ro_mes_sel');
			var objDestSel = myGetElementById('ro_dest_sel');
			
			objMesSel.value = mes;
			objDestSel.value = dest;
			
			var objTablaDatos = myGetElementById('tabla_parametros');
			var objTablaCarga = myGetElementById('mensaje_espera');
			
			objTablaDatos.style.display = "none";
			objTablaCarga.style.display = "block";
			
			objForm.submit();
		} else {
			alert("Debe seleccionar un mes y un destino para llevar a cabo la búsqueda de ofertas.");
		}
	}
}

function valida_busq_pas1_ant(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = myGetElementById('ro_pas');
	var objTopten = myGetElementById('ro_topten');
	
	if((objTopten.value == "1") || (objTopten.value == 1)) {
		objPas.value = 'index';
	} else {
		objPas.value = 0;
	}
	
	objForm.submit();
}

function valida_busq_pas1_sig(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = myGetElementById('ro_pas');
	objPas.value = 'valida';
	
	var array_datos = null;
	var index_datos = 0;
	var nom_datos_ofe = "";
	var nom_datos_sprind = "";
	var nom_datos_oferta = "";
	var valor_datos = "";
	
	var objFamCod = myGetElementById('ro_famcod');
	var objProdCod = myGetElementById('ro_prodcod');
	var objFecVal = myGetElementById('ro_fecval');
	var objSprind = myGetElementById('ro_sprind');
	var objDatosOferta = myGetElementById('ro_datos_oferta');
	
	if(objForm.selecc_ofe.length != null) {
		// Si tenemos más de una oferta
		for(counter = 0; counter < objForm.selecc_ofe.length; counter++) {
			if(objForm.selecc_ofe[counter].checked) {
				index_datos = counter + 1;
				nom_datos_ofe = "datos_ofe"+index_datos+"";
				nom_datos_fecval = "fec_val"+index_datos+"";
				nom_datos_sprind = "sprind"+index_datos+"";
				nom_datos_oferta = "datos_oferta"+index_datos+"";
				
				valor_datos = eval('objForm.'+nom_datos_ofe+'.value');
				array_datos = valor_datos.split("_");
				objFamCod.value = array_datos[0];
				objProdCod.value = array_datos[1];
				objFecVal.value = eval('objForm.'+nom_datos_fecval+'.value');
				objSprind.value = eval('objForm.'+nom_datos_sprind+'.value');
				objDatosOferta.value = eval('objForm.'+nom_datos_oferta+'.value');
			}
		}
	} else {
		// Si tenemos una sóla oferta
		if(objForm.selecc_ofe.checked) {
			nom_datos_ofe = "datos_ofe1";
			nom_datos_fecval = "fec_val1";
			nom_datos_sprind = "sprind1";
			nom_datos_oferta = "datos_oferta1";
			
			valor_datos = eval('objForm.'+nom_datos_ofe+'.value');
			array_datos = valor_datos.split("_");
			objFamCod.value = array_datos[0];
			objProdCod.value = array_datos[1];
			objFecVal.value = eval('objForm.'+nom_datos_fecval+'.value');
			objSprind.value = eval('objForm.'+nom_datos_sprind+'.value');
			objDatosOferta.value = eval('objForm.'+nom_datos_oferta+'.value');
		}
	}
	
	var objTablaDatos = myGetElementById('tabla_parametros');
	var objTablaCarga = myGetElementById('mensaje_espera');
	
	objTablaDatos.style.display = "none";
	objTablaCarga.style.display = "block";
	
	objForm.submit();
}

function valida_aloja_pas2_ant(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objMesSel = myGetElementById('ro_mes_sel');
	var objDestSel = myGetElementById('ro_dest_sel');
	var objTopten = myGetElementById('ro_topten');
	
	if((objTopten.value == "1") || (objTopten.value == 1)) {
			var objPas = myGetElementById('ro_pas');
			objPas.value = 1;
			objForm.submit();
	} else {
		var mes = objMesSel.value;
		var dest = objDestSel.value;
		
		if((mes != '') && (dest != '')) {
			var objPas = myGetElementById('ro_pas');
			objPas.value = 1;
			objForm.submit();
		}
	}
}

function valida_aloja_pas2_sig(formulari) {
	var objForm = myGetElementById(formulari);
	
	var correcto = "true";
	
	if(formulari == 'ro_form_aloja') {
		var numpax = 0;
		var bebes = 0;
		var ninpeq = 0;
		var ningra = 0;
		var l1 = 0;
		var l2 = 0;
		var l3 = 0;
		var l4 = 0;
		var adul = 0;
		var nin = 0;
		var beb = 0;
		var acomod_ar = new Array("", "", "", "", "");
		var acomod = "";
		var paxes = "";
		var pac_cont = 0;
		
		//Comprobación de la selección de acomodación
		var objNHab = myGetElementById('ro_n_hab');
		var num = objNHab.selectedIndex;
		num = num + 1;
		
		for(var k = 1; k <= num; k++) {
			var objAdul = myGetElementById('ro_hab' + k + '_adul');
			var objNin = myGetElementById('ro_hab' + k + '_nin');
			var objBeb = myGetElementById('ro_hab' + k + '_beb');
			
			adul = objAdul.selectedIndex;
			nin = objNin.selectedIndex;
			beb = objBeb.selectedIndex;
			
			if((adul+nin) == 1) {
				l1++;
			}
			if((adul+nin) == 2) {
				l2++;
			}
			if((adul+nin) == 3) {
				l3++;
			}
			if((adul+nin) == 4) {
				l4++;
			}
			numpax = numpax + adul + nin + beb;
			bebes = bebes + beb;
			for(var i = 1; i <= nin; i++) {
				ed_nin = "ro_hab" + k + "_ed_nino" + i;
				
				var objEdNin = myGetElementById(ed_nin);
				if(objEdNin.options[objEdNin.selectedIndex].value < 9) {
					ninpeq++;
				} else {
					ningra++;
				}
			}
			if((adul+nin) == 0) {
				alert('Los datos de la habitación ' + k + ' están incompletos.');
				correcto = "false";
				break;
			}
			if((adul+nin) > 4) {
				alert('La habitación ' + k + ' supera la capacidad permitida. La capacidad máxima es de 4 ocupantes (Bebés no incluídos).');
				correcto = "false";
				break;
			}
			
			var aux = adul+nin;
			acomod_ar[k-1] = "L" + aux;
			for(var i = 1; i <= adul; i++) {
				pac_cont++;
				acomod_ar[k-1] = acomod_ar[k-1] + "-" + pac_cont;
				paxes = paxes + pac_cont + "-A--";
			}
			for(var i = 1; i <= nin; i++) {
				pac_cont++;
				acomod_ar[k-1] = acomod_ar[k-1] + "-" + pac_cont;
				paxes = paxes + pac_cont + "-C--";
			}
			for(var i = 1; i <= beb; i++) {
				pac_cont++;
				acomod_ar[k-1] = acomod_ar[k-1] + "-" + pac_cont;
				paxes = paxes + pac_cont + "-I--";
			}
		}
		
		//Comprobación de la selección de hoteles
		var checkbox_choices = 0;
		if(objForm.p_aloj.length != null) {
			// Si tenemos más de un hotel
			for(counter = 0; counter < objForm.p_aloj.length; counter++) {
				if(objForm.p_aloj[counter].checked) {
					checkbox_choices = checkbox_choices+1;
				}
			}
		} else {
			// Si tenemos sólo un hotel
			if(objForm.p_aloj.checked) {
				checkbox_choices = checkbox_choices+1;
			}
		}
		if(checkbox_choices > 5) {
			msg = "La selección de hoteles está limitada a 5.\n";
			msg = msg + "Usted ha escogido " + checkbox_choices + " hoteles.\n";
			msg = msg + "Por favor, borre " + (checkbox_choices-5) + " selección(es).";
			alert(msg);
			correcto = "false";
		}
		if(checkbox_choices < 1) {
			alert("Debe seleccionar al menos un hotel de la lista.");
			correcto = "false";
		}
		
		acomod = acomod_ar[0] + ";" + acomod_ar[1] + ";" + acomod_ar[2] + ";" + acomod_ar[3] + ";" + acomod_ar[4];
		paxes = paxes.substr(0, paxes.length-2);
		
		var objFecSal = myGetElementById('p_fecsal');
		var objDia = myGetElementById('ro_dia');
		var objNumPax = myGetElementById('p_numpax');
		var objBebes = myGetElementById('p_bebes');
		var objNinPeq = myGetElementById('p_ninpeq');
		var objNinGra = myGetElementById('p_ningra');
		var objPl1 = myGetElementById('p_l1');
		var objPl2 = myGetElementById('p_l2');
		var objPl3 = myGetElementById('p_l3');
		var objPl4 = myGetElementById('p_l4');
		var objPaxes = myGetElementById('p_paxes');
		var objAcomod = myGetElementById('p_acomod');
		
		objFecSal.value = objDia.options[objDia.selectedIndex].value;
		objNumPax.value = numpax;
		objBebes.value = bebes;
		objNinPeq.value = ninpeq;
		objNinGra.value = ningra;
		objPl1.value = l1;
		objPl2.value = l2;
		objPl3.value = l3;
		objPl4.value = l4;
		objPaxes.value = paxes;
		objAcomod.value = acomod;
		
		//DATOS DE NAVEGACIÓN - INI
		var oferta_sin_aptcod = false;
		
		//Guardamos los valores en las variables de navegació
		
		var objNavAersal = myGetElementById('ro_nav_aersal');
		var objAptCod = myGetElementById('p_aptcod');
		// Se tendrá en cuenta que algunos destinos (como Huelva) no disponen de vuelos y por tanto
		// no se mostrarán los pasos de selección de vuelos y conexiones. Se saltará directamente al
		// paso 5.
		if(objAptCod != null) {
			objNavAersal.value = objAptCod.options[objAptCod.selectedIndex].value;
		}
		
		var objNavNumnoc = myGetElementById('ro_nav_numnoc');
		var objNumnoc = myGetElementById('p_numnoc');
		objNavNumnoc.value = objNumnoc.options[objNumnoc.selectedIndex].value;
		
		var objNavFecsal = myGetElementById('ro_nav_fecsal');
		var objDia = myGetElementById('ro_dia');
		objNavFecsal.value = objDia.options[objDia.selectedIndex].value;
		
		var objNavNumhab = myGetElementById('ro_nav_numhab');
		var objNHab = myGetElementById('ro_n_hab');
		objNavNumhab.value = objNHab.options[objNHab.selectedIndex].value;
		
		var num = objNHab.selectedIndex;
		num = num + 1;
		
		for(var k = 1; k <= num; k++) {
			// Datos por habitación
			var str_habitacion = "";
			
			var objAdul = myGetElementById('ro_hab' + k + '_adul');
			var objNin = myGetElementById('ro_hab' + k + '_nin');
			var objBeb = myGetElementById('ro_hab' + k + '_beb');
			
			adul = objAdul.selectedIndex;
			nin = objNin.selectedIndex;
			beb = objBeb.selectedIndex;
			if((adul > 0) || (nin > 0) || (beb > 0)) {
				str_habitacion = "A" + adul + "_N" + nin + "_B" + beb;
			}
			
			var objNavHab = myGetElementById('ro_nav_hab' + k + '');
			objNavHab.value = str_habitacion;
			
			// Datos niños por habitación
			var str_nin_habitacion = "";
			var contador_ninos = 0;
			var edad_nin_hab = 0;
			
			for(var i = 1; i <= nin; i++) {
				ed_nin = "ro_hab" + k + "_ed_nino" + i;
				
				var objEdNin = myGetElementById(ed_nin);
				edad_nin_hab = objEdNin.options[objEdNin.selectedIndex].value;
				if(edad_nin_hab > 0) {
					if(contador_ninos > 0) {
						str_nin_habitacion = "" + str_nin_habitacion + "_";
					}
					str_nin_habitacion = "" + str_nin_habitacion + edad_nin_hab;
					contador_ninos = contador_ninos + 1;
				}
			}
			var objNavNinHab = myGetElementById('ro_nav_ninhab' + k + '');
			objNavNinHab.value = str_nin_habitacion;
		}
		
		var str_hoteles = "";
		var str_nombre_hoteles = "";
		var str_dest_hoteles = "";
		var str_zoncod_hoteles = "";
		if(objForm.p_aloj.length > 0) {
			// Si tenemos más de un hotel
			var k = 0;
			var separa = "";
			var separa2 = "";
			for(counter = 0; counter < objForm.p_aloj.length; counter++) {
				if(objForm.p_aloj[counter].checked) {
					if(k > 0) {
						separa = "_";
						separa2 = ";";
					}
					str_hoteles = "" + str_hoteles + separa + objForm.p_aloj[counter].value + "";
					str_nombre_hoteles = "" + str_nombre_hoteles + separa2 + eval('objForm.nombre_hotel_'+counter+'.value') + "";
					str_dest_hoteles = "" + str_dest_hoteles + separa + eval('objForm.dest_hotel_'+counter+'.value') + "";
					str_zoncod_hoteles = "" + str_zoncod_hoteles + separa + eval('objForm.zoncod_hotel_'+counter+'.value') + "";
					k = k + 1;
				}
			}
		} else {
			// Si tenemos sólo un hotel
			if(objForm.p_aloj.checked) {
				str_hoteles = "" + objForm.p_aloj.value + "";
				str_nombre_hoteles = eval('objForm.nombre_hotel_0.value');
				str_dest_hoteles = eval('objForm.dest_hotel_0.value');
				str_zoncod_hoteles = eval('objForm.zoncod_hotel_0.value');
			}
		}
		
		var objNavHoteles = myGetElementById('ro_nav_hoteles');
		var objNavNombreHoteles = myGetElementById('ro_nombre_hoteles');
		var objNavDestHoteles = myGetElementById('ro_dest_hoteles');
		var objNavZoncodHoteles = myGetElementById('ro_zoncod_hoteles');
		
		objNavHoteles.value = str_hoteles;
		objNavNombreHoteles.value = str_nombre_hoteles;
		objNavDestHoteles.value = str_dest_hoteles;
		objNavZoncodHoteles.value = str_zoncod_hoteles;
		//DATOS DE NAVEGACIÓN - FIN
	}
	
	if(correcto == "true") {
		// Se tendrá en cuenta que algunos destinos (como Huelva) no disponen de vuelos y por tanto
		// no se mostrarán los pasos de selección de vuelos y conexiones. Se saltará directamente al
		// paso 5.
		var objAptCod = myGetElementById('p_aptcod');
		if(objAptCod == null) {
			objForm.ro_pas.value = "5";
		}
		
		var objTablaDatos = myGetElementById('tabla_parametros');
		var objTablaCarga = myGetElementById('mensaje_espera');
		
		objTablaDatos.style.display = "none";
		objTablaCarga.style.display = "block";
		
		objForm.submit();
	}
}

function valida_aloja_pas3_ant(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = objForm.ro_pas;
	objPas.value = 2;
	
	objForm.submit();
}

function valida_vuelos(formulari, tram) {
	var objForm = myGetElementById(formulari);
	
	var objPas = objForm.ro_pas;
	objPas.value = 5;
	if(tram == 'S') {
		objPas.value = 4;
	}
	
	// Obtenemos los datos del vuelo principal de ida y vuelta seleccionado para completar la tabla
	// informativa del paso con los vuelos de conexión
	if(objPas.value == 4) {
		if(objForm.p_discri_ida != null) {
			var str_datos_ida = "";
			if(objForm.p_discri_ida.length > 0) {
				// Si tenemos más de un vuelo de ida
				var k = 0;
				var separa = "";
				
				for(counter = 0; counter < objForm.p_discri_ida.length; counter++) {
					if(objForm.p_discri_ida[counter].checked) {
						if(eval('objForm.ro_ida_fecha'+counter+'') != null) {
							var IdaFecha = eval('objForm.ro_ida_fecha'+counter+'.value');
							var IdaCiaAer = eval('objForm.ro_ida_cia_aerea'+counter+'.value');
							var IdaNVuelo = eval('objForm.ro_ida_n_vuelo'+counter+'.value');
							var IdaDatSal = eval('objForm.ro_ida_datsal'+counter+'.value');
							var IdaDatLleg = eval('objForm.ro_ida_datlleg'+counter+'.value');
							var IdaSupl = eval('objForm.ro_ida_supl'+counter+'.value');
							
							str_datos_ida = "" + IdaFecha + "_" + IdaCiaAer + "_" + IdaNVuelo + "_" + IdaDatSal + "_" + IdaDatLleg + "_" + IdaSupl + "";
						}
					}
				}
			} else {
				// Si tenemos sólo un vuelo de ida
				if(objForm.p_discri_ida.checked) {
					if(eval('objForm.ro_ida_fecha0') != null) {
						var IdaFecha = eval('objForm.ro_ida_fecha0.value');
						var IdaCiaAer = eval('objForm.ro_ida_cia_aerea0.value');
						var IdaNVuelo = eval('objForm.ro_ida_n_vuelo0.value');
						var IdaDatSal = eval('objForm.ro_ida_datsal0.value');
						var IdaDatLleg = eval('objForm.ro_ida_datlleg0.value');
						var IdaSupl = eval('objForm.ro_ida_supl0.value');
						
						str_datos_ida = "" + IdaFecha + "_" + IdaCiaAer + "_" + IdaNVuelo + "_" + IdaDatSal + "_" + IdaDatLleg + "_" + IdaSupl + "";
					}
				}
			}
			var objIdaSelecc = objForm.ro_prin_ida_selecc;
			objIdaSelecc.value = str_datos_ida;
		}
		if(objForm.p_discri_vue != null) {
			var str_datos_vue = "";
			if(objForm.p_discri_vue.length > 0) {
				// Si tenemos más de un vuelo de vuelta
				var k = 0;
				var separa = "";
				for(counter = 0; counter < objForm.p_discri_vue.length; counter++) {
					if(objForm.p_discri_vue[counter].checked) {
						if(eval('objForm.ro_vue_fecha'+counter+'') != null) {
							var VueFecha = eval('objForm.ro_vue_fecha'+counter+'.value');
							var VueCiaAer = eval('objForm.ro_vue_cia_aerea'+counter+'.value');
							var VueNVuelo = eval('objForm.ro_vue_n_vuelo'+counter+'.value');
							var VueDatSal = eval('objForm.ro_vue_datsal'+counter+'.value');
							var VueDatLleg = eval('objForm.ro_vue_datlleg'+counter+'.value');
							var VueSupl = eval('objForm.ro_vue_supl'+counter+'.value');
							
							str_datos_vue = "" + VueFecha + "_" + VueCiaAer + "_" + VueNVuelo + "_" + VueDatSal + "_" + VueDatLleg + "_" + VueSupl + "";
						}
					}
				}
			} else {
				// Si tenemos sólo un vuelo de vuelta
				if(objForm.p_discri_vue.checked) {
					if(eval('objForm.ro_vue_fecha0') != null) {
						var VueFecha = eval('objForm.ro_vue_fecha0.value');
						var VueCiaAer = eval('objForm.ro_vue_cia_aerea0.value');
						var VueNVuelo = eval('objForm.ro_vue_n_vuelo0.value');
						var VueDatSal = eval('objForm.ro_vue_datsal0.value');
						var VueDatLleg = eval('objForm.ro_vue_datlleg0.value');
						var VueSupl = eval('objForm.ro_vue_supl0.value');
						
						str_datos_vue = "" + VueFecha + "_" + VueCiaAer + "_" + VueNVuelo + "_" + VueDatSal + "_" + VueDatLleg + "_" + VueSupl + "";
					}
				}
			}
			var objVueSelecc = objForm.ro_prin_vuel_selecc;;
			objVueSelecc.value = str_datos_vue;
		}
	}
	
	var objTablaDatos = myGetElementById('tabla_parametros');
	var objTablaCarga = myGetElementById('mensaje_espera');
	
	objTablaDatos.style.display = "none";
	objTablaCarga.style.display = "block";
	
	objForm.submit();
}

function valida_aloja_pas4_ant(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = objForm.ro_pas;
	objPas.value = 2;
	
	objForm.submit();
}

function valida_reserva_pas5_ant(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = objForm.ro_pas;
	objPas.value = 2;
	
	objForm.submit();
}

function valida_reserva_pas5_sig(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = objForm.ro_pas;
	objPas.value = 6;
	
	// Obtenemos el precio y el nombre de los hoteles seleccionados
	if(objForm.hotel_options.length > 0) {
		for(counter = 0; counter < objForm.hotel_options.length; counter++) {
			if(objForm.hotel_options[counter].checked) {
				var HotelSelecc = eval('objForm.hotel_'+counter+'.value');
				var PrecioSelecc = eval('objForm.precio_'+counter+'.value');
				var USelecc = eval('objForm.hotel_options['+counter+'].value');
			}
		} 
	} else {
		// Si tenemos sólo un hotel para seleccionar
		if(objForm.hotel_options.checked) {
			var HotelSelecc = eval('objForm.hotel_0.value');
			var PrecioSelecc = eval('objForm.precio_0.value');
			var USelecc = eval('objForm.hotel_options.value');
		}
	}
	objForm.ro_hotel_selected.value = HotelSelecc;
	objForm.ro_precio_selected.value = PrecioSelecc;
	objForm.url.value = USelecc;
	
	var objTablaDatos = myGetElementById('tabla_parametros');
	var objTablaCarga = myGetElementById('mensaje_espera');
	
	objTablaDatos.style.display = "none";
	objTablaCarga.style.display = "block";
	
	objForm.submit();
}

function valida_reserva_pas6_ant(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = objForm.ro_pas;
	objPas.value = 5;
	
	objForm.submit();
}

function valida_reserva_pas6_sig(formulari) {
	var objForm = myGetElementById(formulari);
	
	var objPas = objForm.ro_pas;
	objPas.value = 7;
	
	var resValida = true;
	
	var oNumHab = myGetElementById('numhab');
	var num_hab = parseInt(oNumHab.value);
	if(num_hab > 0) {
		for(j = 1; j <= num_hab; j++) {
			var str_ind_hab = "_hab"+j+"";
			var num_ocup = eval("objForm.numocup"+str_ind_hab+".value");
			if(num_ocup > 0) {
				for(k = 1; k <= num_ocup; k++) {
					var str_ind_ocup = ""+str_ind_hab+"_ocup"+k+"";
					
					// Validaremos los documentos y tipos introducidos para todos los pasajeros
					// excepto para los bebés
					var bValidaDoc = true;
					var oEdad = eval("objForm.edad"+str_ind_ocup+"");
					if((oEdad.value == "1") || (oEdad.value == 1)) {
						bValidaDoc = false;
					}
					
					var oPapel = eval("objForm.papel"+str_ind_ocup+"");
					if(resValida == true) {
						if(dg_validaCampoTexto(oPapel, true, j, k) == false) {
							resValida = false;
						}
					}
					if(resValida == true) {
						var oSapel = eval("objForm.sapel"+str_ind_ocup+"");
						if(dg_validaCampoTexto(oSapel, true, j, k) == false) {
							resValida = false;
						}
					}
					if(resValida == true) {
						var oNomb = eval("objForm.nomb"+str_ind_ocup+"");
						if(dg_validaCampoTexto(oNomb, true, j, k) == false) {
							resValida = false;
						}
					}
					if(bValidaDoc == true) {
						if(resValida == true) {
							var oDocum = eval("objForm.docum"+str_ind_ocup+"");
							if(dg_vacio(oDocum, true, j, k) == true) {
								resValida = false;
							}
						}
						if(resValida == true) {
							if(oDocum.value != "") {
								var oTipDocum = eval("objForm.tipdoc"+str_ind_ocup+"");
								// Tipos de documento válidos: 1 - DNI, 2 - Pasaporte, 3 - NIE o Tarjeta Residente
								switch(oTipDocum.value) {
									case '1':
										if(dg_validateDNI(oDocum, j, k) == false) {
											resValida = false;
										}
										break;
										
									case '3':
										if(dg_validateNIE(oDocum, j, k) == false) {
											resValida = false;
										}
										break;
										
									default:
										if(dg_validatePasaporte(oDocum, true, j, k) == false) {
											resValida = false;
										}
								}
							}
						}
					}
					if(resValida == false) {
						break;
					}
				}
			}
			if(resValida == false) {
				break;
			}
		}
	}
	
	if(resValida == true) {
		var objTablaDatos = myGetElementById('tabla_parametros');
		var objTablaCarga = myGetElementById('mensaje_espera');
		
		objTablaDatos.style.display = "none";
		objTablaCarga.style.display = "block";
		
		objForm.submit();
	}
}

function valida_volver() {
	window.location = "http://www.viajesindaltravel.com/index.php";
}
