// --------------------------------------------------- 	
// CHECK REGISTRATION FORM  	
// --------------------------------------------------- 	
	function EnewsForm_Validator(theForm) {
		if (!theForm.privacy_accepted.checked) {
			//alert("PLEASE NOTE!\n\nTo receive your NEWSLETTERS is necessary to read and approve the privacy statement.");
			alert("ATTENZIONE!\n\nPer ricevere le NEWSLETTERS è necessario leggere ed approvare l'informativa sulla PRIVACY.");
			theForm.Reset.focus();
			window.open('../privacy/privacy.php','Privacy','toolbar=no,width=520,height=500,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
			return (false);
		}
		
		if ((!(theForm.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.([A-Za-z0-9])([A-Za-z0-9]?)([A-Za-z0-9]?)$/)!= -1))){
			alert("(I) Indirizzo E-MAIL non valido\n(EN) Invalid E-MAIL ADDRESS!");
			theForm.email.focus();
			return (false);
		}
		if (theForm.firstname.value.length < 2) {
			alert("(I) NOME non valido\n(EN) Invalid NAME!");
			theForm.firstname.focus();
			return (false);
		}
		if (theForm.lastname.value.length < 2) {
			alert("(I) COGNOME non valido\n(EN) Invalid SURNAME!");
			theForm.lastname.focus();
			return (false);
		}
		
		frm=document.EnewsForm;
		len = frm.elements.length;
		var isnumber=0;
		for (var j=0; j<len; j++){
			if (frm.elements[j].name=='chk[]') {
				if (frm.elements[j].checked) {
					isnumber=1;      
				}
			}
		}	
		if (isnumber==0) {
			alert("(I) Selezionare almeno 1 ARGOMENTO\n(EN) Please, select at least 1 TOPIC!");
			return (false);  
		}
		
		if (theForm.elements['security_code'].value == "") {
		   alert("ATTENZIONE!!! Scrivere il codice di sicurezza visibile nell'immagine con bordo rosso!");
		    theForm.elements['security_code'].focus();
		    return (false);
		}
		
		
		//if (theForm.mailtype[0].checked) {
		//	alert("(I) Hai selezionato il formato HTML. Ricorda che alcuni programmi di posta elettronica non supportano questo formato in modo corretto. Clicca OK se sei sicuro di utilizzare un programma adatto, oppure clicca CANCELLA e seleziona il formato TEXT.\n\n(EN) You selected HTML e-mail format. Please note that some e-mail clients are not able to handle HTML formatting correctly. Click the OK button to proceed with HTML format or click Cancel to go back and change it to Text. If you find problems reading your iSource, you can alwais return to the iSource page and select Text.");
		//}
		
		theForm.elements['okForm'].value = 1;
		return (true);
	}
// --------------------------------------------------- 	
// --------------------------------------------------- 	


// --------------------------------------------------- 	
// CHECK EDIT FORM  	
// --------------------------------------------------- 	
	function EnewsEditForm_Validator(theForm) {
		
		if (theForm.firstname.value.length < 2) {
			alert("(I) NOME non valido\n(EN) Invalid NAME!");
			theForm.firstname.focus();
			return (false);
		}
		if (theForm.lastname.value.length < 2) {
			alert("(I) COGNOME non valido\n(EN) Invalid SURNAME!");
			theForm.lastname.focus();
			return (false);
		}
		
		frm=theForm;
		len = frm.elements.length;
		var isnumber=0;
		for (var j=0; j<len; j++){
			if (frm.elements[j].name=='chk[]') {
				if (frm.elements[j].checked) {
					isnumber=1;      
				}
			}
		}	
		if (isnumber==0) {
			alert("(I) Selezionare almeno 1 ARGOMENTO\n(EN) Please, select at least 1 TOPIC!");
			
			return (false);  
		}
		
		/*if (theForm.elements['security_code'].value == "") {
		   alert("ATTENZIONE!!! Scrivere il codice di sicurezza visibile nell'immagine con bordo rosso!");
		    theForm.elements['security_code'].focus();
		    return (false);
		}*/
		
		//if (theForm.mailtype[0].checked) {
		//	alert("Hai selezionato il formato HTML. Ricorda che alcuni programmi di posta elettronica non supportano questo formato in modo corretto. Clicca OK se sei sicuro di utilizzare un programma adatto, oppure clicca CANCELLA e seleziona il formato TEXT.\n\nYou selected HTML e-mail format. Please note that some e-mail clients are not able to handle HTML formatting correctly. Click the OK button to proceed with HTML format or click Cancel to go back and change it to Text. If you find problems reading your iSource, you can alwais return to the iSource page and select Text.");
		//}
		
		theForm.elements['okForm'].value = 1;
		return (true);
		
	}
// --------------------------------------------------- 	
// --------------------------------------------------- 	


// --------------------------------------------------- 	
// CHECK E-MAIL x MODIFICA/CANCELLAZIONE   	
// --------------------------------------------------- 	
	function UnsubForm_Validator(theForm) {
		if (theForm.email.value == "" || (!(theForm.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.([A-Za-z0-9])([A-Za-z0-9]?)([A-Za-z0-9]?)$/)!= -1))) {
	    	alert("(I) Indirizzo E-MAIL non valido\n(EN) Invalid E-MAIL ADDRESS!");
	        theForm.email.focus();
			return (false);
		}
					
		theForm.elements['okForm'].value = 1;
        return (true);        
	}
// --------------------------------------------------- 	
// --------------------------------------------------- 	


// --------------------------------------------------- 	
// ARCHIVE POP-UP PREVIEW    	
// --------------------------------------------------- 	
function archive_preview( msgid ) {
	var preview = window.open( "archive_popup.php?msgid=" + msgid, "preview", "height=500,width=700,toolbar=no,menubar=no,status=yes,resizable=yes,scrollbars=yes" );
}
// --------------------------------------------------- 	