var ndom = 65 // definisci il numero di domande del questionario
var nris = 5
var domande = new Array();

function Inizia()
{document.risultati.totale.value="";
for (i=1;i<=ndom;i++){domande[i]=0}
		for (j=1;j<=ndom;j++){for (i=0;i<nris;i++){document.questionario["d"+j][i].checked=false}}
		}

function profilo(){
var score = 0;
var cntrl = 0

var f = document.questionario;

for (x=0; x < f.length; x++) //per ogni domanda calcola il punteggio
   if (f.elements[x].type == "radio") 
   if (f.elements[x].checked) 
          score += parseInt(f.elements[x].value);         
   			
for (x=0; x < f.length; x++) //controlla che si risponda a tutte le domande
  if (f.elements[x].type == "radio") 
  if (f.elements[x].checked) 
    		cntrl = cntrl+1;

if (cntrl<ndom)
		alert("Non hai risposto a tutte le domande. Controlla!")

  else if (score < -390 && score>=-650)
  ris=open ("Cog1.htm","nuova","width=890",height=600,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0);
  else if (score >= -390 && score <-130)
  ris=open ("Cog2.htm","nuova","width=890,height=600,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0");
  else if (score >= -130 && score <130)
  ris=open ("Cog3.htm","nuova","width=890,height=600,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0");
  else if (score >= 130 && score <390)
  ris=open ("Cog4.htm","nuova","width=890,height=600,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0");
  else if (score >= 390 && score<=650)
  ris=open ("Cog5.htm","nuova","width=890,height=600,toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0");
  document.risultati.totale.value=score;

      }

