var xmlhttp = null;
var SPECIAL_DAYS = new Array();
var arrMessage = new Array();
var arrTitleText = new Array();
var arrButtonText = new Array();
var strLanguageExtension;
var Type;
var IdType;
var IdNumber;
var IdIdioma;
var Idioma;

Number.prototype.formatMoney = function(c, d, t){
  	var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
	return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
 };
 
function SelectLanguage(Idioma,Type){
	
	/* Type:

	0 - Textos de los botones  
	1 - Textos de la página 
	2 - Alert - Textos
	3 - DIV central - Titulos
	4 - DIV central - Botones
	5 - DIV central - Textos
	6 - DIV central - Textos de los "Campos"
	7 - Titulos de las paginas
*/

			if (Idioma == 1) { 
			
			strLanguageExtension = ''; 
			
			if (Type == 0) { 
			arrMessage [0] = 'localización'; 
			arrMessage [1] = 'Servicios'; 
			arrMessage [2] = 'reservas <br> precios <br> condiciones'; 
			arrMessage [3] = 'imágenes'; 
			arrMessage [4] = 'apartamentos'; 
			arrMessage [5] = 'Información de la Ciudad'; 
			arrMessage [6] = 'FAQ\'s'; 
			arrMessage [7] = 'Inicio'; 
			arrMessage [8] = 'enviar'; 
			arrMessage [9] = 'Contactar'; 
			arrMessage [11] = '<strong> entradas </strong> <br> espectáculos'; 
			arrMessage [10] = 'selección <br> <strong> Black and white home </strong>'; 
			arrMessage [12] = '<strong> clásicos </strong> <br> de la ciudad'; 
			arrMessage [13] = '<strong> <br> música </strong>'; 
			arrMessage [14] = 'agenda <br> <strong> cultural </strong>'; 
			arrMessage [15] = '<strong> vivir <br> </strong> barcelona'; 
			arrMessage [16] = '<strong> teatro </strong>'; 
			arrMessage [17] = '<strong> música </strong>'; 
			arrMessage [18] = '<strong> cine </strong>'; 
			arrMessage [19] = '<strong> deportes </strong>'; 
			arrMessage [20] = 'venta <strong> de entradas </strong>'; 
			arrMessage [21] = 'música'; 
			arrMessage [22] = 'vivir en barcelona'; 
			arrMessage [23] = 'agenda cultural'; 
			arrMessage [24] = 'información de la ciudad'; 
			arrMessage [25] = 'clásicos de la ciudad'; 
			arrMessage [26] = 'selección <strong> Black and white home </strong>'; 
			arrMessage [27] = 'Precio Noche'; 			
			arrMessage [28] = 'Promociones'; 
			arrMessage [29] = 'Ir'; 
			arrMessage [30] = 'Caracteristicas'; 			
			arrMessage [31] = 'precios';
			arrMessage [32] = 'resultados de la búsqueda';			
			arrMessage [33] = 'Volver';			
			arrMessage [34] = 'Reservar Ahora';			
			arrMessage [35] = 'precio para las fechas seleccionadas';			
			arrMessage [36] = 'Reservar Ahora';			
			arrMessage [37] = 'Más Información';			
			arrMessage [38] = 'Mapa';				
		}
			
			if (Type == 1) { 
			arrMessage [0] = '<strong> vivir</strong>barcelona'; 
			arrMessage [1] = 'apartamento'; 
			arrMessage [2] = 'Descuento del 10% para estancias de una semana o más. <br> Descuento del 30% para estancias de un mes o más.'; 
			arrMessage [3] = 'Entrada:'; 
			arrMessage [4] = 'Salida:'; 
			arrMessage [5] = 'Adultos:'; 
			arrMessage [6] = 'Niños:'; 
			arrMessage [7] = 'Bebés:'; 
			arrMessage [8] = 'Noches:'; 
			arrMessage [9] = 'Total:'; 
			arrMessage [10] = 'Si necesitas asistencia técnica para hacer tu reserva contacta con nosotros:'; 
			arrMessage [11] = 'La información se ha enviado correctamente.'; 
			arrMessage [12] = '<strong> Condiciones de los precios </strong>'; 
			arrMessage [13] = 'Descuento del '; 
			arrMessage [14] = ' para estancias de una semana o más. <br> Descuento del '; 
			arrMessage [15] = ' para estancias de un mes o más.'; 
		}
			
			
			if (Type == 2) { 
			arrMessage [0] = 'Se han encontrado los siguientes errores: \n\n-Las fechas elegidas no están disponibles.'; 
			arrMessage [1] = '- El total de personas no puede ser superior a'; 
			arrMessage [2] = '- Debe seleccionar al menos un adulto. \n'; 
			arrMessage [3] = '- El campo Fecha Salida no es correcto. \n'; 
			arrMessage [4] = '- El campo Fecha Salida no puede estar vacio. \n'; 
			arrMessage [5] = '- El campo Fecha Llegada no es correcta. \n'; 
			arrMessage [6] = '- El campo Fecha Llegada debe ser posterior a la fecha actual. \n'; 
			arrMessage [7] = '- El campo Fecha Llegada no puede estar vacía. \n'; 
			arrMessage [8] = '- El campo Fecha Entrada no puede ser posterior a la Fecha Salida. \n'; 
			arrMessage [9] = '- El campo Fecha Salida no puede ser igual a Fecha Llegada. \n'; 
			arrMessage [10] = '- La estancia mínima es de 1 noche. \n'; 
			arrMessage [11] = 'Se han encontrado los siguientes errores: \n\n'; 
			arrMessage [12] = '- El campo Nombre es obligatorio. \n'; 
			arrMessage [13] = '- El campo Apellidos es obligatorio. \n'; 
			arrMessage [14] = '- El campo Número de Documento es obligatorio. \n'; 
			arrMessage [15] = '- Falta la letra del DNI. \n'; 
			arrMessage [16] = '- El campo Número de Documento no es correcto. \n'; 
			arrMessage [17] = '- El campo E-mail es obligatorio. \n'; 
			arrMessage [18] = '- El campo E-mail no es correcto. \n'; 
			arrMessage [19] = '- El campo E-mail y su confirmación deben ser iguales. \n'; 
			arrMessage [20] = '- El campo Teléfono Móvil es obligatorio. \n'; 
			arrMessage [21] = '- El campo Teléfono Móvil no ha sido escrito en la forma correcta. \n'; 
			arrMessage [22] = '- El campo Teléfono Fijo no ha sido escrito en la forma correcta. \n'; 
			arrMessage [23] = '- El campo Dirección es obligatorio. \n'; 
			arrMessage [24] = '- El campo Población es obligatorio. \n'; 
			arrMessage [25] = '- El campo Provincia es obligatorio. \n'; 
			arrMessage [26] = '- El campo Código Postal es obligatorio. \n'; 
			arrMessage [27] = '- Falta la letra del DNI. \n'; 
			arrMessage [28] = '- Debe confirmar que acepta las condiciones de reserva. \n'; 
			arrMessage [29] = '- El campo Comentarios es demasiado grande. \n'; 
			arrMessage [30] = '- El campo Total no es correcto. \n'; 
			arrMessage [31] = '- El campo A pagar ahora no es correcto. \n'; 
			arrMessage [32] = '- El campo Pendiente no es correcto. \n'; 
		}
			
			if (Type == 3) { 
			arrMessage [0] = 'Lista de Precios'; 
			arrMessage [1] = 'Disponibilidad'; 
			arrMessage [2] = 'Reservar - Datos Personales'; 
			arrMessage [3] = 'Reservar - Datos Factura'; 
			arrMessage [4] = 'Pagar'; 
			arrMessage [5] = 'Confirmación de la Reserva'; 
		}
			
			if (Type == 4) { 
			arrMessage [0] = 'Anterior'; 
			arrMessage [1] = 'Ver Disponibilidad'; 
			arrMessage [2] = 'Siguiente'; 
			arrMessage [3] = 'Disponibilidad'; 
			arrMessage [4] = 'Confirmar y Pagar'; 
			arrMessage [5] = 'Imprimir Reserva'; 
			arrMessage [6] = 'Enviar'; 
			arrMessage [7] = 'palau de la música'; 
			arrMessage [8] = 'jazz'; 
			arrMessage [9] = 'l\'auditori'; 
			arrMessage [10] = 'liceo'; 
			arrMessage [11] = '<strong> españa </strong> información'; 
			arrMessage [12] = '<strong> transporte </strong> público'; 
			arrMessage [13] = '<strong> mapa </strong> barcelona'; 
			arrMessage [14] = '<strong> parkings </strong> públicos'; 
			arrMessage [15] = '<strong> alquiler </strong> de motos'; 
			arrMessage [16] = '<strong> aeropuerto </strong>'; 
			arrMessage [17] = 'restaurantes'; 
			arrMessage [18] = 'tiendas'; 
			arrMessage [19] = 'bares'; 
			arrMessage [20] = '<strong> Golondrinas </strong> barcelona'; 
			arrMessage [21] = '<strong> l\'aquarium </strong> barcelona'; 
			arrMessage [22] = '<strong> zoo </strong> barcelona'; 
			arrMessage [23] = '<strong> feria </strong> barcelona'; 
			arrMessage [24] = 'actividades <strong> turísticas </strong>'; 
			arrMessage [25] = 'actividades <strong> culturales </strong>'; 
			arrMessage [26] = 'ruta del <strong> modernismo </strong>'; 
			arrMessage [27] = 'Plano'; 			
			
			}
			
			if (Type == 5) { 
			arrMessage [0] = 'Descuento del 10% para estancias de una semana o más. <br> Descuento del 30% para estancias de un mes o más. <br> Coste 0 para bebés de 1 a 23 meses . <br> Niños a partir de 24 meses cuentan como persona extra. <br> Check-in posteriores a las 20:00 hs tienen cargo adicional de 50 €. <br> 7% IVA no incluido. '; 
			arrMessage [1] ='2 a 13 años'; 
			arrMessage [2] ='1 a 23 meses'; 
			arrMessage [3] ='7% IVA '; 
			arrMessage [4] ='30% del Total '; 
			arrMessage [5] = 'A pagar en Check-in'; 
			arrMessage [6] = 'A depositar en Check-in';  
			arrMessage [7] ='34 111222333 '; 
			arrMessage [8] = '* Estos datos son obligatorios.'; 
			arrMessage [9] = 'Tu nombre'; 
			arrMessage [10] = 'Tu e-mail'; 
			arrMessage [11] = 'Nombre del destinatario'; 
			arrMessage [12] = 'E-mail del destinatario'; 
			arrMessage [13] = 'Comentario'; 
			arrMessage [14] = 'vivir en barcelona'; 
			arrMessage [15] = 'agenda cultural'; 
			arrMessage [16] = 'música'; 
			arrMessage [17] = 'clásicos ciudad'; 
			arrMessage [18] = 'entradas'; 
			arrMessage [19] = 'black & white'; 
			arrMessage [20] = '<p> Gracias por confiar a su estancia en Barcelona. Estaremos encantados de recibirte. </ p> <p> Si has realizado el pago a través de transferencia bancaria, debes hacer una transferencia a la cuenta: 0081-7301-31-0001133624, indicando en el concepto tu número de reserva y enviar el justificante por mail (info@blackandwhitehome.com). <br> Te enviaremos un mail de confirmación en el momento que hayamos confirmado el abono del importe. </ p> '; 
			arrMessage [21] = '<p> Error al realizar el pago con la tarjeta. </ p> <p> Imprime esta página y ponte en contacto con nosotros para solucionar el problema. < / p> '; 
			arrMessage [22] = 'Estado Reserva'; 
			arrMessage [23] = 'rechazada'; 
			arrMessage [24] = 'Nº Reserva'; 
			arrMessage [25] = 'Fecha Reserva'; 
			arrMessage [26] = 'Apartamento'; 
			arrMessage [27] = 'Fecha Entrada'; 
			arrMessage [28] = 'Fecha Salida'; 
			arrMessage [29] = 'Noches'; 
			arrMessage [30] = 'Nº personas'; 
			arrMessage [31] = 'Nombre y Apellidos'; 
			arrMessage [32] = 'Documento'; 
			arrMessage [33] = 'E-mail'; 
			arrMessage [34] = 'Teléfono fijo'; 
			arrMessage [35] = 'Teléfono móvil'; 
			arrMessage [36] = 'Forma de pago'; 
			arrMessage [37] = 'Total reserva'; 
			arrMessage [38] = 'A pagar ahora'; 
			arrMessage [39] = 'Pendiente'; 
			arrMessage [40] = 'Si necesitas asistencia técnica para hacer tu reserva contacta con nosotros:'; 
			arrMessage [41] = 'Condiciones de los precios'; 
			arrMessage [42] = 'Adultos'; 
			arrMessage [43] = 'Niños'; 
			arrMessage [44] = 'Bebés'; 
			arrMessage [45] = 'Debe hacer una transferencia a la cuenta: 0081-7301-31-0001133624, indicando en el concepto tu número de reserva y enviar el justificante por mail (info@blackandwhitehome.com). <br> Te enviaremos un mail de confirmación en el momento que hayamos confirmado el abono del importe. <br> Información para transferencias internacionales: <br> IBAN ES46008173013100033624 <br> BIC BSAB ESBB '; 
			arrMessage [46] = 'He leído, entiendo y acepto las Condiciones de Reserva.'; 
			arrMessage [47] = 'Si tienes requerimientos especiales o quieres enviarnos algún comentario, no dudes en hacerlo.'; 
			arrMessage [48] = 'Presionando el botón "CONFIRMAR Y PAGAR", está autorizando a Black and white home a cargar en su tarjeta el 30% del total de la reserva como garantía de la reserva del apartamento, para tu estancia seleccionada. '; 
			arrMessage [49] = '<p> Su reserva ha sido enviada correctamente y en breve recibirás los detalles en tu dirección de correo. </ p> <p> A continuación te detallamos la información de la reserva. </ p>' ;
			arrMessage [50] = 'ACEPTADA';
			arrMessage [51] = 'PENDIENTE DE CONFIRMACIÓN';	
		    arrMessage [52] = 'Calendario';	
			arrMessage [53] = 'Tarjeta';
			arrMessage [54] = 'Transferencia';
			arrMessage [55] = 'Efectivo';
		}
			
			if (Type == 6) {  
			arrMessage [0] = 'Nº de personas'; 
			arrMessage [1] = 'Precio por noche'; 
			arrMessage [2] = 'personas'; 
			arrMessage [3] = 'Persona extra'; 
			arrMessage [4] = 'máx.persones';  
			arrMessage [5] = 'Fecha Entrada'; 
			arrMessage [6] = 'Fecha Salida'; 
			arrMessage [7] = 'Adultos'; 
			arrMessage [8] = 'Niños'; 
			arrMessage [9] = 'Bebés'; 
			arrMessage [10] = 'Total'; 
			arrMessage [11] = 'A pagar ahora'; 
			arrMessage [12] = 'Pendiente'; 
			arrMessage [13] = 'Fianza'; 
			arrMessage [14] = 'Nombre'; 
			arrMessage [15] = 'Apellidos'; 
			arrMessage [16] = 'Tipo documento'; 
			arrMessage [17] = 'Nº documento'; 
			arrMessage [18] = 'E-mail'; 
			arrMessage [19] = 'Confirmar e-mail'; 
			arrMessage [20] = 'Teléfono fijo'; 
			arrMessage [21] = 'Teléfono móvil'; 
			arrMessage [22] = 'Datos para la factura'; 
			arrMessage [23] = 'Dirección'; 
			arrMessage [24] = 'Código Postal'; 
			arrMessage [25] = 'Población'; 
			arrMessage [26] = 'Provincia'; 
			arrMessage [27] = 'Pasaporte'; 
			arrMessage [28] = 'DNI';
			arrMessage [29] = 'Desde';
			arrMessage [30] = 'persona-noche';
			arrMessage [31] = 'Persona-noche';			
			arrMessage [32] = 'Noches';			
		} 
			
		if (Type == 7) { 
				arrMessage [0] = 'servicios'; 
				arrMessage [1] = 'Enviar vínculo:'; 
				arrMessage [2] = 'precios <br> condiciones <br> reservas'; 
				arrMessage [3] = 'imágenes'; 
				arrMessage [4] = 'servicios'; 
				arrMessage [5] = 'Enviar a un amigo';
				arrMessage [6] = 'ir';
				arrMessage [7] = 'Reservar por Fechas';
				arrMessage [8] = 'Lo sentimos, no se han encontrado apartamentos disponibles, seleccione otras fechas por favor.';
			}
			
		if (Type == 8) { 
				arrMessage [0] = 'Añadir a favoritos'; 
				arrMessage [1] = 'Enviar a un amigo'; 
			}			

		if (Type == 9) { 
				arrMessage [0] = 'Búsqueda Rápida'; 
				arrMessage [1] = 'Fecha Llegada'; 
				arrMessage [2] = 'Fecha Salida'; 
				arrMessage [3] = 'Adultos'; 
				arrMessage [4] = 'Niños'; 
			}			
			
			
				if (Type == 10) { 				
				arrMessage [0] = 'Nuestros Apartamentos';
				arrMessage [1] = 'Todos los apartamentos';
				arrMessage [2] = 'Estudios';
				arrMessage [3] = 'Apartamentos de 1 habitación';
				arrMessage [4] = 'Apartamentos de 2 habitaciones';				
				arrMessage [5] = 'Apartamentos de 3 o más habitaciones';
				arrMessage [6] = 'Apartamentos Sagrada Família';
				arrMessage [7] = 'Apartamentos Fira';
				arrMessage [8] = 'Apartamentos Paseo de Gracia';
				arrMessage [9] = 'Apartamentos Lowcost';				
				}

				if (Type == 11) { 				
				arrMessage [0] = '1. Fecha de Llegada y Salida, numero de adultos, niños y bebes.';
				arrMessage [1] = '2. Datos Personales';
				arrMessage [2] = '3. Datos Facturación';
				arrMessage [3] = '4. Forma de Pago';
				arrMessage [4] = '5. Observaciones';				
				arrMessage [5] = '6. Condiciones de la Reserva';
				arrMessage [6] = 'Importe total de la Reserva';
				arrMessage [7] = 'Importe total de la Reserva';
				arrMessage [8] = '5. Datos del Pago';	
				arrMessage [9] = 'Utilizar los mismos que los datos personales';					
				arrMessage [10] = '4. Datos del Pago';				
				}

				if (Type == 12) { 				
				arrMessage [0] = 'Disponibilidad';
				arrMessage [1] = 'Consultar otras fechas';
				arrMessage [2] = 'Localización';
				arrMessage [3] = 'Información';
				arrMessage [4] = 'Servicios';				
				}
				
				if (Type == 13) { 				
				arrMessage [0] = 'Apartamentos amueblados de lujo para alquiler en Barcelona';				
				}

// 14- Estado del Pago

				if (Type == 14) { 				
				arrMessage [0] = 'Pendiente';
				arrMessage [1] = 'Confirmado';
				arrMessage [2] = 'Rechazado';
				arrMessage [3] = 'Estado del pago';				
				}
				
// 15- Botones Confirmación de la Reserva

				if (Type == 15) { 				
				arrMessage [0] = 'Anterior';
				arrMessage [1] = 'Home';
				arrMessage [2] = 'Imprimir';
				}
				
				if (Type == 16) { 				
				arrMessage [0] = 'Consultar otros apartamentos disponibles para las mismas fechas';		
				arrMessage [1] = 'Zona';
				arrMessage [2] = 'Noche disponible';		
				arrMessage [3] = 'Noche ocupada';				
				}
				
				if (Type == 17) { 				
				arrMessage [0] = 'No hay apartamentos disponibles para las fechas consultadas';		
				}				
				

}
	
	if(Idioma == 2){
			
			strLanguageExtension = '_cat';

			if(Type == 0){
				arrMessage[0] = 'localització';
				arrMessage[1] = 'Serveis';
				arrMessage[2] = 'reserves<br>preus<br>condicions';
				arrMessage[3] = 'imatges';
				arrMessage[4] = 'apartaments';
				arrMessage[5] = 'Informació de la Ciutat';
				arrMessage[6] = 'FAQ\'s';
				arrMessage[7] = 'Inici';
				arrMessage[8] = 'enviar';
				arrMessage[9] = 'Contactar';
				arrMessage[11] = '<strong>entrades</strong><br>espectacles';		  
		  		arrMessage[10] = 'selecció<br><strong>Black and white home</strong>';
				arrMessage[12] = '<strong>clàssics</strong><br>de la ciutat';  
				arrMessage[13] = '<strong><br>música</strong>';
				arrMessage[14] = 'agenda<br><strong>cultural</strong>';
				arrMessage[15] = '<strong>viure<br></strong>barcelona';
				arrMessage[16] = '<strong>teatre</strong>';  		  
				arrMessage[17] = '<strong>música</strong>';  		  
				arrMessage[18] = '<strong>cinema</strong>';  		  
				arrMessage[19] = '<strong>esports</strong>';
				arrMessage[20] = 'venda <strong>d\'entrades</strong>';
				arrMessage[21] = 'música';
				arrMessage[22] = 'viure a barcelona';
				arrMessage[23] = 'agenda cultural';
				arrMessage[24] = 'informació de la ciutat';
				arrMessage[25] = 'clàssics de la ciutat';				
				arrMessage[26] = 'selecció <strong>Black and white home</strong>';								
				arrMessage [27] = 'Preu Nit'; 							
				arrMessage [28] = 'Promocions'; 
				arrMessage [29] = 'Anar'; 					
				arrMessage [30] = 'Caracteristiques'; 			
				arrMessage [31] = 'preus'; 	
				arrMessage [32] = 'resultats de la cerca';				
				arrMessage [33] = 'Tornar';				
				arrMessage [34] = 'reservar ara';				
				arrMessage [35] = 'preu per a les dates seleccionades ';				
				arrMessage [36] = 'Reservar Ara';			
				arrMessage [37] = 'Més Informació';		
				arrMessage [38] = 'Mapa';								
				}
				
			if(Type == 1){
				arrMessage[0] = '<strong>viure</strong>barcelona';
				arrMessage[1] = 'apartament';
						/* Availability */
				arrMessage[2] = 'Descompte del 10% per a estàncies d\'una setmana o més.<br><br>Descompte del 30% per a estàncies d\'un mes o més.';
						/* Booking1 */
				arrMessage[3] = 'Arribada:';
				arrMessage[4] = 'Sortida:';
				arrMessage[5] = 'Adults:';
				arrMessage[6] = 'Nens:';
				arrMessage[7] = 'Nadons:';
				arrMessage[8] = 'Nits:';
				arrMessage[9] = 'Total:';
				arrMessage[10] = 'Si necessites assistència tècnica per a fer la teva reserva contacta amb nosaltres:';
				arrMessage[11] = 'La informació s\'ha enviat correctament.'; 
				arrMessage[12] = '<strong>Condicions dels preus</strong>';
				arrMessage[13] = 'Descompte del ';
				arrMessage[14] = ' per a estàncies d\'una setmana o més.<br><br>Descompte del '; 
				arrMessage[15] = ' per a estàncies d\'un mes o més.';
			}
			
			
			if(Type == 2){			
				arrMessage[0] = 'S\'han trobat els següents errors:\n\n- Les dates seleccionades no estan disponibles.';
				arrMessage[1] = '- El total de persones no pot superior a ';
				arrMessage[2] = '- Ha de seleccionar almenys un adult.\n';
				arrMessage[3] = '- El camp Data Sortida no és correcte.\n';
				arrMessage[4] = '- El camp Data Sortida no pot estar buit.\n';
				arrMessage[5] = '- El camp Data Arribada no és correcte.\n';
				arrMessage[6] = '- El camp Data Arribada ha de ser posterior a la data actual.\n';
				arrMessage[7] = '- El camp Data Arribada no pot estar buit.\n';
				arrMessage[8] = '- El camp Data Arribada no pot ser posterior a Data Sortida.\n';
				arrMessage[9] = '- El camp Data Sortida no pot ser igual a Data Arribada.\n';
				arrMessage[10] = '- L\'estada mínima és de 1 nit.\n';
				arrMessage[11] = 'S\'han trobat els següents errors:\n\n';
				arrMessage[12] = '- El camp Nom és obligatori.\n';
				arrMessage[13] = '- El camp Cognoms és obligatori.\n';
				arrMessage[14] = '- El camp Nombre de Document és obligatori.\n';
				arrMessage[15] = '- Falta la lletra del DNI.\n';
				arrMessage[16] = '- El camp Nombre de Document no és correcte.\n';
				arrMessage[17] = '- El camp E-mail és obligatori.\n';
				arrMessage[18] = '- El camp E-mail no és correcte.\n';
				arrMessage[19] = '- El camp E-mail i la seva confirmació han de ser iguals.\n';
				arrMessage[20] = '- El camp Telèfon Mòbil és obligatori.\n';
				arrMessage[21] = '- El camp Telèfon Mòbil no ha estat escrit en la forma correcta.\n';
				arrMessage[22] = '- El camp Telèfon Fix no és correcte.\n';
				arrMessage[23] = '- El camp Adreça és obligatori.\n';
				arrMessage[24] = '- El camp Població és obligatori.\n';
				arrMessage[25] = '- El camp Província és obligatori.\n';
				arrMessage[26] = '- El camp Codi Postal és obligatori.\n';
				arrMessage[27] = '- Falta la lletra del DNI.\n';
				arrMessage[28] = '- Ha de confirmar que accepta les condicions de reserva.\n';
				arrMessage[29] = '- El camp Comentaris és massa gran.\n';
			}

			if(Type == 3){
				arrMessage[0] = 'Llista de Preus';
						/* Availability */
				arrMessage[1] = 'Disponibilitat';
						/* Booking1 */
				arrMessage[2] = 'RESERVAR - Dades Personals';
				arrMessage[3] = 'RESERVAR - Dades Factura';
				arrMessage[4] = 'Pagar';
				arrMessage[5] = 'Confirmació de la Reserva';
			}
			
			if(Type == 4){
				arrMessage[0] = 'Anterior';
				arrMessage[1] = 'Veure Disponibilitat';
				arrMessage[2] = 'Següent';
				arrMessage[3] = 'Disponibilitat';
				arrMessage[4] = 'Confirmar y Pagar';
				arrMessage[5] = 'Imprimir Reserva';
				arrMessage[6] = 'Enviar';
				arrMessage[7] = 'palau de la música';
				arrMessage[8] = 'jazz';
				arrMessage[9] = 'l\'auditori';
				arrMessage[10] = 'liceu';
				arrMessage[11] = '<strong>espanya</strong> informació';
				arrMessage[12] = '<strong>transport</strong> públic'; 
				arrMessage[13] = '<strong>mapa</strong> barcelona'; 
				arrMessage[14] = '<strong>parkings</strong> públics';
				arrMessage[15] = '<strong>lloguer</strong> de motos';
				arrMessage[16] = '<strong>aeroport</strong>';
				arrMessage[17] = 'restaurants';
				arrMessage[18] = 'botigues';
				arrMessage[19] = 'bars';
				arrMessage[20] = '<strong>golondrinas</strong> barcelona';
				arrMessage[21] = '<strong>l\'aquarium</strong> barcelona';
				arrMessage[22] = '<strong>zoo</strong> barcelona';
				arrMessage[23] = '<strong>fira</strong> barcelona';
				arrMessage[24] = 'activitats <strong>tur&iacute;stiques</strong>';
				arrMessage[25] = 'activitats <strong>culturals</strong>'; 
				arrMessage[26] = 'ruta del <strong>modernisme</strong>';
				arrMessage [27] = 'Plànol'; 				
				
			}
			
			if(Type == 5){
						/* Pricing */
				arrMessage[0] = 'Descompte del 10% per a estades d\'una setmana o més.<br>Descompte del 30% per a estades d\'un mes o més.<br>Cost 0 per a nadons de 1 a 23 mesos.<br>Nens a partir de 24 mesos conten com un persona extra.<br>Check-in posteriors a les 20:00hs tenen càrrec addicional de 50&euro;.<br>7% d\'IVA no inclòs.';
						/* Availability */
				arrMessage[1] = '2 a 13 anys';
				arrMessage[2] = '1 a 23 mesos';
				arrMessage[3] = '7% IVA inclòs';
				arrMessage[4] = '30% del Total';
				arrMessage[5] = 'A pagar en Check-in';
				arrMessage[6] = 'A dipositar en Check-in';
						/* Booking1 */
				arrMessage[7] = '34 111222333';
				arrMessage[8] = ' * Aquestes dades són obligatoris.';
				arrMessage[9] = 'El teu nom';
				arrMessage[10] = 'El teu e-mail';
				arrMessage[11] = 'Nom del destinatari';
				arrMessage[12] = 'E-mail del destinatari';
				arrMessage[13] = 'Comentari';
				arrMessage[14] = 'viure a barcelona';
				arrMessage[15] = 'agenda cultural';
				arrMessage[16] = 'música';
				arrMessage[17] = 'clàssics ciutat';
				arrMessage[18] = 'entrades';
				arrMessage[19] = 'black & white';
				arrMessage[20] = '<p>Gràcies per confiar-nos la teva estada a Barcelona. Estarem encantats de rebre\'t.</p><p>Si has realitzat el pagament a través de transferència bancària, has de fer una transferència al compte: 0081-7301-31-0001133624, indicant en el concepte el teu nombre de reserva i enviar el justificant per mail (info@blackandwhitehome.com).<br>T\'enviarem un mail de confirmació en el moment que hàgim confirmat l\'abonament de l\'import. </p>';
				arrMessage[21] = '<p>S\'ha produ&iuml;t un error al realitzar el pagament amb la targeta.</p><p>Imprimeix aquesta pàgina i posa\'t en contacte amb nosaltres per a solucionar el problema.</p>';
				arrMessage[22] = 'Estat Reserva';
				arrMessage[23] = 'REBUTJADA';
				arrMessage[24] = 'Nº Reserva';
				arrMessage[25] = 'Data Reserva';
				arrMessage[26] = 'Apartament';
				arrMessage[27] = 'Data Arribada';
				arrMessage[28] = 'Data Sortida';
				arrMessage[29] = 'Nits';
				arrMessage[30] = 'Nº persones';
				arrMessage[31] = 'Nom i Cognoms';
				arrMessage[32] = 'Document';
				arrMessage[33] = 'E-mail';
				arrMessage[34] = 'Telèfon fix';
				arrMessage[35] = 'Telèfon mòbil';
				arrMessage[36] = 'Forma de pagament';
				arrMessage[37] = 'Total reserva';
				arrMessage[38] = 'A pagar ara';
				arrMessage[39] = 'Pendent';
				arrMessage[40] = 'Si necessites assistència tècnica per a fer la teva reserva contacta amb nosaltres:';
				arrMessage[41] = 'Condicions dels preus';
				arrMessage[42] = 'Adults:';
				arrMessage[43] = 'Nens:';
				arrMessage[44] = 'Nadons:';				
				arrMessage[45] = 'Has de fer una transferència al compte: 0081-7301-31-0001133624, indicant en el concepte el teu nombre de reserva i enviar el justificant per mail (info@blackandwhitehome.com).<br>T\'enviarem un mail de confirmació en el moment que hàgim confirmat l\'abonament de l\'import.<br>Informació per a transferències internacionals: <br>IBAN ES46008173013100033624<br>BIC BSAB ESBB';
				arrMessage[46] = 'He llegit, entenc i accepto les Condicions de Reserva.';
				arrMessage[47] = 'Si tens requeriments especials o vols enviar-nos algun comentari, no dubtis en fer-lo.';
				arrMessage[48] = 'Pressionant el botó "CONFIRMAR I PAGAR", estàs autoritzant a Black and white home a carregar en la teva targeta el 30% del total de la reserva com garantia de la reserva de l\'apartament, per a la teva estada seleccionada.';
				arrMessage[49] = '<p>La teva reserva ha estat enviada correctament i en breu rebràs els detalls en la teva adreça de correu.</p><p>A continuació detallem la informació de la reserva.</p>';
				arrMessage[50] = 'ACEPTADA';
				arrMessage[51] = 'PENDENT DE CONFIRMACIÓ';
				arrMessage[52] = 'Calendari';
				arrMessage[53] = 'Targeta';
				arrMessage[54] = 'Transferència';
				arrMessage[55] = 'Efectiu';								
			}
			
			if(Type == 6){
						/* Pricing */
				arrMessage[0] = 'Nº  de persones';
				arrMessage[1] = 'Preu per nit';
				arrMessage[2] = 'persones';
				arrMessage[3] = 'Persona extra';
				arrMessage[4] = 'màx.persones';
						/* Availability */
				arrMessage[5] = 'Data Arribada';
				arrMessage[6] = 'Data Sortida';
				arrMessage[7] = 'Adults';
				arrMessage[8] = 'Nens';
				arrMessage[9] = 'Nadons';
				arrMessage[10] = 'Total';
				arrMessage[11] = 'A pagar ara';
				arrMessage[12] = 'Pendent';
				arrMessage[13] = 'Fiança';
						/* Booking1 */
				arrMessage[14] = 'Nom';
				arrMessage[15] = 'Cognoms';
				arrMessage[16] = 'Tipus document';
				arrMessage[17] = 'Nº  document';
				arrMessage[18] = 'E-mail';
				arrMessage[19] = 'Confirmar e-mail';
				arrMessage[20] = 'Telèfon fix';
				arrMessage[21] = 'Telèfon mòbil';
				arrMessage[22] = 'Dades per a factura';
				arrMessage[23] = 'Adreça';
				arrMessage[24] = 'Codi Postal';
				arrMessage[25] = 'Població';
				arrMessage[26] = 'Provincia';
				arrMessage[27] = 'Pasaport';				
				arrMessage[28] = 'DNI';
				arrMessage [29] = 'Des de';
				arrMessage [30] = 'persona-nit';
				arrMessage [31] = 'Persona-nit';				
				arrMessage [32] = 'Nits';				
			}
			
				if(Type == 7){
				arrMessage[0] = 'serveis';
				arrMessage[1] = 'Enviar vincle:';
				arrMessage[2] = 'preus<br>condicions<br>reserves';
				arrMessage[3] = 'imatges';
				arrMessage[4] = 'serveis';
				arrMessage[5] = 'Enviar a un amic';
				arrMessage[6] = 'veure';
				arrMessage[7] = 'Reserves per Dates';
				arrMessage[8] = 'Ho sentim, no s\'han trobat apartaments disponibles, seleccioni altres dates si us plau.';
				 
				}
				
			if (Type == 8) { 
					arrMessage [0] = 'Afegir a favorits'; 
					arrMessage [1] = 'Enviar a un amic'; 
				}			
				
			if (Type == 9) { 
					arrMessage [0] = 'Recerca ràpida';
					arrMessage [1] = 'Data d\'Arribada';
					arrMessage [2] = 'Data de Sortida';
					arrMessage [3] = 'Adults';
					arrMessage [4] = 'Nens';
			}
			
	
				if (Type == 10) {
				arrMessage [0] = 'Els nostres Apartaments';
				arrMessage [1] = 'Tots els apartaments';
				arrMessage [2] = 'Estudis';
				arrMessage [3] = 'Apartaments de 1 habitació';
				arrMessage [4] = 'Apartaments de 2 habitacions';
				arrMessage [5] = 'Apartaments de 3 o més habitacions';
				arrMessage [6] = 'Apartaments Sagrada Familia';
				arrMessage [7] = 'Apartaments Fira';
				arrMessage [8] = 'Apartaments Passeig de Gràcia';
				arrMessage [9] = 'Apartaments Lowcost';
				}
				
	
				if (Type == 11) {
				arrMessage [0] ='1. Data d\'Arribada i Sortida, nombre d\'adults, nens i nadons. ';
				arrMessage [1] ='2. Dades Personals';
				arrMessage [2] ='3. Dades Facturació ';
				arrMessage [3] ='4. Forma de Pagament ';
				arrMessage [4] ='5. Observacions';
				arrMessage [5] ='6. Condicions de la Reserva ';
				arrMessage [6] ='Import de la Reserva';
				arrMessage [7] ='Import de la Reserva';	
				arrMessage [8] = '5. Dades del Pagament';								
				arrMessage [9] = 'Utilitzar els mateixos que les dades personals';		
				arrMessage [10] = '4. Dades del Pagament';												
				}
				
	
				if (Type == 12) {
				arrMessage [0] = 'Disponiblitat';
				arrMessage [1] = 'Consultar altres dates';
				arrMessage [2] = 'Localització';
				arrMessage [3] = 'Informació';
				arrMessage [4] = 'Serveis';
				}
				
				if (Type == 13) { 				
				arrMessage [0] = 'Apartaments moblats de luxe per a lloguer a Barcelona';				
				}				
				
// 14 - Estado del Pago

				if (Type == 14) {
				arrMessage [0] = 'Pendent';
				arrMessage [1] = 'Confirmat';
				arrMessage [2] = 'Rebutjat';
				arrMessage [3] = 'Estat del pagament';
				}
				
// 15- Botones Confirmación de la Reserva

				if (Type == 15) { 				
				arrMessage [0] = 'Anterior';
				arrMessage [1] = 'Inici';
				arrMessage [2] = 'Imprimeix'; 				
				}	
				
			if (Type == 16) { 				
				arrMessage [0] = 'Consultar altres apartaments disponibles per a les mateixes dates';
				arrMessage [1] = 'Zona';	
				arrMessage [2] = 'Nit disponible';
				arrMessage [3] = 'Nit ocupada';				
				}
				
				if (Type == 17) { 				
				arrMessage [0] = 'No hi ha apartaments disponibles per a les dates consultades';		
				}				
				
				
	}
	
		if (Idioma == 3) { 
				
				strLanguageExtension ='_eng'; 
				
				if (Type == 0) { 
				arrMessage [0] = 'location'; 
				arrMessage [1] = 'Services'; 
				arrMessage [2] = 'reserves <br> prices <br> conditions'; 
				arrMessage [3] = 'image'; 
				arrMessage [4] = 'apartment'; 
				arrMessage [5] = 'Information from the City'; 
				arrMessage [6] = 'FAQ\'s'; 
				arrMessage [7] = 'Home'; 
				arrMessage [8] = 'submit'; 
				arrMessage [9] = 'Contact'; 
				arrMessage [11] = '<strong> posts </strong> <br> shows'; 
				arrMessage [10] = 'selection <br> <strong> Black and white home </strong>'; 
				arrMessage [12] = '<strong> classic </strong> <br> of the city'; 
				arrMessage [13] = '<strong> <br> music </strong>'; 
				arrMessage [14] = 'agenda <br> <strong> cultural </strong>'; 
				arrMessage [15] = '<strong> live <br> </strong> barcelona'; 
				arrMessage [16] = '<strong> theater </strong>'; 
				arrMessage [17] = '<strong> music </strong>'; 
				arrMessage [18] = '<strong> movie </strong>'; 
				arrMessage [19] = '<strong> sports </strong>'; 
				arrMessage [20] = '<strong> sale of tickets </strong>'; 
				arrMessage [21] = 'music'; 
				arrMessage [22] = 'live in barcelona'; 
				arrMessage [23] = 'cultural agenda'; 
				arrMessage [24] = 'information from the city'; 
				arrMessage [25] = 'classics of the city'; 
				arrMessage [26] = 'selection <strong> Black and white home </strong>'; 
				arrMessage [27] = 'Price per Night'; 							
				arrMessage [28] = 'Special Offers'; 											
				arrMessage [29] = 'Go'; 							
				arrMessage [30] = 'Features'; 									
				arrMessage [31] = 'prices'; 														
				arrMessage [32] = 'search results';				
				arrMessage [33] = 'Back';				
				arrMessage [34] = 'booking';
				arrMessage [35] = 'price for the selected dates';
				arrMessage [36] = 'Booking';			
				arrMessage [37] = 'More Info';			
				arrMessage [38] = 'Map';								
				}
				
				if (Type == 1) { 
				arrMessage [0] = '<strong> live</strong>barcelona'; 
				arrMessage [1] = 'apartment'; 
				arrMessage [2] = '10% discount for stays of a week or more. <br> 30% discount for stays of a month or more. '; 
				arrMessage [3] = 'Input:'; 
				arrMessage [4] = 'Output:'; 
				arrMessage [5] = 'Adult:'; 
				arrMessage [6] = 'Children:'; 
				arrMessage [7] = 'Baby:'; 
				arrMessage [8] = 'Nights:'; 
				arrMessage [9] = 'Total:'; 
				arrMessage [10] = 'if you need assistance to make your reservation contact us:';
				arrMessage [11] = 'The information has been sent.'; 
				arrMessage [12] = '<strong> Terms of prices </strong>'; 
				arrMessage [13] = ''; 
				arrMessage [14] = ' discount for stays of a week or more. <br> '; 
				arrMessage [15] = ' discount for stays of a month or more. '; 
				}
				
				
				if (Type == 2) { 
				arrMessage [0] = 'The following errors were found:\n\n- The dates chosen are not available.'; 
				arrMessage [1] = '- The total number of people can not be greater than'; 
				arrMessage [2] = '- Must select at least one adult.\n';  
				arrMessage [3] = '- The field is not correct: Check out.\n'; 
				arrMessage [4] = '- This field cannot be empty: Check out.\n'; 
				arrMessage [5] = '- The field is not correct: Arrival Date.\n'; 
				arrMessage [6] = '- The Arrival Date field must be after the current date.\n'; 
				arrMessage [7] = '- This field cannot be empty: Arrival Date.\n'; 
				arrMessage [8] = '- The Entry Date field can not be after the departure date.\n'; 
				arrMessage [9] = '- The field Departure Date can not be equal to Arrival Date.\n'; 
				arrMessage [10] = '- The minimum stay is 1 night.\n'; 
				arrMessage [11] = 'The following errors were found:\n\n'; 
				arrMessage [12] = '- This field cannot be empty: Name.\n'; 
				arrMessage [13] = '- This field cannot be empty: Last Name.\n'; 
				arrMessage [14] = '- This field cannot be empty: Document Number.\n'; 
				arrMessage [15] = '- Lack letter of the DNI.\n'; 
				arrMessage [16] = '- The field is not correct: Document Number.\n'; 
				arrMessage [17] = '- This field cannot be empty: E-mail.\n'; 
				arrMessage [18] = '- The field is not correct: E-mail.\n'; 
				arrMessage [19] = '- The field E-mail and his confirmation must be equal.\n';
				arrMessage [20] = '- This field cannot be empty: Mobile Phone.\n'; 
				arrMessage [21] = '- The Mobile Phone field has not been written in the right way.\n'; 
				arrMessage [22] = '- The field is not correct: Telephone.\n'; 
				arrMessage [23] = '- This field cannot be empty: Address.\n'; 
				arrMessage [24] = '- This field cannot be empty: City.\n'; 
				arrMessage [25] = '- This field cannot be empty: Province.\n'; 
				arrMessage [26] = '- This field cannot be empty: Postal Code.\n'; 
				arrMessage [27] = '- Lack letter of the DNI.\n'; 
				arrMessage [28] = '- Please confirm you have read our terms and condtions.\n'; 
				arrMessage [29] = '- The Comments field is too big.\n'; 
				}
				
				if (Type == 3) { 
				arrMessage [0] = 'PRICE LIST'; 
				arrMessage [1] = 'AVAILABILITY'; 
				arrMessage [2] = 'BOOK - Personal Data'; 
				arrMessage [3] = 'BOOK - Data Invoice'; 
				arrMessage [4] = 'PAY'; 
				arrMessage [5] = 'CONFIRMATION OF THE BOOK'; 
				}
				
				if (Type == 4) { 
				arrMessage [0] = 'Previous'; 
				arrMessage [1] = 'VIEW AVAILABILITY'; 
				arrMessage [2] = 'Next'; 
				arrMessage [3] = 'AVAILABILITY'; 
				arrMessage [4] = 'Confirm and Pay'; 
				arrMessage [5] = 'PRINT BOOKING'; 
				arrMessage [6] = 'SEND'; 
				arrMessage [7] = 'palau de la música'; 
				arrMessage [8] = 'jazz'; 
				arrMessage [9] = 'l\'Auditori'; 
				arrMessage [10] = 'academy'; 
				arrMessage [11] = '<strong> Spain </strong> information'; 
				arrMessage [12] = '<strong> transport </strong> public'; 
				arrMessage [13] = '<strong> map </strong> barcelona'; 
				arrMessage [14] = '<strong> parking </strong> servants'; 
				arrMessage [15] = '<strong> rental </strong> motorcycles'; 
				arrMessage [16] = '<strong> airport </strong>'; 
				arrMessage [17] = 'restaurants'; 
				arrMessage [18] = 'shops'; 
				arrMessage [19] = 'bar'; 
				arrMessage [20] = '<strong> Swallows </strong> barcelona'; 
				arrMessage [21] = '<strong> l \ aquarium </strong> barcelona'; 
				arrMessage [22] = '<strong> zoo </strong> barcelona'; 
				arrMessage [23] = '<strong> fair </strong> barcelona'; 
				arrMessage [24] = 'tourist activities <strong> </strong>'; 
				arrMessage [25] = 'cultural activities <strong> </strong>'; 
				arrMessage [26] = 'route of modernism <strong> </strong>'; 
				arrMessage [27] = 'Map'; 								
				
				}
				
				if (Type == 5) { 
				arrMessage [0] = '10% discount for stays of a week or more. <br> 30% discount for stays of a month or more. Cost <br> 0 for infants from 1 to 23 months. <br> Children from 24 months counted as extra person. <br> Check-in after 20:00 pm with additional charge of 50 €. <br> 7% VAT not included. '; 
				arrMessage [1] ='2 to 13 years'; 
				arrMessage [2] ='1 to 23 months'; 
				arrMessage [3] =' VAT 7%'; 
				arrMessage [4] ='of Total 30%'; 
				arrMessage [5] = 'Payable Check-in'; 
				arrMessage [6] = 'A deposit at check-in'; 
				arrMessage [7] = '34 111222333'; 
				arrMessage [8] = '* These data are required.'; 
				arrMessage [9] = 'Your Name'; 
				arrMessage [10] = 'Your e-mail'; 
				arrMessage [11] = 'Name of recipient'; 
				arrMessage [12] = 'E-mail address'; 
				arrMessage [13] = 'Comment'; 
				arrMessage [14] = 'live in barcelona'; 
				arrMessage [15] = 'cultural agenda'; 
				arrMessage [16] = 'music'; 
				arrMessage [17] = 'classic city'; 
				arrMessage [18] = 'tickets'; 
				arrMessage [19] = 'black & white'; 
				arrMessage [20] = '<p> Thank you for choosing to stay in Barcelona. We are delighted to welcome you. </ P> <p> if you\'ve made the payment through bank transfer, you must make a transfer to the account: 0081-7301-31-0001133624, indicating the concept in your reservation number and send the proof by mail (info @ blackandwhitehome.com). <br> We\'ll send you an email confirmation at the moment we have confirmed the amount of fertilizer. </ P> '; 
				arrMessage [21] = '<p> Failed to make the payment with the card. </ P> <p> Print this page and get in touch with us so solve the problem. </ P> '; 
				arrMessage [22] = 'State Reserve'; 
				arrMessage [23] = 'rejected'; 
				arrMessage [24] = 'No Reserve'; 
				arrMessage [25] = 'Date Book'; 
				arrMessage [26] = 'Apartment'; 
				arrMessage [27] = 'Entry Date'; 
				arrMessage [28] = 'Departure Date'; 
				arrMessage [29] = 'Nights'; 
				arrMessage [30] = 'No person'; 
				arrMessage [31] = 'Name'; 
				arrMessage [32] = 'Document'; 
				arrMessage [33] = 'E-mail'; 
				arrMessage [34] = 'Telephone'; 
				arrMessage [35] = 'Mobile'; 
				arrMessage [36] = 'Method of payment'; 
				arrMessage [37] = 'Total booking'; 
				arrMessage [38] = 'To pay now'; 
				arrMessage [39] = 'Not yet'; 
				arrMessage [40] = 'if you need assistance to make your reservation contact us:';
				arrMessage [41] = 'Conditions in prices'; 
				arrMessage [42] = 'Adult'; 
				arrMessage [43] = 'Children'; 
				arrMessage [44] = 'Baby'; 
				arrMessage [45] = 'You must make a transfer to the account: 0081-7301-31-0001133624, indicating the concept in your reservation number and send the proof by mail (info@blackandwhitehome.com). <br> We\'ll send you an email confirmation at the moment we have confirmed the amount of fertilizer. <br> Information for international transfers: <br> BIC IBAN ES46008173013100033624 <br> BSAB ESBB '; 
				arrMessage [46] = 'I have read, understand and accept the Terms and Conditions'; 
				arrMessage [47] = 'if you have special requirements or want to send us any comments, please feel free to do so.'; 
				arrMessage [48] = 'Pressing the button "CONFIRM AND PAY", is allowing Black and white home to charge your card for 30% of the total amount as a guarantee of the reservation of the apartment, for your stay selected. '; 
				arrMessage [49] = '<p> Your reservation has been sent successfully and will receive the details in your e-mail. </ p> <p> The following information from the reservation. </ p>' ;
				arrMessage [50] = 'accepted';
				arrMessage [51] = 'pending confirmation';
				arrMessage [52] = 'Calendar';
				arrMessage [53] = 'Card';
				arrMessage [54] = 'Transfer';
				arrMessage [55] = 'Cash';												
				}
				
				if (Type == 6) { 
				arrMessage [0] = 'Number of people'; 
				arrMessage [1] = 'Price per night'; 
				arrMessage [2] = 'persons'; 
				arrMessage [3] = 'Extra person'; 
				arrMessage [4] = 'máx.persones'; 
				arrMessage [5] = 'Entry Date'; 
				arrMessage [6] = 'Departure Date'; 
				arrMessage [7] = 'Adult'; 
				arrMessage [8] = 'Children'; 
				arrMessage [9] = 'Baby'; 
				arrMessage [10] = 'Total'; 
				arrMessage [11] = 'To pay now'; 
				arrMessage [12] = 'Not yet'; 
				arrMessage [13] = 'Bond'; 
				arrMessage [14] = 'Name'; 
				arrMessage [15] = 'Last Name'; 
				arrMessage [16] = 'Document'; 
				arrMessage [17] = 'Nº Document'; 
				arrMessage [18] = 'E-mail'; 
				arrMessage [19] = 'Confirm e-mail'; 
				arrMessage [20] = 'Telephone'; 
				arrMessage [21] = 'Mobile'; 
				arrMessage [22] = 'Data for the bill'; 
				arrMessage [23] = 'Address'; 
				arrMessage [24] = 'Postcode'; 
				arrMessage [25] = 'City'; 
				arrMessage [26] = 'State'; 
				arrMessage [27] = 'Passport'; 
				arrMessage [28] = 'ID'; 
				arrMessage [29] = 'From';
				arrMessage [30] = 'person-night';
				arrMessage [31] = 'Person-night';				
				arrMessage [32] = 'Nights';				
				}
				
				if (Type == 7) { 
				arrMessage [0] = 'services'; 
				arrMessage [1] = 'Send Link'; 
				arrMessage [2] = 'prices <br> conditions <br> bookings'; 
				arrMessage [3] = 'image'; 
				arrMessage [4] = 'services'; 
				arrMessage [5] = 'Send to a friend';
				arrMessage [6] = 'go';
				arrMessage [7] = 'Bookings by Date'; 				
				arrMessage [8] = 'Sorry, there was no apartments available, please select other dates.'; 				
				}
				
				if (Type == 8) { 
					arrMessage [0] = 'Bookmark'; 
					arrMessage [1] = 'Send to a friend'; 
				}				
				if (Type == 9) { 				
					arrMessage [0] = 'Quick';
					arrMessage [1] = 'Arrival Date';
					arrMessage [2] = 'Check out';
					arrMessage [3] = 'Adult';
					arrMessage [4] = 'Child';				
				}
				
	
				if (Type == 10) {
				arrMessage [0] = 'Our Apartments';
				arrMessage [1] = 'All Apartments';
				arrMessage [2] = 'Studio Apartments';
				arrMessage [3] = '1 Bedroom Apartments';
				arrMessage [4] = '2 Bedroom Apartments';
				arrMessage [5] = '3 or More Bedroom Apartments';
				arrMessage [6] = 'Sagrada Familia Apartments';
				arrMessage [7] = 'Fira Apartments';
				arrMessage [8] = 'Paseo de Gracia Apartments';
				arrMessage [9] = 'Lowcost Apartments';
				}
				
				if (Type == 11) {
				arrMessage [0] ='1. Arrival date and departure, number of adults, children and babies';
				arrMessage [1] ='2. Personal Data ';
				arrMessage [2] ='3. Billing Data ';
				arrMessage [3] ='4. Form of Payment ';
				arrMessage [4] ='5. Observations';
				arrMessage [5] ='6. Terms and Conditions';
				arrMessage [6] ='Total amount of the booking';
				arrMessage [7] ='Total amount of the booking';
				arrMessage [8] ='5. Payment Details';								
				arrMessage [9] = 'Use the same personal data';						
				arrMessage [10] ='4. Payment Details';												
				}
				
				if (Type == 12) {
				arrMessage [0] = 'Access';
				arrMessage [1] = 'Check other dates';
				arrMessage [2] = 'Location';
				arrMessage [3] = 'Information';
				arrMessage [4] = 'Service';
				}
				
				if (Type == 13) { 				
				arrMessage [0] = 'Luxury furnished apartments for rent in Barcelona';				
				}					
				
	
// 14 - Estado del Pago

				if (Type == 14) {
				arrMessage [0] = 'Pending';
				arrMessage [1] = 'Confirmed';
				arrMessage [2] = 'Rejected';
				arrMessage [3] = 'State payment';							
				}
				
// 15- Botones Confirmación de la Reserva

				if (Type == 15) { 				
				arrMessage [0] = 'Previous';
				arrMessage [1] = 'Home';
				arrMessage [2] = 'Print'; 
				}		
				
			if (Type == 16) { 				
				arrMessage [0] = 'Consult other available apartments for the same dates';				
				arrMessage [1] = 'Zone';			
				arrMessage [2] = 'Night available';
				arrMessage [3] = 'Night busy';
				}
				
				if (Type == 17) { 				
				arrMessage [0] = 'No available apartments for chosen dates';		
				}				
				
					
}
		
			if (Idioma == 4) { 
			
			strLanguageExtension = ''; 
			
			if (Type == 0) { 
			arrMessage [0] = 'posto'; 
			arrMessage [1] = 'Servizi'; 
			arrMessage [2] = 'riserve <br> prezzi<br> condizioni'; 
			arrMessage [3] = 'immagini'; 
			arrMessage [4] = 'appartamenti'; 
			arrMessage [5] = 'Informazioni della Città'; 
			arrMessage [6] = 'FAQ\'s'; 
			arrMessage [7] = 'Inizio'; 
			arrMessage [8] = 'mandare'; 
			arrMessage [9] = 'Contattare'; 
			arrMessage [11] = '<strong> entrate </strong> <br> spettacoli'; 
			arrMessage [10] = 'selezionare <br> <strong> Black and white home </strong>'; 
			arrMessage [12] = '<strong> classici </strong> <br> dellla città'; 
			arrMessage [13] = '<strong> <br> musica </strong>'; 
			arrMessage [14] = 'agenda <br> <strong> culturale </strong>'; 
			arrMessage [15] = '<strong> vivere <br> </strong> barcellona'; 
			arrMessage [16] = '<strong> teatro </strong>'; 
			arrMessage [17] = '<strong> musica </strong>'; 
			arrMessage [18] = '<strong> cine </strong>'; 
			arrMessage [19] = '<strong> sport </strong>'; 
			arrMessage [20] = 'Vendita <strong> di biglietti </strong>'; 
			arrMessage [21] = 'musica'; 
			arrMessage [22] = 'Vivere a barcellona'; 
			arrMessage [23] = 'agenda culturale'; 
			arrMessage [24] = 'informazioni della città'; 
			arrMessage [25] = 'classici della città'; 
			arrMessage [26] = 'selezionare<strong> Black and white home </strong>'; 
			arrMessage [27] = 'Prezzo per Notte'; 										
			arrMessage [28] = 'Promozioni'; 													
			arrMessage [29] = 'Vista';			
			arrMessage [30] = 'Caratteristiche'; 													
			arrMessage [31] = 'prezzi'; 																		
			arrMessage [32] = 'i risultati della ricerca';
			arrMessage [33] = 'Tornare';
			arrMessage [34] = 'booking';
			arrMessage [35] = 'prezzo per le date selezionate';
			arrMessage [36] = 'Booking';			
			arrMessage [37] = 'Informazioni';			
			arrMessage [38] = 'Mappa';											
		}
			
			if (Type == 1) { 
			arrMessage [0] = '<strong> vivere</strong>barcellona'; 
			arrMessage [1] = 'appartamento'; 
			arrMessage [2] = 'Sconto del 10%  per soggiorni  di una settimana  o piu´.<br>Sconti del 30% per soggiorni di un mese o piu´.'; 
			arrMessage [3] = 'Entrata:'; 
			arrMessage [4] = 'Uscita:'; 
			arrMessage [5] = 'Adulti:'; 
			arrMessage [6] = 'Bambini:'; 
			arrMessage [7] = 'Neonati:'; 
			arrMessage [8] = 'Notti:'; 
			arrMessage [9] = 'Totale:'; 
			arrMessage [10] = 'Se avete bisogno di una assistenza  tecnica per fare una prenotazione  contattateci:'; 
			arrMessage [11] = 'L\'informazione  e\' stata mandata correttamente.'; 
			arrMessage [12] = '<strong> Condizione  dei prezzi </strong>'; 
			arrMessage [13] = 'Sconto del '; 
			arrMessage [14] = '  per soggiorni  di una settimana  o piu´.<br>Sconti del '; 
			arrMessage [15] = ' per soggiorni di un mese o piu´.'; 
		}
			
			
			if (Type == 2) { 
			arrMessage [0] = 'Abbiamo incontrato i seguenti errori: \n\n-Le date scelte non sono disponibili.'; 
			arrMessage [1] = '- Il massimo delle persone non puo\' essere superiore a'; 
			arrMessage [2] = '- Deve selezionare  per lo meno a un adulto. \n'; 
			arrMessage [3] = '- La zona  data di partenza  non e\' corretta. \n'; 
			arrMessage [4] = '- La zona data di partenza non puo\' rimanere  in bianco. \n'; 
			arrMessage [5] = '- La zona  data di arrivo  non e\' corretta. \n'; 
			arrMessage [6] = '- La zona  data di arrivo  debe essere  posteriore alla data di oggi. \n'; 
			arrMessage [7] = '- La zona  data di arrivo non puo\' rimanere in bianco. \n'; 
			arrMessage [8] = '- La zona data di arrivo non puo\' essere posteriore alla data di Partenza. \n'; 
			arrMessage [9] = '- La zona data di Partenza non puo\' essere uguale alla data di Arrivo. \n'; 
			arrMessage [10] = '- Il soggiorno minimo e\' di una notte. \n'; 
			arrMessage [11] = 'Abbiamo incontrato i seguenti errori: \n\n'; 
			arrMessage [12] = '- La zona Nome e\' obbligatoria. \n'; 
			arrMessage [13] = '- La zona Cognome e\' obbligatoria. \n'; 
			arrMessage [14] = '- La zona  Numero di Documento e\' obbligatoria . \n'; 
			arrMessage [15] = '- Manca  la lettera del Documento  D\'identità . \n'; 
			arrMessage [16] = '- La zona  Numero  del Documento  non e\' corretta. \n'; 
			arrMessage [17] = '- La zona e-mail e\' obbligatoria. \n'; 
			arrMessage [18] = '- La zona e-mail non e\' corretta. \n'; 
			arrMessage [19] = '- La zona e-mail e su conferma  devono essere gli stessi. \n'; 
			arrMessage [20] = '- La zona Telefonino e\' obbligatoria. \n'; 
			arrMessage [21] = '- La zona Telefonino  non e\' stata  scritta nella forma  corretta. \n'; 
			arrMessage [22] = '- La zona  Telefono  fisso non e\' corretta. \n'; 
			arrMessage [23] = '- La zona  Indirizzi  e\' obbligatoria. \n'; 
			arrMessage [24] = '- La zona  citta\' e\' obbligatoria. \n'; 
			arrMessage [25] = '- La zona Provincia e\' obbligatoria. \n'; 
			arrMessage [26] = '- La zona  Codice Postale e\' obbligatoria. \n'; 
			arrMessage [27] = '- Manca la lattera del Documento d\'Identita\'. \n'; 
			arrMessage [28] = '- Deve confermare  che accetta le condizioni della prenotazione. \n'; 
			arrMessage [29] = '- La zona Commenti e\' troppo grande. \n'; 
		}
			
			if (Type == 3) { 
			arrMessage [0] = 'LISTA DEI PREZZI'; 
			arrMessage [1] = 'DISPONIBILITÀ'; 
			arrMessage [2] = 'PRENOTARE - Dati Personali'; 
			arrMessage [3] = 'PRENOTARE - Dati della Fattura'; 
			arrMessage [4] = 'PAGARE'; 
			arrMessage [5] = 'CONFERMA  DELLA PRENOTAZIONE'; 
		}
			
			if (Type == 4) { 
			arrMessage [0] = 'Anteriore'; 
			arrMessage [1] = 'GUARDARE LA DISPONIBILITÀ'; 
			arrMessage [2] = 'Successivo'; 
			arrMessage [3] = 'DISPONIBILITÀ'; 
			arrMessage [4] = 'Confermare e Pagare'; 
			arrMessage [5] = 'STAMPARE LA PRENOTAZIONE'; 
			arrMessage [6] = 'MANDARE'; 
			arrMessage [7] = 'palau de la música'; 
			arrMessage [8] = 'jazz'; 
			arrMessage [9] = 'l\'auditorio'; 
			arrMessage [10] = 'liceo'; 
			arrMessage [11] = '<strong> spagna </strong> informazioni'; 
			arrMessage [12] = '<strong> trasporti </strong> pubblici'; 
			arrMessage [13] = '<strong> mappa </strong> barcellona'; 
			arrMessage [14] = '<strong> parkings </strong> pubblici'; 
			arrMessage [15] = '<strong> affittare </strong> motocicli'; 
			arrMessage [16] = '<strong> aeropuerto </strong>'; 
			arrMessage [17] = 'ristoranti'; 
			arrMessage [18] = 'negozi'; 
			arrMessage [19] = 'bar'; 
			arrMessage [20] = '<strong> Golondrinas </strong> barcellona'; 
			arrMessage [21] = '<strong> l\'aquario </strong> barcellona'; 
			arrMessage [22] = '<strong> zoo </strong> barcellona'; 
			arrMessage [23] = '<strong> eventi </strong> barcellona'; 
			arrMessage [24] = 'attività <strong> turistiche </strong>'; 
			arrMessage [25] = 'attività <strong> culturali </strong>'; 
			arrMessage [26] = 'cammino del <strong> modernismo </strong>'; 
			arrMessage [27] = 'Mappa'; 											
			
			}
			
			if (Type == 5) { 
			arrMessage [0] = 'Sconto del 10% per soggiorni di una settimana o piu\'. <br> Sconti del 30% per soggiorni di un mese o piu\'. <br> Costo 0 per neonati di 1 a 23 mesi. <br> Bambini a partire di 24 mesi contano come persona extra. <br> Check -in dopo le 20.00 ore pagano un costo addizionale di 50€. <br> 7% IVA esclusa. '; 
			arrMessage [1] ='2 a 13 anni'; 
			arrMessage [2] ='1 a 23 mesi'; 
			arrMessage [3] ='7% IVA '; 
			arrMessage [4] ='30% del Totale'; 
			arrMessage [5] = 'Da pagare al Check-in'; 
			arrMessage [6] = 'Da depositare al Check-in';  
			arrMessage [7] ='34 111222333 '; 
			arrMessage [8] = '* Questi dati sono obbligatori.'; 
			arrMessage [9] = 'Il tuo nome'; 
			arrMessage [10] = 'Il tuo e-mail'; 
			arrMessage [11] = 'Nome del destinatario'; 
			arrMessage [12] = 'E-mail del destinatario'; 
			arrMessage [13] = 'Commentario'; 
			arrMessage [14] = 'vivere a barcellona'; 
			arrMessage [15] = 'agenda culturale'; 
			arrMessage [16] = 'musica'; 
			arrMessage [17] = 'classici  citta\''; 
			arrMessage [18] = 'entrate'; 
			arrMessage [19] = 'black & white'; 
			arrMessage [20] = '<p> Grazie per venire a Barcellona . Saremo lieti di accoglierti. </ p> <p> Se hai fatto il pagamento attraverso un bonifico bancario , devi fare il bonifico al numero di conto :0081-7301-31-0001133624, indicando il tuo numero di prenotazione e mandare  la tua ricevuta del pagamento per mail a (info@blackandwhitehome.com). <br>Ti manderemo un mail di accettazione   nel momento  della conferma dell\'avvenuto trasferimento  della quantita\' dovuta.</ p> '; 
			arrMessage [21] = '<p> Errore nel realizzare il pagamento con la carta di credito. </ p> <p> Stampa questa pagina e mettiti in contatto  con  noi per risolvere il problema. < / p> '; 
			arrMessage [22] = 'Stato Prenotazione'; 
			arrMessage [23] = 'rifiutata'; 
			arrMessage [24] = 'Nº Prenotazione'; 
			arrMessage [25] = 'Data Prenotazione'; 
			arrMessage [26] = 'Appartamento'; 
			arrMessage [27] = 'Data di Arrivo'; 
			arrMessage [28] = 'Data di Partenza'; 
			arrMessage [29] = 'Notti'; 
			arrMessage [30] = 'Nº persone'; 
			arrMessage [31] = 'Nome e Cognome'; 
			arrMessage [32] = 'Documento'; 
			arrMessage [33] = 'E-mail'; 
			arrMessage [34] = 'Telefono fiisso'; 
			arrMessage [35] = 'Telefonino'; 
			arrMessage [36] = 'Forma di pagamento'; 
			arrMessage [37] = 'Totale prenotazione'; 
			arrMessage [38] = 'Pagare adesso'; 
			arrMessage [39] = 'Restante'; 
			arrMessage [40] = 'Se avete bisogno di assistenza tecnica  per fare la vostra prenotazione contattateci:'; 
			arrMessage [41] = 'Condizione dei prezzi'; 
			arrMessage [42] = 'Adulti'; 
			arrMessage [43] = 'Bambini'; 
			arrMessage [44] = 'Neonati'; 
			arrMessage [45] = 'Devi fare un bonifico al numero di conto : 0081-7301-31-0001133624, specificando il concetto , il numero di prenotazione e mandare il comprovante per mail  (info@blackandwhitehome.com). <br> Ti manderemo un mail di conferma  nel momento che avremo ingressato l\'importo del trasferimento.<br> Informazioni per un bonifico :  <br> IBAN ES46008173013100033624 <br> BIC BSAB ESBB '; 
			arrMessage [46] = 'Ho letto e capito e accettato  le Condizioni della Prenotazione.'; 
			arrMessage [47] = 'Se avete richieste speciali o volete mandarci qualche commento  non abbiate nessun dubbio nel farlo.'; 
			arrMessage [48] = 'Spingendo il bottone “ACCETTARE  E PAGARE”, autorizza Blackand whitehome  a dapplicare il 30% del costo della prenotazione totale sulla vostra carta di credito, come garanzia  della prenotazione del\'appartamento  da voi scelto per il vostro soggiorno. '; 
			arrMessage [49] = '<p> La sua prenotazione e\'stata mandata correttamente e in breve momento ricevera\' i dettagli al  suo indirizzo mail. </ p> <p> Di seguito indichiamo i dettagli della sua prenotazione. </ p>' ;
			arrMessage [50] = 'ACCETTATA';
			arrMessage [51] = 'ASPETTANDO LA AUTORIZZAZIONE';	
		    arrMessage [52] = 'Calendario';
			arrMessage [53] = 'Carta';	
		    arrMessage [54] = 'Trasferimento';
		    arrMessage [55] = 'Cash';
			}
			
			if (Type == 6) {  
			arrMessage [0] = 'Nº di persone'; 
			arrMessage [1] = 'Prezzi a notte'; 
			arrMessage [2] = 'persone'; 
			arrMessage [3] = 'Persona extra'; 
			arrMessage [4] = 'máx.persone';  
			arrMessage [5] = 'Data D\'arrivo'; 
			arrMessage [6] = 'Data Partenza'; 
			arrMessage [7] = 'Adulti'; 
			arrMessage [8] = 'Bambini'; 
			arrMessage [9] = 'Neonati'; 
			arrMessage [10] = 'Totale'; 
			arrMessage [11] = 'Pagare adesso'; 
			arrMessage [12] = 'Restante'; 
			arrMessage [13] = 'Caparra'; 
			arrMessage [14] = 'Nome'; 
			arrMessage [15] = 'Cognome'; 
			arrMessage [16] = 'Tipo di documento'; 
			arrMessage [17] = 'Nº documento'; 
			arrMessage [18] = 'E-mail'; 
			arrMessage [19] = 'Confermar e-mail'; 
			arrMessage [20] = 'Telefono fisso'; 
			arrMessage [21] = 'Telefonino'; 
			arrMessage [22] = 'Dati per la fattura'; 
			arrMessage [23] = 'Indirizzo'; 
			arrMessage [24] = 'Códice Postale'; 
			arrMessage [25] = 'Città'; 
			arrMessage [26] = 'Provincia'; 
			arrMessage [27] = 'Passaporto'; 
			arrMessage [28] = 'Doc. d\'identità'; 
			arrMessage [29] = 'Da';
			arrMessage [30] = 'persona-notte';
			arrMessage [31] = 'Persona-notte';			
			arrMessage [32] = 'Notti';			
		} 
			
		if (Type == 7) { 
				arrMessage [0] = 'servizi'; 
				arrMessage [1] = 'Mandare collegamento:'; 
				arrMessage [2] = 'prezzi <br> condizioni <br> prenotazioni'; 
				arrMessage [3] = 'immagini'; 
				arrMessage [4] = 'servizi'; 
				arrMessage [5] = 'Invia ad un amico';
				arrMessage [6] = 'andare'; 
				arrMessage [7] = 'Prenotazioni per Data';
				arrMessage [8] = 'Siamo spiacenti, non vi era alcun appartamenti disponibili, si prega di selezionare altre date.';
			}
			
		if (Type == 8) { 
			arrMessage [0] = 'Aggiungi ai preferiti'; 
			arrMessage [1] = 'Invia ad un amico'; 
		}			
		
				if (Type == 9) { 				
					arrMessage [0] = 'veloce';
					arrMessage [1] = 'Data di arrivo';
					arrMessage [2] = 'Check out';
					arrMessage [3] = 'adulti';
					arrMessage [4] = 'Bambino';				}

				if (Type == 10) {
				arrMessage [0] = 'I Nostri Appartamenti';
				arrMessage [1] = 'Tutti Gli Appartamenti';
				arrMessage [2] = 'Studio Appartamenti';
				arrMessage [3] = '1 Camera da Letto Appartamento';
				arrMessage [4] = '2 Camera da Letto Appartamento';
				arrMessage [5] = '3 o più  da Letto Appartamento';
				arrMessage [6] = 'Sagrada Familia Appartamenti';
				arrMessage [7] = 'Fira  Appartamenti';
				arrMessage [8] = 'Paseo de Gracia Appartamenti';
				arrMessage [9] = 'Lowcost Appartamenti';
				}
				
				if (Type == 11) {
				arrMessage [0] = '1. Data di arrivo e di partenza, il numero di adulti, bambini e neonati ';
				arrMessage [1] = '2. Dei dati personali ';
				arrMessage [2] = '3. I dati di fatturazione ';
				arrMessage [3] = '4. Forma di pagamento ';
				arrMessage [4] = '5. Osservazioni ';
				arrMessage [5] = '6. Termini';
				arrMessage [6] = 'Total importo della Riserva';
				arrMessage [7] = 'Total importo della Riserva';
				arrMessage [8] = '5. Dettagli Pagamento';				
				arrMessage [9] = 'Utilizzare la stessa dati personali';	
				arrMessage [10] = '4. Dettagli Pagamento';								
				
				}
				
				if (Type == 12) {
				arrMessage [0] = 'Accesso';
				arrMessage [1] = 'Controlla le altre date';
				arrMessage [2] = 'Posizione';
				arrMessage [3] = 'Informazioni';
				arrMessage [4] = 'Servizi';
				}
				
			if (Type == 13) {
			arrMessage [0] = 'di lusso appartamenti arredati in affitto a Barcellona'; 
			}
			
// 14 - Estado del Pago

				if (Type == 14) {
				arrMessage [0] = 'In attesa';
				arrMessage [1] = 'Confermato';
				arrMessage [2] = 'Rifiutato';
				arrMessage [3] = 'Stato pagamento';											
				}
				
// 15- Botones Confirmación de la Reserva

				if (Type == 15) { 				
				arrMessage [0] = 'Precedente';
				arrMessage [1] = 'Home';
				arrMessage [2] = 'Stampa'; 
				}		
				
			if (Type == 16) { 				
				arrMessage [0] = 'Consultare altri appartamenti disponibili per le stesse date';				
				arrMessage [1] = 'Zona';													
				arrMessage [2] = 'Notte disponibili';
				arrMessage [3] = 'Notte occupato';
				}
				
				if (Type == 17) { 				
				arrMessage [0] = 'Non disponibili appartamenti per le date scelte';		
				}				
				
					
	}

	
			if (Idioma == 5) { 
			
			strLanguageExtension = '_backoffice'; 
			
			if (Type == 0) { 
			arrMessage [0] = 'localización'; 
			arrMessage [1] = 'servicios'; 
			arrMessage [2] = 'reservas <br> precios <br> condiciones'; 
			arrMessage [3] = 'imágenes'; 
			arrMessage [4] = 'apartamentos'; 
			arrMessage [5] = 'información de la ciudad'; 
			arrMessage [6] = 'FAQ\'s'; 
			arrMessage [7] = 'inicio'; 
			arrMessage [8] = 'enviar'; 
			arrMessage [9] = 'contactar'; 
			arrMessage [11] = '<strong> entradas </strong> <br> espectáculos'; 
			arrMessage [10] = 'selección <br> <strong> Black and white home </strong>'; 
			arrMessage [12] = '<strong> clásicos </strong> <br> de la ciudad'; 
			arrMessage [13] = '<strong> <br> música </strong>'; 
			arrMessage [14] = 'agenda <br> <strong> cultural </strong>'; 
			arrMessage [15] = '<strong> vivir <br> </strong> barcelona'; 
			arrMessage [16] = '<strong> teatro </strong>'; 
			arrMessage [17] = '<strong> música </strong>'; 
			arrMessage [18] = '<strong> cine </strong>'; 
			arrMessage [19] = '<strong> deportes </strong>'; 
			arrMessage [20] = 'venta <strong> de entradas </strong>'; 
			arrMessage [21] = 'música'; 
			arrMessage [22] = 'vivir en barcelona'; 
			arrMessage [23] = 'agenda cultural'; 
			arrMessage [24] = 'información de la ciudad'; 
			arrMessage [25] = 'clásicos de la ciudad'; 
			arrMessage [26] = 'selección <strong> Black and white home </strong>'; 
			arrMessage [27] = 'caracteristicas'; 			
		}
			
			if (Type == 1) { 
			arrMessage [0] = '<strong> vivir </strong> barcelona'; 
			arrMessage [1] = 'apartamento'; 
			arrMessage [2] = 'Descuento del 10% para estancias de una semana o más. <br> Descuento del 30% para estancias de un mes o más.'; 
			arrMessage [3] = 'Entrada:'; 
			arrMessage [4] = 'Salida:'; 
			arrMessage [5] = 'Adultos:'; 
			arrMessage [6] = 'Niños:'; 
			arrMessage [7] = 'Bebés:'; 
			arrMessage [8] = 'Noches:'; 
			arrMessage [9] = 'Total:'; 
			arrMessage [10] = 'Si necesitas asistencia técnica para hacer tu reserva contacta con nosotros:'; 
			arrMessage [11] = 'La información se ha enviado correctamente.'; 
			arrMessage [12] = '<strong> Condiciones de los precios </strong>'; 
			arrMessage [13] = 'Descuento del '; 
			arrMessage [14] = ' para estancias de una semana o más. <br> Descuento del '; 
			arrMessage [15] = ' para estancias de un mes o más.'; 
		}
			
			
			if (Type == 2) { 
			arrMessage [0] = 'Se han encontrado los siguientes errores: \n\n-Las fechas elegidas no están disponibles.'; 
			arrMessage [1] = '- El total de personas no puede ser superior a'; 
			arrMessage [2] = '- Debe seleccionar al menos un adulto. \n'; 
			arrMessage [3] = '- El campo Fecha Salida no es correcto. \n'; 
			arrMessage [4] = '- El campo Fecha Salida no puede estar vacio. \n'; 
			arrMessage [5] = '- El campo Fecha Llegada no es correcta. \n'; 
			arrMessage [6] = '- El campo Fecha Llegada debe ser posterior a la fecha actual. \n'; 
			arrMessage [7] = '- El campo Fecha Llegada no puede estar vacía. \n'; 
			arrMessage [8] = '- El campo Fecha Entrada no puede ser posterior a la Fecha Salida. \n'; 
			arrMessage [9] = '- El campo Fecha Salida no puede ser igual a Fecha Llegada. \n'; 
			arrMessage [10] = '- La estancia mínima es de 1 noche. \n'; 
			arrMessage [11] = 'Se han encontrado los siguientes errores: \n\n'; 
			arrMessage [12] = '- El campo Nombre es obligatorio. \n'; 
			arrMessage [13] = '- El campo Apellidos es obligatorio. \n'; 
			arrMessage [14] = '- El campo Número de Documento es obligatorio. \n'; 
			arrMessage [15] = '- Falta la letra del DNI. \n'; 
			arrMessage [16] = '- El campo Número de Documento no es correcto. \n'; 
			arrMessage [17] = '- El campo E-mail es obligatorio. \n'; 
			arrMessage [18] = '- El campo E-mail no es correcto. \n'; 
			arrMessage [19] = '- El campo E-mail y su confirmación deben ser iguales. \n'; 
			arrMessage [20] = '- El campo Teléfono Móvil es obligatorio. \n'; 
			arrMessage [21] = '- El campo Teléfono Móvil no ha sido escrito en la forma correcta. \n'; 
			arrMessage [22] = '- El campo Teléfono Fijo no es correcte. \n'; 
			arrMessage [23] = '- El campo Dirección es obligatorio. \n'; 
			arrMessage [24] = '- El campo Población es obligatorio. \n'; 
			arrMessage [25] = '- El campo Provincia es obligatorio. \n'; 
			arrMessage [26] = '- El campo Código Postal es obligatorio. \n'; 
			arrMessage [27] = '- Falta la letra del DNI. \n'; 
			arrMessage [28] = '- Debe confirmar que acepta las condiciones de reserva. \n'; 
			arrMessage [29] = '- El campo Comentarios es demasiado grande. \n'; 
		}
			
			if (Type == 3) { 
			arrMessage [0] = 'LISTA DE PRECIOS'; 
			arrMessage [1] = 'DISPONIBILIDAD'; 
			arrMessage [2] = 'RESERVAR - Datos Personales'; 
			arrMessage [3] = 'RESERVAR - Datos Factura'; 
			arrMessage [4] = 'PAGAR'; 
			arrMessage [5] = 'CONFIRMACIÓN DE LA RESERVA'; 
		}
			
			if (Type == 4) { 
			arrMessage [0] = 'ANTERIOR'; 
			arrMessage [1] = 'VER DISPONIBILIDAD'; 
			arrMessage [2] = 'SIGUIENTE'; 
			arrMessage [3] = 'DISPONIBILIDAD'; 
			arrMessage [4] = 'Confirmar y Pagar'; 
			arrMessage [5] = 'IMPRIMIR RESERVA'; 
			arrMessage [6] = 'ENVIAR'; 
			arrMessage [7] = 'palau de la música'; 
			arrMessage [8] = 'jazz'; 
			arrMessage [9] = 'l\'auditori'; 
			arrMessage [10] = 'liceo'; 
			arrMessage [11] = '<strong> españa </strong> información'; 
			arrMessage [12] = '<strong> transporte </strong> público'; 
			arrMessage [13] = '<strong> mapa </strong> barcelona'; 
			arrMessage [14] = '<strong> parkings </strong> públicos'; 
			arrMessage [15] = '<strong> alquiler </strong> de coches'; 
			arrMessage [16] = '<strong> aeropuerto </strong>'; 
			arrMessage [17] = 'restaurantes'; 
			arrMessage [18] = 'tiendas'; 
			arrMessage [19] = 'bares'; 
			arrMessage [20] = '<strong> Golondrinas </strong> barcelona'; 
			arrMessage [21] = '<strong> l\aquarium </strong> barcelona'; 
			arrMessage [22] = '<strong> zoo </strong> barcelona'; 
			arrMessage [23] = '<strong> feria </strong> barcelona'; 
			arrMessage [24] = 'actividades <strong> turísticas </strong>'; 
			arrMessage [25] = 'actividades <strong> culturales </strong>'; 
			arrMessage [26] = 'ruta del <strong> modernismo </strong>'; 
			arrMessage [27] = 'PLANO'; 
			
			
			}
			
			if (Type == 5) { 
			arrMessage [0] = 'Descuento del 10% para estancias de una semana o más. <br> Descuento del 30% para estancias de un mes o más. <br> Coste 0 para bebés de 1 a 23 meses . <br> Niños a partir de 24 meses cuentan como persona extra. <br> Check-in posteriores a las 20:00 hs tienen cargo adicional de 50 €. <br> 7% IVA no incluido. '; 
			arrMessage [1] ='2 a 13 años'; 
			arrMessage [2] ='1 a 23 meses'; 
			arrMessage [3] ='7% IVA '; 
			arrMessage [4] ='30% del Total '; 
			arrMessage [5] = 'A pagar en Check-in'; 
			arrMessage [6] = 'A depositar en Check-in';  
			arrMessage [7] ='34 111222333 '; 
			arrMessage [8] = '* Estos datos son obligatorios.'; 
			arrMessage [9] = 'Tu nombre'; 
			arrMessage [10] = 'Tu e-mail'; 
			arrMessage [11] = 'Nombre del destinatario'; 
			arrMessage [12] = 'E-mail del destinatario'; 
			arrMessage [13] = 'Comentario'; 
			arrMessage [14] = 'vivir en barcelona'; 
			arrMessage [15] = 'agenda cultural'; 
			arrMessage [16] = 'música'; 
			arrMessage [17] = 'clásicos ciudad'; 
			arrMessage [18] = 'entradas'; 
			arrMessage [19] = 'black & white'; 
			arrMessage [20] = '<p> Gracias por confiar a su estancia en Barcelona. Estaremos encantados de recibirte. </ p> <p> Si has realizado el pago a través de transferencia bancaria, debes hacer una transferencia a la cuenta: 0081-7301-31-0001133624, indicando en el concepto tu número de reserva y enviar el justificante por mail (info@blackandwhitehome.com). <br> Te enviaremos un mail de confirmación en el momento que hayamos confirmado el abono del importe. </ p> '; 
			arrMessage [21] = '<p> Error al realizar el pago con la tarjeta. </ p> <p> Imprime esta página y ponte en contacto con nosotros para solucionar el problema. < / p> '; 
			arrMessage [22] = 'Estado Reserva'; 
			arrMessage [23] = 'rechazada'; 
			arrMessage [24] = 'Nº Reserva'; 
			arrMessage [25] = 'Fecha Reserva'; 
			arrMessage [26] = 'Apartamento'; 
			arrMessage [27] = 'Fecha Entrada'; 
			arrMessage [28] = 'Fecha Salida'; 
			arrMessage [29] = 'Noches'; 
			arrMessage [30] = 'Nº personas'; 
			arrMessage [31] = 'Nombre y Apellidos'; 
			arrMessage [32] = 'Documento'; 
			arrMessage [33] = 'E-mail'; 
			arrMessage [34] = 'Teléfono fijo'; 
			arrMessage [35] = 'Teléfono móvil'; 
			arrMessage [36] = 'Forma de pago'; 
			arrMessage [37] = 'Total reserva'; 
			arrMessage [38] = 'A pagar ahora'; 
			arrMessage [39] = 'Pendiente'; 
			arrMessage [40] = 'Si necesitas asistencia técnica para hacer tu reserva contacta con nosotros:'; 
			arrMessage [41] = 'Condiciones de los precios'; 
			arrMessage [42] = 'Adultos'; 
			arrMessage [43] = 'Niños'; 
			arrMessage [44] = 'Bebés'; 
			arrMessage [45] = 'Debe hacer una transferencia a la cuenta: 0081-7301-31-0001133624, indicando en el concepto tu número de reserva y enviar el justificante por mail (info@blackandwhitehome.com). <br> Te enviaremos un mail de confirmación en el momento que hayamos confirmado el abono del importe. <br> Información para transferencias internacionales: <br> IBAN ES46008173013100033624 <br> BIC BSAB ESBB '; 
			arrMessage [46] = 'He leído, entiendo y acepto las Condiciones de Reserva.'; 
			arrMessage [47] = 'Si tienes requerimientos especiales o quieres enviarnos algún comentario, no dudes en hacerlo.'; 
			arrMessage [48] = 'Presionando el botón "CONFIRMAR Y PAGAR", estás autorizando a Black and white home a cargar en su tarjeta el 30% del total de la reserva como garantía de la reserva del apartamento, para tu estancia seleccionada. '; 
		}
			
			if (Type == 6) {  
			arrMessage [0] = 'Nº de personas'; 
			arrMessage [1] = 'Precio por noche'; 
			arrMessage [2] = 'personas'; 
			arrMessage [3] = 'persona extra'; 
			arrMessage [4] = 'máx.persones';  
			arrMessage [5] = 'Fecha Entrada'; 
			arrMessage [6] = 'Fecha Salida'; 
			arrMessage [7] = 'Adultos'; 
			arrMessage [8] = 'Niños'; 
			arrMessage [9] = 'Bebés'; 
			arrMessage [10] = 'Total'; 
			arrMessage [11] = 'A pagar ahora'; 
			arrMessage [12] = 'Pendiente'; 
			arrMessage [13] = 'Fianza'; 
			arrMessage [14] = 'Nombre *'; 
			arrMessage [15] = 'Apellidos *'; 
			arrMessage [16] = 'Tipo documento *'; 
			arrMessage [17] = 'Nº documento *'; 
			arrMessage [18] = 'E-mail *'; 
			arrMessage [19] = 'Confirmar e-mail *'; 
			arrMessage [20] = 'Teléfono fijo *'; 
			arrMessage [21] = 'Teléfono móvil *'; 
			arrMessage [22] = 'Datos para la factura'; 
			arrMessage [23] = 'Dirección *'; 
			arrMessage [24] = 'Código Postal *'; 
			arrMessage [25] = 'Población *'; 
			arrMessage [26] = 'Provincia *'; 
			arrMessage [27] = 'pasaporte'; 
			arrMessage [28] = 'DNI'; 
		} 
			
		if (Type == 7) { 
				arrMessage [0] = 'servicios'; 
				arrMessage [1] = 'Enviar vínculo:'; 
				arrMessage [2] = 'precios <br> condiciones <br> reservas'; 
				arrMessage [3] = 'imágenes'; 
				arrMessage [4] = 'servicios'; 
				arrMessage [5] = 'Enviar a un amigo'; 
				arrMessage [6] = 'ir'; 
				arrMessage [7] = 'reservas'; 
				arrMessage [8] = 'Lo sentimos, no se han encontrado apartamentos disponibles, seleccione otras fechas por favor.'; 
				
			}
			
	}
}







