function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

function FormValidator(theForm)

{
	
	if (theForm.uname.value == "")
  {
    alert("Por favor escriba su nombre de \"usuario\" .");
    theForm.uname.focus();
    return (false);
  }
  
    if (theForm.passwd.value == "")
  {
    alert("Por favor escriba su \"password\" .");
    theForm.passwd.focus();
    return (false);
  }
  
     if (theForm.passwd_again.value == "")
  {
    alert("Por favor confirmar su \"password\" .");
    theForm.passwd_again.focus();
    return (false);
  }
  
  if (theForm.email.value == "")
  {
    alert("Por favor escriba su \"email\" .");
    theForm.email.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.email.value))
  {
    alert("Por favor escriba su email completo ej: sunombre@sudominio.com");
    theForm.email.focus();
    return (false);
  }
  
    if (theForm.titulo.value == "")
  {
    alert("Por favor escriba su \"titulo\" .");
    theForm.titulo.focus();
    return (false);
  }
  
    if (theForm.version.value == "")
  {
    alert("Por favor escriba su \"version\" .");
    theForm.version.focus();
    return (false);
  }


    if (theForm.dlurl.value == "")
  {
    alert("URL para \" descargar\" es requerido.");
    theForm.dlurl.focus();
    return (false);
  }
  
      if (theForm.plataforma.value == "")
  {
    alert("Por favor escriba \"Plataforma\" .");
    theForm.plataforma.focus();
    return (false);
  }
  
    if (theForm.precio.value == "")
  {
    alert("Por favor escriba \"licencia\" de uso .");
    theForm.precio.focus();
    return (false);
  }
  
      if (theForm.cat.value == "")
  {
    alert("Por favor escriba \"categoria\" para su script .");
    theForm.cat.focus();
    return (false);
  }

  return (true);
}
