// JavaScript Document
function KunaFormCheckForm(theForm)
{

  if (theForm.Nominativo.value == "")
  {
	alert("Enter a value for the field \"Name\".");
	theForm.Nominativo.focus();
	return (false);
  }  

  if (theForm.EMail.value == "")
  {
	alert("Enter your e-Mail Address.");
	theForm.EMail.focus();
	return (false);
  }

  if (theForm.Testo.value == "")
  {
	alert("Enter a value for the field \"Request\".");
	theForm.Testo.focus();
	return (false);
  }  

  if (KunaFormconvalidaMail(theForm.EMail) == false)
  {
    alert("Enter a valid E-mail address.");
    theForm.EMail.focus();
    return (false);
  } 

  if (theForm.Privacy.checked == false)
  {
    alert("To continue you must agree to the Privacy rules.");
    theForm.Privacy.focus();
    return (false);
  }

  if (theForm.CodiceDiControllo.value.length != 8 )
  {
    alert("Enter the code of proper control.");
    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;
	}
}