/* VALIDACION BOOKING */

function ValidateBooking(){
/* VARIABLES */

document.frmReserva.CP.value = Trim(document.frmReserva.CP.value);
document.frmReserva.CPFactura.value = Trim(document.frmReserva.CPFactura.value);
document.frmReserva.TelefonoMovil.value = Trim(document.frmReserva.TelefonoMovil.value);
document.frmReserva.TelefonoFijo.value = Trim(document.frmReserva.TelefonoFijo.value);

var errors = '';
var strDate1 = '';
var strDate2 = '';
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
var TipoIVA = 1.00;
var PrecioBase = Number(document.frmReserva.iPrecioBase.value);
var PrecioExtra = Number(document.frmReserva.iPrecioExtra.value);
var BasePersonas = Number(document.frmReserva.iBasePersonas.value);
var MaxPersonas = Number(document.frmReserva.iMaxPersonas.value);
var TotalPersonas = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) + Number(document.frmReserva.Baby.value);
var TotalAdultos = Number(document.frmReserva.Adult.value);
var TotalPersonasAPagar = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);	
var IdIdioma = document.frmReserva.IdIdioma.value;
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();
var IdApartamento = document.frmReserva.IdApartamento.value;

var strNumeroDocumento = '';
var strCadena="TRWAGMYFPDXBNJZSQVHLCKET";
var intPosicion;
var strLetra;
var strLet;
var intDNI;
	
