// <!-- miércoles, 10 de diciembre de 2008 11:55 -->
	
var cont = 0;//Inicio calendario, mes para dia actual. Pasos del calendario.


//retorna elementos según su nombre de clase
function getElementsByClass(node,searchClass,tag) {
	var classElements = new Array();
    var els = node.getElementsByTagName(tag); // usar "*" para todos los elementos
    var pattern = new RegExp('\\b'+searchClass+'\\b');
		for (var i = 0; i < els.length; i++) { if ( pattern.test(els[i].className) ){ classElements[classElements.length] = els[i]; } }
    return classElements;
}

function rumbo_verhoteles() {
    document.getElementById("rumbo_c450x300_hotel_id").style.display = "";
	document.getElementById("rumbo_c450x300_vuelos_id").style.display = "none";
    document.getElementById("rumbo_c450x300_vueloyhotel_id").style.display = "none";
}

function rumbo_vervh() {
    document.getElementById("rumbo_c450x300_hotel_id").style.display = "none";
	document.getElementById("rumbo_c450x300_vuelos_id").style.display = "none";
    document.getElementById("rumbo_c450x300_vueloyhotel_id").style.display = "";
}

function rumbo_vervuelos() {
    document.getElementById("rumbo_c450x300_hotel_id").style.display = "none";
	document.getElementById("rumbo_c450x300_vuelos_id").style.display = "";
    document.getElementById("rumbo_c450x300_vueloyhotel_id").style.display = "none";
}

function soloida() {
	var formulario = document.getElementById("rumbo_c450x300_vuelos");
	if (formulario.idavuelta.checked) {
		formulario.fecha_mesanio_salida_vuelta.disabled = false;
		formulario.fecha_dia_salida_vuelta.disabled = false;
		formulario.fecha_mesanio_salida_vuelta.style.background = "";	
		formulario.fecha_dia_salida_vuelta.style.background = "";		
	}
	if (formulario.ida.checked) {
		formulario.fecha_mesanio_salida_vuelta.disabled = true;
		formulario.fecha_dia_salida_vuelta.disabled = true;
		formulario.fecha_mesanio_salida_vuelta.style.background = "#088DD6";	
		formulario.fecha_dia_salida_vuelta.style.background = "#088DD6";
	}
}

function rumbo_crear_fechas(idform,direccion) {
	if (direccion == "entrada_ida")	{ document.write('<input type="hidden" name="depDate" value="" />'); }
	if (direccion == "salida_vuelta") { document.write('<input type="hidden" name="retDate" value="" />'); }
    var tabla_meses = new Array('Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic');
	var fecha_hoy = new Date();
	var dia_actual = fecha_hoy.getDate();
	var mes_actual = fecha_hoy.getMonth ();
    var anio_actual = fecha_hoy.getFullYear ();
		var numero_dias_mes = rumbo_dame_numero_dias_mes(anio_actual,mes_actual);
	var nombre_mes = tabla_meses[mes_actual];
	var anio_corto = anio_actual.toString().substring(2,4);
	document.writeln('<select class="SELE" name="fecha_dia_'+direccion+'">');
		 				for (i = dia_actual; i <= numero_dias_mes; i++){
        				var j = (i < 10) ? "0"+i : i; 
         				document.write('<option value='+j+'>'+j+'<\/option>');
						}
	document.write('<\/select>&nbsp;');
	document.writeln('<select class="SELE" name="fecha_mesanio_'+direccion+'"');
	document.writeln('onChange="actualizar_meses(\''+idform+'\',\''+direccion+'\');">');
    document.write('<option value='+rumbo_dame_valor_aniomes(anio_actual,mes_actual)+' selected="selected">'+nombre_mes+' '+anio_corto+'<\/option>');
    var i = mes_actual + 1;
	if (direccion == "entrada_ida") {
		for (k=1; k < 13; k++) {
			if (i == 12) { i = 0; anio_actual+=1; anio_corto = anio_actual.toString().substring(2,4); }          			
 			nombre_mes = tabla_meses[i];
         	document.write(' <option value="'+rumbo_dame_valor_aniomes(anio_actual,i)+'">'+nombre_mes+' '+anio_corto+'</option>');
         	i++;
		}
	}
	if (direccion == "salida_vuelta") {								 
		for (k=1; k < 14; k++){
			if (i == 12){ i = 0; anio_actual+=1; anio_corto = anio_actual.toString().substring(2,4); }          			
	 		nombre_mes = tabla_meses[i];
         	document.write(' <option value='+rumbo_dame_valor_aniomes(anio_actual,i)+'>'+nombre_mes+' '+anio_corto+'</option>');
         	i++;
		}
	}
	document.write('</select>');
}

