//***********************
// Varibles y arrays varios
//***********************

var ar_origen = new Array("", "Flughafen (Lanzarote)", "Arrecife", "Costa Teguise", "Matagorda/Los Pocillos", "Puerto del Carmen", "Playa Blanca", "Puerto Calero", "Club La Santa", "Charco del Palo", "Famara", "Orzola Hafen", "Playa Blanca Hafen", "Los Mármoles  Hafen (Arrecife)",  "Küstengebiet Puerto Calero", "Küstengebiet Rubicón", "San Bartolomé", "Haría", "Teguise", "Tías", "Tinajo", "Yaiza","------------------------");
var ar_destino = new Array("", "Flughafen (Lanzarote)", "Arrecife", "Costa Teguise", "Matagorda/Los Pocillos", "Puerto del Carmen", "Playa Blanca", "Puerto Calero", "Club La Santa", "Charco del Palo", "Famara", "Orzola Hafen", "Playa Blanca Hafen", "Los Mármoles  Hafen (Arrecife)",  "Küstengebiet Puerto Calero", "Küstengebiet Rubicón", "San Bartolomé", "Haría", "Teguise", "Tías", "Tinajo", "Yaiza","------------------------");
var ar_recorrido_completo = new Array(0, 1, 13, 12, 11, 22, 2, 3, 4, 5, 6, 7, 8, 9, 10, 16, 17, 18, 19, 20, 21, 22, 14, 15);
var ar_recorrido_puertos_aeropuertos = new Array(0, 1, 13, 12, 11);
var ar_recorrido_puertos_aeropuertos2 = new Array(0, 1, 13, 12, 11, 22, 14, 15); // incluye las marinas
var ar_recorrido_solo_puertos = new Array(13, 12, 11);
var ar_recorrido_sin_puertos_aeropuertos = new Array(0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 16, 17, 18, 19, 20, 21);
var ar_recorridos = new Array(ar_recorrido_completo, ar_recorrido_puertos_aeropuertos, ar_recorrido_sin_puertos_aeropuertos);
//var ar_excursiones = new Array("", "1 - Ruta Turística Norte/Sur", "2 - Ruta Turística Norte", "3 - Ruta Turística Sur" , "4 - Ruta Personalizada", "5 - Ruta del Vino 1", "6 - Ruta del Vino 2", "7 - Ruta Cultural");
var ar_excursiones = new Array("", "1 - Nord/Süd Tour", "2 - Nordtour", "3 - Südtour" , "4 -Persönliche Route", "5 - Weintour ", "6 - Kulturroute", "7 - Vergnügungstour", "8 - Arrecife Tour");
var ar_nortesur = new Array("", "1.1 - North/South Route - 7 hours", "1.2 - North/South Route - 9 hours");
var ar_personalizadas = new Array("", "4.1-Montañas del Fuego-Timanfaya", "4.2-Jameos del Agua (Tag)", "4.3-Jameos del Agua (Nacht), tuesdays, fridays and saturdays", "4.4-Cueva de Los Verdes", "4.5-Mirador del Río", "4.6-Jardín de Cactus", "4.7-Monumento al Campesino", "4.8-Castillo de San José (MIAC)",  "4.9-Montañas del Fuego-Jameos del Agua", "4.10-Jameos del Agua-Cueva de los Verdes", "4.11-Los Hervideros, Charco de los Clicos, El Golfo", "4.12-Fundación Cesar Manrique", "4.13-Museo de Cetáceos de Canarias", "4.14-Museo Aeronáutico del Aeropuerto", "4.15-Museo Etnográfico Tanit", "4.16-Museo Agrícola El Patio", "4.17-Rancho Texas Park", "4.18-Lanzarote a Caballo", "4.19-Aquarium Lanzarote", "4.20-Guinate Tropical Park", "4.21-Bodega Stratvs", "4.22-Bodega Museo del Vino El Grifo", "4.23-Villa de Teguise (Historic Area)", "4.24-Ermita de los Dolores");

var ar_alojamientos = new Array('', '', ar_aloj_arrecife, ar_aloj_costa_teguise, ar_aloj_matagorda_pocillos, ar_aloj_puerto_del_carmen, ar_aloj_playa_blanca, ar_aloj_puerto_calero, ar_aloj_la_santa, ar_aloj_charco_del_palo, ar_aloj_famara, '', '', '', '', '', ar_aloj_san_bartolome, ar_aloj_haria, ar_aloj_teguise, ar_aloj_tias, ar_aloj_tinajo, ar_aloj_yaiza);
var ar_municipios = new Array("Arrecife", "Haría", "San Bartolomé", "Teguise", "Tinajo", "Tías", "Yaiza");
var ar_local_arrecife = new Array("Altavista", "Argana Alta", "Argana Baja", "Centro", "El Cable", "La Concha", "La Vega", "Las Salinas", "Los Alonso", "Maneje", "S. Fco. Javier", "Tenorio", "Titerroy", "Valterra");
var ar_local_haria = new Array("Arrieta", "Charco del Palo", "Guinate", "Haría", "Máguez", "Mala", "Órzola", "Punta Mujeres", "Ye");
var ar_local_san_bartolome = new Array("El Islote", "Güime", "Montaña Blanca", "Mozaga", "Playa Honda", "San Bartolomé");
var ar_local_teguise =new Array("Caleta Caballo", "Caleta Famara", "Costa Teguise", "El Mojón", "Guatiza", "Las Caletas", "Los Cocoteros", "Los Valles", "Muñique", "Nazaret", "Soo", "Tahiche", "Tao", "Teguise", "Teseguite", "Tiagua");
var ar_local_tinajo =new Array("El Cuchillo", "La Santa", "La Vegueta", "Mancha Blanca", "Tinajo");
var ar_local_tias =new Array("Conil", "La Asomada", "Mácher", "Masdache", "Matagorda/Los Pocillos", "Pto. del Carmen", "Tías", "Vega de Tegoyo");
var ar_local_yaiza =new Array("El Golfo", "Femés", "La Geria", "La Hoya", "Las Breñas", "Las Casitas de Femés", "Playa Blanca", "Playa Quemada", "Puerto Calero", "Uga", "Yaiza");
var ar_todas_localidades = new Array(ar_local_arrecife, ar_local_haria, ar_local_san_bartolome, ar_local_teguise, ar_local_tinajo, ar_local_tias, ar_local_yaiza);
var ar_moneda = new Array("","€","£","$");
var SPECIAL_DAYS = {  // festivos
	0 : [1, 6],
	1 : [16],
	2 : [0],
	3 : [1, 2],
	4 : [1, 30],
	5 : [0],
	6 : [ 0 ],	
	7 : [ 24 ],	
	8 : [ 15 ],
	9 : [ 12 ],
	10 : [1],
	11 : [6, 8, 25]
};

Array.prototype.in_array=function(elem){
    for(var j in this){
        if(this[j]==arguments[0]){
            return true;
        }
    }
    return false;     
}


//***********************
// Fin de Varibles y arrays varios
//***********************
function ventanaSecundaria (URL, ancho, alto, barra_desplazamiento){
//   window.open(URL,"ventana1","width=120,height=300,scrollbars=yes")
   window.open(URL,"ventana1","width="+ancho+",height="+alto+",scrollbars="+barra_desplazamiento)
}

function agregar_favoritos()
{
	if (document.all) 
	{
		window.external.AddFavorite('http://www.lanzarotetaxi.com','Lanzarotetaxi.com - Reservas de Taxis');
	}
}

function colapso () 
{
	//document.form_reservas.fila_de_colapso.className = 'fila_sin_colapso';
	document.getElementById('div_expandible').className = 'formulario_reservas_extendido';
	document.getElementById('fila_de_colapso').className = 'fila_sin_colapso';
}
//***********************
// Funciones de los menús
//***********************
function mostrar(elemento) 
{
	if (document.getElementById(elemento).className== 'opcion_visible') 
	{
		document.getElementById(elemento).className = 'opcion_oculta';
	} 
	else 
	{
		document.getElementById(elemento).className = 'opcion_visible';	
	}
}
//***********************
// Fin de Funciones de los menús
//***********************