//ValidateFechasPersonas(<%=strIdIdioma%>);ValidateDatosPersonales(<%=strIdIdioma%>,2,'<%=Session("SessionId")%>','<%=Session("IdApartamento")%>');

	/* CREAMOS EL ARRAY DE MENSAJES SEGUN IDIOMA*/
	SelectLanguage(IdIdioma,2);

	/* VALIDACION DE DATOS 1 */
	if (TotalPersonas > MaxPersonas) {
		errors+=arrMessage[1] + ' ' + MaxPersonas + ' \n';
	}
	
	if(Trim(document.frmReserva.FechaSalida.value)!="")
	{
		if (!isDate(document.frmReserva.FechaSalida.value,0)) {
			errors+=arrMessage[3]; 
			strDate1Ok=0;
		} else {
			strDate1 = document.frmReserva.FechaSalida.value;
			m_fecha1 = strDate1.split('/');
			dia_fecha1 = m_fecha1[0];
			mes_fecha1 = m_fecha1[1];
			year_fecha1 = m_fecha1[2];
			mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
			strDate1Ok = 1;
		}
	} else {
		strDate1 = ""
		errors+=arrMessage[4];
		strDate1Ok = 0;
	}


	if(Trim(document.frmReserva.FechaLlegada.value)!="")
	{
		if (!isDate(document.frmReserva.FechaLlegada.value,0)) {
			errors+=arrMessage[5]; 
			strDate2Ok=0;
		} else {
			strDate2 = document.frmReserva.FechaLlegada.value;
			m_fecha2 = strDate2.split('/');
			dia_fecha2 = m_fecha2[0];
			mes_fecha2 = m_fecha2[1];
			year_fecha2 = m_fecha2[2];
			mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			
			var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
			
			if(fecha2_js<Today) {
				errors+=arrMessage[6]; 
				strDate2Ok=0;
			} else {
				strDate2Ok=1;
			}
		}
	} else {
		strDate2 = "";
		errors+=arrMessage[7];
		strDate2Ok=0;
	}
	
	if((strDate1!="") && (strDate2)!="") {
		//Total de Dias (Noches)		
		TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
		if  (TotalDias < 0) {
			errors+=arrMessage[8]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias == 0) {
			errors+=arrMessage[9]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias < 1) {
			errors+=arrMessage[10]; 
		}
	}
	
	
	
	
	
	
	/* VALIDACION DE DATOS 2 */

	if(Trim(document.frmReserva.Nombre.value)=="") errors+=arrMessage[12]; 
	if(Trim(document.frmReserva.Apellidos.value)=="") errors+=arrMessage[13]; 
	if(Trim(document.frmReserva.NumeroDocumento.value)=="")
	{
		errors+=arrMessage[14]; 
	} else {
		if (document.frmReserva.TipoDocumento.value=='DNI')
		{
			strNumeroDocumento = document.frmReserva.NumeroDocumento.value;
			intDNI = strNumeroDocumento.substring(0,strNumeroDocumento.length-1);
			strLet=strNumeroDocumento.charAt(strNumeroDocumento.length-1);
	
			if (!isNaN(strLet))
			{
				errors+=arrMessage[15]; 
			} else {
				intPosicion = intDNI % 23;
				strLetra = strCadena.substring(intPosicion,intPosicion+1)
				if (strLetra!=strLet.toUpperCase())
				{
				errors+=arrMessage[16]; 
				}
			}
		}	
	}

	if (Trim(document.frmReserva.Email.value)=="")
	{
		errors+=arrMessage[17]; 
	} else {
		var str = Trim(document.frmReserva.Email.value)
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)


		if (str.indexOf(at)==-1) {
			errors+=arrMessage[18];
		} else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
			errors+=arrMessage[18];
		} else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
			errors+=arrMessage[18];
		} else if (str.indexOf(at,(lat+1))!=-1) {
			errors+=arrMessage[18];
		} else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {
			errors+=arrMessage[18];
		} else if (str.indexOf(dot,(lat+2))==-1) {
			errors+=arrMessage[18];
		} else if (str.indexOf(" ")!=-1) {
			errors+=arrMessage[18];
		}
		
		if(Trim(document.frmReserva.Email.value)!=Trim(document.frmReserva.ConfirmEmail.value)) {
			errors+=arrMessage[19];
		}
	}

	if(Trim(document.frmReserva.TelefonoMovil.value)=="") {
		errors+=arrMessage[20]; 
	} 
	//Éste Else If era para mirar si el teléfono no era un número.
	//else if (isNaN(Trim(document.frmReserva.TelefonoMovil.value))==true) {
	   //errors+=arrMessage[21];
	//}

	//if(Trim(document.frmReserva.TelefonoFijo.value)!="") {
		//if (isNaN(Trim(document.frmReserva.TelefonoFijo.value))==true) errors+=arrMessage[22];
	//}
	
	if(document.frmReserva.ConfirmConditions.checked == false)
	{
		errors+=arrMessage[28]; 
	}
	
	if(document.frmReserva.Notas.value.length > 5000)
	{
		errors+=arrMessage[29]; 
	}

	if(errors){
		alert(arrMessage[11]+errors);
		return false;
	} else {
		
		
/*		if(TotalPersonasAPagar <= BasePersonas){ 
			ImporteDia = PrecioBase;
		} else {
			ImporteDia = (PrecioBase + ((Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) - BasePersonas)*PrecioExtra));
		}
		
		//Calculamos el porcentaje de descuento	
		if (TotalDias >= 27){
		//Cojemos el descuento de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento2.value)/100));
		} else if(TotalDias >= 7){
		//Cojemos el descuento de más de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento1.value)/100));
		} else {
			TotalPercentage	= 1;
		}		
		
		//Calculamos el importe total de la limpieza (que ya lleva el IVA incorporado)
		var Limpieza = Number(document.frmReserva.Limpieza.value);		

		TotalAmount = ((ImporteDia * TotalDias * TipoIVA * TotalPercentage) + Limpieza);
		TotalToPay = TotalAmount * 0.3;
		TotalEstancia = TotalAmount;
		TotalPorcentaje = TotalAmount * 0.3;

		TotalAmount = TotalAmount.toFixed(2);
		TotalToPay = TotalToPay.toFixed(2);
		TotalEstancia = TotalEstancia.toFixed(2); 
		TotalPorcentaje = TotalPorcentaje.toFixed(2);

		TotalPendiente = (TotalAmount - TotalToPay);
		TotalPendiente = TotalPendiente.toFixed(2);
		
		
		document.frmReserva.TotalDias.value = TotalDias;
		
		if(TotalDias>0){
			document.frmReserva.Amount.value = TotalAmount;
			document.frmReserva.ToPay.value = TotalToPay;
			
			document.frmReserva.Total.value = TotalEstancia + ' €';
			document.frmReserva.Porcentaje.value = TotalPorcentaje + ' €';
			document.frmReserva.Pendiente.value = TotalPendiente + ' €';
			document.frmReserva.NumNochesTotal.value = TotalDias;
		} else {
			document.frmReserva.Amount.value = '';
			document.frmReserva.ToPay.value = '';
			document.frmReserva.Total.value = '';
			document.frmReserva.Porcentaje.value =  '';
			document.frmReserva.Pendiente.value = '';
			document.frmReserva.NumNochesTotal.value = '';
		}		
*/		

		//Validamos si las fechas estan disponibles al final de todo
		if(errors==''){
			
			if (window.XMLHttpRequest){
				// if IE7, Mozilla, Safari, etc: Use native object
				xmlhttp = new XMLHttpRequest(); // no var
				//xmlhttp.overrideMimeType('text/xml');
				xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + strDate2 + '&Date2=' + strDate1, true);
				//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
				xmlhttp.onreadystatechange = function handleHttpResponse() {
				  if (xmlhttp.readyState == 4) {
					// Split the comma delimited response into an array
					if(xmlhttp.responseText=='<HTML>Error</HTML>'){
						alert(arrMessage[0]);
						return false;
					} else {
						//if (document.frmReserva.ConfirmConditions.checked){
						document.frmReserva.ActionToDo.value = 'Reservar';
						document.frmReserva.submit();
						return true;
						//}
					}
				  }
				};
				xmlhttp.send(null)	
			}
			else if (window.ActiveXObject){
			
				// ...otherwise, use the ActiveX control for IE5.x and IE6
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // no var
				xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + strDate2 + '&Date2=' + strDate1, true);
				//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
				xmlhttp.onreadystatechange = function handleHttpResponse() {
				  if (xmlhttp.readyState == 4) {
					// Split the comma delimited response into an array
					if(xmlhttp.responseText=='<HTML>Error</HTML>'){
						alert(arrMessage[0]);
						return false;
					} else {
						//if (document.frmReserva.ConfirmConditions.checked){
						document.frmReserva.ActionToDo.value = 'Reservar';
						document.frmReserva.submit();
						return true;
						//}
					}
				  }
				};
				xmlhttp.send(null)	
			
			} 	
		}
	}

}
/* END VALIDACION BOOKING */