function rumbo_dame_numero_dias_mes(anio_actual, mes_actual) {
	var mes_siguiente = new Date();
  	mes_siguiente.setFullYear(anio_actual,mes_actual + 1,0);
  	return (mes_siguiente.getDate());
}

function actualizar_meses (idform,direccion) {
	var	formulario = document.getElementById(idform);
	var dia_index = eval("formulario.fecha_dia_"+direccion+".selectedIndex");//dia seleccionado index -- recojo dato para luego ponerlo después de actualizar; por comodidad para el usuario
	var dia_selec = eval("formulario.fecha_dia_"+direccion+".options["+dia_index+"].value");// valor dia seleccionado
	var mes_anio_index = eval("formulario.fecha_mesanio_"+direccion+".selectedIndex");//año mes indice seleccionado
	var mes_anio_value = eval("formulario.fecha_mesanio_"+direccion+".options[mes_anio_index].value");//año mes indice seleccionado valor
	var anio = mes_anio_value.substring(0,4);//año
	var mes = mes_anio_value.substring(4,6);//mes
	var dt_fecha = new Date(anio, mes, 0);//seteo nueva fecha con valores seleccionados
	var dias = dt_fecha.getDate();//obtengo total días
	var dt_fecha_hoy = new Date();//fecha de hoy
	var dia_hoy = dt_fecha_hoy.getDate();//dia de hoy
	var selectbox = eval("formulario.fecha_dia_"+direccion+"");//campo select
	for (i=selectbox.options.length-1; i>=0; i--) { selectbox.remove(i); }//Borrarmos todos los dias para pintarlos de nuevo según corresponda
	for (i=0; i<dias ;i++ ){//creamos de nuevo el select hasta el total de días del mes
		var j = i+1;
			if (j<10) {	j = "0"+j; }
		eval("formulario.fecha_dia_"+direccion+".options[i] = new Option (j,j)");
	}
	if (mes_anio_index == 0) {//si se selecciona el primer mes de la lista
		for (i=0; i<dia_hoy-1; i++) { selectbox.remove(0); }//Borrarmos todos los dias consumidos
	}
	//pongo el dia como lo puso el usuario - por comodidad para el - si el dia no existe porque se consumió, simplemente pondrá el de inicio
	for (i=0; i<selectbox.options.length; i++ )	{ if (selectbox.options[i].value == dia_selec) { selectbox.options[i].selected = true; } }
}

function rumbo_dame_valor_aniomes(anio, mes){
	var val_anio = anio.toString(); mes++; var val_mes = mes.toString();
		if (mes < 10){ val_mes = "0" + val_mes; } return val_anio+val_mes;
}

function fecha_a_fechastr (dt_mueve_mes) {
	return (new String (dt_mueve_mes.getDate()+"/"+(dt_mueve_mes.getMonth()+1)+"/"+dt_mueve_mes.getFullYear()+" "));
}

function dt_nuevafecha (str_fecha) {
	var re_date = /^(\d+)\/(\d+)\/(\d+)\s/;
	if (!re_date.exec(str_fecha))
		return alert("Invalid Datetime format: "+ str_fecha);
	return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}


