// JavaScript Document



//**************************************************************

//VALIDAR NEWS_LETTER

function validar_news_letter(){
  
  with(document.frm_news_letter) {
    
        if (txt_news_letter.value == ''){
          
              alert("Debes introducir un e-mail");
              txt_news_letter.focus();
              txt_news_letter.style.background="#FFF2F2";
              return false;
          
        }else{
                patron = /^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
                if (patron.test(txt_news_letter.value)==false){
                    alert("El e-mail introducido no es correcto");
                    txt_news_letter.focus();
                    txt_news_letter.style.background="#FFF2F2";
                    return false;
                }
            
        }         
      
  } // fin de with     
  
  return true;
  
}

//**************************************************************
 

 //VALIDAR form libro

function validar_form_libro(){
  
  with(document.form_libro) {
    
        if (txt_nombre.value == ''){
          
              alert("Debes introducir tu nombre");
              txt_nombre.focus();
              txt_nombre.style.background="#FFF2F2";
              return false;            
        
        }else{              
            patron_nombre = /[A-Za-z]/;
            if (patron_nombre.test(txt_nombre.value)==false){
                alert("El formato del nombre es incorrecto");
                txt_nombre.focus();
                txt_nombre.style.background="#FFF2F2";
                return false;
            }
        }
        
         if (txt_email.value == ''){
      
          //mensaje de error
          alert("Debes introducir tu e-mail");           
          txt_email.focus();           
          txt_email.style.background="#FFF2F2";
          
          return false;
          
        }else{
            patron = /^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
            if (patron.test(txt_email.value)==false){
                alert("El e-mail introducido no es correcto");
                txt_email.focus();
                txt_email.style.background="#FFF2F2";
                return false;
            }
            
        }
         
        if (lst_valoracion.value == '0'){
                
          alert("Debes seleccionar una puntuación");
          lst_valoracion.focus();
          lst_valoracion.style.background="#FFF2F2";
          return false;
          
        }
        
        if (txt_comentarios.value == ''){
          
          alert("Debes introducir algún comentario");
          txt_comentarios.focus();
          txt_comentarios.style.background="#FFF2F2";
          return false;
          
        } 
           
        if (txt_captcha.value == ''){
                 
            alert("Escriba el código de seguridad");
            txt_captcha.focus();
            txt_captcha.style.background="#92ADDA";
            return false;
            
        }        
        
        
      
  } // fin de with     
  
  return true;
  
}

//**************************************************************

//MENSAJE MOTOR RESERVAS

function alerta_motor_e()
{                                                                                                             
    
    alert ("Motor de reservas en construcción.\n\n\tConsulte en booking@augustushotels.com o en el teléfono: 34 977 38 11 54");

}

function alerta_motor_c()
{
    
    alert ("Motor de reserves en construcció.\n\n\tConsulti a booking@augustushotels.com o al telèfon: 34 977 38 11 54");

}

function alerta_motor_en()
{
    
    alert ("Engine reserves under construction.\n\n\tYou can book in: booking@augustushotels.com or phone: 34 977 38 11 54");

}

function alerta_motor_f()
{
    
    alert ("Moteur de réserves en cours de construction.\n\n\tPour consulter sur booking@augustushotels.com ou par téléphone: 34 977 38 11 54");

}

function alerta_motor_d()
{
    
    alert ("Engine behält sich im Bau.\n\n\tUm auf booking@augustushotels.com oder Telefon: 34 977 38 11 54");

}

function alerta_motor_i()
{
    
    alert ("Motore di riserva in costruzione.\n\n\tPer ulteriori informazioni in booking@augustushotels.com o per telefono: 34 977 38 11 54");

}

function cambia_idioma()
{
    with (document.frm_idioma)
    {
        submit();
    }
}