function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

  document.cookie = NameOfCookie + "=" + escape(value) + 
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

  function controlla_privacy()
  {
    var ifrm = 1;
    var formok = true;
    var strnm = '';
    while ((ifrm <= 3))
    {
      strnm = 'consenso'+ifrm;
      formok = (document.forms['consenso'].elements[strnm].checked && formok);
      ifrm++;
    }
    if (formok)
    {
      document.forms['consenso'].submit();
      setCookie("Consenso","SI", 1);
    }
    else
    {
      alert('\t          Attenzione!!!\n \ Prima di proseguire bisogna validare tutti i campi \n     di consenso al trattemento dei dati sensibili');
      return false;    
    }
  }


