function permitirSoloNumeros(evt) {
  // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57  
  var key = nav4 ? evt.which : evt.keyCode;  
  return (key <= 13 || (key >= 48 && key <= 57));       
}
function validarMail(mail) {
  var filtro = /^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
  if (filtro.test(mail)) {
    return true;
  }
  else {
    return false;
  }
}
function validarFormulario(pagina) {
  var mail = document.formContacto.email.value;
  var error = false;
  var campo = "";
  var errorMail = "";
  if (document.formContacto.nombre.value == "") {
    error = true;
    campo = "your name";
  }
  if (mail == "" && document.formContacto.telefono1.value == "") {
    if (error) campo += ", e-mail or contact phone mumber"; else campo = "e-mail or contact phone mumber";
    error = true;
  }
  if (mail != "") {
    if (!validarMail(mail)) {
      error = true;
      errorMail = " Please submit a correct e-mail address";
    }
  }
  if (error) {
    document.getElementById("errorobligatorio").style.visibility = "visible";
    if (campo != "") {
      campo += " should be submitted";
      if (document.formContacto.consulta.value == "") {
        if (error) campo += " as well as your question"; else campo = "your question";
        //error = true;
      }
      if (errorMail != "") {
        campo += ".";
      }
    }
    document.getElementById("errorobligatorio").innerHTML = campo + errorMail + ". Thank you.";
  }
  else {
    document.getElementById("errorobligatorio").style.visibility = "hidden";
    document.formContacto.action = pagina;
    document.formContacto.submit();
  }
}
function confirmarLimpiar() {
  if (confirm("ARE YOU SURE THAT YOU WANT TO DELETE ALL SUBMITTED DATA?")) {
    document.getElementById("errorobligatorio").innerHTML = "";
    return true;
  }
  else {
    return false;
  }
}
function cambiarColorFormulario() {
  switch (activa) {
    case 0:
      document.getElementById("boton3").style.backgroundColor = "#007D48";
      document.getElementById("boton4").style.backgroundColor = "#007D48";
      break;
    case 2:
      document.getElementById("boton3").style.backgroundColor = "#336699";
      document.getElementById("boton4").style.backgroundColor = "#336699";
      break;
    case 3:
      document.getElementById("boton3").style.backgroundColor = "#6B476B";
      document.getElementById("boton4").style.backgroundColor = "#6B476B";
      break;
  }
}
