// -- AUTHOR: Filippo Spadaro
// -- PROGRAMMER: Filippo Spadaro
// -- LASTREVIEW: 3 agosto 2003
// -- SITE URL: http://utenti.lycos.it/nienteperniente

// -- rmbr: sostituire **test.js nelle importazioni JScript dei file HTML
// ##9
path = "20test.html";
// ##9
path_fine = "20test_fine.html";


// -- definizioni array --
var t = new Array();

var txtA = new Array();
var txtB = new Array();
var txtC = new Array();
var txtD = new Array();
var txtE = new Array();
var txtF = new Array();
var txtG = new Array();

var r = new Array();
var esatta = new Array();
commento = new Array();

// -- NB: l'utente deve riempire solo i campi:
// -- txt*[*], t[*], r[*], p*[*]

// -- NB: le prime 2 risposte A - B sono obbligatorie, 
// -- mentre  C - D - E - F - G si possono omettere, basta 
// -- inserire un campo vuoto txt*[*]=""; nella prima delle 
// -- cinque che non si vorrà visualizzare.

// -- * --
txtA[0]="parte della botanica che studia le anaconditi<BR>";
txtB[0]="gondola brasiliana, utilizzata per navigare lungo il Rio delle Amazzoni<BR>";
txtC[0]="grosso serpente lungo 8-10 metri, non velenoso; stritola la sua preda<BR>";
txtD[0]="cosmetico a base di olio di vasellina profumato, per dare il lucido ai capelli";
txtE[0]="";
txtF[0]="";
txtG[0]="";
t[0]="Cos'è l'anaconda?<BR>";
esatta[0] = "C";
commento[0] = "";

// -- * --
txtA[1]="stessa direzione della freccia<BR>";
txtB[1]="direzione opposta alla freccia<BR>";
txtC[1]="in parte nella stessa direzione della freccia, in parte in senso antiorario";
txtD[1]="";
txtE[1]="";
txtF[1]="";
txtG[1]="";
t[1]="<img src='20_21_22_02_10_domanda.gif' align=left height=200><BR>La ruota dentata X ha 20 denti e fa muovere la ruota Y da 40 denti, che a sua volta fa muovere la ruota Z da 100 denti.<BR>Se X gira nel verso indicato dalla freccia, Y si muoverà nella:<BR><BR><BR><BR><BR>";
esatta[1] = "B";
commento[1] = "";

// -- * --
txtA[2]="<img src='20_03_4_domanda.gif' align=middle width=120>";
txtB[2]="<img src='20_03_2_domanda.gif' align=middle width=150>";
txtC[2]="<img src='20_03_3_domanda.gif' align=middle width=150>";
txtD[2]="";
txtE[2]="";
txtF[2]="";
txtG[2]="";
t[2]= "Quale dei segmenti A, B o C non è contenuto nella linea in figura?<BR><img src='20_03_1_domanda.gif' align=middle height=100><BR><BR>";
esatta[2] = "B";
commento[2] = "";

// -- * --
txtA[3]="<img src='20_04_4_domanda.gif' align=middle width=95>";
txtB[3]="<img src='20_04_3_domanda.gif' align=middle width=95>";
txtC[3]="<img src='20_04_5_domanda.gif' align=middle width=95>";
txtD[3]="<img src='20_04_2_domanda.gif' align=middle width=95>";
txtE[3]="";
txtF[3]="";
txtG[3]="";
t[3]= "Quale figura completa la serie?<BR><img src='20_04_1_domanda.gif' width=450><BR>";
esatta[3] = "D";
commento[3] = "";

// -- * --
txtA[4]="<img src='20_05_2_domanda.gif' align=middle width=120>";
txtB[4]="<img src='20_05_4_domanda.gif' align=middle width=120>";
txtC[4]="<img src='20_05_3_domanda.gif' align=middle width=120>";
txtD[4]="<img src='20_05_5_domanda.gif' align=middle width=120>";
txtE[4]="";
txtF[4]="";
txtG[4]="";
t[4]= "Quale figura completa la serie?<BR><img src='20_05_1_domanda.gif' width=550><BR>";
esatta[4] = "A";
commento[4] = "";

// -- * --
txtA[5]="A&nbsp;&nbsp;";  
txtB[5]="F&nbsp;&nbsp;";  
txtC[5]="N&nbsp;&nbsp;";  
txtD[5]="Q&nbsp;&nbsp;";  
txtE[5]="T&nbsp;&nbsp;";  
txtF[5]="Z&nbsp;&nbsp;";  
txtG[5]="";  
t[5]= "<img src='20_06_domanda.gif' align=left width=200>In questa figura mancano due lettere, inserisci quella contrassegnata dal punto interrogativo.<BR><BR><BR>";
esatta[5] = "A";
commento[5] = ", le due lettere mancanti sono A - O, che servono a comporre la parola OTTAGONO.<BR>";

