<!--
function lTrim(sStr)
{
     while (sStr.charAt(0) == " ")
      sStr = sStr.substr(1, sStr.length - 1);
     return sStr;
}

function rTrim(sStr)
{
     while (sStr.charAt(sStr.length - 1) == " ")
      sStr = sStr.substr(0, sStr.length - 1);
     return sStr;
}

function allTrim(sStr)
{
     return rTrim(lTrim(sStr));
}

function Validar(form)
{
var groserias = new RegExp("MIERDA|COJUDO|CARAJO|CABRÓN|CABRON|PUTA|PUTO|JOD|IDIOTA|HUEV|CACA|CAGA|VERGA|CHOLIS|GAY|CHUCHA|CHOLO|CHUPA|HIJO DE|HIJOS DE", "gi");
if (coment1.nombre.value == "")
{ alert("Por favor: Ingrese su NOMBRE COMPLETO"); coment1.nombre.focus(); return; }
else {
		coment1.nombre.value = coment1.nombre.value.replace(groserias,"...");
	if (coment1.nombre.value.length < 4)
	  {
	    alert("Escriba por lo menos 4 caracteres en el campo \"NOMBRE\".");
		coment1.nombre.select();
	    coment1.nombre.focus();
	    return (false);
	  }

	var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚabcdefghijklmnñopqrstuvwxyzáéíóú ";
	var checkStr = coment1.nombre.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 letras en el campo \"NOMBRE\".");
	coment1.nombre.select()
	coment1.nombre.focus();
    return;
	}
	}

if (coment1.correo.value == "")
{
alert("Por favor: Ingrese su CORREO"); coment1.correo.focus(); return;
}
else
{
	// validar la cuenta de correo usando una expresión regular (RegExp)
	coment1.correo.value=allTrim(coment1.correo.value);
	coment1.correo.value = coment1.correo.value.replace(groserias,"");
    if(coment1.correo.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig))
	{
		alert("Por favor: Ingrese un CORREO VÁLIDO");
		coment1.correo.select();
		coment1.correo.focus();
		return;
    }
}

if (coment1.comentario.value == ""){ alert("Por favor: Ingrese su COMENTARIO"); coment1.comentario.focus();return; }
else {
	coment1.comentario.value = coment1.comentario.value.replace(groserias,"...");
	}
coment1.submit();
}

function caracter( formulario ) {
   var maxLongitud = 512;
   var libres = 512;
   if ( formulario.comentario.value.length > maxLongitud ) {
      formulario.comentario.value = formulario.comentario.value.substring(0,maxLongitud);
      libres = 0;
      alert("¡Ha superado el límite!\nUsted dispone de\n" + maxLongitud + " caracteres");
   } else {
      libres = maxLongitud - formulario.comentario.value.length;
   }
   formulario.numero.value = libres;
}
//-->
