function Convalida() {

  var x_cognome =     document.getElementById("cv").x_cognome.value;
  var x_nome =        document.getElementById("cv").x_nome.value;
  var x_indirizzo =   document.getElementById("cv").x_indirizzo.value;
  var x_comune =      document.getElementById("cv").x_comune.value;
  var x_siglaProv =   document.getElementById("cv").x_siglaProv.value;
  var x_dataNascita = document.getElementById("cv").x_dataNascita.value;
  var x_email =       document.getElementById("cv").x_email.value;
  var x_diploma =     document.getElementById("cv").x_diploma.value;
  var x_dip_anno =    document.getElementById("cv").x_dip_anno.value;

  if (x_cognome == "") {
    alert("Il cognome e' un campo obbligatorio!");
    document.getElementById("cv").x_cognome.focus();
    return false;
  }

  if (x_nome == "") {
    alert("Il nome e' un campo obbligatorio!");
    document.getElementById("cv").x_nome.focus();
    return false;
  }

  if (x_indirizzo == "") {
    alert("L'indirizzo e' un campo obbligatorio!");
    document.getElementById("cv").x_indirizzo.focus();
    return false;
  }

  if (x_comune == "") {
    alert("Il comune e' un campo obbligatorio!");
    document.getElementById("cv").x_comune.focus();
    return false;
  }

  if (x_siglaProv == "") {
    alert("La provincia è un campo obbligatorio!");
    document.getElementById("cv").x_siglaProv.focus();
    return false;
  }

  if (x_dataNascita == "") {
    alert("La data di nascita e' un campo obbligatorio!");
    document.getElementById("cv").x_comune.focus();
    return false;
  }

  if (x_email == "") {
    alert("L'indirizzo email è un campo obbligatorio!");
    document.getElementById("cv").x_email.focus();
    return false;
  }

  if (x_diploma == "") {
    alert("Il diploma è un campo obbligatorio!");
    document.getElementById("cv").x_diploma.focus();
    return false;
  }

  if (x_dip_anno == "") {
    alert("L'anno in cui è stato conseguito il diploma è un campo obbligatorio!");
    document.getElementById("cv").x_dip_anno.focus();
    return false;
  }

  var dataExp=/^([0-3][0-9])\/([0-1][0-9])\/([0-9][0-9][0-9][0-9])$/;   //italiana gg/mm/aaaa

  if (!dataExp.test(x_dataNascita)) {
    alert("La data di nascita non è nel formato corretto gg/mm/aaaa");
    document.getElementById("cv").x_dataNascita.focus();
    return false;
  }

  if (document.getElementById("cv").informativa[1].checked) {
    alert("Per inviare il curriculum vitae è obbligatorio accettare l'informativa");
    return false;
  }

  return true;
}

function enableInvioCV(stato){
  if (stato){
    document.forms[0].Action.disabled=false;
  }else{
    document.forms[0].Action.disabled=true;
  }
}

function enableInvioFornitori(stato){
  if (stato){
    document.forms[0].salvaDati.disabled=false;
  }else{
    document.forms[0].salvaDati.disabled=true;
  }
}

function enableStatoEstero(stato){
  if (stato){
    document.forms[0].estero.disabled=false;
    document.forms[0].estero.className ='text';
    document.forms[0].provincia.disabled=true;
    document.forms[0].provincia.className='disabled';
  }else{
    document.forms[0].estero.disabled=true;
    document.forms[0].provincia.disabled=false;
    document.forms[0].provincia.className='select';
    document.forms[0].estero.className ='disabled';
  }
}
