// JavaScript Document
function KunaFormCheckForm(theForm)
{

  if (theForm.Nominativo.value == "")
  {
	alert("Inserire un valore per il campo \"Nominativo\".");
	theForm.Nominativo.focus();
	return (false);
  }  

  if (theForm.EMail.value == "")
  {
	alert("Inserire l'indirizzo e-Mail.");
	theForm.EMail.focus();
	return (false);
  }
  
  if (KunaFormconvalidaMail(theForm.EMail) == false)
  {
    alert("Inserire un indirizzo EMail valido.");
    theForm.EMail.focus();
    return (false);
  } 
  
  if (theForm.CodiceDiControllo.value.length != 8 )
  {
    alert("Inserire il codice di controllo corretto.");
    theForm.CodiceDiControllo.focus();
    return (false);
  }   
  
  return (true);
}

function KunaFormconvalidaMail(email)
{
	apos=email.value.indexOf("@");
	dotpos=email.value.lastIndexOf(".");
	lastpos=email.value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
	{
		return false;
	}
	else 
	{
		return true;
	}
}