/* VALIDACION BOOKING */

function ValidateBookingBO(){
/* VARIABLES */
var errors = '';
var strDate1 = '';
var strDate2 = '';
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
var TipoIVA = 1.00;
var PrecioBase = Number(document.frmReserva.iPrecioBase.value);
var PrecioExtra = Number(document.frmReserva.iPrecioExtra.value);
var BasePersonas = Number(document.frmReserva.iBasePersonas.value);
var MaxPersonas = Number(document.frmReserva.iMaxPersonas.value);
var TotalPersonas = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) + Number(document.frmReserva.Baby.value);
var TotalAdultos = Number(document.frmReserva.Adult.value);
var TotalPersonasAPagar = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);	
var IdIdioma = document.frmReserva.IdIdioma.value;
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();
var IdApartamento = document.frmReserva.IdApartamento.value;

var strNumeroDocumento = '';
var strCadena="TRWAGMYFPDXBNJZSQVHLCKET";
var intPosicion;
var strLetra;
var strLet;
var intDNI;
	
//ValidateFechasPersonas(<%=strIdIdioma%>);ValidateDatosPersonales(<%=strIdIdioma%>,2,'<%=Session("SessionId")%>','<%=Session("IdApartamento")%>');

	/* CREAMOS EL ARRAY DE MENSAJES SEGUN IDIOMA*/
	SelectLanguage(IdIdioma,2);

	/* VALIDACION DE DATOS 1 */
	if (TotalPersonas > MaxPersonas) {
		errors+=arrMessage[1] + ' ' + MaxPersonas + ' \n';
	}
	
	if(Trim(document.frmReserva.FechaSalida.value)!="")
	{
		if (!isDate(document.frmReserva.FechaSalida.value,0)) {
			errors+=arrMessage[3]; 
			strDate1Ok=0;
		} else {
			strDate1 = document.frmReserva.FechaSalida.value;
			m_fecha1 = strDate1.split('/');
			dia_fecha1 = m_fecha1[0];
			mes_fecha1 = m_fecha1[1];
			year_fecha1 = m_fecha1[2];
			mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
			strDate1Ok = 1;
		}
	} else {
		strDate1 = ""
		errors+=arrMessage[4];
		strDate1Ok = 0;
	}


	if(Trim(document.frmReserva.FechaLlegada.value)!="")
	{
		if (!isDate(document.frmReserva.FechaLlegada.value,0)) {
			errors+=arrMessage[5]; 
			strDate2Ok=0;
		} else {
			strDate2 = document.frmReserva.FechaLlegada.value;
			m_fecha2 = strDate2.split('/');
			dia_fecha2 = m_fecha2[0];
			mes_fecha2 = m_fecha2[1];
			year_fecha2 = m_fecha2[2];
			mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			
			var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
			
			//if(fecha2_js<Today) {
				//errors+=arrMessage[6]; 
				//strDate2Ok=0;
			//} else {
				strDate2Ok=1;
			//}
		}
	} else {
		strDate2 = "";
		errors+=arrMessage[7];
		strDate2Ok=0;
	}
	
	if((strDate1!="") && (strDate2)!="") {
		//Total de Dias (Noches)
		TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
		if  (TotalDias < 0) {
			errors+=arrMessage[8]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias == 0) {
			errors+=arrMessage[9]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias < 1) {
			errors+=arrMessage[10]; 
		}
	}
	
	
	document.frmReserva.TotalDias.value = TotalDias;
	
	
	
	/* VALIDACION DE DATOS 2 */

