  // funzioni generali per il calcolo dei test...
  
  function calcola () {
  var dum=0;
    var i;
	var j;
	var notfound;
	
  for (i=0; i<result.length; i++) {
    notfound = true;
    for (j=0; j<result[0].length; j++)
        if (document.form.elements[i*result[i].length+j].checked) {
		    dum += result[i][j];
			notfound = false;
            break;
		}
	if (notfound) {
	    alert ("Non hai completato tutte le risposte!");
		return -1;
	}
  }
  return dum;
  }
  
  function stampa (str, titolo) {
    //document.form.out.value = str;
	var win = window.open ("","win", "width=300,height=200,dependent,scrollbars,resizable=yes");
	win.document.open ();
	win.document.write ("<HEAD><TITLE>" + titolo + "</TITLE>");
	win.document.write ("<LINK rel='StyleSheet' type='text/css' href='../nathan/stile.css'>");
	win.document.write ("</HEAD><BODY><DIV class='body'>");
	win.document.write ("<P>");
	win.document.write (str);
	win.document.write ("</P>");
	win.document.write ("</DIV></BODY>");
	win.document.close ();
	win.stop ();
  }
  
  
  function check () {
    var dum = calcola ();
	if (dum<0) return false;
    var str = profilo (dum);  
	var titolo = "Punteggio: " + dum;
	stampa (str, titolo);
    return false;
  }
