function trim(str){return str.replace(/^\s*|\s*$/g,"");}
function validarAlpha(campo)
 {
  if(trim(campo.value) == "")return;
  if (/^[A-Za-z\s]+$/.test(trim(campo.value)))
   {
    return (true)
   }
  else
   {
    return false;
   }
 }
function validarAlphaNumerico(campo)
 {
  if(trim(campo.value) == "")return;
  if (/^[A-Za-z]+$/.test(trim(campo.value)))
   {
    return (true)
   }
  else
   {
    return false;
   }
 }  
function validacion_login()
 {
  valor1 = trim(this.document.LOGIN.P_LOGIN.value);
  valor2 = trim(this.document.LOGIN.P_PASSWORD.value);
  if(valor1.length==0)
   {
    alert("Es campo nombre es necesario.");
    this.document.LOGIN.P_LOGIN.focus();
   }
  else if(valor2.length==0)
   {
    alert("Es campo apellidos es necesario.");
    this.document.LOGIN.P_PASSWORD.focus();
   } 
  else
   {
    this.document.LOGIN.H_ACCION.value='LOGEAR';
    this.document.LOGIN.submit();
   }
 }
function enviar_form()
 {
  if(event.keyCode==13)validacion_login();
 } 