// JavaScript Document
<!--

function isValidEmail(strEmail){
	var i = 1;
	var sLength = strEmail.length;
	
	// look for @
	while ((i < sLength) && (strEmail.charAt(i) != "@")){ 
		i++;
	}
	if ((i >= sLength) || (strEmail.charAt(i) != "@")) {
		//alert(sMsgError);
		return false;
	} else {
		i += 2;	
	}
	// look for .
	while ((i < sLength) && (strEmail.charAt(i) != ".")){ 
		i++;
	}	
	// there must be at least one character after the .
	if ((i >= (sLength - 1)) || (strEmail.charAt(i) != ".")) {
		//alert(sMsgError);
		return false;
	} else {
		return true;
	}
}

function checkForm()	{
	
	var myForm = document.forms.frmDove;
	
	//Controllo l'accettazione della privacy
	if ((myForm.datipersonali[0].checked == false) && (myForm.datipersonali[1].checked == false))	{
		alert('ATTENTION PLEASE!\nRemember to accept the general conditions\nconcerning the personal data processing');
		return false;
	}
	
	if (myForm.datipersonali[1].checked)	{
		alert('ATTENTION PLEASE!\nRemember to accept the general conditions\nconcerning the personal data processing');
		return false;
	}

	//Controllo i campi obbligatori
	if (myForm.cognome.value == '')	{
		alert('You must exploit the SURNAME field');
		myForm.cognome.focus();
		return false;
	}	
	
	if (myForm.email.value == '')	{
		alert('You must exploit the E-MAIL field');
		myForm.email.focus();
		return false;
	}

	if (isValidEmail(myForm.email.value) == false)	{
		alert('E-MAIL is not in the right format');
		myForm.email.focus();
		return false;
	}
	
	return true;
}
//-->