// JavaScript Document
/*************************************************************************************************/
function fecha_hora_italiano()
{
meses = new Array ("Gennaio","Febbraio","Marzo","Aprile","Maggio","Gigno","Luglio","Agosto","Settembe","Ottobre","Novembre","Dicembre");
dias = new Array ("Domenica","Luned&igrave;","Marted&igrave;","Mercoled&igrave;","Gioved&igrave;","Venerd&igrave;","Sabato");
        data = new Date();
        index = data.getMonth();
		 dia = data.getDay();
	var an=data.getYear();
	if (an<1000){
		an = 1900+an;
	}
        document.write( dias[dia] + ", " + data.getDate()+ " " + meses[index] +" " + an + " - ");
        var Hora;
        var Minutos;
        var AmPm;
        Hora = data.getHours();
        if (Hora >= 12) {
                AmPm = " P.M.";
        }
        else {
                AmPm = " A.M.";
        }
             if (Hora > 12) {
                Hora -= 12;
        }
        if (Hora == 0) {
                Hora = 12;
        }
        Minutos = data.getMinutes();
        if (Minutos < 10) {
                Minutos = "0" + Minutos;
        }
         document.write(" "+ "Ora " + Hora + ":" + Minutos + AmPm );
	
}
/*************************************************************************************************/
function fecha_hora_ingles()
{
meses = new Array ("January","February","March","April","May","June","July","August","September","October","November","Decembre");
dias = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
        data = new Date();
        index = data.getMonth();
		 dia = data.getDay();
	var an=data.getYear();
	if (an<1000){
		an = 1900+an;
	}
        document.write( dias[dia] + ", " + data.getDate()+ " " + meses[index] +" " + an + " - ");
        var Hora;
        var Minutos;
        var AmPm;
        Hora = data.getHours();
        if (Hora >= 12) {
                AmPm = " P.M.";
        }
        else {
                AmPm = " A.M.";
        }
             if (Hora > 12) {
                Hora -= 12;
        }
        if (Hora == 0) {
                Hora = 12;
        }
        Minutos = data.getMinutes();
        if (Minutos < 10) {
                Minutos = "0" + Minutos;
        }
         document.write(" "+ "Hour " + Hora + ":" + Minutos + AmPm );
	
}
/*************************************************************************************************/
function fecha_hora_frances()
{

meses = new Array ("Janvier","F&eacute;vrier","Mars","Avril","Mai","Juin","Juillet","Ao&uacute;t","Septembre","Octobre","Novembre","D&eacute;cembre");
dias = new Array ("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendreli","Samedi");
        data = new Date();
        index = data.getMonth();
		 dia = data.getDay();
	var an=data.getYear();
	if (an<1000){
		an = 1900+an;
	}
        document.write( dias[dia] + ", " + data.getDate()+ " " + meses[index] +" " + an + " - ");
        var Hora;
        var Minutos;
        var AmPm;
        Hora = data.getHours();
        if (Hora >= 12) {
                AmPm = " P.M.";
        }
        else {
                AmPm = " A.M.";
        }
             if (Hora > 12) {
                Hora -= 12;
        }
        if (Hora == 0) {
                Hora = 12;
        }
        Minutos = data.getMinutes();
        if (Minutos < 10) {
                Minutos = "0" + Minutos;
        }
         document.write(" "+ "Heure " + Hora + ":" + Minutos + AmPm );
}
/*************************************************************************************************/
function fecha_hora_aleman()
{
meses = new Array ("Januar","Februar","M&aacute;rz","April","Mai","Juni","Juli","Ausgut","September","Oktober","November","Dezember");
dias = new Array ("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Vendreli","Sonntag");
        data = new Date();
        index = data.getMonth();
		 dia = data.getDay();
	var an=data.getYear();
	if (an<1000){
		an = 1900+an;
	}
        document.write( dias[dia] + ", " + data.getDate()+ " " + meses[index] +"  " + an + " - ");
        var Hora;
        var Minutos;
        var AmPm;
        Hora = data.getHours();
        if (Hora >= 12) {
                AmPm = " P.M.";
        }
        else {
                AmPm = " A.M.";
        }
             if (Hora > 12) {
                Hora -= 12;
        }
        if (Hora == 0) {
                Hora = 12;
        }
        Minutos = data.getMinutes();
        if (Minutos < 10) {
                Minutos = "0" + Minutos;
        }
         document.write(" "+ "Stunde " + Hora + ":" + Minutos + AmPm );
}

