var vTesti=new Array(9);

function CreaVettore(lang){
	if(lang == 1){
		vTesti[0]="Controlla l'indirizzo E-Mail inserito!";
		vTesti[1]="Devi accettare il trattamento dei Dati Personali per effettuare un'iscrizione!";
		vTesti[2]="Il campo Nome è obbligatorio!";
		vTesti[3]="Il campo Cognome è obbligatorio!";
		vTesti[4]="Il campo Nome Azienda è obbligatorio!";
		vTesti[5]="Il campo Settore è obbligatorio!";
		vTesti[6]="Il campo Ufficio è obbligatorio!";
		vTesti[7]="Il campo Nazione è obbligatorio!";
		vTesti[8]="Il campo Telefono è obbligatorio!";
	}
	else{
		vTesti[0]="Check the written E-Mail address!";
		vTesti[1]="You have to accept the handling of your personal data , in order to register you!";
		vTesti[2]="The field Name is compulsory!";
		vTesti[3]="The field Surname is compulsory!";
		vTesti[4]="The field Company Name is compulsory!";
		vTesti[5]="The field Sector is compulsory!";
		vTesti[6]="The field Department is compulsory!";
		vTesti[7]="The field Nation is compulsory!";
		vTesti[8]="The field Phone Number is compulsory!";
	}
}


function UnsubscribeMail(lang){
	CreaVettore(lang);
	
	var lung=null;
	var stringa=null;
	
	Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

   Email = document.SuperForm.email.value;
   if (Filtro.test(Email))
   {  }
   else
   {
      alert(vTesti[0]);
      document.SuperForm.email.focus();
      return false;
   }
}


function ControllaDati(TipoForm,lang){
	CreaVettore(lang);
	
	var lung=null;
	var stringa=null;
	
	if (TipoForm == 'new')
	{
   if (document.SuperForm.acce[0].checked==false)
   {
      alert(vTesti[1]);
      document.SuperForm.acce[0].focus();
      return false;
   }
}

   stringa=document.SuperForm.nome.value
   lung=stringa.length;
   if (lung<=0)
   { 
     alert(vTesti[2]);
     document.SuperForm.nome.focus();
     return false; 
   }

   stringa=document.SuperForm.cognome.value
   lung=stringa.length;
   if (lung<=0)
   { 
     alert(vTesti[3]);
     document.SuperForm.cognome.focus();
     return false; 
   }

	Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

   Email = document.SuperForm.email.value;
   if (Filtro.test(Email))
   {  }
   else
   {
      alert(vTesti[0]);
      document.SuperForm.email.focus();
      return false;
   }

   Filtro = /^([a-zA-Z\ ])+$/;

   NomeAzienda = document.SuperForm.nome_azienda.value;
   if (Filtro.test(NomeAzienda))
   {  }
   else
   {
      alert(vTesti[4]);
      document.SuperForm.nome_azienda.focus();
      return false;
   }

   stringa=document.SuperForm.telefono_azienda.value
   lung=stringa.length;
   if (lung<=0)
   { 
     alert(vTesti[8]);
     document.SuperForm.telefono_azienda.focus();
     return false; 
   }

   stringa=document.SuperForm.settore.value
   lung=stringa.length;
   if (lung<=0)
   { 
     alert(vTesti[5]);
     document.SuperForm.settore.focus();
     return false; 
   }

   stringa=document.SuperForm.ufficio.value
   lung=stringa.length;
   if (lung<=0)
   { 
     alert(vTesti[6]);
     document.SuperForm.ufficio.focus();
     return false; 
   }

   stringa=document.SuperForm.nazione.value
   lung=stringa.length;
   if (lung<=0)
   { 
     alert(vTesti[7]);
     document.SuperForm.nazione.focus();
     return false; 
   }

return true;
}

function ControllaEmailCanc(lingua){
	CreaVettore(lingua);
	str=document.SuperForm.email.value;
	lung=str.length;

	if(lung<=0){
		alert(vTesti[0]);
		return false;
	}
	return true;
}