var TotalNaN = document.frmReserva.Total.value;
TotalNaN = TotalNaN.substring(0,TotalNaN.length-2);

var PorcentajeNaN = document.frmReserva.Porcentaje.value;
PorcentajeNaN = PorcentajeNaN.substring(0,PorcentajeNaN.length-2);

var PendienteNaN = document.frmReserva.Pendiente.value;
PendienteNaN = PendienteNaN.substring(0,PendienteNaN.length-2);

if(isNaN(TotalNaN) == true) errors+= arrMessage[30]; 
if(isNaN(PorcentajeNaN) == true) errors+= arrMessage[31]; 
if(isNaN(PendienteNaN) == true) errors+= arrMessage[32]; 


	if(Trim(document.frmReserva.Nombre.value)=="") errors+=arrMessage[12]; 
	if(Trim(document.frmReserva.Apellidos.value)=="") errors+=arrMessage[13]; 
	if(Trim(document.frmReserva.NumeroDocumento.value)=="")
	{
		errors+=arrMessage[14]; 
	} else {
		if (document.frmReserva.TipoDocumento.value=='DNI')
		{
			strNumeroDocumento = document.frmReserva.NumeroDocumento.value;
			intDNI = strNumeroDocumento.substring(0,strNumeroDocumento.length-1);
			strLet=strNumeroDocumento.charAt(strNumeroDocumento.length-1);
	
			if (!isNaN(strLet))
			{
				errors+=arrMessage[15]; 
			} else {
				intPosicion = intDNI % 23;
				strLetra = strCadena.substring(intPosicion,intPosicion+1)
				if (strLetra!=strLet.toUpperCase())
				{
				errors+=arrMessage[16]; 
				}
			}
		}	
	}

	if (Trim(document.frmReserva.Email.value)=="")
	{
		errors+=arrMessage[17]; 
	} else {
		var str = Trim(document.frmReserva.Email.value)
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)


		if (str.indexOf(at)==-1) {
			errors+=arrMessage[18];
		} else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
			errors+=arrMessage[18];
		} else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
			errors+=arrMessage[18];
		} else if (str.indexOf(at,(lat+1))!=-1) {
			errors+=arrMessage[18];
		} else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {
			errors+=arrMessage[18];
		} else if (str.indexOf(dot,(lat+2))==-1) {
			errors+=arrMessage[18];
		} else if (str.indexOf(" ")!=-1) {
			errors+=arrMessage[18];
		}
		
		if(Trim(document.frmReserva.Email.value)!=Trim(document.frmReserva.ConfirmEmail.value)) {
			errors+=arrMessage[19];
		}
	}

	if(Trim(document.frmReserva.TelefonoMovil.value)=="") {
		errors+=arrMessage[20]; 
	} else if (isNaN(Trim(document.frmReserva.TelefonoMovil.value))==true) {
	   errors+=arrMessage[21];
	}

	if(Trim(document.frmReserva.TelefonoFijo.value)!="") {
		if (isNaN(Trim(document.frmReserva.TelefonoFijo.value))==true) errors+=arrMessage[22];
	}
	
	if(document.frmReserva.ConfirmConditions.checked == false)
	{
		errors+=arrMessage[28]; 
	}
	
	if(document.frmReserva.Notas.value.length > 5000)
	{
		errors+=arrMessage[29]; 
	}

	if(errors){
		alert(arrMessage[11]+errors);
		return false;
	} else {
		
		//Validamos si las fechas estan disponibles al final de todo
/*		if(errors==''){
			if (window.XMLHttpRequest){
				// if IE7, Mozilla, Safari, etc: Use native object
				xmlhttp = new XMLHttpRequest(); // no var
				//xmlhttp.overrideMimeType('text/xml');
				xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + document.frmReserva.FechaSalida.value + '&Date2=' + document.frmReserva.FechaLlegada.value, true);
				//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
				xmlhttp.onreadystatechange = function handleHttpResponse() {
				  if (xmlhttp.readyState == 4) {
					// Split the comma delimited response into an array
					if(xmlhttp.responseText=='<HTML>Error</HTML>'){
						alert(arrMessage[0]);
						return false;
					} else {
						//if (document.frmReserva.ConfirmConditions.checked){
						document.frmReserva.ActionToDo.value = 'Reservar';
//						document.frmReserva.ActionToDo.value = document.frmReserva.IdiomaBO.value;
						document.frmReserva.submit();
						return true;
						//}
					}
				  }
				};
				xmlhttp.send(null)	
			}
			else if (window.ActiveXObject){
			
				// ...otherwise, use the ActiveX control for IE5.x and IE6
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // no var
				xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + document.frmReserva.FechaSalida.value + '&Date2=' + document.frmReserva.FechaLlegada.value, true);
				//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
				xmlhttp.onreadystatechange = function handleHttpResponse() {
				  if (xmlhttp.readyState == 4) {
					// Split the comma delimited response into an array
					if(xmlhttp.responseText=='<HTML>Error</HTML>'){
						alert(arrMessage[0]);
						return false;
					} else {
						//if (document.frmReserva.ConfirmConditions.checked){
						document.frmReserva.ActionToDo.value = 'Reservar';
//						document.frmReserva.ActionToDo.value = document.frmReserva.IdiomaBO.value;						
						document.frmReserva.submit();
						return true;
						//}
					}
				  }
				};
				xmlhttp.send(null)	
			
			} 	
*/		
		if(errors==''){
			
			if (window.XMLHttpRequest){
				// if IE7, Mozilla, Safari, etc: Use native object
				xmlhttp = new XMLHttpRequest(); // no var
				//xmlhttp.overrideMimeType('text/xml');
				xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + strDate2 + '&Date2=' + strDate1, true);
				//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
				xmlhttp.onreadystatechange = function handleHttpResponse() {
				  if (xmlhttp.readyState == 4) {
					// Split the comma delimited response into an array
					if(xmlhttp.responseText=='<HTML>Error</HTML>'){
						alert(arrMessage[0]);
						return false;
					} else {
						//if (document.frmReserva.ConfirmConditions.checked){
						document.frmReserva.ActionToDo.value = 'Reservar';
						document.frmReserva.submit();
						return true;
						//}
					}
				  }
				};
				xmlhttp.send(null)	
			}
			else if (window.ActiveXObject){
			
				// ...otherwise, use the ActiveX control for IE5.x and IE6
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // no var
				xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + strDate2 + '&Date2=' + strDate1, true);
				//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
				xmlhttp.onreadystatechange = function handleHttpResponse() {
				  if (xmlhttp.readyState == 4) {
					// Split the comma delimited response into an array
					if(xmlhttp.responseText=='<HTML>Error</HTML>'){
						alert(arrMessage[0]);
						return false;
					} else {
						//if (document.frmReserva.ConfirmConditions.checked){
						document.frmReserva.ActionToDo.value = 'Reservar';
						document.frmReserva.submit();
						return true;
						//}
					}
				  }
				};
				xmlhttp.send(null)	
			
			} 	

		}
	}

}
/* END VALIDACION BOOKING */
function CalculateBookingAmount(){
/* VARIABLES */
var errors = '';
var strDate1 = '';
var strDate2 = '';
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
//De momento el IVA ya está incluido en los precios de los apartamentos, pero lo dejamos por si acaso
var TipoIVA = 1.00;
var PrecioBase = Number(document.frmReserva.iPrecioBase.value);
var PrecioExtra = Number(document.frmReserva.iPrecioExtra.value);
var BasePersonas = Number(document.frmReserva.iBasePersonas.value);
var MaxPersonas = Number(document.frmReserva.iMaxPersonas.value);
var TotalPersonas = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) + Number(document.frmReserva.Baby.value);
var TotalAdultos = Number(document.frmReserva.Adult.value);
var TotalPersonasAPagar = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);	
var IdIdioma = document.frmReserva.IdIdioma.value;
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();
var IdApartamento = document.frmReserva.IdApartamento.value;

