function check_email() {

if(document.harvester.email.value=="") 
	{
		alert ("Inserire un indirizzo e-mail");
		return false
	}
else
	{
		if(!document.harvester.privacy.checked) 
			{
			alert ("Accettare l'informativa sulla Privacy ");
			return false
			}
	}
registration();
}


function registration(){
    
	var ajax = assegnaXMLHttpRequest();
			
	if(ajax) {
		// applicativo AJAX

        var emailDiv=document.getElementById("costruiscizopa2");
		email = document.getElementById("harvester").email.value;
		emailDiv.innerHTML="Invio in corso";

		// inizializzo la richiesta in post
		ajax.open("post", "/ZopaWeb/ApplicationResources/newsletter/registration.asp", true);
		
		// imposto il giusto header
		ajax.setRequestHeader("content-type", "application/x-www-form-urlencoded");
	
		// ulteriore header consigliato per richieste get o post
		// da scrivere prima di utilizzare send
		ajax.setRequestHeader("connection", "close");
		ajax.onreadystatechange = function() {
		    if (ajax.readyState == 4){
		     if (ajax.status == 200) {
			    var xml=ajax.responseXML;
			    
			   var testo = xml.getElementsByTagName("message")[0].firstChild.nodeValue;
			   emailDiv.innerHTML=testo;
		    }else {
		    emailDiv.innerHTML="si &egrave; verificato un errore, riprovare pi&ugrave; tardi "+ajax.readyState;
		    }
		    }
		}

	
		// effettuo la richiesta inviando la variabile leggi con contenuto Dante
		ajax.send("action=insertEmail&email="+email);
 
	}
	else
	{
		alert("XMLHttpRequest non supportato")
	}
return false
}



function open_privacy()
{
	var generator=window.open('','name','height=300,width=400');
	generator.document.write('<html><head><title>Informativa sulla privacy</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
	generator.document.write('<style type="text/css">@import url("/ZopaWeb/ApplicationResources/css/homepage.css");</style><!--[if lte IE 6]><style type="text/css">@import');
	generator.document.write('url("/ZopaWeb/ApplicationResources/css/homepageie.css");</style><![endif]-->');
	generator.document.write('</head><body><br><strong>Informativa sulla privacy</strong><br><div style="text-align:justify;margin:20px 20px 20px 20px">');
	generator.document.write('Ai sensi dell\'art 13 del Dlgs. 196/2003, La informiamo che l\'indirizzo e-mail da Lei comunicatoci verr&agrave; utilizzato da Zopa.it esclusivamente per dare seguito alla Sua specifica richiesta di essere informato sulle attivit&agrave; e le tempistiche inerenti l\'apertura del sito Web Zopa.it e sulle novit&agrave; ad essa connesse.');
	generator.document.write('Il titolare del trattamento &egrave; Zopa Italia spa, Via Savona 97, 20144 Milano e pu&ograve; essere contattato all\'indirizzo <a href=\'mailto:privacy@zopa.it\' id=\'costruiscizopa2_testo\'>privacy@zopa.it</a>');
	generator.document.write('</div></body></html>');
	generator.document.close();
}