//***********************
// Funciones del formulario traslados
//***********************
function aceptar_condiciones(chk_aceptar) {
	if (chk_aceptar.checked) {		
		document.getElementById('btn_enviar').disabled=false;
	} else {
		document.getElementById('btn_enviar').disabled=true;
	}
}
function cambia_destino() {		
		tmp_puerto_aeropuerto = false;
		tmp_sel_destino = document.getElementById('sel_destino');
		tmp_sel_origen = document.getElementById('sel_origen');
		tmp_ar_recorrido = ar_recorridos[1];
		if (tmp_sel_origen.value!=0 && ar_recorrido_puertos_aeropuertos.in_array(tmp_sel_origen.value)) {	// Comprueba el origen
			tmp_puerto_aeropuerto = true;
			tmp_ar_recorrido = ar_recorridos[0]; // el origen está en puertos y aeropuerto
		} else if (tmp_sel_origen.value!=0 && ar_recorrido_sin_puertos_aeropuertos.in_array(tmp_sel_origen.value)) {
			tmp_ar_recorrido = ar_recorridos[1]; // el origen no está en puertos y aeropuerto
		}		
		if (document.forms.form_reservas.rb_tipo_servicio[0].checked) { //vefirica si es traslado 
			tmp_sel_destino.options.length = 0;  //borramos las opciones
			for (i=0;i<tmp_ar_recorrido.length;i++){
				if (tmp_sel_origen.value!=tmp_ar_recorrido[i]) {
				   tmp_sel_destino.options[i] = new Option(ar_destino[tmp_ar_recorrido[i]], tmp_ar_recorrido[i]);
				} else {
					ind_borrar = i;	
				}
			}						
			if (tmp_puerto_aeropuerto) { // si el origen está en puerto y aeropuerto elimina esta opción
				tmp_sel_destino.options[ind_borrar] = null;
			}
			// si el origen no está en el aeropuerto, sólo es ida
			if (tmp_sel_origen.value==1) {
				document.getElementById('id_fecha_mostrar').style.display = 'block';
			} else {
				document.getElementById('in_fecha_vuelta').value = '';
				document.getElementById('id_fecha_mostrar').style.display = 'none';	
			}
		} 
}

function comprueba_vuelta () {
	tmp_sel_origen = document.getElementById('sel_origen').value;
	if (tmp_sel_origen==1) {
		document.getElementById('in_fecha_vuelta').disabled = false;
		document.getElementById('lanzador2').disabled = false;
	} else {
		document.getElementById('in_fecha_vuelta').value = '';		
		document.getElementById('in_fecha_vuelta').disabled = true;
		document.getElementById('lanzador2').disabled = true;	
	}
}

function cambia_destino_traslados() {
		tmp_puerto_aeropuerto = false;	
		tmp_sel_destino = document.getElementById('sel_destino');
		tmp_sel_origen = document.getElementById('sel_origen');
		tmp_ar_recorrido = ar_recorridos[1];
		if (tmp_sel_origen.value!=0 && ar_recorrido_puertos_aeropuertos.in_array(tmp_sel_origen.value)) {	// Comprueba el origen
			tmp_puerto_aeropuerto = true;
			tmp_ar_recorrido = ar_recorridos[0]; // el origen está en puertos y aeropuerto
			// cambiar nº de vuelo por naviera
			if (tmp_sel_origen.value==1) {
				document.getElementById('html_vuelo_naviera').innerHTML = "Flugnummer & Ausgangsort:";
			} else {
				document.getElementById('html_vuelo_naviera').innerHTML = "Fähre/Schiff:";
			}
			document.getElementById('campo_vuelo_naviera').style.display = "block";
		} else if (tmp_sel_origen.value!=0 && ar_recorrido_sin_puertos_aeropuertos.in_array(tmp_sel_origen.value)) {
			tmp_ar_recorrido = ar_recorridos[1]; // el origen no está en puertos y aeropuerto
			//document.getElementById('html_vuelo_naviera').innerHTML = "Nº de Vuelo:";
			document.getElementById('campo_vuelo_naviera').style.display = "none";
			
		}		
		tmp_sel_destino.options.length = 0;  //borramos las opciones
		for (i=0;i<tmp_ar_recorrido.length;i++){
			if (tmp_sel_origen.value!=tmp_ar_recorrido[i]) {
			   tmp_sel_destino.options[i] = new Option(ar_destino[tmp_ar_recorrido[i]], tmp_ar_recorrido[i]);
			} else {
				ind_borrar = i;	
			}
		}						
		if (tmp_puerto_aeropuerto) { // si el origen está en puerto y aeropuerto elimina esta opción
			tmp_sel_destino.options[ind_borrar] = null;
		}
}
function cambia_alojamiento() {	
	tmp_sel_destino = document.getElementById('sel_destino').value;
	tmp_sel_origen = document.getElementById('sel_origen').value;	
	if (tmp_sel_origen!=0 && ar_recorrido_puertos_aeropuertos.in_array(tmp_sel_origen)) { //si puerto y aeropuertos en origen elegir destino como índice
		tmp_sel = tmp_sel_destino;
	} else if (tmp_sel_destino!=0 && ar_recorrido_puertos_aeropuertos.in_array(tmp_sel_destino)) { //si puerto y aeropuertos en destino elegir origen como índice
		tmp_sel = tmp_sel_origen;
	} else {
		tmp_sel = "";
		return false;
	}	
	tmp_sel_alojamiento = document.getElementById('sel_alojamiento');
	temp_ar=ar_alojamientos[tmp_sel];
	tmp_sel_alojamiento.options.length = 0;  //borramos las opciones
	i=0;
	for(var clave in temp_ar)
	{		
		tmp_sel_alojamiento.options[i] = new Option(temp_ar[clave], clave);
		i++;
	}
	document.getElementById('div_expandible').className = 'formulario_reservas_extendido';
	document.getElementById('tr_opciones_alojamiento').className = 'fila_colapso';
}
function cambia_destino_excursiones() {
		tmp_sel_origen = document.getElementById('sel_origen');
		tmp_sel_alojamiento = document.getElementById('sel_alojamiento');
		temp_ar=ar_alojamientos[tmp_sel_origen.value];
		tmp_sel_alojamiento.options.length = 0;  //borramos las opciones		
		// cambiar nº de vuelo por naviera
		if (tmp_sel_origen.value!=0) {
			if (ar_recorrido_solo_puertos.in_array(tmp_sel_origen.value)) {
				document.getElementById('html_vuelo_naviera').innerHTML = "Fähre/Schiff:";
				document.getElementById('campo_vuelo_naviera').style.display = "block";
			} else if (tmp_sel_origen.value==1) {
				document.getElementById('html_vuelo_naviera').innerHTML = "Flugnummer & Ausgangsort:";
				document.getElementById('campo_vuelo_naviera').style.display = "block";
			} else {
				document.getElementById('campo_vuelo_naviera').style.display = "none";
			}
		}
		// actualiza el listado de alojamientos
		tmp_sel_origen = document.getElementById('sel_origen').value;	
		if (tmp_sel_origen!=0 && ar_recorrido_puertos_aeropuertos.in_array(tmp_sel_origen)) { //si puerto y aeropuertos en origen no hacer nada
			return false;
		} else {
				i=0;
				for(var clave in temp_ar)
				{		
					tmp_sel_alojamiento.options[i] = new Option(temp_ar[clave], clave);
					i++;
				}
				document.getElementById('div_expandible').className = 'formulario_reservas_extendido';
				document.getElementById('tr_opciones_alojamiento').className = 'fila_colapso';
		}			
}

function cambia_alojamiento_excursion() {	

}
function cambia_ruta() {	
	tmp_sel_excursion = document.getElementById('sel_excursion').value;
	tmp_sel_origen = document.getElementById('sel_origen').value;	
	if (tmp_sel_origen!=0 && ar_recorrido_puertos_aeropuertos.in_array(tmp_sel_origen)) { //si puerto y aeropuertos en origen elegir destino como índice
		tmp_sel = '';
	} else if (tmp_sel_destino!=0 && ar_recorrido_puertos_aeropuertos.in_array(tmp_sel_destino)) { //si puerto y aeropuertos en destino elegir origen como índice
		tmp_sel = '';
	} else {
		return false;
	}	
	tmp_sel_ruta_personalizada = document.getElementById('sel_ruta_personalizada');
	tmp_sel_ruta_personalizada.options.length = 0;  //borramos las opciones
	i=0;
	/*for(var clave in temp_ar)
	{		
		tmp_sel_ruta_personalizada.options[i] = new Option(temp_ar[clave], clave);
		i++;
	}	*/
}

function reset_equipaje_extra () {
	if (document.getElementById('sel_tipo_vehiculo').value == "Behindertengerechte") 
	{
		document.getElementById('sel_extras').value ="Rollstühle";
	} else {
		document.getElementById('sel_extras').value ="";
	}
}