function abrir_calendario(que_formulario,que_calendario,str_fecha,valor_sentido) {
	cont += valor_sentido;//adelante o atrás
	var arr_meses = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
	var arr_dias_semana = ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"];
	var dt_fecha = (str_fecha == null || str_fecha =="" ?  new Date() : dt_nuevafecha(str_fecha));//fecha del calendario-si es la primera vez se crea con la de hoy
	var dt_fecha_hoy = new Date();
	var anio_hoy = dt_fecha_hoy.getFullYear();
	var mes_hoy = dt_fecha_hoy.getMonth();
	var anio_fecha = dt_fecha.getFullYear();
	var mes_fecha = dt_fecha.getMonth();
		if (anio_fecha == anio_hoy+1 && mes_hoy == mes_fecha) {// Un año hacia adelante y ponemos tope -> escondemos botón de avance.
			document.getElementById("boton_adelante").style.visibility = "hidden";
			cont -= valor_sentido;//no se ha movido el calendario así que le recupero el valor al contador de pasos
			return;
		}
	var dt_fecha_menos_un_mes = new Date(dt_fecha);
	dt_fecha_menos_un_mes.setMonth(dt_fecha.getMonth()-1);//date fecha mes anterior

	var dt_fecha_mas_un_mes = new Date(dt_fecha); 
	dt_fecha_mas_un_mes.setMonth(dt_fecha.getMonth()+1);//date fecha mes siguiente

	var n_inicio_semana = 1; // Día de inicio de la semana (Domingo-Lunes  0-1)
	var dt_primer_dia_calendario = new Date(dt_fecha);//date para tratarlo
	dt_primer_dia_calendario.setDate(1);//date fecha primer dia mes
	dt_primer_dia_calendario.setDate(1-(7+dt_primer_dia_calendario.getDay()-n_inicio_semana)%7);//date fecha cambia sobre seteo anterior a dia elegido de inicio

	var dt_ultimo_dia_calendario = new Date(dt_fecha_mas_un_mes);
	dt_ultimo_dia_calendario.setDate(0);//date ultimo día mes
// Inicio cadena calendario ----------
	var str_buffer = new String (	
	"<table align='center' class='CAL_FONDO_TABLA' cellspacing='0' cellpadding='0' border='0' width='100%' height='100%'>"+
		"<tr>"+
			"<td>"+
				"<table align='center' style='border-collapse: collapse;' width='100%' height='100%' border='0'>"+
					"<tr>"+
"<td id='boton_atras' style='cursor: hand; cursor: pointer;' align='left'"+
"onclick='abrir_calendario(\""+que_formulario+"\",\""+que_calendario+"\",\""+fecha_a_fechastr(dt_fecha_menos_un_mes)+"\", -1);'>"+
"<img border='0' src='imagenes/anterior.gif' alt='mes anterior' /></td>"+
"<td align='center' class='CAL_TITULO_CELDA'>"+arr_meses[dt_fecha.getMonth()]+" "+dt_fecha.getFullYear()+"</td>"+
"<td id='boton_adelante' style='cursor: hand; cursor: pointer;' align='right'"+
"onclick='abrir_calendario(\""+que_formulario+"\",\""+que_calendario+"\",\""+fecha_a_fechastr(dt_fecha_mas_un_mes)+"\", 1);'>"+
"<img border='0' src='imagenes/siguiente.gif' alt='mes siguiente' /></td>"+
					"</tr>"+
				"</table>"+
			"</td>"+
		"</tr>"+
		"<tr>"+
			"<td>"+
				"<table align='center' width='100%' class='CAL_DIAS_SEMANA_TABLA'>"+
					"<tr>"
	);
	str_buffer += "<tr>";
		for (var n=0; n<7; n++) {
			if(n==5||n==6) { str_buffer += "<td align='center' style='color: #FF3333;' >"+arr_dias_semana[(n_inicio_semana+n)%7]+"</td>"; }
			else { str_buffer += "<td align='center'>"+arr_dias_semana[(n_inicio_semana+n)%7]+"</td>"; }
		}	
	str_buffer += ("</tr>"+
			"</table>"+
		"</td>"+
	"</tr>"+
	"<tr>"+
		"<td>"+
			"<table align='center' width='100%'>");

	var diaHoy = false;//contador para saber cual es el primer día no pasado - será entonces el dia de hoy con estilo diferente
	var dt_dia_pinto = new Date(dt_primer_dia_calendario);//date dia que vamos pintando

		while (dt_dia_pinto.getMonth() == dt_fecha.getMonth() || dt_dia_pinto.getMonth() == dt_primer_dia_calendario.getMonth()) {//------------------------------
		// Imprimir cabecera columna
		str_buffer += "<tr>\n";
			for (var n_actual_dia_semana=0; n_actual_dia_semana<7; n_actual_dia_semana++) {

				if (dt_dia_pinto.getDay() == 0 || dt_dia_pinto.getDay() == 6) {
					// Fines de semana
					if ( (mes_hoy == mes_fecha) && (dt_dia_pinto < dt_fecha) ) {//si es día pasado deshabilito
						str_buffer += "	<td class=\"CAL_FINDE_CELDA_DESHABILITADO\" align=\"center\" ";
						str_buffer += " > ";
					} else {
						
							str_buffer += "	<td class=\"CAL_FINDE_CELDA\" style='cursor: pointer; cursor: hand;' align=\"center\" ";
							str_buffer += " onclick='dia_calendario(\""+fecha_a_fechastr(dt_dia_pinto)+"\",\""+que_formulario+"\",\""+que_calendario+"\")' ";
							str_buffer += " onmouseover='this.style.background = \"#FFDD3F\";' onmouseout='this.style.background = \"#DDDDDD\";'> ";
					}
				} else {
					// Días laborables del mes
					if ( (mes_hoy == mes_fecha) && (dt_dia_pinto < dt_fecha) ) {//si es día pasado deshabilito
						str_buffer += "	<td class=\"CAL_LABORABLES_CELDA_DESHABILITADO\" align=\"center\" ";
						str_buffer += " > ";
					} else {

							str_buffer += "	<td class=\"CAL_LABORABLES_CELDA\" style='cursor: pointer; cursor: hand;' align=\"center\" ";
							str_buffer += " onclick='dia_calendario(\""+fecha_a_fechastr(dt_dia_pinto)+"\",\""+que_formulario+"\",\""+que_calendario+"\")' ";
							str_buffer += " onmouseover='this.style.background = \"#FFDD3F\";' onmouseout='this.style.background = \"#CCE3F2\";' > ";
					}
				}

				str_buffer += dt_dia_pinto.getDate()+"</td>\n";
				dt_dia_pinto.setDate(dt_dia_pinto.getDate()+1);
			}
		// Imprimir pie columna
		str_buffer += "</tr>\n";
		}//---------------------------------------------------------------------------------------------------------------------------------------------------------
	str_buffer += "</table></td></tr>";
	str_buffer += (
					"<tr>"+
						"<td>"+
							"<table align='center' width='100%' border='0'>"+
								"<tr>"+
									"<td align='center'"+
									"colspan='2' class='CAL_CIERRE_CELDA'"+
									"style='cursor: pointer; cursor: hand;' onClick='cerrarCalendario();'>Cerrar</td>"+
								"</tr>"+
							"</table>"+
						"</td>"+
					"</tr>"+
				"</table>"
	);
// Fin cadena calendario ----------


	document.getElementById("rumbo_c450x300_cal").innerHTML =  str_buffer;
	// ver calendario
	document.getElementById('rumbo_c450x300_cal').style.display = 'inline';
	// Ancho gualdrapa igual que el ancho del calendario una vez redimensionado
	document.getElementById("rumbo_c450x300_gualdrapa_marco").style.height = document.getElementById("rumbo_c450x300_cal").offsetHeight;
	// ver capa gualdrapa
	document.getElementById("rumbo_c450x300_gualdrapa_capa").style.display = 'inline';
	//escondemos botón retroceso para hoy, si no, lo mostramos
	if (cont == 0) { document.getElementById("boton_atras").style.visibility = "hidden"; } else { document.getElementById("boton_atras").style.visibility = "visible"; }
}