/*************************************************************************************************/
function fecha_hora_catalan()
{
meses = new Array ("Gener","Febrer","Mar&ccedil;","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre");
dias = new Array ("Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte");
        data = new Date();
        index = data.getMonth();
		 dia = data.getDay();
	var an=data.getYear();
	if (an<1000){
		an = 1900+an;
	}
        document.write( dias[dia] + ", " + data.getDate()+ " " + meses[index] +" " + an + " - ");
        var Hora;
        var Minutos;
        var AmPm;
        Hora = data.getHours();
        if (Hora >= 12) {
                AmPm = " P.M.";
        }
        else {
                AmPm = " A.M.";
        }
             if (Hora > 12) {
                Hora -= 12;
        }
        if (Hora == 0) {
                Hora = 12;
        }
        Minutos = data.getMinutes();
        if (Minutos < 10) {
                Minutos = "0" + Minutos;
        }
         document.write(" "+ "Hora " + Hora + ":" + Minutos + AmPm );
}
/***************************************************/
function fecha_hora_castellano()
{
meses = new Array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
dias = new Array ("Domingo","Lunes","Martes","Mi&eacute;rcoles","Jueves","Viernes","S&aacute;bado");
data = new Date();
index = data.getMonth();
dia = data.getDay();
var an=data.getYear();
if (an<1000)
{
	an = 1900+an;
}
  document.write( dias[dia] + ", " + data.getDate()+ " de " + meses[index] +" del " + an + " - ");
  var Hora;
  var Minutos;
  var AmPm;
  Hora = data.getHours();
  if (Hora >= 12) {
          AmPm = " P.M.";
  }
  else {
          AmPm = " A.M.";
  }
       if (Hora > 12) {
          Hora -= 12;
  }
  if (Hora == 0) {
          Hora = 12;
  }
  Minutos = data.getMinutes();
  if (Minutos < 10) {
          Minutos = "0" + Minutos;
  }
   document.write(" "+ "Hora " + Hora + ":" + Minutos + AmPm );
}

/*************************************************************************************************/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*************************************************************************************************/

