var libero=0;
function valida(){
  if (document.theform.nome.value==''){
    alert ("You did not enter the following information: NAME");
    return false;
    libero=1;
  }

  if (document.theform.cognome.value==''){
    alert ("You did not enter the following information: SURNAME.");
    return false;
    libero=1;
  }

  if (document.theform.citta.value==''){
    alert ("You did not enter the following information: CITY.");
    return false;
    libero=1;
  }

  if (document.theform.telefono.value==''){
    alert ("You did not enter the following information: PHONE.");
    return false;
    libero=1;
  }
  if (document.theform.via.value==''){
    alert ("You did not enter the following information: STREET.");
    return false;
    libero=1;
  }
 // if (document.theform.cap.value==''){
 //   alert ("Campo cap obbligatorio");
 //   return false;
 //   libero=1;
 // }

  if (document.theform.email.value.indexOf("@")==-1) {
    alert ("You did not enter the following information: E-MAIL.");
    return false;
    libero=1;
  }

    if (document.theform.privx.checked == false )
    {
      alert('You did not enter the following information: PRIVACY.');
    return false;
    libero=1;
    }else  libero=0;
	
	if (document.theform.firma.checked == false )
    {
      alert('You did not enter the following information: Electronic signature .');
    return false;
    libero=1;
    }else  libero=0;

    if (document.theform.cancx.checked == false )
    {
      alert('You did not enter the following information: CANCELLATION ');
    return false;
    libero=1;
    }else  libero=0;


if(libero==0)
document.theform.pulsante.enabled=false;
document.theform.submit();
}



var libero2=0;

function valida2(){
valore= ValoreRadio('theform','pagamento');
  if (valore=='cartacredito'){
    if (document.theform.cc_number.value==''){
       alert ("Campo cc_number obbligatorio");
       return false;
       libero2=1;
    }
    if (document.theform.cc_intestatario.value==''){
       alert ("Campo cc_intestatario obbligatorio");
       return false;
       libero2=1;
    }
    if (document.theform.expiration_month.value==''){
       alert ("Campo expiration_month obbligatorio");
       return false;
       libero2=1;
    }
    if (document.theform.cc_codice.value==''){
       alert ("Campo cc_codice obbligatorio");
       return false;
       libero2=1;
    }
    if (document.theform.nomecartacc.value==''){
       alert ("Campo nomecartacc obbligatorio");
       return false;
       libero2=1;
    }

  }else libero2=0;
if(libero2==0)document.theform.submit();
}

function ValoreRadio(form_info,langRadio){
var rr = document.forms[form_info].elements[langRadio]
var valore=null
if(rr.length){
for(var i=0;i<rr.length;i++)
if(rr[i].checked)
valore=rr[i].value
}else if(rr.checked)valore=rr.value
return valore
}