function dia_calendario(fecha,que_formulario,direccion){
	var formulario = document.getElementById(que_formulario);
	//dividimos fecha para coger valores elegidos
	arr_fecha = fecha.split("/");
	var dia = arr_fecha[0];
	var mes = arr_fecha[1];
	var anio = arr_fecha[2];
	anio = anio.split(" ");//quito espacio al final
	if (dia <10) dia = '0'+dia;
	if (mes <10) mes = '0'+mes;
	var dt_fecha_hoy = new Date();//fecha de hoy
	var dia_de_hoy = dt_fecha_hoy.getDate();//dia de hoy para saber luego si tenemos que borrar días consumidos
	var dt_fecha = new Date(anio[0],mes-1,dia);//nueva fecha con valores elegidos
	dt_fecha.setFullYear(dt_fecha.getFullYear(), dt_fecha.getMonth()+1, 0);//seteo valores hasta final mes para saber total dias mes elegido
	var dias = dt_fecha.getDate();//total dias mes elegido
	var selectbox = eval("formulario.fecha_dia_"+direccion+"");//campo select dias
		for (i=selectbox.options.length-1; i>=0; i--) {//Borrarmos todos los dias para pintarlos de nuevo según corresponda
			selectbox.remove(i);
		}
		for (i=0; i<dias ;i++ ) {//creamos de nuevo el select dias hasta el total de días del mes
			var j = i+1;
				if (j<10) { j = "0"+j; }
			eval("formulario.fecha_dia_"+direccion+".options[i] = new Option (j,j)");
		}
	eval("formulario.fecha_dia_"+direccion+".value = dia");//marco valor dia en el select
	eval("formulario.fecha_mesanio_"+direccion+".value = anio[0]+mes");//marco año mes en el select
	eval("var indice_mes = formulario.fecha_mesanio_"+direccion+".selectedIndex");//indice mes elegido
		if (indice_mes == 0) {//si se ha elegido el primer mes - borramos los dias consumidos
			for (i=0; i<dia_de_hoy-1; i++) {//Borrarmos todos los dias consumidos
				selectbox.remove(0);
			}
		}
	//cerramos calendario
	document.getElementById('rumbo_c450x300_gualdrapa_capa').style.display = 'none';
	$("#rumbo_c450x300_cal").hide("slow"); //con efecto jquery salida
	cont= 0;//reset calendario
}