function oculto()
{
	   document.frm_reservas.oculto_email.value = document.frm_reservas.txt_email.value;

}
/*************************************************************************************************/
function valida_autentificacion(){
	with(document.frmAutentificar){
		if(txt_usuario.value == ""){ // Falta Nombre
			alert('¡Ingrese Nombre de Usuario'); txt_usuario.focus(); return; }
			
		if(txt_clave.value == ""){ // Falta Clave
			alert('¡Ingrese Clave del Usuario'); txt_clave.focus(); return; }
			
		// Desabilito el boton de envio para evitar reenvios
		btnOk.disabled = true;
		action="autentificar.php";
		submit();
	}
}
/**************************************************************************************************/
function verificar_datos(){
	with(document.frm_verificacion){
		if(txt_usuario.value == ""){ // Falta Nombre
			alert('¡Ingrese Nombre de Usuario'); txt_usuario.focus(); return; }
			
		if(txt_clave.value == ""){ // Falta Clave
			alert('¡Ingrese Clave del Usuario'); txt_clave.focus(); return; }
			
		// Desabilito el boton de envio para evitar reenvios
		btn_enviar.disabled = true;
		action="tpv_comprar.php";
		submit();
	}
}
//**********************************************************************************
function valida_autentificacion_cliente(){
	with(document.frm_reservas){
		if(txt_nombre.value == ""){ 
			alert('¡Ingrese su Nombre o Razón Social');  txt_nombre.focus(); txt_nombre.style.background="#A7CCEB"; return; }
			
		if(txt_apellidos.value == ""){ 
			alert('¡Ingrese sus Apellidos '); txt_apellidos.focus(); txt_apellidos.style.background="#A7CCEB"; return; }

		if(txt_direccion.value == ""){ 
			alert('¡Ingrese su Dirección');  txt_direccion.focus(); txt_direccion.style.background="#A7CCEB"; return; }

		if(txt_poblacion.value == ""){ 
			alert('¡Ingrese su Población '); txt_poblacion.focus(); txt_poblacion.style.background="#A7CCEB"; return; }						

		if(txt_pais.value == ""){ 
			alert('¡Ingrese su País de Procedencia'); txt_pais.focus(); txt_pais.style.background="#A7CCEB"; return; }
			
		if(txt_telefono.value == ""){ 
			alert('¡Ingrese su Teléfono de Contacto'); txt_telefono.focus(); txt_telefono.style.background="#A7CCEB"; return; }
			
		if(txt_email.value == ""){
			alert('¡Ingrese su Email de Pago y/o Contacto'); txt_email.focus(); txt_email.style.background="#A7CCEB"; return; }
		else 
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt_email.value))
			{} 
			else 
			{	alert ('La dirección de email es incorrecta.');	txt_email.focus(); txt_email.style.background="#A7CCEB"; return;
			}
		} 

		if ((txt_individual.value == "") && (txt_dobles.value == "") && (txt_triples.value == "") && (txt_cuadruples.value == "")) {
			alert('¡Ingrese por lo menos un Tipo de Habitación'); txt_individual.focus(); txt_individual.style.background="#A7CCEB"; return; 
		}

		if(txt_personas.value == ""){ 
			alert('¡Ingrese la cantidad de personas para el Alojamiento'); txt_personas.focus(); txt_personas.style.background="#A7CCEB"; return; }

		btn_enviar.disabled = true;
		action="espa_reservas_enviar.php";
		submit();
	}	
}
//**********************************************************************************
function valida_autentificacion_cliente_catalan(){
	with(document.frm_reservas){
		if(txt_nombre.value == ""){ 
			alert('¡Introdueixi el seu Nom');  txt_nombre.focus(); txt_nombre.style.background="#A7CCEB"; return; }
			
		if(txt_apellidos.value == ""){ 
			alert('¡Introdueixi els seus cognoms'); txt_apellidos.focus(); txt_apellidos.style.background="#A7CCEB"; return; }

		if(txt_direccion.value == ""){ 
			alert('¡Introdueixi la seva Adreça ');  txt_direccion.focus(); txt_direccion.style.background="#A7CCEB"; return; }

		if(txt_poblacion.value == ""){ 
			alert('¡Introdueixi la seva Població'); txt_poblacion.focus(); txt_poblacion.style.background="#A7CCEB"; return; }						

		if(txt_pais.value == ""){ 
			alert('¡Introdueixi el seu País de Procedència'); txt_pais.focus(); txt_pais.style.background="#A7CCEB"; return; }
			
		if(txt_telefono.value == ""){ 
			alert('¡Introdueixi el seu Telèfon de Contacte '); txt_telefono.focus(); txt_telefono.style.background="#A7CCEB"; return; }
			
		if(txt_email.value == ""){
			alert('¡Introdueixi el seu Email de Pagament i/o Contacte'); txt_email.focus(); txt_email.style.background="#A7CCEB"; return; }
		else 
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt_email.value))
			{} 
			else 
			{	alert ("L'adreça de email és incorrecta");	txt_email.focus(); txt_email.style.background="#A7CCEB"; return;
			}
		} 

		if ((txt_individual.value == "") && (txt_dobles.value == "") && (txt_triples.value == "") && (txt_cuadruples.value == "")) {
			alert("¡Introdueixi almenys un Tipus d'Habitació"); txt_individual.focus(); txt_individual.style.background="#A7CCEB"; return; 
		}

		if(txt_personas.value == ""){ 
			alert("¡Introdueixi la quantitat de persones per a l'Allotjament"); txt_personas.focus(); txt_personas.style.background="#A7CCEB"; return; }

		btn_enviar.disabled = true;
		action="cata_reservas_enviar.php";
		submit();
	}	
}
//**********************************************************************************
function valida_autentificacion_cliente_ingles(){
	with(document.frm_reservas){
		if(txt_nombre.value == ""){ 
			alert('¡Introduce its Name');  txt_nombre.focus(); txt_nombre.style.background="#A7CCEB"; return; }
			
		if(txt_apellidos.value == ""){ 
			alert('¡Introduce its Last names. '); txt_apellidos.focus(); txt_apellidos.style.background="#A7CCEB"; return; }

		if(txt_direccion.value == ""){ 
			alert('¡Introduce its Direction.');  txt_direccion.focus(); txt_direccion.style.background="#A7CCEB"; return; }

		if(txt_poblacion.value == ""){ 
			alert('¡Introduce its Population. '); txt_poblacion.focus(); txt_poblacion.style.background="#A7CCEB"; return; }						

		if(txt_pais.value == ""){ 
			alert('¡Introduce its Country of Origin.'); txt_pais.focus(); txt_pais.style.background="#A7CCEB"; return; }
			
		if(txt_telefono.value == ""){ 
			alert('¡Introduce its Telephone of Contact.'); txt_telefono.focus(); txt_telefono.style.background="#A7CCEB"; return; }
			
		if(txt_email.value == ""){
			alert('¡Introduce its email of Payment and/or Contact.'); txt_email.focus(); txt_email.style.background="#A7CCEB"; return; }
		else 
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt_email.value))
			{} 
			else 
			{	alert ('The email direction is incorrect.');	txt_email.focus(); txt_email.style.background="#A7CCEB"; return;
			}
		} 

		if ((txt_individual.value == "") && (txt_dobles.value == "") && (txt_triples.value == "") && (txt_cuadruples.value == "")) {
			alert('¡Introduce at least a Type of Room.'); txt_individual.focus(); txt_individual.style.background="#A7CCEB"; return; 
		}

		if(txt_personas.value == ""){ 
			alert('¡Introduce the amount of people for the Lodging.'); txt_personas.focus(); txt_personas.style.background="#A7CCEB"; return; }

		btn_enviar.disabled = true;
		action="ingl_reservas_enviar.php";
		submit();
	}	
}
//**********************************************************************************
function valida_autentificacion_cliente_frances(){
	with(document.frm_reservas){
		if(txt_nombre.value == ""){ 
			alert('¡Versez son Nom');  txt_nombre.focus(); txt_nombre.style.background="#A7CCEB"; return; }
			
		if(txt_apellidos.value == ""){ 
			alert('¡Versez ses Noms de famille '); txt_apellidos.focus(); txt_apellidos.style.background="#A7CCEB"; return; }

		if(txt_direccion.value == ""){ 
			alert('¡Versez son adresse');  txt_direccion.focus(); txt_direccion.style.background="#A7CCEB"; return; }

		if(txt_poblacion.value == ""){ 
			alert('¡Versez sa Population '); txt_poblacion.focus(); txt_poblacion.style.background="#A7CCEB"; return; }						

		if(txt_pais.value == ""){ 
			alert("¡Versez son Pays d'Origine"); txt_pais.focus(); txt_pais.style.background="#A7CCEB"; return; }
			
		if(txt_telefono.value == ""){ 
			alert('¡Versez son Téléphone de Contact'); txt_telefono.focus(); txt_telefono.style.background="#A7CCEB"; return; }
			
		if(txt_email.value == ""){
			alert('¡Versez son Email Paiement et/ou Contact'); txt_email.focus(); txt_email.style.background="#A7CCEB"; return; }
		else 
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt_email.value))
			{} 
			else 
			{	alert ("La direction d'email est incorrecte.");	txt_email.focus(); txt_email.style.background="#A7CCEB"; return;
			}
		} 

		if ((txt_individual.value == "") && (txt_dobles.value == "") && (txt_triples.value == "") && (txt_cuadruples.value == "")) {
			alert('¡Versez au moins un Type de Chambre'); txt_individual.focus(); txt_individual.style.background="#A7CCEB"; return; 
		}

		if(txt_personas.value == ""){ 
			alert('¡Versez la quantité de personnes pour le Logement'); txt_personas.focus(); txt_personas.style.background="#A7CCEB"; return; }

		btn_enviar.disabled = true;
		action="fran_reservas_enviar.php";
		submit();
	}	
}
//**********************************************************************************
function valida_autentificacion_cliente_aleman(){
	with(document.frm_reservas){
		if(txt_nombre.value == ""){ 
			alert('¡Stellen Sie seinen Namen vor');  txt_nombre.focus(); txt_nombre.style.background="#A7CCEB"; return; }
			
		if(txt_apellidos.value == ""){ 
			alert('¡Stellen Sie seine letzten Namen vor. '); txt_apellidos.focus(); txt_apellidos.style.background="#A7CCEB"; return; }

		if(txt_direccion.value == ""){ 
			alert('¡Stellen Sie seine Richtung vor.');  txt_direccion.focus(); txt_direccion.style.background="#A7CCEB"; return; }

		if(txt_poblacion.value == ""){ 
			alert('¡Stellen Sie seine Bevölkerung vor. '); txt_poblacion.focus(); txt_poblacion.style.background="#A7CCEB"; return; }						

		if(txt_pais.value == ""){ 
			alert('¡Führen Sie sein Ursprungsland ein.'); txt_pais.focus(); txt_pais.style.background="#A7CCEB"; return; }
			
		if(txt_telefono.value == ""){ 
			alert('¡Führen Sie sein Telefon des Kontaktes ein.'); txt_telefono.focus(); txt_telefono.style.background="#A7CCEB"; return; }
			
		if(txt_email.value == ""){
			alert('¡Führen Sie sein email der Zahlung ein und/oder treten Sie in Verbindung.'); txt_email.focus(); txt_email.style.background="#A7CCEB"; return; }
		else 
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt_email.value))
			{} 
			else 
			{	alert ('Die email Richtung ist falsch.');	txt_email.focus(); txt_email.style.background="#A7CCEB"; return;
			}
		} 

		if ((txt_individual.value == "") && (txt_dobles.value == "") && (txt_triples.value == "") && (txt_cuadruples.value == "")) {
			alert('¡Stellen Sie mindestens eine Art Raum vor.'); txt_individual.focus(); txt_individual.style.background="#A7CCEB"; return; 
		}

		if(txt_personas.value == ""){ 
			alert('¡Stellen Sie die Menge der Leute für die Unterkunft vor.'); txt_personas.focus(); txt_personas.style.background="#A7CCEB"; return; }

		btn_enviar.disabled = true;
		action="alem_reservas_enviar.php";
		submit();
	}	
}
//**********************************************************************************
function valida_autentificacion_cliente_italiano(){
	with(document.frm_reservas){
		if(txt_nombre.value == ""){ 
			alert('¡Introduca il relativo nome');  txt_nombre.focus(); txt_nombre.style.background="#A7CCEB"; return; }
			
		if(txt_apellidos.value == ""){ 
			alert('¡Introduca i relativi ultimi nomi. '); txt_apellidos.focus(); txt_apellidos.style.background="#A7CCEB"; return; }

		if(txt_direccion.value == ""){ 
			alert('¡Introduca il relativo senso.');  txt_direccion.focus(); txt_direccion.style.background="#A7CCEB"; return; }

		if(txt_poblacion.value == ""){ 
			alert('¡Introduca la relativa popolazione. '); txt_poblacion.focus(); txt_poblacion.style.background="#A7CCEB"; return; }						

		if(txt_pais.value == ""){ 
			alert("¡Introduca il relativo pæse d'origine."); txt_pais.focus(); txt_pais.style.background="#A7CCEB"; return; }
			
		if(txt_telefono.value == ""){ 
			alert('¡Introduca il relativo telefono del contatto.'); txt_telefono.focus(); txt_telefono.style.background="#A7CCEB"; return; }
			
		if(txt_email.value == ""){
			alert('¡Introduca il relativo email del pagamento e/o mettasi in contatto con.'); txt_email.focus(); txt_email.style.background="#A7CCEB"; return; }
		else 
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt_email.value))
			{} 
			else 
			{	alert ('Il senso del email è errato.');	txt_email.focus(); txt_email.style.background="#A7CCEB"; return;
			}
		} 

		if ((txt_individual.value == "") && (txt_dobles.value == "") && (txt_triples.value == "") && (txt_cuadruples.value == "")) {
			alert('¡Introduca almeno un tipo di stanza.'); txt_individual.focus(); txt_individual.style.background="#A7CCEB"; return; 
		}

		if(txt_personas.value == ""){ 
			alert("¡Introduca la quantità di gente per l'alloggio."); txt_personas.focus(); txt_personas.style.background="#A7CCEB"; return; }

		btn_enviar.disabled = true;
		action="ital_reservas_enviar.php";
		submit();
	}	
}
/***********************************************************************************************************************/
function comprobar_importe()
{
	if (document.frm_pago.txt_importe.value == "" )
	{ alert ("\n Es necesario escribir el importe de la reserva.\n\n \t      Gracias.") ; 
	  document.frm_pago.txt_importe.focus();
	  return false;
	}
}
/***********************************************************************************************************************/

