// Common functions

function popitup(name,url,w,h,scrollbars,dirs) {
	var newwindow = '';
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
		}
	else {
		newwindow=window.open(url,name,'scrollbars='+scrollbars+',resizable=yes,directories='+dirs+',location='+dirs+',status='+dirs+',titlebar='+dirs+',toolbar='+dirs+',menubar='+dirs+',width='+w+',height='+h+',left=20,top=0');
		if (!newwindow.opener) newwindow.opener = self;
		}
	if (window.focus) {newwindow.focus()}
	return false;
	}

function conferma_eliminazione() {
	return confirm("ATTENZIONE! Confermi la cancellazione? Questa operazione è irreversibile.");
	}

function validatenews(form) {
	var ret=true;
	var emptytext="<p>&nbsp;<\/p>";
	var filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if (form.nome.value=="" || !filtro.test(form.email.value)) {
		alert ("Per iscriverti alla newsletter, riempi entrambi i campi nome ed email e riprova.");
		form.nome.focus();
		ret=false;
		}
	if (form.nome.value!="" && form.email.value!="" && !form.consenso.checked) {
		alert ("Senza il consenso al trattamento dei dati personali non è possibile portare a termine l'iscrizione. Leggi l'informativa sulla privacy e fai clic su accetto per effettuare l'iscrizione.");
		form.consenso.focus();
		ret=false;
		}
	return ret
	}
