function deleteUser(lang) {
	if(lang=="EN") {
		if(confirm("Delete the registration?"))	document.location="autenticazioneDeleteUser.php";
		}
	else if(lang=="IT") {
		if(confirm("Cancellare la registrazione?"))	document.location="autenticazioneDeleteUser.php";
		}	
	}
	
function ctrForm(lang) {	
	if(document.forms['register_modify'].consenso[1].checked) {
		if(lang=="EN") alert("You must ACCEPT the informative to the treatment of the personal data");
		else alert("E' necessario esprimere il consenso sull'informativa in materia di privacy");
		return false;
		}
	if(document.forms['register_modify'].Nome.value=="") {
		if(lang=="EN") alert("The field 'Name' is mandatory");
		else alert("Il campo 'Nome' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Cognome.value=="") {
		if(lang=="EN") alert("The field 'Surname' is mandatory");
		else alert("Il campo 'Cognome' deve essere valorizzato");
		return false;
		}	
	if(document.forms['register_modify'].Data_nascita.value=="") {
        alert("Il campo 'Data di nascita' deve essere valorizzato");
		return false;
		}	
	if(document.forms['register_modify'].Codfisc.value=="") {
		if(lang=="EN") alert("The field 'Codfisc' is mandatory");
		else alert("Il campo 'Codice fiscale' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Qualifica.value=="") {
		if(lang=="EN") alert("The field 'Qualifica' is mandatory");
		else alert("Il campo 'Qualifica' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Cap.value=="") {
		if(lang=="EN") alert("The field 'Cap' is mandatory");
		else alert("Il campo 'Cap' deve essere valorizzato");
		return false;
		}
	if(isNaN(document.forms['register_modify'].Cap.value)) {
		if(lang=="EN") alert("The field 'Cap' is mandatory");
		else alert("Il campo 'Cap' deve essere numerico");
		return false;
		}
	if(document.forms['register_modify'].Citta.value=="") {
		if(lang=="EN") alert("The field 'Country' is mandatory");
		else alert("Il campo 'Cittā' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Email.value=="") {
		if(lang=="EN") alert("The field 'E-mail' is mandatory");
		else alert("Il campo 'E-mail' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Cellulare.value=="") {
		if(lang=="EN") alert("The field 'Cellulare' is mandatory");
		else alert("Il campo 'Cellulare' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Pwd.value=="") {
		if(lang=="EN") alert("The field 'Password' is mandatory");
		else alert("Il campo 'Password' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].c_Pwd.value=="") {
		if(lang=="EN") alert("The field 'Re-type password' is mandatory");
		else alert("Il campo 'Conferma password' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Pwd.value!=document.forms['register_modify'].c_Pwd.value) {
		if(lang=="EN") alert("The fields 'Re-type password' and 'Password' do not contain the same value");
		else alert("Attenzione: le password non coincidono");
		return false;
		}
	return true;
	}	

function ctrFormModificaDati() {
	if(document.forms['register_modify'].Pwd.value=="     " && document.forms['register_modify'].cv.value=="") {
		alert("Modificare la password e/o allegare il CV aggiornato");
		return false;
	}
	if(document.forms['register_modify'].Nome.value=="") {
		alert("Il campo 'Nome' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Cognome.value=="") {
		alert("Il campo 'Cognome' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Data_nascita.value=="") {
		alert("Il campo 'Data di nascita' deve essere valorizzato");
		return false;
		}	
	if(document.forms['register_modify'].Azienda.value=="") {
		alert("Il campo 'Azienda' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Nazione.value=="") {
		alert("Il campo 'Nazione' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Email.value=="") {
		alert("Il campo 'E-mail' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Pwd.value=="") {
		alert("Il campo 'Password' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].c_Pwd.value=="") {
		alert("Il campo 'Conferma password' deve essere valorizzato");
		return false;
		}
	if(document.forms['register_modify'].Pwd.value!=document.forms['register_modify'].c_Pwd.value) {
		alert("Attenzione: le password non coincidono");
		return false;
		}
	return true;
	}	

	
function resetFormRegistrati() {
	document.forms['register_modify'].reset();
	}

var ajaxObj;

function fillComuniNazioni() {
    ajaxObj = AjaxLib.createRequestObject();
    ajaxObj.onreadystatechange = receiveContent;
    AjaxLib.sendRequest(ajaxObj, 'pr=' + document.register_modify.Provincia_nascita.value, 'ajax_stub.php');
    }

function receiveContent() {
    if(ajaxObj.readyState == 4) {
        if(ajaxObj.status>=400) {
    		alert("Si č verificato un errore durante il caricamento dei dati. Ricaricare la pagina e riprovare.");
            }
        else {			
            document.getElementById('comuniNazioniSpan').innerHTML = ajaxObj.responseText;
            }
        }
    }