function equipaje_extra() {
	if (document.getElementById('sel_extras').value == "Extra Gepäck + 4 Koffer") {
		/*if (document.getElementById('sel_tipo_vehiculo').value == "Adaptado a Discapacitados") {
			alert('    Con la opción de equipaje extra, se sumará un taxi más.    ');
			document.getElementById('sel_num_taxis').value++;
		} else {*/
			document.getElementById('sel_tipo_vehiculo').value = "Familienwagen";
		//}
	} else if (document.getElementById('sel_extras').value == "Rollstühle") {
			document.getElementById('sel_tipo_vehiculo').value = "Behindertengerechte";		
	} else if (document.getElementById('sel_extras').value == "Schrankkoffer Und Sperrgut") {
			document.getElementById('sel_tipo_vehiculo').value = "Familienwagen";		
	} else if (document.getElementById('sel_extras').value == "") { 
			document.getElementById('sel_tipo_vehiculo').value = "Pkw-Limousinen";
	}	
	 else {
		if (document.getElementById('sel_tipo_vehiculo').value == "Behindertengerechte") {
			document.getElementById('sel_tipo_vehiculo').value = "Pkw-Limousinen";
		}
	} 
}
html_excursion = 'Ausflüge: <span class="texto2_formulario" style="margin-left:45px;"><select name="sel_excursion" id="sel_excursion" class="select1_formulario_reservas"></select></span>';
html_traslado = 'Ziele: <span class="texto2_formulario" style="padding-left:71px;"><select name="sel_destino" id="sel_destino" class="select1_formulario_reservas"></select></span>';
html_fechas_excursion = 'Datum Des Ausflugs:';
html_fechas_traslado = 'Datum Der Fahrt (Hin):';
function tipo_de_formulario (tipo_formulario) {
	if(tipo_formulario==2) {
		document.getElementById('id_htlm_destino').innerHTML = html_excursion;
		document.getElementById('id_htlm_fechas').innerHTML = html_fechas_excursion;
		document.getElementById('id_fecha_mostrar').style.display = 'none';
		document.getElementById('sel_excursion').options.length = 0;  //borramos las opciones
		document.getElementById('sel_excursion').options[0] = new Option("", 0, "defaultSelected");
		for (i=1;i<ar_excursiones.length;i++){ // Rellena la lista
		//for (i=1;i<9;i++){ // Rellena la lista capada
			document.getElementById('sel_excursion').options[i] = new Option(ar_excursiones[i], i);
		}
		document.getElementById('sel_origen').options.length = 0;  //borramos las opciones
		document.getElementById('sel_origen').options[0] = new Option("", 0, "defaultSelected");
		tmp_ar_recorrido = ar_recorridos[0];
		cont_temp = 1;
		for (i=1;i<tmp_ar_recorrido.length;i++){ // Rellena la lista		
			 //if (i == 1 || i == 11 || i == 12 || i == 13) {  //solo puertos aeropuertos  
				document.getElementById('sel_origen').options[cont_temp] = new Option(ar_destino[tmp_ar_recorrido[i]], tmp_ar_recorrido[i]);
				cont_temp++;
			 //}
		}
	} else {
		tmp_ar_recorrido = ar_recorridos[0];
		document.getElementById('id_htlm_destino').innerHTML = html_traslado;
		document.getElementById('id_htlm_fechas').innerHTML = html_fechas_traslado;
		document.getElementById('id_fecha_mostrar').style.display = 'block';	
		document.getElementById('sel_destino').options.length = 0;  //borramos las opciones
		document.getElementById('sel_destino').options[0] = new Option("", 0, "defaultSelected");
		for (i=1;i<tmp_ar_recorrido.length;i++){ // Rellena la lista
			document.getElementById('sel_destino').options[i] = new Option(ar_destino[tmp_ar_recorrido[i]], tmp_ar_recorrido[i]);
		}
		document.getElementById('sel_origen').options.length = 0;  //borramos las opciones
		document.getElementById('sel_origen').options[0] = new Option("", 0, "defaultSelected");
		cont_temp = 1;
		for (i=1;i<tmp_ar_recorrido.length;i++){ // Rellena la lista		
			 //if (i == 1 || i == 11 || i == 12 || i == 13) {  //solo puertos aeropuertos  
				document.getElementById('sel_origen').options[cont_temp] = new Option(ar_destino[tmp_ar_recorrido[i]], tmp_ar_recorrido[i]);
				cont_temp++;
			 //}
		} 
	}
	
}
function cambia_municipio_otros (){ // actualiza los campos de municipio y localidad en otros
	tmp_sel = document.getElementById('sel_origen').value;	
	if (!ar_recorrido_sin_puertos_aeropuertos.in_array(tmp_sel)) {
		tmp_sel = document.getElementById('sel_destino').value;
	}
	switch(tmp_sel)
	{	
		case "2":		
			//document.getElementById('sel_municipio_alojamiento').value="Arrecife";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Arrecife", "Arrecife", "defaultSelected");				
			comprobar_municipio("Arrecife");		
			break;
		case "3":
//			document.getElementById('sel_municipio_alojamiento').value="Teguise";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Teguise", "Teguise", "defaultSelected");
			comprobar_municipio("Teguise");
//			document.getElementById('sel_localidad_alojamiento').value="Costa Teguise";			
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Costa Teguise", "Costa Teguise", "defaultSelected");			
			
			break;
		case "4":
//			document.getElementById('sel_municipio_alojamiento').value="Tías";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Tías", "Tías", "defaultSelected");
			comprobar_municipio("Tías");
//			document.getElementById('sel_localidad_alojamiento').value="Matagorda/Los Pocillos";
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Matagorda/Los Pocillos", "Matagorda/Los Pocillos", "defaultSelected");				
			break;			
		case "5":
//			document.getElementById('sel_municipio_alojamiento').value="Tías";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Tías", "Tías", "defaultSelected");
			comprobar_municipio("Tías");
//			document.getElementById('sel_localidad_alojamiento').value="Pto. del Carmen";
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Pto. del Carmen", "Pto. del Carmen", "defaultSelected");			
			break;		
		case "6":
//			document.getElementById('sel_municipio_alojamiento').value="Yaiza";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Yaiza", "Yaiza", "defaultSelected");
			comprobar_municipio("Yaiza");
//			document.getElementById('sel_localidad_alojamiento').value="Playa Blanca";
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Playa Blanca", "Playa Blanca", "defaultSelected");			
			break;		
		case "7":
//			document.getElementById('sel_municipio_alojamiento').value="Yaiza";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Yaiza", "Yaiza", "defaultSelected");
			comprobar_municipio("Yaiza");
//			document.getElementById('sel_localidad_alojamiento').value="Puerto Calero";
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Puerto Calero", "Puerto Calero", "defaultSelected");			
			break;		
		case "8":
//		document.getElementById('sel_municipio_alojamiento').value="Tinajo";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Tinajo", "Tinajo", "defaultSelected");
			comprobar_municipio("Tinajo");
//			document.getElementById('sel_localidad_alojamiento').value="La Santa";
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Club La Santa", "Club La Santa", "defaultSelected");			
			break;			
		case "9":
//			document.getElementById('sel_municipio_alojamiento').value="Haría";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Haría", "Haría", "defaultSelected");
			comprobar_municipio("Haría");
//			document.getElementById('sel_localidad_alojamiento').value="Charco del Palo";
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Charco del Palo", "Charco del Palo", "defaultSelected");			
			break;		
		case "10":
//			document.getElementById('sel_municipio_alojamiento').value="Teguise";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Teguise", "Teguise", "defaultSelected");
			comprobar_municipio("Teguise");
//			document.getElementById('sel_localidad_alojamiento').value="Caleta Famara";
			document.getElementById('sel_localidad_alojamiento').options.length = 0;			
			document.getElementById('sel_localidad_alojamiento').options[0] = new Option("Caleta Famara", "Caleta Famara", "defaultSelected");			
			break;	
		case "16":
//			document.getElementById('sel_municipio_alojamiento').value="San Bartolomé";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("San Bartolomé", "San Bartolomé", "defaultSelected");
			comprobar_municipio("San Bartolomé");
			break;		
		case "17":
//			document.getElementById('sel_municipio_alojamiento').value="Haría";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Haría", "Haría", "defaultSelected");
			comprobar_municipio("Haría");
			break;				
		case "18":
//			document.getElementById('sel_municipio_alojamiento').value="Teguise";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Teguise", "Teguise", "defaultSelected");
			comprobar_municipio("Teguise");
			break;		
		case "19":
//			document.getElementById('sel_municipio_alojamiento').value="Tías";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Tías", "Tías", "defaultSelected");
			comprobar_municipio("Tías");
			break;		
		case "20":
//			document.getElementById('sel_municipio_alojamiento').value="Tinajo";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Tinajo", "Tinajo", "defaultSelected");
			comprobar_municipio("Tinajo");
			break;			
		case "21":
//			document.getElementById('sel_municipio_alojamiento').value="Yaiza";
			document.getElementById('sel_municipio_alojamiento').options.length = 0;			
			document.getElementById('sel_municipio_alojamiento').options[0] = new Option("Yaiza", "Yaiza", "defaultSelected");
			comprobar_municipio("Yaiza");
			break;				
	}
}

