function verificaPrivacy(){

	if (document.getElementById('NEmail').value.length < 1){
		alert("E' necessario inserire l'indirizzo e-mail")
		document.getElementById('NEmail').focus();
		return false	
	}else{
		if ((document.getElementById('NEmail').value.indexOf("@") < 1) || (document.getElementById('NEmail').value.indexOf(".") < 1) || (document.getElementById('NEmail').value.indexOf(" ") > 1)){
		alert("L'indirizzo e-mail inserito non è corretto");
		document.getElementById('NEmail').focus();
		return (false);
		}
	}



if (document.getElementById('Privacy').checked== false){
	alert("E' necessario accettare la clausola per la privacy")
	document.getElementById('Privacy').focus();
	return false}

}

//---------------------------------------------------------------------------------------
// funzione per assegnare l'oggetto XMLHttpRequest
// compatibile con i browsers più recenti e diffusi
function assegnaXMLHttpRequest() {
// lista delle variabili locali
var XHR = null,
 // informazioni sul nome del browser
 browserUtente = navigator.userAgent.toUpperCase();
 // browser standard con supporto nativo
 // non importa il tipo di browser
 if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
  XHR = new XMLHttpRequest();
 // browser Internet Explorer
 // è necessario filtrare la versione 4
 else if(
  window.ActiveXObject &&
  browserUtente.indexOf("MSIE 4") < 0
 ) {
  // la versione 6 di IE ha un nome differente
  // per il tipo di oggetto ActiveX
  if(browserUtente.indexOf("MSIE 5") < 0)
   XHR = new ActiveXObject("Msxml2.XMLHTTP");
 // le versioni 5 e 5.5 invece sfruttano lo stesso nome
  else
   XHR = new ActiveXObject("Microsoft.XMLHTTP");
 }
 return XHR;
} 
//--------------------------------------------------------
//onload = function() {

//} 
//--------------------------------------------------------
function DammiInfoProdotto(idProdotto){
 var ajax = assegnaXMLHttpRequest();
  if(ajax) {
   // applicativo AJAX
   ajax.open("get", "giveme-info.asp?idProdotto="+idProdotto, true);
   ajax.send(null);

	ajax.onreadystatechange = function() {
	  if(ajax.readyState === 4) {
	  	if(ajax.status == 200){
		//alert("Operazione effettuata con successo");
			document.getElementById("info-prod").innerHTML = ajax.responseText;
			
	  	}else{
			alert("Operazione fallita, errore numero " + ajax.status);
		}
	  }else{
	  //alert(ajax.readyState);
	  }
	} 
	
	var readyState = {
		INATTIVO:	0,
		INIZIALIZZATO:	1,
		RICHIESTA:	2,
		RISPOSTA:	3,
		COMPLETATO:	4
	};

 }
}
//--------------------------------------------------------

function CalcolaImporto(ImportoX,QtaX,CampoDiv,id){
 var ajax = assegnaXMLHttpRequest();
  if(ajax) {
   // applicativo AJAX
   ajax.open("get", "calcola_imp.asp?ImportoX="+ImportoX+"&Qtax="+QtaX+"&id="+id, true);
   ajax.send(null);

	ajax.onreadystatechange = function() {
	  if(ajax.readyState === 4) {
	  	if(ajax.status == 200){
		//alert("Operazione effettuata con successo");
			document.getElementById(CampoDiv).innerHTML = ajax.responseText;
			
	  	}else{
			alert("Operazione fallita, errore numero " + ajax.status);
		}
	  }else{
	  //alert(ajax.readyState);
	  }
	} 
	
	var readyState = {
		INATTIVO:	0,
		INIZIALIZZATO:	1,
		RICHIESTA:	2,
		RISPOSTA:	3,
		COMPLETATO:	4
	};

 }
}


function CalcolaTotale(TipoSpedizione,IdOrdine){
 var ajax = assegnaXMLHttpRequest();
  if(ajax) {
   // applicativo AJAX
   ajax.open("get", "calcola_totali.asp?TipoSpedizione="+TipoSpedizione+"&IdOrdine="+IdOrdine, true);
   ajax.send(null);

	ajax.onreadystatechange = function() {
	  if(ajax.readyState === 4) {
	  	if(ajax.status == 200){
		//alert("Operazione effettuata con successo");
			document.getElementById("TotaleGenerale").innerHTML = ajax.responseText;
			
	  	}else{
			alert("Operazione fallita, errore numero " + ajax.status);
		}
	  }else{
	  //alert(ajax.readyState);
	  }
	} 
	
	var readyState = {
		INATTIVO:	0,
		INIZIALIZZATO:	1,
		RICHIESTA:	2,
		RISPOSTA:	3,
		COMPLETATO:	4
	};

 }
}

function CalcolaTotaleSpedizione(TipoSpedizione,IdOrdine){
 var ajax = assegnaXMLHttpRequest();
  if(ajax) {
   // applicativo AJAX
   ajax.open("get", "calcola_totali_sped.asp?IdOrdine="+IdOrdine+"&TipoSpedizione="+TipoSpedizione, true);
   ajax.send(null);

	ajax.onreadystatechange = function() {
	  if(ajax.readyState === 4) {
	  	if(ajax.status == 200){
		//alert("Operazione effettuata con successo");
			document.getElementById("costosped").innerHTML = ajax.responseText;
			
	  	}else{
			alert("Operazione fallita, errore numero " + ajax.status);
		}
	  }else{
	  //alert(ajax.readyState);
	  }
	  document.getElementById("boxLoading").style.visibility = "hidden";
	} 
	
	var readyState = {
		INATTIVO:	0,
		INIZIALIZZATO:	1,
		RICHIESTA:	2,
		RISPOSTA:	3,
		COMPLETATO:	4
	};

 }
}