// -- * --
txtA[6]="<img src='20_21_07_d_domanda.gif' align=middle height=120>";     
txtB[6]="<img src='20_21_07_f_domanda.gif' align=middle width=110>";      
txtC[6]="<img src='20_21_07_c_domanda.gif' align=middle width=110><BR>";      
txtD[6]="<img src='20_21_07_a_domanda.gif' align=middle height=110>";     
txtE[6]="<img src='20_21_07_e_domanda.gif' align=middle width=110>";  
txtF[6]="<img src='20_21_07_b_domanda.gif' align=middle height=110>";     
txtG[6]="";                                                               
t[6]= "Se <img src='20_21_07_a_domanda.gif' width=110 align=middle> sta a <img src='20_21_07_e_domanda.gif' width=110 align=middle> allora <img src='20_21_07_b_domanda.gif' width=110 align=middle> sta a:<BR><BR>";
esatta[6] = "A";
commento[6] = "";

// -- * --
txtA[7]="A&nbsp;&nbsp;";  
txtB[7]="D&nbsp;&nbsp;";  
txtC[7]="G&nbsp;&nbsp;";  
txtD[7]="M&nbsp;&nbsp;";  
txtE[7]="S&nbsp;&nbsp;";  
txtF[7]="V&nbsp;&nbsp;";  
txtG[7]="";  
t[7]= "Inserisci la lettera mancante:<BR><BR><img src='20_08_domanda.gif' width=350><BR>";
esatta[7] = "E";
commento[7] = ", si aumenta progressivamente di +2, +3, +4, +5.";

// -- * --
txtA[8]="Simona";
txtB[8]="Daniela";
txtC[8]="Marco";
txtD[8]="Massimo";
txtE[8]="";
txtF[8]="";
txtG[8]="";
t[8]= "Simona ha superato l'esame meglio di Marco, ma non di Daniela. Massimo ha preso un voto più basso di quello di Matteo, ma è andato meglio di Simona.<BR>Chi ha preso il voto peggiore?<BR>";
esatta[8] = "C";
commento[8] = "";

// -- * --
txtA[9]="1/5 di giro<BR>";
txtB[9]="1 giro e 1/4<BR>";
txtC[9]="5 giri<BR>";
txtD[9]="1/4 di giro";
txtE[9]="";
txtF[9]="";
txtG[9]="";
t[9]="<img src='20_21_22_02_10_domanda.gif' align=left height=200><BR>La ruota dentata X ha 20 denti e fa muovere la ruota Y da 40 denti, che a sua volta fa muovere la ruota Z da 100 denti.<BR>Se X fa un giro completo, quanti giri farà Z?<BR><BR><BR><BR><BR>";
esatta[9] = "A";
commento[9] = "";


// -- funzioni --
function createTempCookie(name, value) {
  	document.cookie=name + "=" + value + ";";
}


function extractCookieValue(val) {
	if ((endOfCookie = document.cookie.indexOf(";", val)) == -1) {
		endOfCookie = document.cookie.length;
	}
  return unescape(document.cookie.substring(val,endOfCookie));
}


function ReadCookie(cookiename) {
	var numOfCookies = document.cookie.length;
	var nameOfCookie = cookiename + "=";
	var cookieLen = nameOfCookie.length;
	var x = 0;
	while (x <= numOfCookies) {
		var y = (x + cookieLen);
		if (document.cookie.substring(x, y) == nameOfCookie)
			return (extractCookieValue(y));
			x = document.cookie.indexOf(" ", x) + 1;
			if (x == 0)
				break;
  		}
	return (null);
}


function getData(i) {
	separatore = "#"
	var VecchioValore = ReadCookie("ordine");
	var NuovoValore = VecchioValore + separatore + document.forms[0].elements[i].name;
	test = parseInt(NuovoValore.charAt(0));
	if ((test > 0) && (test < 9))
	test = parseInt(NuovoValore.charAt(0)) + 1;
	else if (test == 9)
	test = 0;
	else if (test == 0)
	test = "X";
	createTempCookie("ordine", test + NuovoValore);
	//userCookie = ReadCookie("ordine");
}


function leggiDati() {
	userCookie = ReadCookie("ordine");
	var u = 1;
	var bool = 0;
	var totale = 0;
	var numero = new Array();
     	while (bool == 0) {
		if (userCookie.charAt(u) == "") 
			bool = 1;
		if (userCookie.charAt(u) == "#") {	 
			document.write("&nbsp;");
			u+=1;
		}
		if (userCookie.charAt(u) == "£") {
				u+=1;	
				totale = totale 
				+ parseInt(userCookie.charAt(u))*1000
				+ parseInt(userCookie.charAt(u+1))*100
				+ parseInt(userCookie.charAt(u+2))*10
				+ parseInt(userCookie.charAt(u+3));
		}
		u+=1;
	}
	document.write("<BR><FONT SIZE=4 FACE=\x22 courier new\x22 color=Maroon><B>Punteggio parziale: </B></FONT>" 
			+ "<FONT SIZE=5 FACE=\x22 courier new\x22 color=Navy><B>" 
			+ totale + "</B></FONT>");
}


function NuovoOrdine() {	
	createTempCookie("ordine", "1");
}