function comprobar_otro(alojamiento) {
	if (alojamiento.substr(0,4)=='otro') {
		document.getElementById('div_expandible').className = 'formulario_reservas_extendido_opciones';
		document.getElementById('tr_opciones_alojamiento').className = 'fila_sin_colapso';
		cambia_municipio_otros();
	} else {
		document.getElementById('div_expandible').className = 'formulario_reservas_extendido';
		document.getElementById('tr_opciones_alojamiento').className = 'fila_colapso';
	}
}

function cambio_formulario(tipo_formulario) {
	if(tipo_formulario.value==2) {
		document.forms.form_reservas.action = "formulario_excursiones_lanzarote_taxi.php";		
		tipo_de_formulario(tipo_formulario.value);
	} else {
		document.forms.form_reservas.action = "formulario_traslados_lanzarote_taxi.php";
		tipo_de_formulario(tipo_formulario.value);
	}
	document.getElementById('in_fecha_ida').value = ""; 
	document.getElementById('in_fecha_vuelta').value = ""; 
}

function comprobar_localidad (localidad) {
	if (localidad != "") {
//		alert(ar_municipios[2]);
		for (i=0; i<ar_todas_localidades.length; i++) {
			//alert(ar_municipios[i]);
			for (j=0; j<ar_todas_localidades[i].length; j++) {
				if (ar_todas_localidades[i].in_array(localidad)) {
					document.getElementById('sel_municipio_alojamiento').value = ar_municipios[i];
					//alert(ar_municipios[i]+' '+i);
					return true;
				}
			}
		}
		
	}
	return false;
}

function comprobar_municipio (municipio) {
	tmp_sel = document.getElementById('sel_localidad_alojamiento');
	if (municipio=="") {
		tmp_sel.options.length = 0;
		cont = 0;
		tmp_sel.options[cont] = new Option('', '', 'defaultSelected');		
		for (i=0; i<ar_municipios.length; i++) {
			cont++;
			tmp_sel.options[cont] = new Option('- '+ar_municipios[i]+' -----', ar_municipios[i]);
			tmp_sel.options[cont].style.color = '#990000';
			for (j=0; j<ar_todas_localidades[i].length; j++) {
				cont++;
				tmp_sel.options[cont] = new Option(ar_todas_localidades[i][j], ar_todas_localidades[i][j]);
			}
		}
		return true;
	} else {
		for (i=0; i<ar_municipios.length; i++) {
			if (ar_municipios[i]==municipio) {
				ar_temp = ar_todas_localidades[i];			
				tmp_sel.options.length = 0;
				tmp_sel.options[0] = new Option('- '+municipio+' -----', '', 'defaultSelected');
				tmp_sel.options[0].style.color = '#990000';
				for (j=0; j<ar_temp.length; j++) {
					tmp_sel.options[j+1] = new Option(ar_temp[j], ar_temp[j]);
				}
				return true;	
			}
		}
		return false;
	}
}

function apuntaLocalidad(municipio) {
	document.getElementById('sel_localidad_alojamiento').value='-'+municipio;
}

function actualiza_pasajeros () {
	pasajeros_por_taxi = 4;
	num_pasajeros = document.getElementById('sel_num_pasajeros').value;
	num_taxis = Math.ceil(num_pasajeros/pasajeros_por_taxi);
	/*if (document.getElementById('sel_extras').value== 'Equipaje Extra + de 4 bultos' && document.getElementById('sel_tipo_vehiculo').value == 'Adaptado a Discapacitados') {
		num_taxis++;
	}*/
	if (num_taxis > document.getElementById('sel_num_taxis').value) {
		document.getElementById('sel_num_taxis').value = num_taxis;
	} else if (num_taxis < document.getElementById('sel_num_taxis').value) {
			if (!confirm("Sie haben sich eine Reihe von Taxis als nötig. Weiter?")) {
				document.getElementById('sel_num_taxis').value = num_taxis;
			}
	}
}

function LZ(x) { // función para añadir un cero a la izquierda y queda convertida en string
	return (x<0||x>=10?"":"0") + x 
}
function f_fecha_formateada (fecha) {
	var dia = LZ(fecha.getDate());
	var mes = LZ(fecha.getMonth()+1);
	var year = fecha.getFullYear();
	return dia +'/'+mes+'/'+year;	
}


// this function returns true if the passed date is special
function dateIsSpecial(year, month, day) {
	var m = SPECIAL_DAYS[month];
	if (!m) return false;
	for (var i in m) if (m[i] == day) return true;
	return false;
}

function comprobarFechaIdayConExcursion (date, y, m, d) {  
	tmp_fecha_servidor = document.getElementById("fecha_servidor").value;
	var fecha_hoy = new Date(tmp_fecha_servidor);
	var tmp_fecha_hoy = new Date(tmp_fecha_servidor);
	var tmp_fecha = new Date(y, m, d);
	if (fecha_hoy.getDay()==0) {
		fecha_hoy.setDate(fecha_hoy.getDate()+1);
	} else if (fecha_hoy.getDay()!=6){ // el sábado es hasta la una
		fecha_hoy.setDate(fecha_hoy.getDate()+1);
	}
	if (tmp_fecha_hoy.getDay()==6) {// el sábado dos días
		fecha_hoy.setDate(tmp_fecha_hoy.getDate()+2);
	}
	if (tmp_fecha>fecha_hoy) {
		var tmp_dia = tmp_fecha.getDay();
// sólo están activos los días 24 más que el día actual
		if (document.forms.form_reservas.rb_tipo_servicio[1].checked) {				
			var origen = document.getElementById("sel_origen").value; 
			if (origen!=13 && origen!=2 && (tmp_dia == 0 || tmp_dia == 4)) {
				return true;
			} else {
				if (dateIsSpecial(y, m, d) || tmp_dia ==0) {return 'special';}
				else {return false;}
			}	
		} else {
			if (dateIsSpecial(y, m, d) || tmp_dia ==0) {return 'special';}
			else {return false;}
		}		
		
	} else {
		return true;
	}	
}

function diasConExcursion(date, y, m, d) {
	tmp_fecha_servidor = document.getElementById("fecha_servidor").value;
	var fecha_hoy = new Date(tmp_fecha_servidor);
	var tmp_fecha_hoy = new Date(tmp_fecha_servidor);
	var tmp_fecha = new Date(y, m, d);
	if (fecha_hoy.getDay()==0) {
		fecha_hoy.setDate(fecha_hoy.getDate()+1);
	} else if (fecha_hoy.getDay()!=6){ // el sábado es hasta la una
		fecha_hoy.setDate(fecha_hoy.getDate()+1);
	}
	if (tmp_fecha_hoy.getDay()==6) {// el sábado dos días
		fecha_hoy.setDate(tmp_fecha_hoy.getDate()+2);
	}		
	if (tmp_fecha>fecha_hoy) {
// sólo están activos los días 24 más que el día actual		
		var tmp_dia = tmp_fecha.getDay();
		var origen = document.getElementById("sel_origen").value; 
		if (origen!=13 && origen!=2 && (tmp_dia == 0 || tmp_dia == 4)) {					
			return true;			
		} else {
			if (document.getElementById("sel_excursion").value==4 && document.getElementById("sel_personalizada").value == 3 && (tmp_dia == 0 || tmp_dia == 1 || tmp_dia == 3 || tmp_dia == 4)) {
				return true;
			} else {
				if (dateIsSpecial(y, m, d) || tmp_dia ==0) {return 'special';}
				else {return false;}
			}
		}	
	} else {
		return true;
	}
}

function comprobarFechaIda (date, y, m, d) {
	tmp_fecha_servidor = document.getElementById("fecha_servidor").value;
	var fecha_hoy = new Date(tmp_fecha_servidor);
	var tmp_fecha_hoy = new Date(tmp_fecha_servidor);
	var tmp_fecha = new Date(y, m, d);
	if (fecha_hoy.getDay()==0) {
		fecha_hoy.setDate(fecha_hoy.getDate()+1);
	} else if (fecha_hoy.getDay()!=6){ // el sábado es hasta la una
		fecha_hoy.setDate(fecha_hoy.getDate()+1);
	}
	if (tmp_fecha_hoy.getDay()==6) {// el sábado dos días
		fecha_hoy.setDate(tmp_fecha_hoy.getDate()+2);
	}	
	if (tmp_fecha>fecha_hoy) {
		var tmp_dia = tmp_fecha.getDay();
// sólo están activos los días 24 más que el día actual
		if (dateIsSpecial(y, m, d) || tmp_dia ==0) {return 'special';}
		else {return false;}
	} else {
		return true;
	}
}


