function verificaRegistrazioni(){
	var v = isEmail(document.forms['registerForm'].email.value);
	if(document.forms['registerForm'].nome.value.length==0){
		alert('Non hai inserito il nome');
		document.registerForm.nome.focus();
		return false;
	}else if(document.forms['registerForm'].cognome.value.length==0){
		alert('Non hai inserito il cognome');
		document.registerForm.cognome.focus();
		return false;
	}else if(document.forms['registerForm'].telefono.value.length==0){
		alert('Non hai inserito il telefono');
		document.registerForm.telefono.focus();
		return false;
	}else if(document.forms['registerForm'].pwd.value.length==0){
		alert('Non hai inserito la password');
		document.registerForm.pwd.focus();
		return false;
	}
	else if(document.forms['registerForm'].pwd.value != document.forms['registerForm'].confPwd.value){
		alert('Le due password non coincidono');
		document.registerForm.confPwd.focus();
		return false;
	}else if(document.forms['registerForm'].email.value.length==0){
		alert('Non hai inserito la mail');
		document.registerForm.email.focus();
		return false;
	}else if(v==0){
		alert('Email non valida!');
		document.registerForm.email.focus();
		return false;
	}else if(document.forms['registerForm'].privacy.checked==false){
		alert('Devi dare il consenso al trattamento dei dati personali');
		return false;
	}
	else{
		document.forms['registerForm'].action="private.php?action=mail";
		return true;
	}
}

function isEmail(string){
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) != -1)
	return 1;
	else
	return 0;
}
function openPrivacy() {

	var y=screen.height;
	var x=screen.width;
	var width=400;
	var height=650;
	var page="privacy.php";

	y=Math.round((y/2)-(height/2));
	x=Math.round((x/2)-(width/2));

   var wind=window.open(page, "privacy",
			"Width=" +
				width +
			",Height=" +
				height +
			",left=" +
				x +
			",top=" +
				y +
			"location=no,menubar=no,toolbar=no,status=no,resizable=no");
		wind.focus();
}
