
function of2RedirDemo() {
  document.moduloDemo.thankyou.value = "http://www.mathemasoftware.it/download.c3ay_2wp/of2GetDemo.html";  

  return verificaPrelevaDemo();
} 

function ofexRedirDemo() {
  document.moduloDemo.thankyou.value = "http://www.mathemasoftware.it/download.c3ay_2wp/ofexGetDemo.html";  

  return verificaPrelevaDemo();
} 

function of2RedirUpdate() {
  document.moduloUpdate.thankyou.value = "http://www.mathemasoftware.it/download.c3ay_2wp/of2GetUpdate.html";  
  return verificaPrelevaUpdate();
} 

function ofexRedirUpdate() {
  document.moduloUpdate.thankyou.value = "http://www.mathemasoftware.it/download.c3ay_2wp/ofexGetUpdate.html";  

  return verificaPrelevaUpdate();
} 

function ofexNewRedirUpdate() {
  document.moduloUpdate.thankyou.value = "http://www.mathemasoftware.it/download.c3ay_2wp/ofexGetUpdate.html";  

  return verificaNewPrelevaUpdate();
} 

function verificaPrelevaDemo(){
  var er = false; 
  if (document.moduloDemo.comunicare1.checked &&
      (document.moduloDemo.emailscuola.value.length == 0 || 
       document.moduloDemo.emailscuola.value =="@"))
   {
     alert("Attenzione. Lei ha richiesto di ricevere comunicazioni via posta elettronica a scuola ma non ha specificato la relativa e-mail");
     er=true;
   }

  if (document.moduloDemo.comunicare2.checked &&
      (document.moduloDemo.personalemail.value.length == 0 || 
       document.moduloDemo.personalemail.value =="@"))
   {
     alert("Attenzione. Lei ha richiesto di ricevere comunicazioni via posta elettronica al suo indirizzo personale ma non ha specificato la relativa e-mail");
     er=true;
   }

   if (er)
     return false;
   else 
     return true;
}

function verificaPrelevaUpdate(){
   if( 
       document.moduloUpdate.nome.value.length==0 ||
       document.moduloUpdate.cognome.value.length==0 ||
       document.moduloUpdate.scuola.value.length==0 ||
       document.moduloUpdate.indirizzoScuola.value.length==0 ||
       document.moduloUpdate.cap.value.length==0 ||
       document.moduloUpdate.provincia.value.length==0 ||
       document.moduloUpdate.citta.value.length==0){
     alert("Si prega di completare i dati del modulo");
     return false;
   }
   else return true;
}

function verificaNewPrelevaUpdate(){
   if( 
       document.moduloUpdate.serialId.value.length==0){
     alert("Si prega di completare i dati del modulo");
     return false;
   }
   else return true;
}

function verificaRichiesta(){
  var er = false; 
  if (document.moduloDemo.comunicare1.checked &&
      (document.moduloDemo.emailscuola.value.length == 0 || 
       document.moduloDemo.emailscuola.value =="@"))
   {
     alert("Attenzione. Lei ha richiesto di ricevere comunicazioni via posta elettronica a scuola ma non ha specificato la relativa e-mail");
     er=true;
   }

  if (document.moduloDemo.comunicare2.checked &&
      (document.moduloDemo.personalemail.value.length == 0 || 
       document.moduloDemo.personalemail.value =="@"))
   {
     alert("Attenzione. Lei ha richiesto di ricevere comunicazioni via posta elettronica al suo indirizzo personale ma non ha specificato la relativa e-mail");
     er=true;
   }

   if( 
       document.moduloDemo.nome.value.length==0 ||
       document.moduloDemo.cognome.value.length==0 ||
       document.moduloDemo.scuola.value.length==0 ||
       document.moduloDemo.indirizzoScuola.value.length==0 ||
       document.moduloDemo.cap.value.length==0 ||
       document.moduloDemo.provincia.value.length==0 ||
       document.moduloDemo.citta.value.length==0)
   {
     alert("Attenzione. Si prega di completare i dati del modulo");
     er=true;
   }
   
   if (er)
     return false;
   else 
     return true;
}

function emailYes(){
  document.moduloDemo.comunicare1.checked = true;
  document.moduloDemo.comunicare2.checked = true;
}

function emailNo(){
  document.moduloDemo.comunicare1.checked = false;
  document.moduloDemo.comunicare2.checked = false;
}

function checkYesNo(){
  if (document.moduloDemo.comunicare1.checked || document.moduloDemo.comunicare2.checked){
    document.moduloDemo.comunicazioni[0].checked=true;
    document.moduloDemo.comunicazioni[1].checked=false;
  }
  else{
    document.moduloDemo.comunicazioni[0].checked=false;
    document.moduloDemo.comunicazioni[1].checked=true;
  }
}

