function frm_validar_usuario(theForm)
{
    
	 if (theForm.username.value.length < 4)
  {
    alert("Escriba por lo menos 4 caracteres en el campo \"Usuario\".");
    theForm.username.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚabcdefghijklmnñopqrstuvwxyzáéíóú0123456789%$_-&/ ";
  var checkStr = theForm.username.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Escriba sólo caracteres válidos en el campo \"Usuario\".");
    theForm.username.focus();
    return (false);
  }
	

	if (theForm.password.value.length < 6)
  {
    alert("Escriba por lo menos 6 caracteres en el campo \"password\".");
    theForm.password.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚabcdefghijklmnñopqrstuvwxyzáéíóú0123456789-_/$%&#+*!?¡¿()| ";
  var checkStr = theForm.password.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Escriba sólo caracteres válidos en el campo \"password\".");
    theForm.password.focus();
    return (false);
  }
}