document.frmReserva.Amount.value = '';
document.frmReserva.Total.value = '';
document.frmReserva.Porcentaje.value =  '';
document.frmReserva.Pendiente.value = '';


	/* CREAMOS EL ARRAY DE MENSAJES SEGUN IDIOMA*/
	SelectLanguage(IdIdioma,2);

	/* VALIDACION DE DATOS 1 */
	if (TotalPersonas > MaxPersonas) {
		errors+=arrMessage[1] + ' ' + MaxPersonas + ' \n';
	}
	
	if(Trim(document.frmReserva.FechaSalida.value)!="")
	{
		if (!isDate(document.frmReserva.FechaSalida.value,0)) {
			errors+=arrMessage[3]; 
			strDate1Ok=0;
		} else {
			strDate1 = document.frmReserva.FechaSalida.value;
			m_fecha1 = strDate1.split('/');
			dia_fecha1 = m_fecha1[0];
			mes_fecha1 = m_fecha1[1];
			year_fecha1 = m_fecha1[2];
			mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
			strDate1Ok = 1;
		}
	} else {
		strDate1 = ""
		errors+=arrMessage[4];
		strDate1Ok = 0;
	}


	if(Trim(document.frmReserva.FechaLlegada.value)!="")
	{
		if (!isDate(document.frmReserva.FechaLlegada.value,0)) {
			errors+=arrMessage[5]; 
			strDate2Ok=0;
		} else {
			strDate2 = document.frmReserva.FechaLlegada.value;
			m_fecha2 = strDate2.split('/');
			dia_fecha2 = m_fecha2[0];
			mes_fecha2 = m_fecha2[1];
			year_fecha2 = m_fecha2[2];
			mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			
			var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
			
			if(fecha2_js<Today) {
				errors+=arrMessage[6]; 
				strDate2Ok=0;
			} else {
				strDate2Ok=1;
			}
		}
	} else {
		strDate2 = "";
		errors+=arrMessage[7];
		strDate2Ok=0;
	}
	
	if((strDate1!="") && (strDate2)!="") {
		//Total de Dias (Noches)
		TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
		if  (TotalDias < 0) {
			errors+=arrMessage[8]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias == 0) {
			errors+=arrMessage[9]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias < 1) {
			errors+=arrMessage[10]; 
		}
	}
	
	if(errors==''){

		
		
		
		if(TotalPersonasAPagar <= BasePersonas){ 
			ImporteDia = PrecioBase;
		} else {
			ImporteDia = (PrecioBase + ((Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) - BasePersonas)*PrecioExtra));
		}
		
		//Calculamos el porcentaje de descuento	
		if (TotalDias >= 27){
		//Cojemos el descuento de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento2.value)/100));
		} else if(TotalDias >= 7){
		//Cojemos el descuento de más de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento1.value)/100));
		} else {
			TotalPercentage	= 1;
		}
		
		//Calculamos el importe total de la limpieza (que ya lleva el IVA incorporado)
		var Limpieza = Number(document.frmReserva.Limpieza.value);		

		TotalAmount = ((ImporteDia * TotalDias * TipoIVA * TotalPercentage) + Limpieza);

		//------------Promociones-------------//

		var DescuentoAAplicar = null;
		var DescuentoTotal = null;
		var IndiceArrayDescuentos = null;

		//Creamos la variable donde guardaremos el número de días en los que hay que aplicar el descuento
		var NumeroDeDiasDescuentoPromocion;

		//Calculamos el número de milisegundos desde 1970 de la fecha de inicio que a puesto el usuario en la reserva
		var NumeroMilisegundosFecha2_js;
		NumeroMilisegundosFecha2_js = fecha2_js.getTime();

		//Calculamos el número de milisegundos desde 1970 de la fecha de salida que a puesto el usuario en la reserva
		var NumeroMilisegundosFecha1_js;
		NumeroMilisegundosFecha1_js = fecha1_js.getTime();

		//Cojemos los valores de los milisegundos desde 1970 de las fechas de los arrays de las promociones arrayMilisegundosFechaInicioDesde1970Promocion
		// y arrayMilisegundosFechaFinDesde1970Promocion y los comparamos con los obtenidos arriba.

		for(i=0;i<arrayMilisegundosFechaInicioDesde1970Promocion.length;i++)
		{
			// 1r Caso: Que los dos números de milisegundos esten dentro de la promoción
			// Then Todos los dias elegidos por el usuario tienen Descuento de Promoción
			if((NumeroMilisegundosFecha2_js >= arrayMilisegundosFechaInicioDesde1970Promocion[i]) && (NumeroMilisegundosFecha1_js <= arrayMilisegundosFechaFinDesde1970Promocion[i]))
			{
				NumeroDeDiasDescuentoPromocion = TotalDias;
				IndiceArrayDescuentos = i;
			}

			// 2º Caso: Que solo el número de milisegundos de la Fecha Inicio elejida por el usuario esté dentro de la promoción
			// Then Los días de la Promoción son los que estan dentro de FechaInicio definido por el Usuario y Fecha Final Promoción
			if((NumeroMilisegundosFecha2_js >= arrayMilisegundosFechaInicioDesde1970Promocion[i]) && (NumeroMilisegundosFecha2_js <= arrayMilisegundosFechaFinDesde1970Promocion[i]))
			{
				if(NumeroMilisegundosFecha1_js >= arrayMilisegundosFechaFinDesde1970Promocion[i])
				{
					NumeroDeDiasDescuentoPromocion = (Math.ceil((arrayMilisegundosFechaFinDesde1970Promocion[i] - fecha2_js)/(un_dia)));
					IndiceArrayDescuentos = i;
				}
			}

			// 3r Caso: Que solo el número de milisegundos de la Fecha Final elejida por el usuario esté dentro de la promoción
			// Then Los días de la Promoción son los que estan dentro de Fecha Final definido por el Usuario y Fecha Inicial Promoción
			if((NumeroMilisegundosFecha1_js >= arrayMilisegundosFechaInicioDesde1970Promocion[i]) && (NumeroMilisegundosFecha1_js <= arrayMilisegundosFechaFinDesde1970Promocion[i]))
			{
				if(NumeroMilisegundosFecha2_js <= arrayMilisegundosFechaInicioDesde1970Promocion[i])
				{
					NumeroDeDiasDescuentoPromocion = (Math.ceil((fecha1_js- arrayMilisegundosFechaInicioDesde1970Promocion[i])/(un_dia)));
					IndiceArrayDescuentos = i;
				}
			}

			// 4º Caso: Que los dos números de milisegundos de la promoción esten dentro de las fechas elegidas por el usuario
			// Then Tienen descuento solamente los días de la Promoción
			if((arrayMilisegundosFechaInicioDesde1970Promocion[i] >= NumeroMilisegundosFecha2_js) && (arrayMilisegundosFechaFinDesde1970Promocion[i] <= NumeroMilisegundosFecha1_js))
			{
				NumeroDeDiasDescuentoPromocion = (Math.ceil((arrayMilisegundosFechaFinDesde1970Promocion[i] - arrayMilisegundosFechaInicioDesde1970Promocion[i])/(un_dia)));
				IndiceArrayDescuentos = i;
			}
		}

		if(IndiceArrayDescuentos != null){
			DescuentoAAplicar = arrayPorcentajePromocion[IndiceArrayDescuentos].replace(",",".");
			DescuentoTotal = ((ImporteDia * (TotalDias - NumeroDeDiasDescuentoPromocion) * TipoIVA * TotalPercentage)) + ((ImporteDia * NumeroDeDiasDescuentoPromocion * TipoIVA * TotalPercentage) * (1 - DescuentoAAplicar/100)) + Limpieza;
			TotalAmount = DescuentoTotal;							
		}

		//------------End Promociones-------------//


		TotalToPay = TotalAmount * 0.3;
		TotalEstancia = TotalAmount;
		TotalPorcentaje = TotalAmount * 0.3;

		TotalAmount = TotalAmount.toFixed(2);
		TotalToPay = TotalToPay.toFixed(2);
		TotalEstancia = TotalEstancia.toFixed(2); 
		TotalPorcentaje = TotalPorcentaje.toFixed(2);

		TotalPendiente = (TotalAmount - TotalToPay);
		TotalPendiente = TotalPendiente.toFixed(2);
		
		
		document.frmReserva.TotalDias.value = TotalDias;
		
		if(TotalDias>0){
			document.frmReserva.Amount.value = TotalAmount;
			document.frmReserva.ToPay.value = TotalToPay;
			
			document.frmReserva.Total.value = TotalEstancia + ' €';
			document.frmReserva.Porcentaje.value = TotalPorcentaje + ' €';
			document.frmReserva.Pendiente.value = TotalPendiente + ' €';
			document.frmReserva.NumNochesTotal.value = TotalDias;
		} else {
			document.frmReserva.Amount.value = '';
			document.frmReserva.Total.value = '';
			document.frmReserva.Porcentaje.value =  '';
			document.frmReserva.Pendiente.value = '';
			document.frmReserva.NumNochesTotal.value = '';
		}		
		
	}

}

function CalculateBookingAmountPrecioPersona(){
/* VARIABLES */
var errors = '';
var strDate1 = '';
var strDate2 = '';
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
var TipoIVA = 1.00;
var PrecioBase = Number(document.frmReserva.iPrecioBase.value);
var PrecioExtra = Number(document.frmReserva.iPrecioExtra.value);
var BasePersonas = Number(document.frmReserva.iBasePersonas.value);
var MaxPersonas = Number(document.frmReserva.iMaxPersonas.value);
var TotalPersonas = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) + Number(document.frmReserva.Baby.value);
var TotalAdultos = Number(document.frmReserva.Adult.value);
var TotalPersonasAPagar = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);	
var IdIdioma = document.frmReserva.IdIdioma.value;
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();
var IdApartamento = document.frmReserva.IdApartamento.value;