function cerrarCalendario(){
	$("#rumbo_c450x300_cal").hide("slow"); //con efecto jquery salida
	document.getElementById('rumbo_c450x300_gualdrapa_capa').style.display = 'none';
	cont = 0;//reset calendario
}

function edadNinhos(){
	var formulario = document.getElementById("rumbo_c450x300_hotel");
	document.getElementById("texto_edades").innerHTML = '';
	document.getElementById("img_edades").style.display = 'none';
	formulario.child1.value = "";
	formulario.child2.value = "";
	formulario.child3.value = "";
	formulario.child4.value = "";
	formulario.child5.value = "";
	formulario.child6.value = "";
	formulario.child7.value = "";
	formulario.child8.value = "";
	formulario.child9.value = "";
	formulario.child10.value = "";
//segun los niños que haya pintamos tantos div como sea necesario
	var numHabitaciones = formulario.numRooms.value;
	var numNinhos = formulario.paxHab.value.substring(2,3);	
		if(numNinhos!=0) {		
		// Primero mostramos u ocultamos los divs de las habitaciones
			if (numHabitaciones == '1') {
				document.getElementById("divHabitacion1").style.display = ''; document.getElementById("divHabitacion2").style.display = 'none';
				document.getElementById("divHabitacion3").style.display = 'none'; document.getElementById("divHabitacion4").style.display = 'none';
				document.getElementById("divHabitacion5").style.display = 'none'; 
			}
			if (numHabitaciones == '2') {
				document.getElementById("divHabitacion1").style.display = ''; document.getElementById("divHabitacion2").style.display = '';
				document.getElementById("divHabitacion3").style.display = 'none'; document.getElementById("divHabitacion4").style.display = 'none';
				document.getElementById("divHabitacion5").style.display = 'none'; 
			}
			if (numHabitaciones == '3') {
				document.getElementById("divHabitacion1").style.display = ''; document.getElementById("divHabitacion2").style.display = '';
				document.getElementById("divHabitacion3").style.display = ''; document.getElementById("divHabitacion4").style.display = 'none';
				document.getElementById("divHabitacion5").style.display = 'none';
			}
			if (numHabitaciones == '4') {
				document.getElementById("divHabitacion1").style.display = ''; document.getElementById("divHabitacion2").style.display = ''; 
				document.getElementById("divHabitacion3").style.display = ''; document.getElementById("divHabitacion4").style.display = '';
				document.getElementById("divHabitacion5").style.display = 'none';
			}
			if (numHabitaciones == '5') {
				document.getElementById("divHabitacion1").style.display = ''; document.getElementById("divHabitacion2").style.display = '';
				document.getElementById("divHabitacion3").style.display = ''; document.getElementById("divHabitacion4").style.display = '';
				document.getElementById("divHabitacion5").style.display = '';
			}
		// Ahora, según sean número de niños 
			if (numNinhos == '0') {
				document.getElementById("ninho1").style.display = 'none'; document.getElementById("ninho2").style.display = 'none';
				document.getElementById("ninho3").style.display = 'none'; document.getElementById("ninho4").style.display = 'none';
				document.getElementById("ninho5").style.display = 'none'; document.getElementById("ninho6").style.display = 'none';
				document.getElementById("ninho7").style.display = 'none'; document.getElementById("ninho8").style.display = 'none';
				document.getElementById("ninho9").style.display = 'none'; document.getElementById("ninho10").style.display = 'none';
			}
			if (numNinhos == '1') {
				document.getElementById("ninho1").style.display = ''; document.getElementById("ninho2").style.display = 'none';
				document.getElementById("ninho3").style.display = '';	document.getElementById("ninho4").style.display = 'none';
				document.getElementById("ninho5").style.display = ''; document.getElementById("ninho6").style.display = 'none';
				document.getElementById("ninho7").style.display = ''; document.getElementById("ninho8").style.display = 'none';
				document.getElementById("ninho9").style.display = ''; document.getElementById("ninho10").style.display = 'none';
			}
			if (numNinhos == '2') {
				document.getElementById("ninho1").style.display = ''; document.getElementById("ninho2").style.display = '';
				document.getElementById("ninho3").style.display = ''; document.getElementById("ninho4").style.display = '';
				document.getElementById("ninho5").style.display = ''; document.getElementById("ninho6").style.display = '';
				document.getElementById("ninho7").style.display = ''; document.getElementById("ninho8").style.display = '';
				document.getElementById("ninho9").style.display = ''; document.getElementById("ninho10").style.display = '';
			}
			// ver capa
			document.getElementById("rellenarEdades").style.display = 'inline';
			// Ancho gualdrapa igual que el ancho de la capa una vez redimensionado
			document.getElementById("rumbo_c450x300_gualdrapa_marco2").style.height = document.getElementById("rellenarEdades").offsetHeight;
			// ver capa gualdrapa
			document.getElementById("rumbo_c450x300_gualdrapa_capa2").style.display = 'inline';
			document.getElementById("rumbo_c450x300_gualdrapa_marco2").style.display = 'inline';
			} else { 
			document.getElementById("rellenarEdades").style.display = 'none'; 
			document.getElementById("rumbo_c450x300_gualdrapa_capa2").style.display = 'none';
		}
}