function actualizaVuelta (cal) {
	var fecha_seleccionada = cal.date;
	var str_temp = document.getElementById("in_fecha_vuelta").value;
	var tmp_fecha_vuelta = new Date(str_temp.substr(6,4), str_temp.substr(3,2)-1, str_temp.substr(0,2));
	if (str_temp!="" && fecha_seleccionada>tmp_fecha_vuelta) {
		document.getElementById("in_fecha_vuelta").value = f_fecha_formateada(fecha_seleccionada);
	}
}

function comprobarFechaVuelta(date, y, m, d) {	
	var tmp_fecha = new Date(y, m, d);	
	var tmp_dia = tmp_fecha.getDay();	
	var str_temp = document.getElementById("in_fecha_ida").value;
	var tmp_fecha_ida = new Date(str_temp.substr(6,4), str_temp.substr(3,2)-1, str_temp.substr(0,2));	
	if (str_temp!="") {
		if (tmp_fecha>=tmp_fecha_ida) {			
			if (dateIsSpecial(y, m, d) || tmp_dia ==0) {return 'special';}
			else {return false;}
		} else {
			return true;
		}
	} else {
		return true;
	}
	
}
function comprueba_prioridad () {
	tipo_vehiculo = document.getElementById('sel_tipo_vehiculo').value;
	origen = document.getElementById('sel_origen').value;
	if (tipo_vehiculo == 'Behindertengerechte' && origen == '1') {
		document.getElementById('div_prioridad').style.display = 'block';
	} else {
		document.getElementById('div_prioridad').style.display = 'none';
	}
}

function mensaje_prioridad (valor) {
	if (valor == 1) {
		alert('Höchste Priorität bedeutet, dass das Taxi warten, für den Kunden auf dem Flughafen, und auch ein Zuschlag auf den Preis.');		
	}
}

function cambia_excursion (valor) {
	document.getElementById('sel_hora_ida').value = "";
	document.getElementById('sel_minutos_ida').value = "";
	document.getElementById('in_fecha_ida').value = "";		
	if (valor==4 || valor==1) {
		tmp_personalizada = document.getElementById('sel_personalizada');
		tmp_personalizada.options.length = 0;
		tmp_personalizada.options[0] = new Option('WÄHLEN SIE EINE ROUTE', '0', 'defaultSelected');
		if ( valor == 1 ) { ar_temp = ar_nortesur; } else if ( valor == 4 ) { ar_temp = ar_personalizadas; }		
		for (j=1; j<ar_temp.length; j++) {
					tmp_personalizada.options[j] = new Option(ar_temp[j], j);
		}
		document.getElementById('tr_fila_ruta_personalizada').className = 'fila_sin_colapso';		
	} else {
		document.getElementById('tr_fila_ruta_personalizada').className = 'fila_colapso';
	}
	hora_tope = 15;
	if (valor == 1) { hora_tope = 10;} // la ruta turística completa es sólo hasta las 10, el resto hatas las 15
	if (valor == 2 || valor == 3) { hora_tope = 12;}
	tmp_sel = document.getElementById('sel_hora_ida');
	tmp_sel.options.length = 0;
	tmp_sel.options[0] = new Option('', '', 'defaultSelected');
	i=1;
	for (j=8; j<hora_tope; j++) {
		tmp_sel.options[i] = new Option(LZ(j), LZ(j));
		i++;
	}
}

function actualiza_fecha_hora() {
	document.getElementById('sel_hora_ida').value = "";
	document.getElementById('sel_minutos_ida').value = "";
	document.getElementById('in_fecha_ida').value = "";	
	tmp_excursion = document.getElementById('sel_excursion').value;
	tmp_personalizada = document.getElementById('sel_personalizada').value;
	hora_tope = 15;
	hora_inicio = 8;
	if (tmp_excursion == 4) {
		if (tmp_personalizada==1) {	hora_tope = 14;  hora_inicio = 9;	}
		if (tmp_personalizada==2) {	hora_tope = 14;  hora_inicio = 10;	}
		if (tmp_personalizada==3) {	hora_tope = 21;  hora_inicio = 19;	}
		if (tmp_personalizada==4) {	hora_tope = 14;  hora_inicio = 10;	}
		if (tmp_personalizada==5) {	hora_tope = 14;  hora_inicio = 10;	}
		if (tmp_personalizada==6) {	hora_tope = 14;  hora_inicio = 10;	}
		if (tmp_personalizada==7) {	hora_tope = 14;  hora_inicio = 10;	}	
		if (tmp_personalizada==8) {	hora_tope = 18;  hora_inicio = 10;	}
		if (tmp_personalizada==9) {	hora_tope = 14;  hora_inicio = 10;	}
		if (tmp_personalizada==10) {	hora_tope = 12;  hora_inicio = 9;	}
		if (tmp_personalizada==11) {	hora_tope = 14;  hora_inicio = 9;	}
		if (tmp_personalizada==12) {	hora_tope = 16;  hora_inicio = 10;	}		
	} else if (tmp_excursion == 1) {
		if (tmp_personalizada==1) {
			hora_tope = 11; 
			hora_inicio = 8;
		} else if (tmp_personalizada==2) {
			hora_tope = 9; 
			hora_inicio = 8;			
		}
	}
	tmp_sel = document.getElementById('sel_hora_ida');
	tmp_sel.options.length = 0;
	tmp_sel.options[0] = new Option('', '', 'defaultSelected');
	i=1;
	for (j=hora_inicio; j<hora_tope; j++) {
		tmp_sel.options[i] = new Option(LZ(j), LZ(j));
		i++;
	}	
}


function comprueba_complemento(valor) { // sólo se ofrece silla de bebé cuando el origen es el aeropuerto
	tmp_sel = document.getElementById('sel_extras');
	/*if (valor == 1) {
		if (tmp_sel.options.length==9) {
			tmp_sel.options[9]= new Option("Kindersitze", "Kindersitze");
		}
	} else {
		tmp_sel.options[9]=null;
	}*/
	
}

function comprueba_complemento_2(valor) { // sólo se ofrece silla de bebé cuando el origen es el aeropuerto
	tmp_sel = document.getElementById('sel_extras');
	if (valor == 1) {
		if (tmp_sel.options.length==2) {
			tmp_sel.options[2]= new Option("Kindersitze", "Kindersitze");
		}
	} else {
		tmp_sel.options[2]=null;
	}
	
}

function maximaLongitud(texto,maxlong) {
	var tecla, in_value, out_value;
	if (texto.value.length > maxlong) {
		in_value = texto.value;
		out_value = in_value.substring(0,maxlong);
		texto.value = out_value;
		return false;
	}
	return true;
}

function validar_formulario_inicio(formulario) {	
	if (document.getElementById('sel_origen').value==null || document.getElementById('sel_origen').value == "0"|| document.getElementById('sel_origen').value == "22" || document.getElementById('sel_origen').value == "22")	{
		alert("Abfahrtsbereiche erforderlich.");
		return false;
	}
	tmp = document.form_reservas.rb_tipo_servicio;
	if (tmp[0].checked) {
		if (document.getElementById('sel_destino').value==null  || document.getElementById('sel_destino').value == "0"|| document.getElementById('sel_destino').value == "22" || document.getElementById('sel_destino').value == "22")	{
			alert("Ziele erforderlich.");	
			return false;
		}
	} else {
		if (document.form_reservas.sel_excursion.value==null  || document.form_reservas.sel_excursion.value == "0")	{
			alert("Ausflüge erforderlich.");	
			return false;
		}
	}
	if (tmp[0].checked) {
		if (document.getElementById('in_fecha_ida').value==null || document.getElementById('in_fecha_ida').value == "")	{
			alert("Datum Der Fahrt erforderlich.");
			return false;		
		}
	}
	return true;
}

var mask_fecha = /^\d{2}\/\d{2}\/\d{4}$/; ///\d{2}\/\d{2}\/\d{4}/; 
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/;

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
e.select()
}
return returnval
}

