<!--

function ltrim(s)
{ return s.replace( /^\s*/, "" ); }

function rtrim(s)
{ return s.replace( /\s*$/, "" ); }

function trim(s)
{ return rtrim(ltrim(s)); }


function checkForm(form){ 

  if (trim(form.autore.value).length == 0 || trim(form.autore.value).match(/[^\w ]/)) {
    alert("Indica il tuo nome correttamente, solo lettere o cifre, grazie");
    form.autore.focus();
    return false
  }
  
  if (trim(form.autoreurl.value).length > 7 && (trim(form.autoreurl.value).indexOf("http://") == -1 || trim(form.autoreurl.value).indexOf(".") == -1)) {
    alert("Inserisci correttamente l'indirizzo web, grazie");
    form.autoreurl.focus();
    return false
  }
  
  if (trim(form.autoreemail.value).length == 0 || !trim(form.autoreemail.value).match(/^\S+\@[\w-]+\.[\w\.-]+$/)) {
    alert("Inserisci correttamente l'indirizzo email, grazie");
    form.autoreemail.focus();
    return false
  }

  if (trim(form.testo.value).length == 0) {
    alert("Scrivi il testo del commento, grazie");
    form.testo.focus();
    return false
  }
  
}
//-->