document.frmReserva.Amount.value = '';
//document.frmReserva.Total.value = '';
document.frmReserva.Porcentaje.value =  '';
document.frmReserva.Pendiente.value = '';


	/* CREAMOS EL ARRAY DE MENSAJES SEGUN IDIOMA*/
	SelectLanguage(IdIdioma,2);

	/* VALIDACION DE DATOS 1 */
	if (TotalPersonas > MaxPersonas) {
		errors+=arrMessage[1] + ' ' + MaxPersonas + ' \n';
	}
	
	if(Trim(document.frmReserva.FechaSalida.value)!="")
	{
		if (!isDate(document.frmReserva.FechaSalida.value,0)) {
			errors+=arrMessage[3]; 
			strDate1Ok=0;
		} else {
			strDate1 = document.frmReserva.FechaSalida.value;
			m_fecha1 = strDate1.split('/');
			dia_fecha1 = m_fecha1[0];
			mes_fecha1 = m_fecha1[1];
			year_fecha1 = m_fecha1[2];
			mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
			strDate1Ok = 1;
		}
	} else {
		strDate1 = ""
		errors+=arrMessage[4];
		strDate1Ok = 0;
	}


	if(Trim(document.frmReserva.FechaLlegada.value)!="")
	{
		if (!isDate(document.frmReserva.FechaLlegada.value,0)) {
			errors+=arrMessage[5]; 
			strDate2Ok=0;
		} else {
			strDate2 = document.frmReserva.FechaLlegada.value;
			m_fecha2 = strDate2.split('/');
			dia_fecha2 = m_fecha2[0];
			mes_fecha2 = m_fecha2[1];
			year_fecha2 = m_fecha2[2];
			mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			
			var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
			
			if(fecha2_js<Today) {
				errors+=arrMessage[6]; 
				strDate2Ok=0;
			} else {
				strDate2Ok=1;
			}
		}
	} else {
		strDate2 = "";
		errors+=arrMessage[7];
		strDate2Ok=0;
	}
	
	if((strDate1!="") && (strDate2)!="") {
		//Total de Dias (Noches)
		//TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));	
		TotalDias = (Math.round((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
		//alert(dateDiff("y","document.frmReserva.FechaLlegada.value","document.frmReserva.FechaSalida.value"));
		
//		function dateDifference(strDate1,strDate2){
//     datDate1= Date.parse(strDate1);
//     datDate2= Date.parse(strDate2);
//     alert((datDate2-datDate1)/(24*60*60*1000))
//}
//
//		dateDifference(document.frmReserva.FechaLlegada.value,document.frmReserva.FechaSalida.value);

		if  (TotalDias < 0) {
			errors+=arrMessage[8]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias == 0) {
			errors+=arrMessage[9]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias < 1) {
			errors+=arrMessage[10]; 
		}
	}
	
	
	
	if(errors==''){
		
		ImporteDia = parseFloat(document.getElementById("PrecioPersona" + TotalPersonas).value);
		
		//Calculamos el porcentaje de descuento	
		if (TotalDias >= 27){
		//Cojemos el descuento de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento2.value)/100));
		} else if(TotalDias >= 7){
		//Cojemos el descuento de más de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento1.value)/100));
		} else {
			TotalPercentage	= 1;
		}
				
		var Limpieza = Number(document.frmReserva.Limpieza.value);

		TotalAmount = ((ImporteDia * TotalDias * TipoIVA * TotalPercentage) + Limpieza);



		//------------Promociones-------------//

		var DescuentoAAplicar = null;
		var DescuentoTotal = null;
		var IndiceArrayDescuentos = null;

		//Creamos la variable donde guardaremos el número de días en los que hay que aplicar el descuento
		var NumeroDeDiasDescuentoPromocion;

		//Calculamos el número de milisegundos desde 1970 de la fecha de inicio que a puesto el usuario en la reserva
		var NumeroMilisegundosFecha2_js;
		NumeroMilisegundosFecha2_js = fecha2_js.getTime();

		//Calculamos el número de milisegundos desde 1970 de la fecha de salida que a puesto el usuario en la reserva
		var NumeroMilisegundosFecha1_js;
		NumeroMilisegundosFecha1_js = fecha1_js.getTime();

		//Cojemos los valores de los milisegundos desde 1970 de las fechas de los arrays de las promociones arrayMilisegundosFechaInicioDesde1970Promocion
		// y arrayMilisegundosFechaFinDesde1970Promocion y los comparamos con los obtenidos arriba.

		for(i=0;i<arrayMilisegundosFechaInicioDesde1970Promocion.length;i++)
		{
			// 1r Caso: Que los dos números de milisegundos esten dentro de la promoción
			// Then Todos los dias elegidos por el usuario tienen Descuento de Promoción
			if((NumeroMilisegundosFecha2_js >= arrayMilisegundosFechaInicioDesde1970Promocion[i]) && (NumeroMilisegundosFecha1_js <= arrayMilisegundosFechaFinDesde1970Promocion[i]))
			{
				NumeroDeDiasDescuentoPromocion = TotalDias;
				IndiceArrayDescuentos = i;
			}

			// 2º Caso: Que solo el número de milisegundos de la Fecha Inicio elejida por el usuario esté dentro de la promoción
			// Then Los días de la Promoción son los que estan dentro de FechaInicio definido por el Usuario y Fecha Final Promoción
			if((NumeroMilisegundosFecha2_js >= arrayMilisegundosFechaInicioDesde1970Promocion[i]) && (NumeroMilisegundosFecha2_js <= arrayMilisegundosFechaFinDesde1970Promocion[i]))
			{
				if(NumeroMilisegundosFecha1_js >= arrayMilisegundosFechaFinDesde1970Promocion[i])
				{
					NumeroDeDiasDescuentoPromocion = (Math.ceil((arrayMilisegundosFechaFinDesde1970Promocion[i] - fecha2_js)/(un_dia)));
					IndiceArrayDescuentos = i;
				}
			}

			// 3r Caso: Que solo el número de milisegundos de la Fecha Final elejida por el usuario esté dentro de la promoción
			// Then Los días de la Promoción son los que estan dentro de Fecha Final definido por el Usuario y Fecha Inicial Promoción
			if((NumeroMilisegundosFecha1_js >= arrayMilisegundosFechaInicioDesde1970Promocion[i]) && (NumeroMilisegundosFecha1_js <= arrayMilisegundosFechaFinDesde1970Promocion[i]))
			{
				if(NumeroMilisegundosFecha2_js <= arrayMilisegundosFechaInicioDesde1970Promocion[i])
				{
					NumeroDeDiasDescuentoPromocion = (Math.ceil((fecha1_js- arrayMilisegundosFechaInicioDesde1970Promocion[i])/(un_dia)));
					IndiceArrayDescuentos = i;
				}
			}

			// 4º Caso: Que los dos números de milisegundos de la promoción esten dentro de las fechas elegidas por el usuario
			// Then Tienen descuento solamente los días de la Promoción
			if((arrayMilisegundosFechaInicioDesde1970Promocion[i] >= NumeroMilisegundosFecha2_js) && (arrayMilisegundosFechaFinDesde1970Promocion[i] <= NumeroMilisegundosFecha1_js))
			{
				NumeroDeDiasDescuentoPromocion = (Math.ceil((arrayMilisegundosFechaFinDesde1970Promocion[i] - arrayMilisegundosFechaInicioDesde1970Promocion[i])/(un_dia)));
				IndiceArrayDescuentos = i;
			}
		}

		if(IndiceArrayDescuentos != null){
			DescuentoAAplicar = arrayPorcentajePromocion[IndiceArrayDescuentos].replace(",",".");
			DescuentoTotal = ((ImporteDia * (TotalDias - NumeroDeDiasDescuentoPromocion) * TipoIVA * TotalPercentage)) + ((ImporteDia * NumeroDeDiasDescuentoPromocion * TipoIVA * TotalPercentage) * (1 - DescuentoAAplicar/100)) + Limpieza;
			TotalAmount = DescuentoTotal;							
		}

		//------------End Promociones-------------//

		TotalToPay = TotalAmount * 0.3;
		TotalEstancia = TotalAmount;
		TotalPorcentaje = TotalAmount * 0.3;

		TotalAmount = TotalAmount.toFixed(2);
		TotalToPay = TotalToPay.toFixed(2);
		TotalEstancia = TotalEstancia.toFixed(2); 
		TotalPorcentaje = TotalPorcentaje.toFixed(2);

		TotalPendiente = (TotalAmount - TotalToPay);
		TotalPendiente = TotalPendiente.toFixed(2);
		
		
		document.frmReserva.TotalDias.value = TotalDias;
		
		if(TotalDias>0){
			document.frmReserva.Amount.value = TotalAmount;
			document.frmReserva.ToPay.value = TotalToPay;
			
			document.frmReserva.Total.value = TotalEstancia + ' €';
			document.frmReserva.Porcentaje.value = TotalPorcentaje + ' €';
			document.frmReserva.Pendiente.value = TotalPendiente + ' €';
			document.frmReserva.NumNochesTotal.value = TotalDias;
		} else {
			document.frmReserva.Amount.value = '';
			document.frmReserva.Total.value = '';
			document.frmReserva.Porcentaje.value =  '';
			document.frmReserva.Pendiente.value = '';
			document.frmReserva.NumNochesTotal.value = '';
		}		
		
	}

}

function CalculateBookingAmountBO(){
/* VARIABLES */
var errors = '';
var strDate1 = '';
var strDate2 = '';
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
var TipoIVA = 1.00;
var PrecioBase = Number(document.frmReserva.iPrecioBase.value);
var PrecioExtra = Number(document.frmReserva.iPrecioExtra.value);
var BasePersonas = Number(document.frmReserva.iBasePersonas.value);
var MaxPersonas = Number(document.frmReserva.iMaxPersonas.value);
var Limpieza = Number(document.frmReserva.Limpieza.value);
var TotalPersonas = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) + Number(document.frmReserva.Baby.value);
var TotalAdultos = Number(document.frmReserva.Adult.value);
var TotalPersonasAPagar = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);	
var IdIdioma = document.frmReserva.IdIdioma.value;
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();
var IdApartamento = document.frmReserva.IdApartamento.value;

document.frmReserva.Amount.value = '';
document.frmReserva.Total.value = '';
document.frmReserva.Porcentaje.value =  '';
document.frmReserva.Pendiente.value = '';


	/* CREAMOS EL ARRAY DE MENSAJES SEGUN IDIOMA*/
	SelectLanguage(IdIdioma,2);

	/* VALIDACION DE DATOS 1 */
	if (TotalPersonas > MaxPersonas) {
		errors+=arrMessage[1] + ' ' + MaxPersonas + ' \n';
	}
	
	if(Trim(document.frmReserva.FechaSalida.value)!="")
	{
		if (!isDate(document.frmReserva.FechaSalida.value,0)) {
			errors+=arrMessage[3]; 
			strDate1Ok=0;
		} else {
			strDate1 = document.frmReserva.FechaSalida.value;
			m_fecha1 = strDate1.split('/');
			dia_fecha1 = m_fecha1[0];
			mes_fecha1 = m_fecha1[1];
			year_fecha1 = m_fecha1[2];
			mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
			strDate1Ok = 1;
		}
	} else {
		strDate1 = ""
		errors+=arrMessage[4];
		strDate1Ok = 0;
	}


	if(Trim(document.frmReserva.FechaLlegada.value)!="")
	{
		if (!isDate(document.frmReserva.FechaLlegada.value,0)) {
			errors+=arrMessage[5]; 
			strDate2Ok=0;
		} else {
			strDate2 = document.frmReserva.FechaLlegada.value;
			m_fecha2 = strDate2.split('/');
			dia_fecha2 = m_fecha2[0];
			mes_fecha2 = m_fecha2[1];
			year_fecha2 = m_fecha2[2];
			mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			
			var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
			
			if(fecha2_js<Today) {
				errors+=arrMessage[6]; 
				strDate2Ok=0;
			} else {
				strDate2Ok=1;
			}
		}
	} else {
		strDate2 = "";
		errors+=arrMessage[7];
		strDate2Ok=0;
	}
	
	if((strDate1!="") && (strDate2)!="") {
		//Total de Dias (Noches)
		TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
		if  (TotalDias < 0) {
			errors+=arrMessage[8]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias == 0) {
			errors+=arrMessage[9]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias < 1) {
			errors+=arrMessage[10]; 
		}
	}
	
	
	
	if(errors==''){
		
		
		if(TotalPersonasAPagar <= BasePersonas){ 
			ImporteDia = PrecioBase;
		} else {
			ImporteDia = (PrecioBase + ((Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) - BasePersonas)*PrecioExtra));
		}
		
		//Calculamos el porcentaje de descuento	
		if (TotalDias >= 27){
		//Cojemos el descuento de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento2.value)/100));
		} else if(TotalDias >= 7){
		//Cojemos el descuento de más de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento1.value)/100));
		} else {
			TotalPercentage	= 1;
		}
				
		TotalAmount = (ImporteDia * TotalDias * TipoIVA * TotalPercentage);	
		TotalAmount = TotalAmount.toFixed(2);
		
		TotalToPay = ((ImporteDia * TotalDias * TipoIVA) * 0.3 * TotalPercentage);
		TotalToPay = TotalToPay.toFixed(2);
		
		TotalEstancia = (ImporteDia * TotalDias * TipoIVA * TotalPercentage);
		TotalEstancia = TotalEstancia.toFixed(2); 
		
		TotalPorcentaje = ((ImporteDia * TotalDias * TipoIVA) * 0.3 * TotalPercentage);
		TotalPorcentaje = TotalPorcentaje.toFixed(2);
		
		TotalPendiente = (TotalAmount - TotalToPay);
		TotalPendiente = TotalPendiente.toFixed(2);
		
		
		document.frmReserva.TotalDias.value = TotalDias;
		
		if(TotalDias>0){
			document.frmReserva.Amount.value = TotalAmount;
			document.frmReserva.ToPay.value = TotalToPay;
			
			document.frmReserva.Total.value = TotalEstancia + ' €';
			document.frmReserva.Porcentaje.value = TotalPorcentaje + ' €';
			document.frmReserva.Pendiente.value = TotalPendiente + ' €';
			document.frmReserva.NumNochesTotal.value = TotalDias;

		} else {
			document.frmReserva.Amount.value = '';
			document.frmReserva.Total.value = '';
			document.frmReserva.Porcentaje.value =  '';
			document.frmReserva.Pendiente.value = '';
			document.frmReserva.NumNochesTotal.value = '';
		}		
		
	}

}








function ValidateFechasPersonas(IdIdioma)
{
/* VARIABLES */
var errors = '';
var errorsNext = '';
var strDate1 = '';
var strDate2 = '';
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
var TipoIVA = 1.00;
var PrecioBase = Number(document.frmReserva.iPrecioBase.value);
var PrecioExtra = Number(document.frmReserva.iPrecioExtra.value);
var BasePersonas = Number(document.frmReserva.iBasePersonas.value);
var MaxPersonas = Number(document.frmReserva.iMaxPersonas.value);
var TotalPersonas = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) + Number(document.frmReserva.Baby.value);
var TotalAdultos = Number(document.frmReserva.Adult.value);
var TotalPersonasAPagar = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);	
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();

	
	/* CREAMOS EL ARRAY DE MENSAJES SEGUN IDIOMA*/
	
	SelectLanguage(IdIdioma,2);


	/* VALIDACION DE DATOS */
	if (TotalPersonas > MaxPersonas) {
		errors+=arrMessage[1] + MaxPersonas + ' \n';
	} else if (TotalAdultos == 0) {
		errorsNext+=arrMessage[2];
	}

	if(Trim(document.frmReserva.FechaSalida.value)!="")
	{
		if (!isDate(document.frmReserva.FechaSalida.value,0)) {
			errorsNext+=arrMessage[3]; 
			strDate1Ok=0;
		} else {
			strDate1 = document.frmReserva.FechaSalida.value;
			m_fecha1 = strDate1.split('/');
			dia_fecha1 = m_fecha1[0];
			mes_fecha1 = m_fecha1[1];
			year_fecha1 = m_fecha1[2];
			mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
			strDate1Ok = 1;
		}
	} else {
		strDate1 = ""
		errorsNext+=arrMessage[4];
		strDate1Ok = 0;
	}


	if(Trim(document.frmReserva.FechaLlegada.value)!="")
	{
		if (!isDate(document.frmReserva.FechaLlegada.value,0)) {
			errorsNext+=arrMessage[5]; 
			strDate2Ok=0;
		} else {
			strDate2 = document.frmReserva.FechaLlegada.value;
			m_fecha2 = strDate2.split('/');
			dia_fecha2 = m_fecha2[0];
			mes_fecha2 = m_fecha2[1];
			year_fecha2 = m_fecha2[2];
			mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			
			var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
			
			if(fecha2_js<Today) {
				errorsNext+=arrMessage[6]; 
				strDate2Ok=0;
			} else {
				strDate2Ok=1;
			}
		}
	} else {
		strDate2 = "";
		errorsNext+=arrMessage[7];
		strDate2Ok=0;
	}
	
	//alert('f1: ' + fecha1_js  + ' f2:' + fecha2_js + ' f3:' + fecha3_js + ' f4:' + fecha4_js);
	
	if((strDate1!="") && (strDate2)!="") {
		
		//Total de Dias (Noches)
		TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
		
		if  (TotalDias < 0) {
			errorsNext+=arrMessage[8]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias == 0) {
			errorsNext+=arrMessage[9]; 
			document.frmReserva.FechaSalida.value = '';
		}

		if  (TotalDias < 1) {
			errorsNext+=arrMessage[10]; 
		}
	}

	
    if (errors) {
		alert(arrMessage[11]+errors);
		
		if (strDate1Ok==0) document.frmReserva.FechaLlegada.value = '';
		if (strDate2Ok==0) document.frmReserva.FechaSalida.value = '';
		document.frmReserva.TotalDias.value = '';

		document.frmReserva.Total.value = '';
		document.frmReserva.Porcentaje.value = '';
		document.frmReserva.Pendiente.value = '';
	} else {
	
		if(TotalPersonasAPagar <= BasePersonas){ 
			ImporteDia = PrecioBase;
		} else {
			ImporteDia = (PrecioBase + ((Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value) - BasePersonas)*PrecioExtra));
		}
		
		//Calculamos el porcentaje de descuento	
		if (TotalDias >= 27){
		//Cojemos el descuento de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento2.value)/100));
		} else if(TotalDias >= 7){
		//Cojemos el descuento de más de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento1.value)/100));
		} else {
			TotalPercentage	= 1;
		}				


		TotalAmount = (ImporteDia * TotalDias * TipoIVA * TotalPercentage);
		TotalAmount = TotalAmount.toFixed(2);
		
		TotalToPay = ((ImporteDia * TotalDias * TipoIVA) * 0.3 * TotalPercentage);
		TotalToPay = TotalToPay.toFixed(2);
		
		TotalEstancia = (ImporteDia * TotalDias * TipoIVA * TotalPercentage);
		TotalEstancia = TotalEstancia.toFixed(2); 
		
		TotalPorcentaje = ((ImporteDia * TotalDias * TipoIVA) * 0.3 * TotalPercentage);
		TotalPorcentaje = TotalPorcentaje.toFixed(2);
		
		TotalPendiente = (TotalAmount - TotalToPay);
		TotalPendiente = TotalPendiente.toFixed(2);
		
		
		document.frmReserva.TotalDias.value = TotalDias;
		
		if(TotalDias>0){
			document.frmReserva.Amount.value = TotalAmount;
			document.frmReserva.ToPay.value = TotalToPay;
			
			document.frmReserva.Total.value = TotalEstancia + ' €';
			document.frmReserva.Porcentaje.value = TotalPorcentaje + ' €';
			document.frmReserva.Pendiente.value = TotalPendiente + ' €';
		} else {
			document.frmReserva.Amount.value = '';
			document.frmReserva.Total.value = '';
			document.frmReserva.Porcentaje.value =  '';
			document.frmReserva.Pendiente.value = '';
		}		
		

			if (errorsNext){
				document.frmReserva.Errors.value = errorsNext; 
			} else {
				ValidateBookingDays(document.frmReserva.IdApartamentValidate.value,document.frmReserva.FechaLlegada.value,document.frmReserva.FechaSalida.value)
				/*document.frmReserva.submit();	*/
			}
	}
}