function validar_formulario_traslado(formulario) {
	if (document.getElementById('sel_origen').value==null || document.getElementById('sel_origen').value == "0")	{
		alert("Abfahrtsbereiche from erforderlich.");
		return false;
	}
	if (document.getElementById('sel_destino').value==null  || document.getElementById('sel_destino').value == "0")	{
		alert("Ziele erforderlich.");	
		return false;
	}
	if (document.getElementById('in_fecha_ida').value==null || document.getElementById('in_fecha_ida').value == "")	{
		alert("Datum Der Fahrt (Hin) erforderlich.");
		return false;		
	} else if (!mask_fecha.test(document.getElementById('in_fecha_ida').value)) {
		alert("Datum Der Fahrt (Hin), bad format.");
		return false;
	}
 	if (document.getElementById('sel_hora_ida').value == "" || document.getElementById('sel_minutos_ida').value == "")	{
		alert("Ortszeit (Hin) erforderlich .");	
		return false;
	}
	if (document.getElementById('in_fecha_vuelta').value != "")	{
		 if (!mask_fecha.test(document.getElementById('in_fecha_vuelta').value)) {
			alert("Ortszeit (Zurück), bad format.");
			return false;
		 }
		if (document.getElementById('sel_hora_vuelta').value == "" || document.getElementById('sel_minutos_vuelta').value == "")	{
				alert("Datum Der Fahrt (Zurück) erforderlich.");	
				return false;
		}		 
	}
	tmp_alojamiento = document.getElementById('sel_alojamiento').value;
  	if ( tmp_alojamiento == "" || tmp_alojamiento.substr(0,1)== "t")	{
	  if (!(ar_recorrido_puertos_aeropuertos2.in_array(document.getElementById('sel_destino').value)) && (ar_recorrido_puertos_aeropuertos2.in_array(document.getElementById('sel_origen').value))) {
		alert("Unterkünfte erforderlich.");	
		return false;
	  }
	} else if ( tmp_alojamiento.substr(0,4) == "otro" )	{
		if (document.getElementById('in_nombre_alojamiento').value == "" || document.getElementById('in_direccion_alojamiento').value == "" || document.getElementById('in_direccion_num_alojamiento').value == "" )	{
		alert("Unterkünfte name erforderlich.");	   
		return false;
		}
		if (document.getElementById('sel_localidad_alojamiento').value == "")	{
		alert("Ort/Bezirk erforderlich.");	   
		return false;
		}
	}
	if (document.getElementById('in_nombre').value==null  || document.getElementById('in_nombre').value == "")	{
		alert("Name erforderlich.");	
		return false;
	}
	if (document.getElementById('in_apellidos').value==null  || document.getElementById('in_apellidos').value == "")	{
		alert("Nachnamen erforderlich.");	
		return false;
	}
	if (document.getElementById('in_telefono').value==null  || document.getElementById('in_telefono').value == "")	{
		alert("Telefon erforderlich.");	
		return false;
	}
	if (document.getElementById('in_email').value==null  || document.getElementById('in_email').value == "")	{
		alert("Email erforderlich.");	
		return false;
	} else if (!emailfilter.test(document.getElementById('in_email').value)) {
		alert("Email, bad format.");	
		return false;	
	}
	if (document.getElementById('sel_origen').value==1  && ( document.getElementById('in_num_vuelo').value == null || document.getElementById('in_num_vuelo').value == "" ))	{
		alert("Flugnummer  erforderlich.");	
		return false;
	}
	return true;

}

function validar_formulario_excursion(formulario) {
	if (document.getElementById('sel_origen').value==null || document.getElementById('sel_origen').value == "0")	{
		alert("Abfahrtsbereiche erforderlich.");
		document.getElementById('sel_origen').select;
		return false;
	}
	if (document.getElementById('sel_excursion').value==null  || document.getElementById('sel_excursion').value == "0")	{
		alert("Ausflüge erforderlich.");	
		return false;
	} else if (document.getElementById('sel_excursion').value=="4" && document.getElementById('sel_personalizada').value=="0") {
		alert("Persönliche route erforderlich.");	
		return false;		
	}
	if (document.getElementById('in_fecha_ida').value==null || document.getElementById('in_fecha_ida').value == "")	{
		alert("Datum Des Ausflugs erforderlich.");
		return false;		
	} else if (!mask_fecha.test(document.getElementById('in_fecha_ida').value)) {
		alert("Datum Des Ausflugs, bad format.");
		return false;
	}
 	if (document.getElementById('sel_hora_ida').value==null  || document.getElementById('sel_hora_ida').value == "" || document.getElementById('sel_minutos_ida').value==null  || document.getElementById('sel_minutos_ida').value == "")	{
		alert("Ortszeit erforderlich.");	
		return false;
	}
	tmp_alojamiento = document.getElementById('sel_alojamiento').value;
  	if ( tmp_alojamiento == "" || tmp_alojamiento.substr(0,1)== "t")	{
	  if (!ar_recorrido_puertos_aeropuertos2.in_array(document.getElementById('sel_origen').value)) {
		alert("Unterkünfte erforderlich.");	
		return false;
	  }
	} else if ( tmp_alojamiento.substr(0,4) == "otro" )	{
		if (document.getElementById('in_nombre_alojamiento').value == "" || document.getElementById('in_direccion_alojamiento').value == "" || document.getElementById('in_direccion_num_alojamiento').value == "" )	{
		alert("Unterkünfte name erforderlich.");	   
		return false;
		}
		if (document.getElementById('sel_localidad_alojamiento').value == "")	{
		alert("Ort/Bezirk erforderlich.");	   
		return false;
		}
	}	
	if (document.getElementById('in_nombre').value==null  || document.getElementById('in_nombre').value == "")	{
		alert("Name erforderlich.");	
		return false;
	}
	if (document.getElementById('in_apellidos').value==null  || document.getElementById('in_apellidos').value == "")	{
		alert("Nachnamen erforderlich.");	
		return false;
	}
	if (document.getElementById('in_telefono').value==null  || document.getElementById('in_telefono').value == "")	{
		alert("Telefon erforderlich.");	
		return false;
	}
	if (document.getElementById('in_email').value==null  || document.getElementById('in_email').value == "")	{
		alert("Email erforderlich.");	
		return false;
	} else if (!emailfilter.test(document.getElementById('in_email').value)) {
		alert("Email, bad format.");	
		return false;	
	}
	if (document.getElementById('sel_origen').value==1  && ( document.getElementById('in_num_vuelo').value == null || document.getElementById('in_num_vuelo').value == "" ))	{
		alert("Flugnummer  erforderlich.");	
		return false;
	}	
	
	return true;

}

function validar_formulario_confirmar_pago (formulario) {
	if (document.getElementById('modo_pago').value==null || document.getElementById('modo_pago').value == "0")	{
		alert("Zahlungsform erforderlich.");
		return false;
	}
}
//***********************
// Fin de Funciones del formulario traslados
//***********************

//***********************
// Funciones del formulario usuario
//***********************

function rellenarUsuario (formulario) {
	if (formulario.chk_datos_usuario.checked) {
		formulario.in_nombre.value = formulario.hid_nombre.value;	 
		formulario.in_apellidos.value = formulario.hid_apellidos.value;
		formulario.in_direccion.value = formulario.hid_direccion.value;
		formulario.in_numero.value = formulario.hid_numero.value;
		formulario.sel_localidad_alojamiento.value = formulario.hid_localidad.value;
		formulario.sel_municipio_alojamiento.value = formulario.hid_municipio.value;
		formulario.in_telefono.value = formulario.hid_telefono.value;
	} else {
		formulario.reset();	
	}
}


function validar_formulario_usuarios_online(formulario) 
{
	if (formulario.in_nombre.value == "") 
	{
		formulario.in_nombre.select();		
		alert("El campo nombre es obligatorio.");	
		return false;
	}
	else if (formulario.in_apellidos.value == "") 
	{
		formulario.in_apellidos.select();
		alert("El campo apellidos es obligatorio.");	
		return false;
	}	
	else if (formulario.in_direccion.value == "") 
	{
		formulario.in_direccion.select();
		alert("El campo direccion es obligatorio.");	
		return false;
	}
	else if (formulario.in_numero.value == "") 
	{
		formulario.in_numero.select();
		alert("El campo número es obligatorio.");			
		return false;
	}
	else if (formulario.sel_localidad_alojamiento.value.substring(0,1) == "-") 
	{
		alert("El campo localidad es obligatorio.");	
		return false;
	}	
	else if (formulario.sel_municipio_alojamiento.value == "") 
	{
		alert("El campo municipio es obligatorio.");			
		return false;
	}
	else if (formulario.in_fecha.value == "") 
	{
		formulario.in_fecha.select();
		alert("El campo fecha de recogida es obligatorio.");			
		return false;
	}
	else if (!mask_fecha.test(formulario.in_fecha.value)) {
		alert("El formato de la fecha de ida no es válido.");
		return false;
	}
	else if (formulario.sel_hora.value == "" || formulario.sel_minutos.value == "") 
	{
		alert("El campo hora de recogida es obligatorio.");			
		return false;
	}		
	else if (formulario.in_telefono.value == "") 
	{
		formulario.in_telefono.select();
		alert("El campo telefono es obligatorio.");			
		return false;
	}	 
	
}

