
function mandatoryField(lingua) { 
	  var msg_err = "";
	  var msg_val = "";
	  var msg_fin = "";

//Seleziona frasi in base alla lingua
	switch (lingua) 
		{  case "it" : 
		      var txt_nome = "Nome";
			  var txt_cognome = "Cognome";
			  var txt_login = "Login (min 6)";
			  var txt_password = "Password (min 6)";
			  var txt_email = "Email";
			  var txt_email_bad = "Email non corretta";
			  var txt_nazione = "Nazione";
			  var txt_city = "Citta";
			  var txt_zipcode = "Cap";
			  var txt_tel = "Telefono";
			  var txt_prj_nome = "Project Name";
			  var txt_prj_street = "Project street";
			  var txt_prj_city = "Project city";
			  var txt_prj_zip = "Project zip code";
			  var txt_prj_state = "Project state";			  
			  var txt_attenzione = "Attenzione!!!";
			  var txt_inserire = "Per procedere mancano i seguenti dati:"
			  var txt_errori = "Si sono verificati i\nseguenti errori:"
			  var txt_privacy = "Prego voler accettare i termini sulla legge della privacy"
		      break; 
		   case "en" : 
		      var txt_nome = "Name";
			  var txt_cognome = "Surname";
			  var txt_login = "Login (min 8)";
			  var txt_password = "Password (min 8)";
			  var txt_email = "Email";
			  var txt_email_bad = "Please, check your e_mail adress";
			  var txt_nazione = "Nazione";
			  var txt_city = "City";
			  var txt_zipcode = "Zip code";
			  var txt_tel = "Phone";
			  var txt_prj_nome = "Project Name";
			  var txt_prj_street = "Project street";
			  var txt_prj_city = "Project city";
			  var txt_prj_zip = "Project zip code";
			  var txt_prj_state = "Project state";
			  var txt_attenzione = "Attention!!!";
			  var txt_inserire = "The following data must be filled in to continue:"
			  var txt_errori = "The following data must be filled in to continue:"
			  var txt_privacy = "please, accept the terms of the privacy notice above"			  
		      break; 
		} 
	
	  if (document.contactus_form.opt_in.checked==true) {
	  
		  if (document.contactus_form.first_name.value=="")	{ msg_err = msg_err + " - " + txt_nome + "\n"; }
			
		  if (document.contactus_form.last_name.value=="")	{ msg_err = msg_err + " - " + txt_cognome + "\n"; }

      if (document.contactus_form.city.value=="")	{ msg_err = msg_err + " - " + txt_city + "\n"; }
      
      if (document.contactus_form.postal_code.value=="")	{ msg_err = msg_err + " - " + txt_zipcode + "\n"; }
      
      if (document.contactus_form.prj_name.value=="")	{ msg_err = msg_err + " - " + txt_prj_nome + "\n"; }
      
      if (document.contactus_form.prj_street.value=="")	{ msg_err = msg_err + " - " + txt_prj_street + "\n"; }      
      
      if (document.contactus_form.prj_city.value=="")	{ msg_err = msg_err + " - " + txt_prj_city + "\n"; }
      
      if (document.contactus_form.prj_zip.value=="")	{ msg_err = msg_err + " - " + txt_prj_zip + "\n"; }
      
      if (document.contactus_form.prj_state.value=="")	{ msg_err = msg_err + " - " + txt_prj_state + "\n"; }

		  if (document.contactus_form.email.value=="") 
				{ msg_err = msg_err + " - " + txt_email + "\n";}
		  else
				{ ValoreEmail=document.contactus_form.email.value;
				  PosizioneAt=ValoreEmail.indexOf("@")
				  PosizionePunto=ValoreEmail.indexOf(".")
			 	  if (PosizioneAt==-1 || PosizioneAt==0 || PosizionePunto==-1 || PosizionePunto==0 || PosizioneAt==ValoreEmail.length-1)
				  		{ msg_val = msg_val + " - " + txt_email_bad + "\n"; }
				}	
			

		//Controllo finale sull'invio dei dati
		  if ((msg_err=="") && (msg_val==""))
		  	{ document.contactus_form.submit(); }
		  else	
		    { msg_fin = txt_attenzione + "\n\n";
			 if (msg_err!="")
			  {	msg_err = txt_inserire + "\n\n" + msg_err + "\n"; }
			 if (msg_val!="")
			 	{ msg_val = txt_errori + "\n\n" + msg_val; }
			 msg_fin = msg_fin + msg_err + msg_val
		 	 alert(msg_fin);
			}
	}
	else { 
		alert(txt_privacy); 
	}


}