function ValidateDatosPersonales(IdIdioma,intAction,SessionId ,IdApartamento)
{
var errors = document.frmReserva.Errors.value;	
var strNumeroDocumento = '';
var strCadena="TRWAGMYFPDXBNJZSQVHLCKET";
var intPosicion;
var strLetra;
var strLet;
var intDNI;
	
	/* CREAMOS EL ARRAY DE MENSAJES SEGUN IDIOMA*/
	
	SelectLanguage(IdIdioma,2);

	/* VALIDACION DE DATOS */

	if(Trim(document.frmReserva.Nombre.value)=="")
	{
		errors+=arrMessage[12]; 
	}

	if(Trim(document.frmReserva.Apellidos.value)=="")
	{
		errors+=arrMessage[13]; 
	}

	if(Trim(document.frmReserva.NumeroDocumento.value)=="")
	{
		errors+=arrMessage[14]; 
	} else {
			if (document.frmReserva.TipoDocumento.value=='DNI')
			{

				strNumeroDocumento = document.frmReserva.NumeroDocumento.value;
				intDNI = strNumeroDocumento.substring(0,strNumeroDocumento.length-1);
				strLet=strNumeroDocumento.charAt(strNumeroDocumento.length-1);
		
				if (!isNaN(strLet))
				{
					errors+=arrMessage[15]; 
				} else {
					intPosicion = intDNI % 23;
					strLetra = strCadena.substring(intPosicion,intPosicion+1)
					if (strLetra!=strLet.toUpperCase())
					{
					errors+=arrMessage[16]; 
					}
				}
			}	
	}

	if (Trim(document.frmReserva.Email.value)=="")
	{
		errors+=arrMessage[17]; 
	} else {

		var str = Trim(document.frmReserva.Email.value)
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)


		if (str.indexOf(at)==-1) {
			errors+=arrMessage[18];
		} else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
			errors+=arrMessage[18];
		} else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {
			errors+=arrMessage[18];
		} else if (str.indexOf(at,(lat+1))!=-1) {
			errors+=arrMessage[18];
		} else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {
			errors+=arrMessage[18];
		} else if (str.indexOf(dot,(lat+2))==-1) {
			errors+=arrMessage[18];
		} else if (str.indexOf(" ")!=-1) {
			errors+=arrMessage[18];
		}
		
		if(Trim(document.frmReserva.Email.value)!=Trim(document.frmReserva.ConfirmEmail.value)) {
			errors+=arrMessage[19];
		}
	}

	if(Trim(document.frmReserva.TelefonoMovil.value)=="") {
		errors+=arrMessage[20]; 
	} else if (checkInternationalPhone(document.frmReserva.TelefonoMovil.value)==false) {
	   errors+=arrMessage[21];
	}

	if(Trim(document.frmReserva.TelefonoFijo.value)!="") {
		if (checkInternationalPhone(document.frmReserva.TelefonoFijo.value)==false) errors+=arrMessage[22];
	}
	
	if(errors && intAction=='2')
	{
		alert(arrMessage[11]+errors);
	} else {
		if(intAction=='1')
		{
			document.frmReserva.action = 'availability.asp?Id0=' + IdIdioma + '&' + SessionId + '&Id0=' + IdApartamento;
			document.frmReserva.submit();			
		} else {
			if(document.frmReserva.RecibirFactura.value=="Si")
			{
				document.frmReserva.action = 'booking2.asp?Id0=' + IdIdioma + '&' + SessionId + '&Id0=' + IdApartamento;
				document.frmReserva.submit();

			} else {
				document.frmReserva.action = 'booking3.asp?Id0=' + IdIdioma + '&' + SessionId + '&Id0=' + IdApartamento;
				document.frmReserva.submit();
			}
		}
	}
	
}

//function ValidateBookingDays(IdApartamento,Date1,Date2){
//	if (IdApartamento!='' && Date1!='' && Date2!='') {
//		if (window.XMLHttpRequest){
//			// if IE7, Mozilla, Safari, etc: Use native object
//			xmlhttp = new XMLHttpRequest(); // no var
//			//xmlhttp.overrideMimeType('text/xml');
//		
//			xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + Date1 + '&Date2=' + Date2, true);
//			//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
//			xmlhttp.onreadystatechange = function handleHttpResponse() {
//			  if (xmlhttp.readyState == 4) {
//				// Split the comma delimited response into an array
//				if(xmlhttp.responseText=='<HTML>Error</HTML>'){
//					alert(arrMessage[0]);
//				} else {
//					document.frmReserva.submit();
//				}
//			  }
//			};
//			xmlhttp.send(null)	
//		}
//		else if (window.ActiveXObject){
//		
//			// ...otherwise, use the ActiveX control for IE5.x and IE6
//			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // no var
//			xmlhttp.open('GET','confirm_booking_days.asp?' + 'IdApartamento=' + IdApartamento + '&Date1=' + Date1 + '&Date2=' + Date2, true);
//			//alert('updateDataProceso.asp?strRowId=' + strRowId + '&strColumnName=' + strColumnName + '&strColumnValue=' + strColumnValue)
//			xmlhttp.onreadystatechange = function handleHttpResponse() {
//			  if (xmlhttp.readyState == 4) {
//				// Split the comma delimited response into an array
//				if(xmlhttp.responseText=='<HTML>Error</HTML>'){
//					alert(arrMessage[0]);
//				} else {
//					document.frmReserva.submit();
//				}
//			  }
//			};
//			xmlhttp.send(null)	
//		
//		} else {
//		// no XMLHTTP... leave as null
//		} 
//	}
//
//}
//
function SelectText(IdIdioma,IdType,IdNumber)
{
	SelectLanguage(IdIdioma,IdType);
	document.write(arrMessage[IdNumber]);
}

function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function dateIsSpecial(year, month, day) {
var y = SPECIAL_DAYS[year];

	if (!y) return false;
	var m = SPECIAL_DAYS[year][month];
	if (!m) return false;
	for (var i in m) if (m[i] == day) return true;
	return false;
};

function specialDateStatusFunc(date, y, m, d) {
	if (dateIsSpecial(y, m, d)) {
	return "special";
	}
	else
	return false; // other dates are enabled
	// return true if you want to disable other dates
};

function dateStatusHandler(date, y, m, d) {
	if (dateIsSpecial(y, m, d)) return 'special';
	else return false;
	// return true above if you want to disable other dates
}
  
var oldLink = null;

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
	cal.hide();                        // hide the calendar
	//  cal.destroy();
	_dynarch_popupCalendar = null;
}

// This function gets called when the end-user clicks on some date.
function setSelectedBooking(cal, date) {
	cal.sel.value = date; // just update the date in the input field.
	if (cal.dateClicked) cal.callCloseHandler();
	CalculateBookingAmount();
	//ValidateFormAvailability();
	// if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
	// if we add this call we close the calendar on single-click.
	// just to exemplify both cases, we are using this only for the 1st
	// and the 3rd field, while 2nd and 4th will still require double-click.
	// cal.callCloseHandler();
}
function setSelectedBookingValidarPersonas(cal, date) {
	cal.sel.value = date; // just update the date in the input field.
	if (cal.dateClicked) cal.callCloseHandler();
	CalculateBookingAmountPrecioPersona();
	//ValidateFormAvailability();
	// if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
	// if we add this call we close the calendar on single-click.
	// just to exemplify both cases, we are using this only for the 1st
	// and the 3rd field, while 2nd and 4th will still require double-click.
	// cal.callCloseHandler();
}
function setSelectedBookingBO(cal, date) {
	IniciarPrecios();
	cal.sel.value = date; // just update the date in the input field.
	if (cal.dateClicked) cal.callCloseHandler();
	//ValidateFormAvailability();
	// if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
	// if we add this call we close the calendar on single-click.
	// just to exemplify both cases, we are using this only for the 1st
	// and the 3rd field, while 2nd and 4th will still require double-click.
	// cal.callCloseHandler();
}

// This function gets called when the end-user clicks on some date.
function setSelected(cal, date) {
	cal.sel.value = date; // just update the date in the input field.
	if (cal.dateClicked) cal.callCloseHandler();
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function flatSelected(cal, date) {
//  var el = document.getElementById("preview");
//  el.innerHTML = date;
}

function showFlatCalendar() {
  var parent = document.getElementById("flatCalendar");

  // construct a calendar giving only the "selected" handler.
  var cal = new Calendar(1, null, flatSelected);

  // hide week numbers
  cal.weekNumbers = true;

  // We want some dates to be disabled; see function isDisabled above
  //cal.setDisabledHandler(isDisabled);
  //cal.setDateFormat("%A, %B %e");
  cal.setDateStatusHandler(specialDateStatusFunc);
  // this call must be the last as it might use data initialized above; if
  // we specify a parent, as opposite to the "showCalendar" function above,
  // then we create a flat calendar -- not popup.  Hidden, though, but...
  cal.create(parent);

  // ... we can show it here.
  cal.show();
}


function showCalendar(id, format, showsTime, showsOtherMonths, showsWeekNumbers) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, setSelected, closeHandler);
    // uncomment the following line to hide the week numbers
    cal.weekNumbers = showsWeekNumbers;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    _dynarch_popupCalendar = cal;     // remember it in the global var

	// configure it to the calendar
	// Marcamos los dias ocupados
	cal.setDateStatusHandler(specialDateStatusFunc);
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el, "Br");        // show the calendar

  return false;
}


function showCalendarBookingValidarPersonas(id, format, showsTime, showsOtherMonths, showsWeekNumbers) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, setSelectedBookingValidarPersonas, closeHandler);
    // uncomment the following line to hide the week numbers
    cal.weekNumbers = showsWeekNumbers;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    _dynarch_popupCalendar = cal;     // remember it in the global var

	// configure it to the calendar
	// Marcamos los dias ocupados
	cal.setDateStatusHandler(specialDateStatusFunc);
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el, "Br");        // show the calendar

return false;
}




function showCalendarBooking(id, format, showsTime, showsOtherMonths, showsWeekNumbers) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, setSelectedBooking, closeHandler);
    // uncomment the following line to hide the week numbers
    cal.weekNumbers = showsWeekNumbers;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    _dynarch_popupCalendar = cal;     // remember it in the global var

	// configure it to the calendar
	// Marcamos los dias ocupados
	cal.setDateStatusHandler(specialDateStatusFunc);
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el, "Br");        // show the calendar

return false;
}

function showCalendarBookingBO(id, format, showsTime, showsOtherMonths, showsWeekNumbers) {
IniciarPrecios();
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, setSelectedBookingBO, closeHandler);
    // uncomment the following line to hide the week numbers
    cal.weekNumbers = showsWeekNumbers;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    _dynarch_popupCalendar = cal;     // remember it in the global var

	// configure it to the calendar
	// Marcamos los dias ocupados
	cal.setDateStatusHandler(specialDateStatusFunc);
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el, "Br");        // show the calendar

return false;
}




function TrimRight( str ) {
var resultStr = "";
var i = 0;
// Return immediately if an invalid value was passed in
if (str+"" == "undefined" || str == null) 
return null;
// Make sure the argument is a string
str += "";

if (str.length == 0) 
resultStr = "";
else {
// Loop through string starting at the end as long as there
// are spaces.
i = str.length - 1;
while ((i >= 0) && (str.charAt(i) == " "))
i--;

// When the loop is done, we're sitting at the last non-space char,
// so return that char plus all previous chars of the string.
resultStr = str.substring(0, i + 1);
}

return resultStr; 
}

function TrimLeft( str ) {
var resultStr = "";
var i = len = 0;
// Return immediately if an invalid value was passed in
if (str+"" == "undefined" || str == null) 
return null;
// Make sure the argument is a string
str += "";
if (str.length == 0) 
resultStr = "";
else { 
// Loop through string starting at the beginning as long as there
// are spaces.
// len = str.length - 1;
len = str.length;

while ((i <= len) && (str.charAt(i) == " "))
i++;
// When the loop is done, we're sitting at the first non-space char,
// so return that char plus the remaining chars of the string.
resultStr = str.substring(i, len);
}
return resultStr;
}

function Trim( str ) {
var resultStr = "";

resultStr = TrimLeft(str);
resultStr = TrimRight(resultStr);

return resultStr;
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
/**********************************************************************/ 
/*Function name :isDigit(theDigit) */ 
/*Usage of this function :test for an digit */ 
/*Input parameter required:thedata=string for test whether is digit */ 
/*Return value :if is digit,return true */ 
/* else return false */ 
/**********************************************************************/ 
function isDigit(theDigit) 
{ 
var digitArray = new Array('0','1','2','3','4','5','6','7','8','9'),j; 

for (j = 0; j < digitArray.length; j++) 
{if (theDigit == digitArray[j]) 
return true 
} 
return false 

} 
/*************************************************************************/ 
/*Function name :isPositiveInteger(theString) */ 
/*Usage of this function :test for an +ve integer */ 
/*Input parameter required:thedata=string for test whether is +ve integer*/ 
/*Return value :if is +ve integer,return true */ 
/* else return false */ 
/*function require :isDigit */ 
/*************************************************************************/ 
function isPositiveInteger(theString) 
{ 
var theData = new String(theString) 

if (!isDigit(theData.charAt(0))) 
if (!(theData.charAt(0)== '+')) 
return false 

for (var i = 1; i < theData.length; i++) 
if (!isDigit(theData.charAt(i))) 
return false 
return true 
} 

/**********************************************************************/ 
/*Function name :isDate(s,f) */ 
/*Usage of this function :To check s is a valid format */ 
/*Input parameter required:s=input string */ 
/* f=input string format */ 
/* =1,in mm/dd/yyyy format */ 
/* else in dd/mm/yyyy */ 
/*Return value :if is a valid date return 1 */ 
/* else return 0 */ 
/*Function required :isPositiveInteger() */ 
/**********************************************************************/ 
function isDate(s,f) 
{var a1=s.split("/"); 
var a2=s.split("-"); 
var e=true; 
if ((a1.length!=3) && (a2.length!=3)) 
{ 
e=false; 
} 
else 
{if (a1.length==3) 
var na=a1; 
if (a2.length==3) 
var na=a2; 
if (isPositiveInteger(na[0]) && isPositiveInteger(na[1]) && isPositiveInteger(na[2])) 
{ if (f==1) 
{var d=na[1],m=na[0]; 
} 
else 
{var d=na[0],m=na[1]; 
} 
var y=na[2]; 
if (((e) && (y<1000)||y.length>4)) 
e=false 
if (e) 
{ 
v=new Date(m+"/"+d+"/"+y); 
if (v.getMonth()!=m-1) 
e=false; 
} 
} 
else 
{ 
e=false; 
} 
} 
return e 
} 


function replaceAll(strSource,lookFor,replaceWith) {
	strLowerCase = strSource.toLowerCase();
	lookForLower = lookFor.toLowerCase();
	while(strLowerCase.indexOf(lookForLower) != -1) {
		posStart = strLowerCase.indexOf(lookForLower)
		posEnd = posStart + lookFor.length
		strLowerCase = strLowerCase.substring(0,posStart) + replaceWith + strLowerCase.substring(posEnd,strLowerCase.length)
		strSource = strSource.substring(0,posStart) + replaceWith + strSource.substring(posEnd,strSource.length)
	}
	return strSource
}


function ValidateDateBooking(Idioma){
var errors = '';
var errorsNext = '';
var strDate1 = '';
var strDate2 = '';
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
var TipoIVA = 1.00;
var TotalPersonas = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);
var TotalAdultos = Number(document.frmReserva.Adult.value);
var TotalPersonasAPagar = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);	
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();


	SelectLanguage(Idioma,2);

	if(Trim(document.frmReserva.FechaLlegada.value)!="")
	{
		if (!isDate(document.frmReserva.FechaLlegada.value,0)) {
			errorsNext+=arrMessage[5]; 
			strDate2Ok=0;
		} else {
			strDate2 = document.frmReserva.FechaLlegada.value;
			m_fecha2 = strDate2.split('/');
			dia_fecha2 = m_fecha2[0];
			mes_fecha2 = m_fecha2[1];
			year_fecha2 = m_fecha2[2];
			mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			
			var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
			
			if(fecha2_js<Today) {
				errorsNext+=arrMessage[6]; 
				strDate2Ok=0;
			} else {
				strDate2Ok=1;
			}
		}
	} else {
		strDate2 = "";
		errorsNext+=arrMessage[7];
		strDate2Ok=0;
	}
	
	if(Trim(document.frmReserva.FechaSalida.value)!="")
	{
		if (!isDate(document.frmReserva.FechaSalida.value,0)) {
			errorsNext+=arrMessage[3]; 
			strDate1Ok=0;
		} else {
			strDate1 = document.frmReserva.FechaSalida.value;
			m_fecha1 = strDate1.split('/');
			dia_fecha1 = m_fecha1[0];
			mes_fecha1 = m_fecha1[1];
			year_fecha1 = m_fecha1[2];
			mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
			var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
			strDate1Ok = 1;
		}
	} else {
		strDate1 = ""
		errorsNext+=arrMessage[4];
		strDate1Ok = 0;
	}
	
	if((strDate1!="") && (strDate2)!="") {
		
		//Total de Dias (Noches)
		TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
		
		if  (TotalDias < 0) {
			errorsNext+=arrMessage[8]; 
			document.frmReserva.FechaSalida.value = '';
		}
		if  (TotalDias == 0) {
			errorsNext+=arrMessage[9]; 
			document.frmReserva.FechaSalida.value = '';
		}

		if  (TotalDias < 1) {
			errorsNext+=arrMessage[10]; 
		}
	}
	
	document.frmReserva.TotalAdultos.value = Number(document.frmReserva.Adult.value) + Number(document.frmReserva.Children.value);
		if(Number(document.frmReserva.TotalAdultos.value) > 6){
			 errorsNext+=arrMessage[1] + ' 6'; 
		}

	errors = errorsNext;
	
    if (errors) {
		alert(arrMessage[11]+errors);
		
		if (strDate1Ok==0) document.frmReserva.FechaLlegada.value = '';
		if (strDate2Ok==0) document.frmReserva.FechaSalida.value = '';
		document.frmReserva.TotalDias.value = '';
	}else{
		document.frmReserva.submit();
		}

}

//*************** BEGIN FUNCIONES DE BUSQUEDA DE APARTAMENTOS ***************//

function CalculateSearchResult(IdIdioma,strDate1,strDate2,PrecioBase,PrecioExtra,BasePersonas,TotalPersonas,opt)
{
/* VARIABLES */
var strDate1Ok = 0;
var strDate2Ok = 0;
var un_dia=1000*60*60*24;
var ImporteDia = 0;
var TipoIVA = 1.00;
var TotalDias;
var TotalAmount;
var TotalPercentage;	
var Today=new Date();
var errorsNext = '';
	

	m_fecha1 = strDate1.split('/');
	dia_fecha1 = m_fecha1[0];
	mes_fecha1 = m_fecha1[1];
	year_fecha1 = m_fecha1[2];
	mes_fecha1 = mes_fecha1 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
	var fecha1_js = new Date(year_fecha1, mes_fecha1, dia_fecha1)
	strDate1Ok = 1;

	m_fecha2 = strDate2.split('/');
	dia_fecha2 = m_fecha2[0];
	mes_fecha2 = m_fecha2[1];
	year_fecha2 = m_fecha2[2];
	mes_fecha2 = mes_fecha2 - 1; // para js los meses del año son de 0 - 11, de ahi ese calculo.
	var fecha2_js = new Date(year_fecha2, mes_fecha2, dia_fecha2);
	if(fecha2_js<Today) {
		errorsNext+='error'; 
		strDate2Ok=0;
	} else {
		strDate2Ok=1;
	}
	
	//Total de Dias (Noches)
	TotalDias = (Math.ceil((fecha1_js.getTime()-fecha2_js.getTime())/(un_dia)));
	
	if(TotalPersonas <= BasePersonas){ 
		ImporteDia = PrecioBase;
	} else {
		ImporteDia = (PrecioBase + ((TotalPersonas - BasePersonas)*PrecioExtra));
	}
	
	//Calculamos el porcentaje de descuento	
		if (TotalDias >= 27){
		//Cojemos el descuento de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento2.value)/100));
		} else if(TotalDias >= 7){
		//Cojemos el descuento de más de una semana de la página del booking o del bookingBO
			TotalPercentage	= (1 - ((document.frmReserva.Descuento1.value)/100));
		} else {
			TotalPercentage	= 1;
		}
			
	TotalAmount = (ImporteDia * TotalDias * TipoIVA * TotalPercentage);
	TotalToPay = ((ImporteDia * TotalDias * TipoIVA) * 0.3 * TotalPercentage);
	TotalEstancia = (ImporteDia * TotalDias * TipoIVA * TotalPercentage);
	TotalEstanciaPorPersona = ((TotalEstancia / TotalPersonas) / TotalDias);
	TotalPorcentaje = ((ImporteDia * TotalDias * TipoIVA) * 0.3 * TotalPercentage);
	TotalPendiente = (TotalAmount - TotalToPay);


	TotalAmount = TotalAmount.formatMoney(2);
	TotalToPay = TotalToPay.formatMoney(2);
	TotalEstancia = TotalEstancia.formatMoney(2); 
	TotalEstanciaPorPersona = TotalEstanciaPorPersona.formatMoney(2);
	TotalPorcentaje = TotalPorcentaje.formatMoney(2);
	TotalPendiente = TotalPendiente.formatMoney(2);
	
	if (opt == '1') return TotalEstancia + ' €';
	if (opt == '2') return TotalToPay + ' €';	
	if (opt == '3') return TotalPendiente + ' €';
	if (opt == '4') return TotalDias;
	if (opt == '5') return TotalEstancia;
	if (opt == '6') return TotalEstanciaPorPersona + ' €';	
			
}

//*************** END FUNCIONES DE BUSQUEDA DE APARTAMENTOS ***************//


function checkInternationalPhone(strPhone){
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // if character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