function confirmarAnular(reserva) 
{
		if (confirm("¿Desea anular la reserva "+reserva+"?")) {
				location.href="acciones/elimina_reserva.php?reserva="+reserva;
		}	
	
}

//***********************
// Fin de Funciones del formulario usuario
//***********************


// ajax
var xmlHttp;
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
	 try
	  {
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	 }
	return xmlHttp;
}




function validarCorreoContacto (formulario)
{
	if (formulario.nombre.value== "")
		{
			     alert("Name erforderlich.");
				 formulario.nombre.select();
                 return false;
		}	
	if (formulario.email.value== "")
		{
			     alert("email erforderlich.");
				 formulario.email.select();
                 return false;
		}
	var returnval=emailfilter.test(formulario.email.value)
	if (returnval==false)
		{
			alert("Email, bad format.");		
			formulario.email.select();
			return false;
		}
	if (formulario.telefono_fijo.value== "")
		{
			     alert("Telefon erforderlich.");
				 formulario.telefono_fijo.select();
                 return false;
		}	
	if (formulario.comentario.value== "")
		{
			     alert("Kommentare erforderlich.");
				 formulario.comentario.select();
                 return false;
		}			
	document.getElementById("enviando_correo").innerHTML="Enviando correo ..."
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
	 	alert ("Lo sentimos, pero su navegador no soportar peticiones HTTP");
	 	return false;
	 }		
	 var url="acciones/envio_contacto.php";
	 url=url+"?email="+formulario.email.value;	 
	 url=url+"&nombre="+formulario.nombre.value;	 
	 url=url+"&telefono_fijo="+formulario.telefono_fijo.value;	 
 	 url=url+"&comentario="+formulario.comentario.value;
	 url=url+"&sid="+Math.random();
	 xmlHttp.onreadystatechange=estadoEnvio;
	 xmlHttp.open("GET",url,true);
	 xmlHttp.send(null);
	 return false;
}

function estadoEnvio()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
     tmp_st=xmlHttp.responseText;
	 if (tmp_st.substring(0,2) == "ok") {	
	 	document.getElementById("enviando_correo").innerHTML="El correo ha sido enviado correctamente. Si desea enviar otro formulario pinche <a href='contactar_lanzarote_taxi.php'>aqu&iacute;</a>";
		return false;
	 }
	 else 
	 {	
		document.getElementById("enviando_correo").innerHTML="No se ha podido enviar el correo. Por favor, int&eacute;ntelo m&aacute;s tarde.";
		return false;
	 }
	}
}

// registro usuarios

function validarRegistroParticular (formulario)
{
	
	if (formulario.nombre.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo nombre es obligatorio.</b>";	
		formulario.nombre.select();
		return false;
	}
	else if (formulario.apellidos.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo apellidos es obligatorio.</b>";	
		formulario.apellidos.select();
		return false;
	}	
	else if (formulario.direccion.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo direccion es obligatorio.</b>";	
		formulario.direccion.select();
		return false;
	}
	else if (formulario.numero.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo número es obligatorio.</b>";	
		formulario.numero.select();
		return false;
	}
	else if (formulario.sel_localidad_alojamiento.value.substring(0,1) == "-") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo localidad es obligatorio.</b>";	
		//formulario.sel_localidad_alojamiento.select();
		return false;
	}	
	else if (formulario.sel_municipio_alojamiento.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo municipio es obligatorio.</b>";	
		//formulario.sel_municipio_alojamiento.select();
		return false;
	}
	else if (formulario.telefono.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo telefono es obligatorio.</b>";	
		formulario.telefono.select();
		return false;
	}	
	else if (formulario.email.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo email es obligatorio.</b>";	
		formulario.email.select();
		return false;
	}
	else if (!emailfilter.test(formulario.email.value)) {
		document.getElementById("txtHint").innerHTML="<b>El email introducido no es v&aacute;lido.</b>";	
		formulario.email.select();	
		return false;
	}	
	else if (formulario.usuario.value == "") 
	{		
		document.getElementById("txtHint").innerHTML="<b>El campo usuario es obligatorio.</b>";
		formulario.usuario.select();
		return false;
	} 
	else if (formulario.clave.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo contrase&ntilde;a es obligatorio.</b>";	
		formulario.clave.select();
		return false;
	} 
	
	document.getElementById("txtHint").innerHTML="<b>Enviando ...</b>";
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
	 	alert ("Lo sentimos, pero su navegador no soportar peticiones HTTP");
	 	return false;
	 }	
	var url="acciones/usuarios_comprobacion.php";
	url=url+"?tipo_usuario="+formulario.tipo_usuario.value;
	url=url+"&usuario="+formulario.usuario.value;
	url=url+"&clave="+formulario.clave.value;
	url=url+"&nombre="+formulario.nombre.value;
	url=url+"&apellidos="+formulario.apellidos.value;
	url=url+"&email="+formulario.email.value;
	url=url+"&telefono="+formulario.telefono.value;
	url=url+"&direccion="+formulario.direccion.value;
	url=url+"&numero="+formulario.numero.value; 
	url=url+"&localidad="+formulario.sel_localidad_alojamiento.value;
	url=url+"&municipio="+formulario.sel_municipio_alojamiento.value;	
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	return false;
}

function stateChanged() 
{ 	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	
	
	{   
		 tmp_st=xmlHttp.responseText;
		 if (tmp_st.substring(0,2) == "ok")
		 {	
			location.href="particular_acceso_lanzarote_taxi.php?op=0";	 
		 }
		 else if (tmp_st.substring(0,2) == "re")
		 {
			document.getElementById("txtHint").innerHTML="&nbsp;<b>El nombre de usuario ya existe. Elija otro.</b>"; 
			document.getElementById("usuario").select();
			return false;
		 }
		 else if (tmp_st.substring(0,2) == "em")
		 {
			document.getElementById("txtHint").innerHTML="&nbsp;<b>El email ya existe. Elija otro.</b>"; 
			document.getElementById("email").select();
			return false;
		 }		 
		 else 
		 {	
			//alert(xmlHttp.responseText);
			document.getElementById("clave").value = "";		
			document.getElementById("txtHint").innerHTML="&nbsp;<b>"+xmlHttp.responseText+"</b>"; 
			return false;
		 }
	}
}


// Recupera contraseña
function validarRecuperarPass (formulario)
{
	if (formulario.email.value== "")
	{
		 document.getElementById("txtHint").innerHTML = "&nbsp;<b>Debe introducir su email.</b>";
		 formulario.email.select();
		 return false;
	}	
	var returnval=emailfilter.test(formulario.email.value)
	if (returnval==false)
	{
		document.getElementById("txtHint").innerHTML = "&nbsp;<b>El email introducido no es válido.</b>";		
		formulario.email.select();
		return false;
	}		
	document.getElementById("txtHint").innerHTML="Enviando consulta ..."
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
		alert ("Lo sentimos, pero su navegador no soportar peticiones HTTP");
		return false;
	 }		
	 var url="acciones/pass_recupera.php";
	 url=url+"?email="+formulario.email.value;	 
	 url=url+"&sid="+Math.random();
	 xmlHttp.onreadystatechange=estadoEnvioPass;
	 xmlHttp.open("GET",url,true);
	 xmlHttp.send(null);
	 return false;
}

function estadoEnvioPass()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
     tmp_st=xmlHttp.responseText;
	 if (tmp_st.substring(0,2) == "ok") {
		//document.getElementById('boton').innerHTML = "";	 
	 	document.getElementById("txtHint").innerHTML="&nbsp;La contraseña ha sido enviada a la dirección de correo indicada."
	 }
	 else if (tmp_st.substring(0,2) == "in")
	 {
		document.getElementById("txtHint").innerHTML="&nbsp;<b>El email introducido no exite o el usuario no está activado.</b>"; 
		document.getElementById("email").select();
	 }	 
	 else 
	 {	
		document.getElementById("txtHint").innerHTML= "No se ha podido enviar el correo. Por favor, int&eacute;ntelo m&aacute;s tarde."
	 }
	}

}