function aceptarEdades() {
	var formulario = document.getElementById("rumbo_c450x300_hotel");
	var nChd = document.getElementById("rumbo_c450x300_hotel").paxHab.value.substring(2,3);
	var nRooms = document.getElementById("rumbo_c450x300_hotel").numRooms.value; 
	var edades = 'Edad ni&ntilde;os: /';
	var aux = 1;
		for(r=1; r<=nRooms; r++) {
			for (i = 1; i <= nChd; i++)	{
					if ( (eval("formulario.child"+aux+".value")) == '') { var mensaje = true; }
					else { edades += "<span class='TEXTO_EDADES_EDAD'>"; edades += eval("formulario.child"+aux+".value"); edades += "</span>"; }
				edades +='/';
					if(nChd==1){aux+=2;} else {aux++;} 
			}
		}
		if (mensaje) { alert("Falta seleccionar la edad de alg\u00FAn ni\u00F1o"); }
		else {
			document.getElementById("rellenarEdades").style.display = 'none';
			document.getElementById('rumbo_c450x300_gualdrapa_capa2').style.display = 'none';
			document.getElementById('rumbo_c450x300_gualdrapa_marco2').style.display = 'none';
				for (i=1;i<=10;i++ ) { eval("formulario.child"+i+".value");	}
			document.getElementById("texto_edades").style.display = '';
			document.getElementById("texto_edades").innerHTML = edades;
			document.getElementById("img_edades").style.display = 'inline';
		}
}

function cancelarEdades() {
	var formulario = document.getElementById("rumbo_c450x300_hotel");
	formulario.child1.value = "";
	formulario.child2.value = "";
	formulario.child3.value = "";
	formulario.child4.value = "";
	formulario.child5.value = "";
	formulario.child6.value = "";
	formulario.child7.value = "";
	formulario.child8.value = "";
	formulario.child9.value = "";
	formulario.child10.value = "";
	//esconder
	$("#rellenarEdades").hide("slow"); //con efecto jquery salida
	document.getElementById('rumbo_c450x300_gualdrapa_capa2').style.display = 'none';
	document.getElementById("texto_edades").innerHTML = "";
	document.getElementById("img_edades").display = "none";
	formulario.numRooms.options.selectedIndex = '0';
	formulario.paxHab.options.selectedIndex = '1';
}

function cambia_edades_on () { document.getElementById("cambia_edades").style.display = "inline"; }

function cambia_edades_off () { document.getElementById("cambia_edades").style.display = "none"; }

