<!--
// ==============================================================================================
// RUTINA PARTICULAR DE ACTUALIZACION DE CAMPOS DESPLEGABLES
// ==============================================================================================
// (c)2004, 2005 KOALAB : http://www.koalab.com 
// Evento de carga onload creados por Sergi Meseguer: http://www.zigotica.com
// ==============================================================================================
function setRooms() {
	var chosen = document.setupAdv.h.options[document.setupAdv.h.selectedIndex].value;
	for(i=1;i<=3;i++){
		var selbox = document.setupAdv['r_'+i];
			selbox.options.length = 0;
		if(document.setupAdv.lang.value == 'es'){
			if (chosen == "1") {
				selbox.options[selbox.options.length] = new Option('Habitación Doble Estándar','1');
				selbox.options[selbox.options.length] = new Option('Habitación Doble entre planta 30 y 41','2');
				selbox.options[selbox.options.length] = new Option('Suite Superior','5');
				selbox.options[selbox.options.length] = new Option('Suite con Terraza','6');
				selbox.options[selbox.options.length] = new Option('Suite sin Terraza','7');
			} 
			if (chosen == "2") {
				selbox.options[selbox.options.length] = new Option('Habitación Doble Estándar','1');
				selbox.options[selbox.options.length] = new Option('Habitación Doble con vista al mar frontal','3');
				selbox.options[selbox.options.length] = new Option('Habitación Doble con vista al mar lateral','4');
			}
			if (chosen == "3" || chosen == "4") {
				selbox.options[selbox.options.length] = new Option('Habitación Doble Estándar','1');
			}
			if (chosen == "5") {
				selbox.options[selbox.options.length] = new Option('Habitación Doble Estándar','1');
				selbox.options[selbox.options.length] = new Option('Habitación Doble Superior','8');
			}
		}else{
			if (chosen == "1") {
				selbox.options[selbox.options.length] = new Option('Standard Double Room','1');
				selbox.options[selbox.options.length] = new Option('Double Room Between floors 30 and 41','2');
				selbox.options[selbox.options.length] = new Option('Superior Suite','5');
				selbox.options[selbox.options.length] = new Option('Suite with Terrace','6');
				selbox.options[selbox.options.length] = new Option('Suite without Terrace','7');
			} 
			if (chosen == "2") {
				selbox.options[selbox.options.length] = new Option('Standard Double Room','1');
				selbox.options[selbox.options.length] = new Option('Double Room with Front Sea Views','3');
				selbox.options[selbox.options.length] = new Option('Double Room with Side Sea Views','4');
			}
			if (chosen == "3" || chosen == "4") {
				selbox.options[selbox.options.length] = new Option('Standard Double Room','1');
			}
			if (chosen == "5") {
				selbox.options[selbox.options.length] = new Option('Standard Double Room','1');
				selbox.options[selbox.options.length] = new Option('Superior Double Room','8');
			}
		}
	}
}
if (document.getElementById && document.getElementsByTagName && navigator.appVersion.indexOf("MSIE") > -1 && !window.opera) {
   ONLOADEVENTS.addLoadEvent(function(){setRooms();showAdv(false);})
} else {
	window.onload = function(){setRooms();showAdv(false);}
}
// ==============================================================================================
// RUTINA PARTICULAR DE COMPROBACION DE CUPO POR HABITACION
// ==============================================================================================
// (c)2004, 2005 KOALAB : http://www.koalab.com 
// ==============================================================================================
function checkCupo(){
	var myObj = document.setupAdv; // Asignación del formulario a objeto
	var hotel = myObj.h.options[myObj.h.selectedIndex].value; // Captura del hotel seleccionado
	// ------------------------------------------------------------------------------------------
	// Inicio del Bucle que itera por las tres filas de habitaciones
	// ------------------------------------------------------------------------------------------
	for(r=1; r<=3; r++){
	// ------------------------------------------------------------------------------------------
	// Declaracion de Variables y Asignacion de Contenidos
	// ------------------------------------------------------------------------------------------
		var errorMsg = '';
		var room = myObj['r_'+r].options[myObj['r_'+r].selectedIndex].value;
		var qty = parseInt(myObj['n_'+r].options[myObj['n_'+r].selectedIndex].value);
		var totalCupo = parseInt(myObj['a_'+r].options[myObj['a_'+r].selectedIndex].value); 
			totalCupo += parseInt(myObj['c_'+r].options[myObj['c_'+r].selectedIndex].value);
			totalCupo += parseInt(myObj['b_'+r].options[myObj['b_'+r].selectedIndex].value);
	// ------------------------------------------------------------------------------------------
	// Seleccion de mensajes de error de acuerdo al idioma
	// ------------------------------------------------------------------------------------------
		if(myObj.lang.value == 'es'){
			msg1 = 'No se pueden acoger mas de 4 personas (niños, adultos y cunas) en una misma habitacion';
			msg2 = 'Lo sentimos. El Gran Hotel Bali no admite habitaciones cuadruples ni triples mas cuna entre las plantas 30 y 41.';
			msg3 = 'Lo sentimos. El Hotel Selomar no admite habitaciones cuadruples ni triples mas cuna.';
			msg4 = 'Debe seleccionar al menos un huesped por habitación escogida.';
		}else{
			msg1 = 'No more than 4 guests, including babies, may stay in one room.';
			msg2 = 'Quadruple rooms cannot be reserved on upper floors of the Gran Hotel Bali.';
			msg3 = 'We regret that the Hotel Selomar has neither quadruple nor triple rooms plus cot.';
			msg4 = 'At least one guest must be selected for each chosen room.';
		}
	// ------------------------------------------------------------------------------------------
	// Comprobación de Condiciones (siempre que se hayan seleccionado habitaciones)
	// ------------------------------------------------------------------------------------------
		if(qty>0){
			// *** Máximo de Ocupación: Cuádruple - 4 personas (adultos, niños y bebes) por habitacion
			if(totalCupo>4){ errorMsg = msg1; } 
			// *** El Gran Hotel Bali no admite habitaciones cuadruples ni triples + cuna en piso alto
			if(room == '2' && totalCupo>3) { errorMsg = msg2; }
			// *** El Hotel Selomar no admite habitaciones cuadruples ni triples + cuna
			if(hotel == '2' && (totalCupo)>3) { errorMsg = msg3; }
			// *** Debe haber al menos un huesped por habitación
			if(totalCupo<1) { errorMsg= msg4; }
		}
	// ------------------------------------------------------------------------------------------
	// Si ya se han encontrado errores, se procede al final del bucle
	// ------------------------------------------------------------------------------------------
		if(errorMsg!=''){break;}
	}
	// ------------------------------------------------------------------------------------------
	// Retornos al Cliente
	// ------------------------------------------------------------------------------------------
	if (errorMsg!=''){alert(errorMsg)}
	if(document.MM_returnValue){document.MM_returnValue = (errorMsg=='')};
}
// ==============================================================================================
// FUNCION DE ON/OFF PARA CAMPOS ADICIONALES DE RESERVA COMBINADA
// ==============================================================================================
// (c)2004, 2005 KOALAB : http://www.koalab.com 
// ==============================================================================================
function showAdv(show){
	if(show){
		// Mostramos los campos adicionales
		document.getElementById('hiddenRoomRows').style.display = 'block';
		document.getElementById('multipleLink').style.display = 'none';
		document.getElementById('simpleLink').style.display = 'block';
	} else {
		// Ocultamos los campos
		document.getElementById('hiddenRoomRows').style.display = 'none';
		document.getElementById('multipleLink').style.display = 'block';
		// Reseteamos los valores de los campos adicionales a cero
		document.getElementById('n_2').selectedIndex = 0;
		document.getElementById('n_3').selectedIndex = 0;
	}
}



//-->