function validarModificarRegistroParticular (formulario)
{
	
	if (formulario.nombre.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo nombre es obligatorio.</b>";	
		formulario.nombre.select();
		return;
	}
	else if (formulario.apellidos.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo apellidos es obligatorio.</b>";	
		formulario.apellidos.select();
		return;
	}	
	else if (formulario.direccion.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo direccion es obligatorio.</b>";	
		formulario.direccion.select();
		return;
	}
	else if (formulario.numero.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo número es obligatorio.</b>";	
		formulario.numero.select();
		return;
	}
	else if (formulario.sel_localidad_alojamiento.value.substring(0,1) == "-") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo localidad es obligatorio.</b>";	
		return;
	}	
	else if (formulario.sel_municipio_alojamiento.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo municipio es obligatorio.</b>";	
		return;
	}
	else if (formulario.telefono.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo telefono es obligatorio.</b>";	
		formulario.telefono.select();
		return;
	}	
	else if (formulario.email.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo email es obligatorio.</b>";	
		formulario.email.select();
		return;
	}
	else if (!emailfilter.test(formulario.email.value)) {
		document.getElementById("txtHint").innerHTML="<b>El email introducido no es v&aacute;lido.</b>";	
		formulario.email.select();	
		return;
	}	
	else if (formulario.usuario.value == "") 
	{		
		document.getElementById("txtHint").innerHTML="<b>El campo usuario es obligatorio.</b>";
		formulario.usuario.select();
		return;
	} 
	else if (formulario.clave.value == "") 
	{
		document.getElementById("txtHint").innerHTML="<b>El campo contrase&ntilde;a es obligatorio.</b>";	
		formulario.clave.select();
		return;
	} 
	
	document.getElementById("txtHint").innerHTML="<b>Enviando ...</b>";
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
	 	alert ("Lo sentimos, pero su navegador no soportar peticiones HTTP");
	 	return;
	 }	
	var url="acciones/modificar_usuario.php";
	url=url+"?tipo_usuario="+formulario.tipo_usuario.value;
	url=url+"&usuario="+formulario.usuario.value;
	url=url+"&clave="+formulario.clave.value;
	url=url+"&nombre="+formulario.nombre.value;
	url=url+"&apellidos="+formulario.apellidos.value;
	url=url+"&email="+formulario.email.value;
	url=url+"&telefono="+formulario.telefono.value;
	url=url+"&direccion="+formulario.direccion.value;
	url=url+"&numero="+formulario.numero.value; 
	url=url+"&localidad="+formulario.sel_localidad_alojamiento.value;
	url=url+"&municipio="+formulario.sel_municipio_alojamiento.value;	
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateModificaUsuario;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateModificaUsuario() 
{ 	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	
	
	{   
		 tmp_st=xmlHttp.responseText;
		 if (tmp_st.substring(0,2) == "ok")
		 {	
			location.href="formulario_online_lanzarote_taxi.php";	 
		 }
		 else 
		 {	
			//alert(xmlHttp.responseText);
			document.getElementById("clave").value = "";		
			document.getElementById("txtHint").innerHTML="&nbsp;<b>"+xmlHttp.responseText+"</b>"; 
		 }
	}
}


// recomendar web

function validarRecomendarWeb (formulario)
{
	if (formulario.sunombre.value== "")
		{
			     alert("El campo nombre es obligatorio.");
				 formulario.sunombre.select();
                 return false;
		}	
	if (formulario.suemail.value== "")
		{
			     alert("El campo email es obligatorio.");
				 formulario.suemail.select();
                 return false;
		}
	var returnval=emailfilter.test(formulario.suemail.value)
	if (returnval==false)
		{
			alert("El email introducido no es válido.");		
			formulario.suemail.select();
			return false;
		}
	if (formulario.nombreamigo.value== "")
		{
			     alert("El campo nombre es obligatorio.");
				 formulario.nombreamigo.select();
                 return false;
		}	
	if (formulario.emailamigo.value== "")
		{
			     alert("El campo email es obligatorio.");
				 formulario.emailamigo.select();
                 return false;
		}
	var returnval=emailfilter.test(formulario.emailamigo.value)
	if (returnval==false)
		{
			alert("El email introducido no es válido.");		
			formulario.emailamigo.select();
			return false;
		}		
	if (formulario.comentario.value== "")
		{
			     alert("El comentario es obligatorio.");
				 formulario.comentario.select();
                 return false;
		}	
	if (formulario.seg.value== "")
		{
			     alert("El campo código es obligatorio.");
				 formulario.seg.select();
                 return false;
		}		
	document.getElementById("enviando_correo").innerHTML="Enviando correo ..."
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
	 	alert ("Lo sentimos, pero su navegador no soportar peticiones HTTP");
	 	return false;
	 }		
	 var url="acciones/envio_recomendar.php";
	 url=url+"?sunombre="+formulario.sunombre.value;		 
	 url=url+"&suemail="+formulario.suemail.value;	  
	 url=url+"&nombreamigo="+formulario.nombreamigo.value;		 
	 url=url+"&emailamigo="+formulario.emailamigo.value;	 
 	 url=url+"&comentario="+formulario.comentario.value;
     url=url+"&seg="+formulario.seg.value;
	 url=url+"&sid="+Math.random();
	 xmlHttp.onreadystatechange=estadoEnvioRecomendar;
	 xmlHttp.open("GET",url,true);
	 xmlHttp.send(null);
	 return false;
}

function estadoEnvioRecomendar()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
     tmp_st=xmlHttp.responseText;
	 if (tmp_st.substring(0,2) == "ok") {	
	 	document.getElementById("enviando_correo").innerHTML="Gracias por recomendar nuestra Web.";
		return false;
	 }
	 else if (tmp_st.substring(0,2) == "co") {
	 	document.getElementById("enviando_correo").innerHTML="El código de seguridad no es correcto. <a href='http://www.lanzarotetaxi.com/recomendar_lanzarote_taxi.php'>Reintentar</a>";
		return false;		 
	 }
	 else 
	 {	
		document.getElementById("enviando_correo").innerHTML="No se ha podido enviar el correo. Por favor, int&eacute;ntelo m&aacute;s tarde.";
		return false;
	 }
	}
}

// intercambio de enlace

function validarIntercambioEnlace (formulario)
{
	if (formulario.nombre.value== "")
		{
			     alert("El campo nombre es obligatorio.");
				 formulario.nombre.select();
                 return false;
		}	
	if (formulario.url.value== "")
		{
			     alert("El campo url es obligatorio.");
				 formulario.url.select();
                 return false;
		}		
	if (formulario.email.value== "")
		{
			     alert("El campo email es obligatorio.");
				 formulario.email.select();
                 return false;
		}
	var returnval=emailfilter.test(formulario.email.value)
	if (returnval==false)
		{
			alert("El email introducido no es válido.");		
			formulario.email.select();
			return false;
		}	
	if (formulario.comentario.value== "")
		{
			     alert("El comentario es obligatorio.");
				 formulario.comentario.select();
                 return false;
		}	
	if (formulario.seg.value== "")
		{
			     alert("El campo código es obligatorio.");
				 formulario.seg.select();
                 return false;
		}		
	document.getElementById("enviando_correo").innerHTML="Enviando correo ..."
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
	 	alert ("Lo sentimos, pero su navegador no soportar peticiones HTTP");
	 	return false;
	 }		
	 var url="acciones/envio_enlace.php";
	 url=url+"?nombre="+formulario.nombre.value;		 
	 url=url+"&email="+formulario.email.value;	  
	 url=url+"&url="+formulario.url.value;		  
 	 url=url+"&comentario="+formulario.comentario.value;
     url=url+"&seg="+formulario.seg.value;
	 url=url+"&sid="+Math.random();
	 xmlHttp.onreadystatechange=estadoEnvioEnlace;
	 xmlHttp.open("GET",url,true);
	 xmlHttp.send(null);
	 return false;
}

function estadoEnvioEnlace()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
     tmp_st=xmlHttp.responseText;
	 if (tmp_st.substring(0,2) == "ok") {	
	 	document.getElementById("enviando_correo").innerHTML="Gracias por utilizar nuestros servicios.";
		return false;
	 }
	 else if (tmp_st.substring(0,2) == "co") {
	 	document.getElementById("enviando_correo").innerHTML="El código de seguridad no es correcto. <a href='http://www.lanzarotetaxi.com/recomendar_lanzarote_taxi.php'>Reintentar</a>";
		return false;		 
	 }
	 else 
	 {	
		document.getElementById("enviando_correo").innerHTML="No se ha podido enviar el correo. Por favor, int&eacute;ntelo m&aacute;s tarde.";
		return false;
	 }
	}
}