function goSubmitVuelos () {
	var formulario = document.getElementById('rumbo_c450x300_vuelos');
	var origen =  formulario.depCity.value;
	var destino = formulario.arrCity.value;
	var bebes = parseInt(formulario.paxInf.value);
	var	ninios = parseInt(formulario.paxChd.value);
	var adultos = parseInt(formulario.paxAdt.value);
	var alerta = "";
		if (origen == ""){ alerta = "Debe completar el campo Origen.\n"; }
		if (destino == ""){	alerta += "Debe completar el campo Destino.\n";	}
		if (bebes > adultos){alerta += "El número de bebés no puede superar al de adultos.\n"; }
		if ( (ninios+adultos) > 9 ){ alerta += "El número total de adultos y niños no puede ser mayor que 9."; }
		if ( bebes+ninios > adultos*2){	alerta += "El número de bebés y niños no puede superar al doble del número de adultos."; }
		if (alerta){ alert(alerta); return;	}
	formulario.depDate.value = formulario.fecha_dia_entrada_ida.value;
	formulario.depDate.value += "/";
	formulario.depDate.value += (formulario.fecha_mesanio_entrada_ida.value).substring(4,7);
	formulario.depDate.value += "/";
	formulario.depDate.value += (formulario.fecha_mesanio_entrada_ida.value).substring(0,4);
	formulario.retDate.value = formulario.fecha_dia_salida_vuelta.value;
	formulario.retDate.value += "/";
	formulario.retDate.value += (formulario.fecha_mesanio_salida_vuelta.value).substring(4,7);
	formulario.retDate.value += "/";
	formulario.retDate.value += (formulario.fecha_mesanio_salida_vuelta.value).substring(0,4);
	formulario.submit();
}

function goSubmitVH () {
	var formulario = document.getElementById('rumbo_c450x300_vueloyhotel');
	var origen =  formulario.depCity.value;
	var destino = formulario.arrCity.value;
	var bebes = parseInt(formulario.paxInf.value);
	var	ninios = parseInt(formulario.paxChd.value);
	var adultos = parseInt(formulario.paxAdt.value);
	var alerta = "";
		if (origen == ""){ alerta = "Debe completar el campo Origen.\n"; }
		if (destino == ""){ alerta += "Debe completar el campo Destino.\n";	}
		if (bebes > adultos){ alerta += "El número de bebés no puede superar al de adultos.\n"; }
		if ( (ninios+adultos) > 9 ){ alerta += "El número total de adultos y niños no puede ser mayor que 9."; }
		if ( bebes+ninios > adultos*2){ alerta += "El número de bebés y niños no puede superar al doble del número de adultos."; }
		if (alerta){ alert(alerta);	return; }
	formulario.depDate.value = formulario.fecha_dia_entrada_ida.value;
	formulario.depDate.value += "/";
	formulario.depDate.value += formulario.fecha_mesanio_entrada_ida.value.substring(4,7);
	formulario.depDate.value += "/";
	formulario.depDate.value += formulario.fecha_mesanio_entrada_ida.value.substring(0,4);
	formulario.retDate.value = formulario.fecha_dia_salida_vuelta.value;
	formulario.retDate.value += "/";
	formulario.retDate.value += formulario.fecha_mesanio_salida_vuelta.value.substring(4,7);
	formulario.retDate.value += "/";
	formulario.retDate.value += formulario.fecha_mesanio_salida_vuelta.value.substring(0,4);
	formulario.submit();
}

function goSubmitHoteles (){
	var formulario = document.getElementById('rumbo_c450x300_hotel');
	var origen =  formulario.arrCity.value;
	var alerta = "";
		if (origen == ""){ alerta = "Debe completar el campo Origen.\n"; }
		if (alerta){ alert(alerta);	return;	}
	formulario.depDate.value = formulario.fecha_mesanio_entrada_ida.value;
	formulario.depDate.value += formulario.fecha_dia_entrada_ida.value;
	formulario.retDate.value = formulario.fecha_mesanio_salida_vuelta.value;
	formulario.retDate.value += formulario.fecha_dia_salida_vuelta.value;
	formulario.paxChd.value = formulario.paxHab.value.substring(2,3);	
	formulario.paxAdt.value = formulario.paxHab.value.substring(0,1);
	//Cambiado a esto por comentario de gente hoteles
		if ( (formulario.paxAdt.value == '1') && (formulario.paxChd.value == '1') ) { formulario.paxAdt.value = '2'; formulario.paxChd.value = '0'; 	}
	formulario.submit();
}
