function aggiorna() {
  var quantita = 0;
  var confezioni = 0; 
  var spese = 0;
  var elenco_prodotti = '';


  if ( eval(document.getElementById("quantita_MECLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_MECLA").value); }
  somma_MECLA = document.getElementById("quantita_MECLA").value * document.getElementById("prezzo_MECLA").value;
  iva_MECLA = somma_MECLA * 0.2;
  totale_MECLA = somma_MECLA * 1.2;
  document.getElementById("somma_MECLA").value = somma_MECLA.toFixed(2);
  document.getElementById("iva_MECLA").value = iva_MECLA.toFixed(2);
  document.getElementById("totale_MECLA").value = totale_MECLA.toFixed(2);
  if ( document.getElementById("quantita_MECLA").value != 0 ) {
	elenco_prodotti = 'n.' + document.getElementById("quantita_MECLA").value + ' Merlot Doc, rosso secco (2008)'; }
  
  if ( eval(document.getElementById("quantita_CFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CFCLA").value); }
  somma_CFCLA = document.getElementById("quantita_CFCLA").value * document.getElementById("prezzo_CFCLA").value ;
  iva_CFCLA = somma_CFCLA * 0.2;
  totale_CFCLA = somma_CFCLA * 1.2;
  document.getElementById("somma_CFCLA").value = somma_CFCLA.toFixed(2);
  document.getElementById("iva_CFCLA").value = iva_CFCLA.toFixed(2);
  document.getElementById("totale_CFCLA").value = totale_CFCLA.toFixed(2);
  if ( document.getElementById("quantita_CFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CFCLA").value + ' Cabernet Franc Doc, rosso secco (2008)'; }

  if ( eval(document.getElementById("quantita_CHCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CHCLA").value); }
  somma_CHCLA = document.getElementById("quantita_CHCLA").value * document.getElementById("prezzo_CHCLA").value;
  iva_CHCLA = somma_CHCLA * 0.2;
  totale_CHCLA = somma_CHCLA * 1.2;
  document.getElementById("somma_CHCLA").value = somma_CHCLA.toFixed(2);
  document.getElementById("iva_CHCLA").value = iva_CHCLA.toFixed(2);
  document.getElementById("totale_CHCLA").value = totale_CHCLA.toFixed(2);
  if ( document.getElementById("quantita_CHCLA").value != 0 ) {  
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CHCLA").value + ' Chardonnay Doc, bianco secco (2008)'; }

  if ( eval(document.getElementById("quantita_TFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_TFCLA").value); }
  somma_TFCLA = document.getElementById("quantita_TFCLA").value * document.getElementById("prezzo_TFCLA").value;
  iva_TFCLA = somma_TFCLA * 0.2;
  totale_TFCLA = somma_TFCLA * 1.2;
  document.getElementById("somma_TFCLA").value = somma_TFCLA.toFixed(2);
  document.getElementById("iva_TFCLA").value = iva_TFCLA.toFixed(2);
  document.getElementById("totale_TFCLA").value = totale_TFCLA.toFixed(2);
  if ( document.getElementById("quantita_TFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_TFCLA").value + ' Friulano Doc, bianco secco (2008)'; }
 
  if ( eval(document.getElementById("quantita_VFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_VFCLA").value); }
  somma_VFCLA = document.getElementById("quantita_VFCLA").value * document.getElementById("prezzo_VFCLA").value;
  iva_VFCLA = somma_VFCLA * 0.2;
  totale_VFCLA = somma_VFCLA * 1.2;
  document.getElementById("somma_VFCLA").value = somma_VFCLA.toFixed(2);
  document.getElementById("iva_VFCLA").value = iva_VFCLA.toFixed(2);
  document.getElementById("totale_VFCLA").value = totale_VFCLA.toFixed(2);
  if ( document.getElementById("quantita_VFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_VFCLA").value + ' Verduzzo Friulano Doc, bianco dolce (2007)'; }
  
  if ( eval(document.getElementById("quantita_MECRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_MECRU").value); }
  somma_MECRU = document.getElementById("quantita_MECRU").value * document.getElementById("prezzo_MECRU").value;
  iva_MECRU = somma_MECRU * 0.2;
  totale_MECRU = somma_MECRU * 1.2;
  document.getElementById("somma_MECRU").value = somma_MECRU .toFixed(2);
  document.getElementById("iva_MECRU").value = iva_MECRU .toFixed(2);
  document.getElementById("totale_MECRU").value = totale_MECRU .toFixed(2);
  if ( document.getElementById("quantita_MECRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_MECRU").value + ' Merlot Doc, rosso secco strutturato (2004)'; }
 
  if ( eval(document.getElementById("quantita_CFCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CFCRU").value); }
  somma_CFCRU = document.getElementById("quantita_CFCRU").value * document.getElementById("prezzo_CFCRU").value;
  iva_CFCRU = somma_CFCRU * 0.2;
  totale_CFCRU = somma_CFCRU * 1.2;
  document.getElementById("somma_CFCRU").value = somma_CFCRU .toFixed(2);
  document.getElementById("iva_CFCRU").value = iva_CFCRU .toFixed(2);
  document.getElementById("totale_CFCRU").value = totale_CFCRU .toFixed(2);
  if ( document.getElementById("quantita_CFCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CFCRU").value + ' Cabernet Franc Doc, rosso secco strutturato (2004)'; }
  
  if ( eval(document.getElementById("quantita_TFCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_TFCRU").value); }
  somma_TFCRU = document.getElementById("quantita_TFCRU").value * document.getElementById("prezzo_TFCRU").value;
  iva_TFCRU = somma_TFCRU * 0.2;
  totale_TFCRU = somma_TFCRU * 1.2;
  document.getElementById("somma_TFCRU").value = somma_TFCRU .toFixed(2);
  document.getElementById("iva_TFCRU").value = iva_TFCRU .toFixed(2);
  document.getElementById("totale_TFCRU").value = totale_TFCRU .toFixed(2);
  if ( document.getElementById("quantita_TFCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_TFCRU").value + ' Friulano Doc, bianco secco strutturato (2004)'; }

  if ( eval(document.getElementById("quantita_CHCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CHCRU").value); }
  somma_CHCRU = document.getElementById("quantita_CHCRU").value * document.getElementById("prezzo_CHCRU").value;
  iva_CHCRU = somma_CHCRU * 0.2;
  totale_CHCRU = somma_CHCRU * 1.2;
  document.getElementById("somma_CHCRU").value = somma_CHCRU .toFixed(2);
  document.getElementById("iva_CHCRU").value = iva_CHCRU .toFixed(2);
  document.getElementById("totale_CHCRU").value = totale_CHCRU .toFixed(2);
   if ( document.getElementById("quantita_CHCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CHCRU").value + ' Chardonnay Doc, bianco secco strutturato (2004)'; }

  if ( eval(document.getElementById("quantita_PGFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_PGFT").value); }
  somma_PGFT = document.getElementById("quantita_PGFT").value * document.getElementById("prezzo_PGFT").value;
  iva_PGFT = somma_PGFT * 0.2;
  totale_PGFT = somma_PGFT * 1.2;
  document.getElementById("somma_PGFT").value = somma_PGFT.toFixed(2);
  document.getElementById("iva_PGFT").value = iva_PGFT.toFixed(2);
  document.getElementById("totale_PGFT").value = totale_PGFT.toFixed(2);
   if ( document.getElementById("quantita_PGFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_PGFT").value + ' Finis Terrae Grigio Igt, bianco secco ramato (2002)'; }
 
  if ( eval(document.getElementById("quantita_BIFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_BIFT").value); }
  somma_BIFT = document.getElementById("quantita_BIFT").value * document.getElementById("prezzo_BIFT").value;
  iva_BIFT = somma_BIFT * 0.2;
  totale_BIFT = somma_BIFT * 1.2;
  document.getElementById("somma_BIFT").value = somma_BIFT.toFixed(2);
  document.getElementById("iva_BIFT").value = iva_BIFT.toFixed(2);
  document.getElementById("totale_BIFT").value = totale_BIFT.toFixed(2);
   if ( document.getElementById("quantita_BIFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_BIFT").value + ' Finis Terrae Bianco Igt, bianco secco aff.legno (2002)'; }
  
  if ( eval(document.getElementById("quantita_ROFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_ROFT").value); }
  somma_ROFT = document.getElementById("quantita_ROFT").value * document.getElementById("prezzo_ROFT").value;
  iva_ROFT = somma_ROFT * 0.2;
  totale_ROFT = somma_ROFT * 1.2;
  document.getElementById("somma_ROFT").value = somma_ROFT.toFixed(2);
  document.getElementById("iva_ROFT").value = iva_ROFT.toFixed(2);
  document.getElementById("totale_ROFT").value = totale_ROFT.toFixed(2);
   if ( document.getElementById("quantita_ROFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_ROFT").value + ' Finis Terrae Rosso Igt, rosso secco aff.legno (2002)'; }

  if ( eval(document.getElementById("quantita_NEFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_NEFT").value); }
  somma_NEFT = document.getElementById("quantita_NEFT").value * document.getElementById("prezzo_NEFT").value;
  iva_NEFT = somma_NEFT * 0.2;
  totale_NEFT = somma_NEFT * 1.2;
  document.getElementById("somma_NEFT").value = somma_NEFT.toFixed(2);
  document.getElementById("iva_NEFT").value = iva_NEFT.toFixed(2);
  document.getElementById("totale_NEFT").value = totale_NEFT.toFixed(2);  
   if ( document.getElementById("quantita_NEFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_NEFT").value + ' Finis Terrae Nero Igt, rosso secco aff.legno (2002)'; }
/*
  quantita = quantita + eval(document.getElementById("quantita_PASSI").value); 
  somma_PASSI = document.getElementById("quantita_PASSI").value * document.getElementById("prezzo_PASSI").value;
  iva_PASSI = somma_PASSI * 0.2;
  totale_PASSI = somma_PASSI * 1.2;
  document.getElementById("somma_PASSI").value = somma_PASSI.toFixed(2);
  document.getElementById("iva_PASSI").value = iva_PASSI.toFixed(2);
  document.getElementById("totale_PASSI").value = totale_PASSI.toFixed(2);  
   if ( document.getElementById("quantita_PASSI").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_PASSI").value + ' Finis Terrae Oro Igt, bianco dolce passito (2002)'; }
*/
  if ( eval(document.getElementById("quantita_SPUM").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_SPUM").value); }
  somma_SPUM = document.getElementById("quantita_SPUM").value * document.getElementById("prezzo_SPUM").value;
  iva_SPUM = somma_SPUM * 0.2;
  totale_SPUM = somma_SPUM * 1.2;
  document.getElementById("somma_SPUM").value = somma_SPUM.toFixed(2);
  document.getElementById("iva_SPUM").value = iva_SPUM.toFixed(2);
  document.getElementById("totale_SPUM").value = totale_SPUM.toFixed(2);  
   if ( document.getElementById("quantita_SPUM").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_SPUM").value + ' Spumante, metodo champenois (2008)'; }
/*	
  quantita = quantita + eval(document.getElementById("quantita_GRAP").value); 
  somma_GRAP = document.getElementById("quantita_GRAP").value * document.getElementById("prezzo_GRAP").value;
  iva_GRAP = somma_GRAP * 0.2;
  totale_GRAP = somma_GRAP * 1.2;
  document.getElementById("somma_GRAP").value = somma_GRAP.toFixed(2);
  document.getElementById("iva_GRAP").value = iva_GRAP.toFixed(2);
  document.getElementById("totale_GRAP").value = totale_GRAP.toFixed(2);  
   if ( document.getElementById("quantita_GRAP").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_GRAP").value + ' Grappa, bianca secca'; }
*/
//	somme_somma = somma_MECLA + somma_CFCLA + somma_CHCLA + somma_TFCLA + somma_VFCLA + somma_MECRU + somma_CFCRU + somma_TFCRU + somma_CHCRU + somma_PGFT + somma_BIFT + somma_ROFT + somma_NEFT + somma_PASSI + somma_GRAP + somma_SPUM;
	somme_somma = somma_MECLA + somma_CFCLA + somma_CHCLA + somma_TFCLA + somma_VFCLA + somma_MECRU + somma_CFCRU + somma_TFCRU + somma_CHCRU + somma_PGFT + somma_BIFT + somma_ROFT + somma_NEFT + somma_SPUM;
	somme_iva = somme_somma * 0.2; 
	somme_totale = somme_somma * 1.2;
	document.getElementById("somme_quantita").value = quantita;
	document.getElementById("somme_somma").value = somme_somma.toFixed(2);  
	document.getElementById("somme_iva").value = somme_iva.toFixed(2);  
	document.getElementById("somme_totale").value = somme_totale.toFixed(2);

//	sconto_somma = somme_somma * document.getElementById("sconto").value;
//	sconto_iva = somme_iva * document.getElementById("sconto").value;
	sconto_totale = somme_totale * document.getElementById("sconto").value;
//	document.getElementById("sconto_somma").value = sconto_somma.toFixed(2);  
//	document.getElementById("sconto_iva").value = sconto_iva .toFixed(2);  
	document.getElementById("sconto_totale").value = sconto_totale.toFixed(2);    

	document.getElementById("elenco_prodotti").innerHTML = elenco_prodotti;
	totale_lordo = somme_totale - sconto_totale + eval(document.getElementById("spese").value)*1.2;
	document.getElementById("totale_lordo").value = totale_lordo.toFixed(2); 	
	document.getElementById("htotale_lordo").innerHTML = totale_lordo.toFixed(2); 

	resto = quantita % 6;
	if ( resto != 0 || quantita == 0 ) {
		document.getElementById("controllo").innerHTML = 'Quantita\' errata! Consiglio: aggiungi ' + (6-resto) + ' bottiglie';
		document.getElementById("controllo2").innerHTML = 'Quantita\' errata! Consiglio: aggiungi ' + (6-resto) + ' bottiglie';
		document.getElementById("controllo3").innerHTML = 'Per completare l\'ordine e\' necessario correggere il quantitativo (multiplo di 6)';
		document.getElementById("submit").disabled=true;
	} else { 
		document.getElementById("controllo").innerHTML = ''; 
		document.getElementById("controllo2").innerHTML = ''; 
		document.getElementById("controllo3").innerHTML = '';
		document.getElementById("submit").disabled=false;		
	}
}

function aggiorna_ana() {
	var anagrafica = '';
	anagrafica = anagrafica + document.getElementById("nome_cliente").value + '<br>';
	anagrafica = anagrafica + document.getElementById("indirizzo_cliente").value + '<br>';
	anagrafica = anagrafica + document.getElementById("cap_cliente").value + ' ';
	anagrafica = anagrafica + document.getElementById("paese_cliente").value + ' ';
	if ( document.getElementById("provincia_cliente").value != '') {
		anagrafica = anagrafica + '(' + document.getElementById("provincia_cliente").value + ')';
	}
	if ( document.getElementById("telefono_cliente").value != '') {
		anagrafica = anagrafica + '<br>Telefono ' + document.getElementById("telefono_cliente").value;
	} 
	if ( document.getElementById("email_cliente").value != '') {
		anagrafica = anagrafica + '<br>Email ' + document.getElementById("email_cliente").value;
	} 
	document.getElementById("anagrafica").innerHTML = anagrafica;

	var spedizione = '<b>SPEDIZIONE</b><br>';
	spedizione = spedizione + document.getElementById("nome_spedizione").value + '<br>'; 
	spedizione = spedizione + document.getElementById("indirizzo_spedizione").value + '<br>'
	spedizione = spedizione + document.getElementById("cap_spedizione").value + ' ' + document.getElementById("paese_spedizione").value;
	if (document.getElementById("provincia_spedizione").value != '') {
		spedizione = spedizione + ' (' + document.getElementById("provincia_spedizione").value + ')'; }
	document.getElementById("dati_spedizione").innerHTML = spedizione;

	var pagamento = '<b>PAGAMENTO</b><br>'; 
	if ( document.getElementById("pagamento1").checked ) { pagamento = pagamento + 'Alla consegna del corriere' }
	if ( document.getElementById("pagamento2").checked ) { pagamento = pagamento + 'Carta di credito' }
	if ( document.getElementById("pagamento3").checked ) { pagamento = pagamento + 'Bonifico bancario anticipato' }
	document.getElementById("dati_pagamento").innerHTML = pagamento;

	var note = '<b>NOTE</b><br>';
	note = note + document.getElementById("note").value;
	document.getElementById("dati_note").innerHTML = note;	
}
//************************************************/
function aggiorna02() {
  var quantita = 0;
  var quantita2 = 0; 
  var confezioni = 0; 
  var spese = 0;
  var elenco_prodotti = '';

  if ( document.getElementById("composizione").value != " " ) {
	elenco_prodotti = document.getElementById("composizione").value + '<br>'; }
  
  if ( eval(document.getElementById("quantita_MECLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_MECLA").value); }
  somma_MECLA = document.getElementById("quantita_MECLA").value * document.getElementById("prezzo_MECLA").value;
  iva_MECLA = somma_MECLA * 0.2;
  totale_MECLA = somma_MECLA * 1.2;
  document.getElementById("somma_MECLA").value = somma_MECLA.toFixed(2);
  document.getElementById("iva_MECLA").value = iva_MECLA.toFixed(2);
  document.getElementById("totale_MECLA").value = totale_MECLA.toFixed(2);
  if ( document.getElementById("quantita_MECLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_MECLA").value + ' Merlot Doc, rosso secco (2008)'; }
  
  if ( eval(document.getElementById("quantita_CFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CFCLA").value); }
  somma_CFCLA = document.getElementById("quantita_CFCLA").value * document.getElementById("prezzo_CFCLA").value ;
  iva_CFCLA = somma_CFCLA * 0.2;
  totale_CFCLA = somma_CFCLA * 1.2;
  document.getElementById("somma_CFCLA").value = somma_CFCLA.toFixed(2);
  document.getElementById("iva_CFCLA").value = iva_CFCLA.toFixed(2);
  document.getElementById("totale_CFCLA").value = totale_CFCLA.toFixed(2);
  if ( document.getElementById("quantita_CFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CFCLA").value + ' Cabernet Franc Doc, rosso secco (2008)'; }

  if ( eval(document.getElementById("quantita_CHCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CHCLA").value); }
  somma_CHCLA = document.getElementById("quantita_CHCLA").value * document.getElementById("prezzo_CHCLA").value;
  iva_CHCLA = somma_CHCLA * 0.2;
  totale_CHCLA = somma_CHCLA * 1.2;
  document.getElementById("somma_CHCLA").value = somma_CHCLA.toFixed(2);
  document.getElementById("iva_CHCLA").value = iva_CHCLA.toFixed(2);
  document.getElementById("totale_CHCLA").value = totale_CHCLA.toFixed(2);
  if ( document.getElementById("quantita_CHCLA").value != 0 ) {  
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CHCLA").value + ' Chardonnay Doc, bianco secco (2008)'; }

  if ( eval(document.getElementById("quantita_TFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_TFCLA").value); }
  somma_TFCLA = document.getElementById("quantita_TFCLA").value * document.getElementById("prezzo_TFCLA").value;
  iva_TFCLA = somma_TFCLA * 0.2;
  totale_TFCLA = somma_TFCLA * 1.2;
  document.getElementById("somma_TFCLA").value = somma_TFCLA.toFixed(2);
  document.getElementById("iva_TFCLA").value = iva_TFCLA.toFixed(2);
  document.getElementById("totale_TFCLA").value = totale_TFCLA.toFixed(2);
  if ( document.getElementById("quantita_TFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_TFCLA").value + ' Friulano Doc, bianco secco (2008)'; }
 
  if ( eval(document.getElementById("quantita_VFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_VFCLA").value); }
  somma_VFCLA = document.getElementById("quantita_VFCLA").value * document.getElementById("prezzo_VFCLA").value;
  iva_VFCLA = somma_VFCLA * 0.2;
  totale_VFCLA = somma_VFCLA * 1.2;
  document.getElementById("somma_VFCLA").value = somma_VFCLA.toFixed(2);
  document.getElementById("iva_VFCLA").value = iva_VFCLA.toFixed(2);
  document.getElementById("totale_VFCLA").value = totale_VFCLA.toFixed(2);
  if ( document.getElementById("quantita_VFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_VFCLA").value + ' Verduzzo Friulano Doc, bianco dolce (2007)'; }
  
  if ( eval(document.getElementById("quantita_MECRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_MECRU").value); }
  somma_MECRU = document.getElementById("quantita_MECRU").value * document.getElementById("prezzo_MECRU").value;
  iva_MECRU = somma_MECRU * 0.2;
  totale_MECRU = somma_MECRU * 1.2;
  document.getElementById("somma_MECRU").value = somma_MECRU .toFixed(2);
  document.getElementById("iva_MECRU").value = iva_MECRU .toFixed(2);
  document.getElementById("totale_MECRU").value = totale_MECRU .toFixed(2);
  if ( document.getElementById("quantita_MECRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_MECRU").value + ' Merlot Doc, rosso secco strutturato (2004)'; }
 
  if ( eval(document.getElementById("quantita_CFCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CFCRU").value); }
  somma_CFCRU = document.getElementById("quantita_CFCRU").value * document.getElementById("prezzo_CFCRU").value;
  iva_CFCRU = somma_CFCRU * 0.2;
  totale_CFCRU = somma_CFCRU * 1.2;
  document.getElementById("somma_CFCRU").value = somma_CFCRU .toFixed(2);
  document.getElementById("iva_CFCRU").value = iva_CFCRU .toFixed(2);
  document.getElementById("totale_CFCRU").value = totale_CFCRU .toFixed(2);
  if ( document.getElementById("quantita_CFCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CFCRU").value + ' Cabernet Franc Doc, rosso secco strutturato (2004)'; }
  
  if ( eval(document.getElementById("quantita_TFCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_TFCRU").value); }
  somma_TFCRU = document.getElementById("quantita_TFCRU").value * document.getElementById("prezzo_TFCRU").value;
  iva_TFCRU = somma_TFCRU * 0.2;
  totale_TFCRU = somma_TFCRU * 1.2;
  document.getElementById("somma_TFCRU").value = somma_TFCRU .toFixed(2);
  document.getElementById("iva_TFCRU").value = iva_TFCRU .toFixed(2);
  document.getElementById("totale_TFCRU").value = totale_TFCRU .toFixed(2);
  if ( document.getElementById("quantita_TFCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_TFCRU").value + ' Friulano Doc, bianco secco strutturato (2004)'; }

  if ( eval(document.getElementById("quantita_CHCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CHCRU").value); }
  somma_CHCRU = document.getElementById("quantita_CHCRU").value * document.getElementById("prezzo_CHCRU").value;
  iva_CHCRU = somma_CHCRU * 0.2;
  totale_CHCRU = somma_CHCRU * 1.2;
  document.getElementById("somma_CHCRU").value = somma_CHCRU .toFixed(2);
  document.getElementById("iva_CHCRU").value = iva_CHCRU .toFixed(2);
  document.getElementById("totale_CHCRU").value = totale_CHCRU .toFixed(2);
   if ( document.getElementById("quantita_CHCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CHCRU").value + ' Chardonnay Doc, bianco secco strutturato (2004)'; }

  if ( eval(document.getElementById("quantita_PGFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_PGFT").value); }
  somma_PGFT = document.getElementById("quantita_PGFT").value * document.getElementById("prezzo_PGFT").value;
  iva_PGFT = somma_PGFT * 0.2;
  totale_PGFT = somma_PGFT * 1.2;
  document.getElementById("somma_PGFT").value = somma_PGFT.toFixed(2);
  document.getElementById("iva_PGFT").value = iva_PGFT.toFixed(2);
  document.getElementById("totale_PGFT").value = totale_PGFT.toFixed(2);
   if ( document.getElementById("quantita_PGFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_PGFT").value + ' Finis Terrae Grigio Igt, bianco secco ramato (2002)'; }
 
  if ( eval(document.getElementById("quantita_BIFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_BIFT").value); }
  somma_BIFT = document.getElementById("quantita_BIFT").value * document.getElementById("prezzo_BIFT").value;
  iva_BIFT = somma_BIFT * 0.2;
  totale_BIFT = somma_BIFT * 1.2;
  document.getElementById("somma_BIFT").value = somma_BIFT.toFixed(2);
  document.getElementById("iva_BIFT").value = iva_BIFT.toFixed(2);
  document.getElementById("totale_BIFT").value = totale_BIFT.toFixed(2);
   if ( document.getElementById("quantita_BIFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_BIFT").value + ' Finis Terrae Bianco Igt, bianco secco aff.legno (2002)'; }
  
  if ( eval(document.getElementById("quantita_ROFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_ROFT").value); }
  somma_ROFT = document.getElementById("quantita_ROFT").value * document.getElementById("prezzo_ROFT").value;
  iva_ROFT = somma_ROFT * 0.2;
  totale_ROFT = somma_ROFT * 1.2;
  document.getElementById("somma_ROFT").value = somma_ROFT.toFixed(2);
  document.getElementById("iva_ROFT").value = iva_ROFT.toFixed(2);
  document.getElementById("totale_ROFT").value = totale_ROFT.toFixed(2);
   if ( document.getElementById("quantita_ROFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_ROFT").value + ' Finis Terrae Rosso Igt, rosso secco aff.legno (2002)'; }

  if ( eval(document.getElementById("quantita_NEFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_NEFT").value); }
  somma_NEFT = document.getElementById("quantita_NEFT").value * document.getElementById("prezzo_NEFT").value;
  iva_NEFT = somma_NEFT * 0.2;
  totale_NEFT = somma_NEFT * 1.2;
  document.getElementById("somma_NEFT").value = somma_NEFT.toFixed(2);
  document.getElementById("iva_NEFT").value = iva_NEFT.toFixed(2);
  document.getElementById("totale_NEFT").value = totale_NEFT.toFixed(2);  
   if ( document.getElementById("quantita_NEFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_NEFT").value + ' Finis Terrae Nero Igt, rosso secco aff.legno (2002)'; }

  if ( eval(document.getElementById("quantita_SPUM").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_SPUM").value); }
  somma_SPUM = document.getElementById("quantita_SPUM").value * document.getElementById("prezzo_SPUM").value;
  iva_SPUM = somma_SPUM * 0.2;
  totale_SPUM = somma_SPUM * 1.2;
  document.getElementById("somma_SPUM").value = somma_SPUM.toFixed(2);
  document.getElementById("iva_SPUM").value = iva_SPUM.toFixed(2);
  document.getElementById("totale_SPUM").value = totale_SPUM.toFixed(2);  
   if ( document.getElementById("quantita_SPUM").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_SPUM").value + ' Spumante, metodo champenois (2008)'; }

  if ( eval(document.getElementById("quantita_GRAP").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_GRAP").value); }
  somma_GRAP = document.getElementById("quantita_GRAP").value * document.getElementById("prezzo_GRAP").value;
  iva_GRAP = somma_GRAP * 0.2;
  totale_GRAP = somma_GRAP * 1.2;
  document.getElementById("somma_GRAP").value = somma_GRAP.toFixed(2);
  document.getElementById("iva_GRAP").value = iva_GRAP.toFixed(2);
  document.getElementById("totale_GRAP").value = totale_GRAP.toFixed(2);  
   if ( document.getElementById("quantita_GRAP").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_GRAP").value + ' Grappa di vinaccia'; }

  if ( eval(document.getElementById("quantita_MARO").value) != null ) { 
    quantita2 = quantita2 + eval(document.getElementById("quantita_MARO").value); }
  somma_MARO = document.getElementById("quantita_MARO").value * document.getElementById("prezzo_MARO").value;
  iva_MARO = somma_MARO * 0.2;
  totale_MARO = somma_MARO * 1.2;
  document.getElementById("somma_MARO").value = somma_MARO.toFixed(2);
  document.getElementById("iva_MARO").value = iva_MARO.toFixed(2);
  document.getElementById("totale_MARO").value = totale_MARO.toFixed(2);  
   if ( document.getElementById("quantita_MARO").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_MARO").value + ' Magnum (s.c.), Rosso secco strutturato (2004)'; }

  if ( eval(document.getElementById("quantita_MARC").value) != null ) { 
    quantita2 = quantita2 + eval(document.getElementById("quantita_MARC").value); }
  somma_MARC = document.getElementById("quantita_MARC").value * document.getElementById("prezzo_MARC").value;
  iva_MARC = somma_MARC * 0.2;
  totale_MARC = somma_MARC * 1.2;
  document.getElementById("somma_MARC").value = somma_MARC.toFixed(2);
  document.getElementById("iva_MARC").value = iva_MARC.toFixed(2);
  document.getElementById("totale_MARC").value = totale_MARC.toFixed(2);  
   if ( document.getElementById("quantita_MARC").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_MARC").value + ' Magnum con cofanetto in legno, Rosso secco strutturato (2004)'; }
	
	
	if ( eval(document.getElementById("confezioni").value) != null ) { 
		confezioni = eval(document.getElementById("confezioni").value);
		if (confezioni == 1) { confezion="e";} else {confezion="i";}
		elenco_prodotti = elenco_prodotti + '<br><br>L\'ordine e\' stato organizzato in ' + confezioni + ' confezion' + confezion + " contenent" + confezion + " ognuna i prodotti sopra indicati";
	} 
 


//	somme_somma = somma_MECLA + somma_CFCLA + somma_CHCLA + somma_TFCLA + somma_VFCLA + somma_MECRU + somma_CFCRU + somma_TFCRU + somma_CHCRU + somma_PGFT + somma_BIFT + somma_ROFT + somma_NEFT + somma_PASSI + somma_GRAP + somma_SPUM;
	var somme_somma = (somma_MECLA + somma_CFCLA + somma_CHCLA + somma_TFCLA + somma_VFCLA + somma_MECRU + somma_CFCRU + somma_TFCRU + somma_CHCRU + somma_PGFT + somma_BIFT + somma_ROFT + somma_NEFT + somma_SPUM + somma_GRAP + somma_MARO + somma_MARC);
	var somme_iva = (somme_somma * 0.2); 
	var somme_totale = (somme_somma * 1.2);
	document.getElementById("somme_quantita").value = quantita + quantita2;
	document.getElementById("somme_somma").value = somme_somma.toFixed(2);  
	document.getElementById("somme_iva").value = somme_iva.toFixed(2);  
	document.getElementById("somme_totale").value = somme_totale.toFixed(2);

	var sconto_imponibile = somme_somma * document.getElementById("sconto").value;
	var sconto_iva = somme_iva * document.getElementById("sconto").value;
	var sconto_totale = somme_totale * document.getElementById("sconto").value;
	document.getElementById("sconto_imponibile").value = sconto_imponibile.toFixed(2);  
	document.getElementById("sconto_iva").value = sconto_iva .toFixed(2);  
	document.getElementById("sconto_totale").value = sconto_totale.toFixed(2); 

	var confezioni_somma = confezioni * (somme_somma - sconto_imponibile);
	var confezioni_iva = confezioni * (somme_iva - sconto_iva); 
	var confezioni_totale = confezioni * (somme_totale - sconto_totale);
	document.getElementById("confezioni_somma").value = confezioni_somma.toFixed(2);  
	document.getElementById("confezioni_iva").value = confezioni_iva.toFixed(2);  
	document.getElementById("confezioni_totale").value = confezioni_totale.toFixed(2);	
	
	if ( document.getElementById("tipospedizione1").checked ) { spese = eval(document.getElementById("spese").value); }
	if ( document.getElementById("tipospedizione2").checked ) { 
		spese = confezioni * eval(document.getElementById("spese").value); 
		if ( confezioni > 1 ) {
		elenco_prodotti = elenco_prodotti + '<br>L\'ordine verra\' spedito direttamente ai clienti (verra\' richiesta l\'anagrafica)'; }
	}
	var speseiva = spese * 0.2;
	var spesetot = spese * 1.2;
	document.getElementById("speseimp").value = spese.toFixed(2);
	document.getElementById("speseiva").value = speseiva.toFixed(2);
	document.getElementById("spesetot").value = spesetot.toFixed(2);
	
	document.getElementById("elenco_prodotti").innerHTML = elenco_prodotti;
	totale_imponibile = confezioni_somma + spese;
	totale_iva = confezioni_iva + speseiva;
	totale_lordo = confezioni_totale + spesetot;
	document.getElementById("totale_imponibile").value = totale_imponibile.toFixed(2); 	
	document.getElementById("totale_iva").value = totale_iva.toFixed(2);  
	document.getElementById("totale_lordo").value = totale_lordo.toFixed(2); 	
	document.getElementById("htotale_imponibile").innerHTML = totale_imponibile.toFixed(2); 
	document.getElementById("htotale_iva").innerHTML = totale_iva.toFixed(2); 	
	document.getElementById("htotale_lordo").innerHTML = totale_lordo.toFixed(2); 

	resto = quantita % 6;
	if ( resto != 0 || ( quantita == 0 & quantita2 == 0) ) {
		document.getElementById("controllo").innerHTML = 'Quantita\' errata! Consiglio: aggiungi ' + (6-resto) + ' bottiglie (Magnum non conteggiate)';
		document.getElementById("controllo2").innerHTML = 'Quantita\' errata! Consiglio: aggiungi ' + (6-resto) + ' bottiglie (Magnum non conteggiate)';
		document.getElementById("controllo3").innerHTML = 'Per completare l\'ordine e\' necessario correggere il quantitativo con un multiplo di 6 (Magnum a parte)';
		document.getElementById("submit").disabled=true;
	} else { 
		document.getElementById("controllo").innerHTML = ''; 
		document.getElementById("controllo2").innerHTML = ''; 
		document.getElementById("controllo3").innerHTML = '';
		document.getElementById("submit").disabled=false;		
	}
}
function aggiorna_ana02() {
	var anagrafica = '';
	anagrafica = anagrafica + document.getElementById("nome_cliente").value + '<br>';
	anagrafica = anagrafica + 'P. Iva / C.F. ' + document.getElementById("partita_iva").value + '<br>';
	anagrafica = anagrafica + document.getElementById("indirizzo_cliente").value + '<br>';
	anagrafica = anagrafica + document.getElementById("cap_cliente").value + ' ';
	anagrafica = anagrafica + document.getElementById("paese_cliente").value + ' ';
	if ( document.getElementById("provincia_cliente").value != '') {
		anagrafica = anagrafica + '(' + document.getElementById("provincia_cliente").value + ')';
	}
	if ( document.getElementById("telefono_cliente").value != '') {
		anagrafica = anagrafica + '<br>Telefono ' + document.getElementById("telefono_cliente").value;
	} 
	if ( document.getElementById("email_cliente").value != '') {
		anagrafica = anagrafica + '<br>Email ' + document.getElementById("email_cliente").value;
	} 
	document.getElementById("anagrafica").innerHTML = anagrafica;

	var spedizione = '<b>SPEDIZIONE</b><br>';
	spedizione = spedizione + document.getElementById("nome_spedizione").value + '<br>'; 
	spedizione = spedizione + document.getElementById("indirizzo_spedizione").value + '<br>'
	spedizione = spedizione + document.getElementById("cap_spedizione").value + ' ' + document.getElementById("paese_spedizione").value;
	if (document.getElementById("provincia_spedizione").value != '') {
		spedizione = spedizione + ' (' + document.getElementById("provincia_spedizione").value + ')'; }
	document.getElementById("dati_spedizione").innerHTML = spedizione;

	var pagamento = '<b>PAGAMENTO</b><br>'; 
	if ( document.getElementById("pagamento1").checked ) { pagamento = pagamento + 'Alla consegna del corriere' }
	if ( document.getElementById("pagamento2").checked ) { pagamento = pagamento + 'Carta di credito' }
	if ( document.getElementById("pagamento3").checked ) { pagamento = pagamento + 'Bonifico bancario anticipato' }
	document.getElementById("dati_pagamento").innerHTML = pagamento;

	var note = '<b>NOTE</b><br>';
	note = note + document.getElementById("note").value;
	document.getElementById("dati_note").innerHTML = note;	
}
/*****************************************************************/
function aggiorna03() {
  var quantita = 0; //quantita per prodotti che devono essere multipli di 6
  var quantita2 = 0; //quantita per prodotti che possono essere acquistati senza vincoli di quantita 
  var confezioni = 0; 
  var spese = 0;
  var elenco_prodotti = '';


  if ( eval(document.getElementById("quantita_MECLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_MECLA").value); }
  somma_MECLA = document.getElementById("quantita_MECLA").value * document.getElementById("prezzo_MECLA").value;
  iva_MECLA = somma_MECLA * 0.2;
  totale_MECLA = somma_MECLA * 1.2;
  document.getElementById("somma_MECLA").value = somma_MECLA.toFixed(2);
  document.getElementById("iva_MECLA").value = iva_MECLA.toFixed(2);
  document.getElementById("totale_MECLA").value = totale_MECLA.toFixed(2);
  if ( document.getElementById("quantita_MECLA").value != 0 ) {
	elenco_prodotti = 'n.' + document.getElementById("quantita_MECLA").value + ' Merlot Doc, rosso secco (2008)'; }
  
  if ( eval(document.getElementById("quantita_CFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CFCLA").value); }
  somma_CFCLA = document.getElementById("quantita_CFCLA").value * document.getElementById("prezzo_CFCLA").value ;
  iva_CFCLA = somma_CFCLA * 0.2;
  totale_CFCLA = somma_CFCLA * 1.2;
  document.getElementById("somma_CFCLA").value = somma_CFCLA.toFixed(2);
  document.getElementById("iva_CFCLA").value = iva_CFCLA.toFixed(2);
  document.getElementById("totale_CFCLA").value = totale_CFCLA.toFixed(2);
  if ( document.getElementById("quantita_CFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CFCLA").value + ' Cabernet Franc Doc, rosso secco (2008)'; }

  if ( eval(document.getElementById("quantita_CHCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CHCLA").value); }
  somma_CHCLA = document.getElementById("quantita_CHCLA").value * document.getElementById("prezzo_CHCLA").value;
  iva_CHCLA = somma_CHCLA * 0.2;
  totale_CHCLA = somma_CHCLA * 1.2;
  document.getElementById("somma_CHCLA").value = somma_CHCLA.toFixed(2);
  document.getElementById("iva_CHCLA").value = iva_CHCLA.toFixed(2);
  document.getElementById("totale_CHCLA").value = totale_CHCLA.toFixed(2);
  if ( document.getElementById("quantita_CHCLA").value != 0 ) {  
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CHCLA").value + ' Chardonnay Doc, bianco secco (2008)'; }

  if ( eval(document.getElementById("quantita_TFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_TFCLA").value); }
  somma_TFCLA = document.getElementById("quantita_TFCLA").value * document.getElementById("prezzo_TFCLA").value;
  iva_TFCLA = somma_TFCLA * 0.2;
  totale_TFCLA = somma_TFCLA * 1.2;
  document.getElementById("somma_TFCLA").value = somma_TFCLA.toFixed(2);
  document.getElementById("iva_TFCLA").value = iva_TFCLA.toFixed(2);
  document.getElementById("totale_TFCLA").value = totale_TFCLA.toFixed(2);
  if ( document.getElementById("quantita_TFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_TFCLA").value + ' Friulano Doc, bianco secco (2008)'; }
 
  if ( eval(document.getElementById("quantita_VFCLA").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_VFCLA").value); }
  somma_VFCLA = document.getElementById("quantita_VFCLA").value * document.getElementById("prezzo_VFCLA").value;
  iva_VFCLA = somma_VFCLA * 0.2;
  totale_VFCLA = somma_VFCLA * 1.2;
  document.getElementById("somma_VFCLA").value = somma_VFCLA.toFixed(2);
  document.getElementById("iva_VFCLA").value = iva_VFCLA.toFixed(2);
  document.getElementById("totale_VFCLA").value = totale_VFCLA.toFixed(2);
  if ( document.getElementById("quantita_VFCLA").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_VFCLA").value + ' Verduzzo Friulano Doc, bianco dolce (2007)'; }
  
  if ( eval(document.getElementById("quantita_MECRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_MECRU").value); }
  somma_MECRU = document.getElementById("quantita_MECRU").value * document.getElementById("prezzo_MECRU").value;
  iva_MECRU = somma_MECRU * 0.2;
  totale_MECRU = somma_MECRU * 1.2;
  document.getElementById("somma_MECRU").value = somma_MECRU .toFixed(2);
  document.getElementById("iva_MECRU").value = iva_MECRU .toFixed(2);
  document.getElementById("totale_MECRU").value = totale_MECRU .toFixed(2);
  if ( document.getElementById("quantita_MECRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_MECRU").value + ' Merlot Doc, rosso secco strutturato (2004)'; }
 
  if ( eval(document.getElementById("quantita_CFCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CFCRU").value); }
  somma_CFCRU = document.getElementById("quantita_CFCRU").value * document.getElementById("prezzo_CFCRU").value;
  iva_CFCRU = somma_CFCRU * 0.2;
  totale_CFCRU = somma_CFCRU * 1.2;
  document.getElementById("somma_CFCRU").value = somma_CFCRU .toFixed(2);
  document.getElementById("iva_CFCRU").value = iva_CFCRU .toFixed(2);
  document.getElementById("totale_CFCRU").value = totale_CFCRU .toFixed(2);
  if ( document.getElementById("quantita_CFCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CFCRU").value + ' Cabernet Franc Doc, rosso secco strutturato (2004)'; }
  
  if ( eval(document.getElementById("quantita_TFCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_TFCRU").value); }
  somma_TFCRU = document.getElementById("quantita_TFCRU").value * document.getElementById("prezzo_TFCRU").value;
  iva_TFCRU = somma_TFCRU * 0.2;
  totale_TFCRU = somma_TFCRU * 1.2;
  document.getElementById("somma_TFCRU").value = somma_TFCRU .toFixed(2);
  document.getElementById("iva_TFCRU").value = iva_TFCRU .toFixed(2);
  document.getElementById("totale_TFCRU").value = totale_TFCRU .toFixed(2);
  if ( document.getElementById("quantita_TFCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_TFCRU").value + ' Friulano Doc, bianco secco strutturato (2004)'; }

  if ( eval(document.getElementById("quantita_CHCRU").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_CHCRU").value); }
  somma_CHCRU = document.getElementById("quantita_CHCRU").value * document.getElementById("prezzo_CHCRU").value;
  iva_CHCRU = somma_CHCRU * 0.2;
  totale_CHCRU = somma_CHCRU * 1.2;
  document.getElementById("somma_CHCRU").value = somma_CHCRU .toFixed(2);
  document.getElementById("iva_CHCRU").value = iva_CHCRU .toFixed(2);
  document.getElementById("totale_CHCRU").value = totale_CHCRU .toFixed(2);
   if ( document.getElementById("quantita_CHCRU").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_CHCRU").value + ' Chardonnay Doc, bianco secco strutturato (2004)'; }

  if ( eval(document.getElementById("quantita_PGFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_PGFT").value); }
  somma_PGFT = document.getElementById("quantita_PGFT").value * document.getElementById("prezzo_PGFT").value;
  iva_PGFT = somma_PGFT * 0.2;
  totale_PGFT = somma_PGFT * 1.2;
  document.getElementById("somma_PGFT").value = somma_PGFT.toFixed(2);
  document.getElementById("iva_PGFT").value = iva_PGFT.toFixed(2);
  document.getElementById("totale_PGFT").value = totale_PGFT.toFixed(2);
   if ( document.getElementById("quantita_PGFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_PGFT").value + ' Finis Terrae Grigio Igt, bianco secco ramato (2002)'; }
 
  if ( eval(document.getElementById("quantita_BIFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_BIFT").value); }
  somma_BIFT = document.getElementById("quantita_BIFT").value * document.getElementById("prezzo_BIFT").value;
  iva_BIFT = somma_BIFT * 0.2;
  totale_BIFT = somma_BIFT * 1.2;
  document.getElementById("somma_BIFT").value = somma_BIFT.toFixed(2);
  document.getElementById("iva_BIFT").value = iva_BIFT.toFixed(2);
  document.getElementById("totale_BIFT").value = totale_BIFT.toFixed(2);
   if ( document.getElementById("quantita_BIFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_BIFT").value + ' Finis Terrae Bianco Igt, bianco secco aff.legno (2002)'; }
  
  if ( eval(document.getElementById("quantita_ROFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_ROFT").value); }
  somma_ROFT = document.getElementById("quantita_ROFT").value * document.getElementById("prezzo_ROFT").value;
  iva_ROFT = somma_ROFT * 0.2;
  totale_ROFT = somma_ROFT * 1.2;
  document.getElementById("somma_ROFT").value = somma_ROFT.toFixed(2);
  document.getElementById("iva_ROFT").value = iva_ROFT.toFixed(2);
  document.getElementById("totale_ROFT").value = totale_ROFT.toFixed(2);
   if ( document.getElementById("quantita_ROFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_ROFT").value + ' Finis Terrae Rosso Igt, rosso secco aff.legno (2002)'; }

  if ( eval(document.getElementById("quantita_NEFT").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_NEFT").value); }
  somma_NEFT = document.getElementById("quantita_NEFT").value * document.getElementById("prezzo_NEFT").value;
  iva_NEFT = somma_NEFT * 0.2;
  totale_NEFT = somma_NEFT * 1.2;
  document.getElementById("somma_NEFT").value = somma_NEFT.toFixed(2);
  document.getElementById("iva_NEFT").value = iva_NEFT.toFixed(2);
  document.getElementById("totale_NEFT").value = totale_NEFT.toFixed(2);  
   if ( document.getElementById("quantita_NEFT").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_NEFT").value + ' Finis Terrae Nero Igt, rosso secco aff.legno (2002)'; }
/*
  quantita = quantita + eval(document.getElementById("quantita_PASSI").value); 
  somma_PASSI = document.getElementById("quantita_PASSI").value * document.getElementById("prezzo_PASSI").value;
  iva_PASSI = somma_PASSI * 0.2;
  totale_PASSI = somma_PASSI * 1.2;
  document.getElementById("somma_PASSI").value = somma_PASSI.toFixed(2);
  document.getElementById("iva_PASSI").value = iva_PASSI.toFixed(2);
  document.getElementById("totale_PASSI").value = totale_PASSI.toFixed(2);  
   if ( document.getElementById("quantita_PASSI").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_PASSI").value + ' Finis Terrae Oro Igt, bianco dolce passito (2002)'; }
*/
  if ( eval(document.getElementById("quantita_SPUM").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_SPUM").value); }
  somma_SPUM = document.getElementById("quantita_SPUM").value * document.getElementById("prezzo_SPUM").value;
  iva_SPUM = somma_SPUM * 0.2;
  totale_SPUM = somma_SPUM * 1.2;
  document.getElementById("somma_SPUM").value = somma_SPUM.toFixed(2);
  document.getElementById("iva_SPUM").value = iva_SPUM.toFixed(2);
  document.getElementById("totale_SPUM").value = totale_SPUM.toFixed(2);  
   if ( document.getElementById("quantita_SPUM").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>n.' + document.getElementById("quantita_SPUM").value + ' Spumante, metodo Charmat lungo (2008)'; }

  if ( eval(document.getElementById("quantita_SPUMMAGNUM").value) != null ) { 
    quantita2 = quantita2 + eval(document.getElementById("quantita_SPUMMAGNUM").value); }
  somma_SPUMMAGNUM = document.getElementById("quantita_SPUMMAGNUM").value * document.getElementById("prezzo_SPUMMAGNUM").value;
  iva_SPUMMAGNUM = somma_SPUMMAGNUM * 0.2;
  totale_SPUMMAGNUM = somma_SPUMMAGNUM * 1.2;
  document.getElementById("somma_SPUMMAGNUM").value = somma_SPUMMAGNUM.toFixed(2);
  document.getElementById("iva_SPUMMAGNUM").value = iva_SPUMMAGNUM.toFixed(2);
  document.getElementById("totale_SPUMMAGNUM").value = totale_SPUMMAGNUM.toFixed(2);  
   if ( document.getElementById("quantita_SPUMMAGNUM").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>N.' + document.getElementById("quantita_SPUMMAGNUM").value + ' Spumante, metodo Charmat lungo (2007)'; }	
	
  if ( eval(document.getElementById("quantita_ROSSMAGNUM").value) != null ) { 
    quantita2 = quantita2 + eval(document.getElementById("quantita_ROSSMAGNUM").value); }
  somma_ROSSMAGNUM = document.getElementById("quantita_ROSSMAGNUM").value * document.getElementById("prezzo_ROSSMAGNUM").value;
  iva_ROSSMAGNUM = somma_ROSSMAGNUM * 0.2;
  totale_ROSSMAGNUM = somma_ROSSMAGNUM * 1.2;
  document.getElementById("somma_ROSSMAGNUM").value = somma_ROSSMAGNUM.toFixed(2);
  document.getElementById("iva_ROSSMAGNUM").value = iva_ROSSMAGNUM.toFixed(2);
  document.getElementById("totale_ROSSMAGNUM").value = totale_ROSSMAGNUM.toFixed(2);  
   if ( document.getElementById("quantita_ROSSMAGNUM").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>N.' + document.getElementById("quantita_ROSSMAGNUM").value + ' Rosso Magnum, Rosso secco strutturato (2004)'; }	

  if ( eval(document.getElementById("quantita_CFCLAMIGNON").value) != null ) { 
    quantita2 = quantita2 + eval(document.getElementById("quantita_CFCLAMIGNON").value); }
  somma_CFCLAMIGNON = document.getElementById("quantita_CFCLAMIGNON").value * document.getElementById("prezzo_CFCLAMIGNON").value;
  iva_CFCLAMIGNON = somma_CFCLAMIGNON * 0.2;
  totale_CFCLAMIGNON = somma_CFCLAMIGNON * 1.2;
  document.getElementById("somma_CFCLAMIGNON").value = somma_CFCLAMIGNON.toFixed(2);
  document.getElementById("iva_CFCLAMIGNON").value = iva_CFCLAMIGNON.toFixed(2);
  document.getElementById("totale_CFCLAMIGNON").value = totale_CFCLAMIGNON.toFixed(2);  
   if ( document.getElementById("quantita_CFCLAMIGNON").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>N.' + document.getElementById("quantita_CFCLAMIGNON").value + ' Cabernet Franc Doc, Mignon Rosso secco (2007)'; }		
	
  if ( eval(document.getElementById("quantita_CHCLAMIGNON").value) != null ) { 
    quantita2 = quantita2 + eval(document.getElementById("quantita_CHCLAMIGNON").value); }
  somma_CHCLAMIGNON = document.getElementById("quantita_CHCLAMIGNON").value * document.getElementById("prezzo_CHCLAMIGNON").value;
  iva_CHCLAMIGNON = somma_CHCLAMIGNON * 0.2;
  totale_CHCLAMIGNON = somma_CHCLAMIGNON * 1.2;
  document.getElementById("somma_CHCLAMIGNON").value = somma_CHCLAMIGNON.toFixed(2);
  document.getElementById("iva_CHCLAMIGNON").value = iva_CHCLAMIGNON.toFixed(2);
  document.getElementById("totale_CHCLAMIGNON").value = totale_CHCLAMIGNON.toFixed(2);  
   if ( document.getElementById("quantita_CHCLAMIGNON").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>N.' + document.getElementById("quantita_CHCLAMIGNON").value + ' Chardonnay Doc, Mignon Bianco secco (2007)'; }	

  if ( eval(document.getElementById("quantita_GRAP").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_GRAP").value); }
  somma_GRAP = document.getElementById("quantita_GRAP").value * document.getElementById("prezzo_GRAP").value;
  iva_GRAP = somma_GRAP * 0.2;
  totale_GRAP = somma_GRAP * 1.2;
  document.getElementById("somma_GRAP").value = somma_GRAP.toFixed(2);
  document.getElementById("iva_GRAP").value = iva_GRAP.toFixed(2);
  document.getElementById("totale_GRAP").value = totale_GRAP.toFixed(2);  
   if ( document.getElementById("quantita_GRAP").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>N.' + document.getElementById("quantita_GRAP").value + ' Grappa di vinaccia'; }	
	
  if ( eval(document.getElementById("quantita_SUCC").value) != null ) { 
    quantita = quantita + eval(document.getElementById("quantita_SUCC").value); }
  somma_SUCC = document.getElementById("quantita_SUCC").value * document.getElementById("prezzo_SUCC").value;
  iva_SUCC = somma_SUCC * 0.2;
  totale_SUCC = somma_SUCC * 1.2;
  document.getElementById("somma_SUCC").value = somma_SUCC.toFixed(2);
  document.getElementById("iva_SUCC").value = iva_SUCC.toFixed(2);
  document.getElementById("totale_SUCC").value = totale_SUCC.toFixed(2);  
   if ( document.getElementById("quantita_SUCC").value != 0 ) {
	elenco_prodotti = elenco_prodotti + '<br>N.' + document.getElementById("quantita_SUCC").value + ' Succo di mela'; }		

//	somme_somma = somma_MECLA + somma_CFCLA + somma_CHCLA + somma_TFCLA + somma_VFCLA + somma_MECRU + somma_CFCRU + somma_TFCRU + somma_CHCRU + somma_PGFT + somma_BIFT + somma_ROFT + somma_NEFT + somma_PASSI + somma_GRAP + somma_SPUM;
	somme_somma = somma_MECLA + somma_CFCLA + somma_CHCLA + somma_TFCLA + somma_VFCLA + somma_MECRU + somma_CFCRU + somma_TFCRU + somma_CHCRU + somma_PGFT + somma_BIFT + somma_ROFT + somma_NEFT + somma_SPUM + somma_SPUMMAGNUM + somma_ROSSMAGNUM + somma_CFCLAMIGNON + somma_CHCLAMIGNON + somma_GRAP + somma_SUCC;
	somme_iva = somme_somma * 0.2; 
	somme_totale = somme_somma * 1.2;	
	somme_quantita = quantita + quantita2;
	document.getElementById("somme_quantita").value = somme_quantita;
	document.getElementById("somme_somma").value = somme_somma.toFixed(2);  
	document.getElementById("somme_iva").value = somme_iva.toFixed(2);  
	document.getElementById("somme_totale").value = somme_totale.toFixed(2);

//	sconto_somma = somme_somma * document.getElementById("sconto").value;
//	sconto_iva = somme_iva * document.getElementById("sconto").value;
	sconto_totale = somme_totale * document.getElementById("sconto").value;
//	document.getElementById("sconto_somma").value = sconto_somma.toFixed(2);  
//	document.getElementById("sconto_iva").value = sconto_iva .toFixed(2);  
	document.getElementById("sconto_totale").value = sconto_totale.toFixed(2);    

	document.getElementById("elenco_prodotti").innerHTML = elenco_prodotti;
	totale_lordo = somme_totale - sconto_totale + eval(document.getElementById("spese").value)*1.2;
	document.getElementById("totale_lordo").value = totale_lordo.toFixed(2); 	
	document.getElementById("htotale_lordo").innerHTML = totale_lordo.toFixed(2); 

	resto = quantita % 6;
	if ( resto != 0 || (quantita == 0 && quantita2 == 0) ) {
		document.getElementById("controllo").innerHTML = 'Quantita\' errata! Consiglio: aggiungi ' + (6-resto) + ' bottiglie';
		document.getElementById("controllo2").innerHTML = 'Quantita\' errata! Consiglio: aggiungi ' + (6-resto) + ' bottiglie';
		document.getElementById("controllo3").innerHTML = 'Per completare l\'ordine e\' necessario correggere il quantitativo (multiplo di 6)';
		document.getElementById("submit").disabled=true;
	} else { 
		document.getElementById("controllo").innerHTML = ''; 
		document.getElementById("controllo2").innerHTML = ''; 
		document.getElementById("controllo3").innerHTML = '';
		document.getElementById("submit").disabled=false;		
	}
}

function aggiorna_ana03() {
	var anagrafica = '';
	var gentile = '';	
	if ( document.getElementById("partita_iva").value != '') {	
	gentile = "Spett.le";
	} else {
	gentile = "Sig.";	
	}
	document.getElementById("gentile").innerHTML = gentile;	
	anagrafica = anagrafica + document.getElementById("cognome_cliente").value + '<br>';
	anagrafica = anagrafica + document.getElementById("nome_cliente").value + '<br>';
	anagrafica = anagrafica + document.getElementById("indirizzo_cliente").value + '<br>';
	anagrafica = anagrafica + document.getElementById("cap_cliente").value + ' ';
	anagrafica = anagrafica + document.getElementById("paese_cliente").value + ' ';
	if ( document.getElementById("provincia_cliente").value != '') {
		anagrafica = anagrafica + '(' + document.getElementById("provincia_cliente").value + ')';
	}
	if ( document.getElementById("partita_iva").value != '') {
		anagrafica = anagrafica + '<br>Partita Iva ' + document.getElementById("partita_iva").value;
	} 
	if ( document.getElementById("codice_fiscale").value != '') {
		anagrafica = anagrafica + '<br>Codice Fisale ' + document.getElementById("codice_fiscale").value;
	} 	
	if ( document.getElementById("telefono_cliente").value != '') {
		anagrafica = anagrafica + '<br>Telefono ' + document.getElementById("telefono_cliente").value;
	} 
	if ( document.getElementById("email_cliente").value != '') {
		anagrafica = anagrafica + '<br>Email ' + document.getElementById("email_cliente").value;
	} 
	document.getElementById("anagrafica").innerHTML = anagrafica;

	var spedizione = '<b>SPEDIZIONE</b><br>';
	spedizione = spedizione + document.getElementById("nome_spedizione").value + '<br>'; 
	spedizione = spedizione + document.getElementById("indirizzo_spedizione").value + '<br>'
	spedizione = spedizione + document.getElementById("cap_spedizione").value + ' ' + document.getElementById("paese_spedizione").value;
	if (document.getElementById("provincia_spedizione").value != '') {
		spedizione = spedizione + ' (' + document.getElementById("provincia_spedizione").value + ')'; }
	document.getElementById("dati_spedizione").innerHTML = spedizione;

	var pagamento = '<b>PAGAMENTO</b><br>'; 
//	if ( document.getElementById("pagamento1").checked ) { pagamento = pagamento + 'Alla consegna del corriere' }
	if ( document.getElementById("pagamento1").checked ) { pagamento = pagamento + 'Carta di credito' }
	if ( document.getElementById("pagamento2").checked ) { pagamento = pagamento + 'Bonifico bancario anticipato' }
	document.getElementById("dati_pagamento").innerHTML = pagamento;

	var note = '<b>NOTE</b><br>';
	note = note + document.getElementById("note").value;
	document.getElementById("dati_note").innerHTML = note;	
}
