// -- 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 = "18test.html";
// ##9
path_fine = "18test_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]="&nbsp;24&nbsp;&nbsp;&nbsp;"; 
txtB[0]="&nbsp;27&nbsp;&nbsp;&nbsp;";
txtC[0]="&nbsp;28&nbsp;&nbsp;&nbsp;";
txtD[0]="&nbsp;30&nbsp;&nbsp;&nbsp;";
txtE[0]="";
txtF[0]="";
txtG[0]="";
t[0]="In una grande scatola ci sono 3 scatole, ognuna delle quali contiene 2 scatole più piccole e in ognuna di queste scatole più piccole ci sono altre 3 minuscole scatole.<BR>Quante scatole in tutto?<BR>";
esatta[0] = "C";
commento[0] = ", il totale è dato da: 18 minuscole scatole + 6 scatole più piccole + 3 scatole + 1 scatola grande.";


// -- * --
txtA[1]="<img src='18_02_10_d_domanda.gif' align=middle height=100>";   
txtB[1]="<img src='18_02_10_f_domanda.gif' align=middle width=100>";    
txtC[1]="<img src='18_02_10_c_domanda.gif' align=middle width=100>";    
txtD[1]="<img src='18_02_10_a_domanda.gif' align=middle height=100>";   
txtE[1]="<img src='18_02_10_e_domanda.gif' align=middle width=100><BR>";
txtF[1]="<img src='18_02_10_b_domanda.gif' align=middle height=100>";   
txtG[1]="";
t[1]="Se <img src='18_02_10_a_domanda.gif' width=100 align=middle> sta a <img src='18_02_10_b_domanda.gif' width=100 align=middle> allora <img src='18_02_10_c_domanda.gif' width=100 align=middle> sta a:<BR><BR><BR>";
esatta[1] = "E";
commento[1] = "";

// -- * --
txtA[2]="15&nbsp;&nbsp;&nbsp;";
txtB[2]="16&nbsp;&nbsp;&nbsp;";
txtC[2]="18&nbsp;&nbsp;&nbsp;";
txtD[2]="19&nbsp;&nbsp;&nbsp;";
txtE[2]="";
txtF[2]="";
txtG[2]="";
t[2]= "Inserisci il numero che completa la serie:<BR><B>4 - 7 - 10 - 13 - ...</B><BR>";
esatta[2] = "B";
commento[2] = ", si incrementa sempre di 3 alla volta.";

// -- * --
txtA[3]="POREGNI";
txtB[3]="APIUTOLN";
txtC[3]="DECIHARO";
txtD[3]="ARGOLISE";
txtE[3]="FRONAGAO";
txtF[3]="";
txtG[3]="";
t[3]= "Indica quale di queste parole non è un fiore:<BR>";
esatta[3] = "A";
commento[3] = ": ginepro. I fiori anagrammati sono nell'ordine: tulipano, orchidea, girasole, garofano.";

// -- * --
txtA[4]="A&nbsp;&nbsp;&nbsp;";
txtB[4]="F&nbsp;&nbsp;&nbsp;";
txtC[4]="N&nbsp;&nbsp;&nbsp;";
txtD[4]="T&nbsp;&nbsp;&nbsp;";
txtE[4]="Z&nbsp;&nbsp;&nbsp;";
txtF[4]="B&nbsp;&nbsp;&nbsp;";
txtG[4]="Q&nbsp;&nbsp;&nbsp;";
t[4]= "<img src='18_05_domanda.gif' width=160 hspace=10 align=left>Completa con la lettera mancante (alfabeto italiano).<BR><BR>";
esatta[4] = "C";
commento[4] = ": si moltiplicano tra di loro le posizioni delle lettere della prima colonna per le rispettive della seconda colonna, ottenendo quelle della terza colonna.";

// -- * --
txtA[5]="<img src='18_06_f_domanda.gif' width=55 align=middle>";      
txtB[5]="<img src='18_06_b_domanda.gif' width=70 align=middle>";      
txtC[5]="<img src='18_06_d_domanda.gif' width=60 align=middle>";      
txtD[5]="<img src='18_06_e_domanda.gif' width=70 align=middle><BR>";  
txtE[5]="";      
txtF[5]="";  
txtG[5]="";  
t[5]= "Se <img src='18_06_a_domanda.gif' width=150 align=middle> sta a <img src='18_06_b_domanda.gif' width=70 align=middle> allora <img src='18_06_c_domanda.gif' width=170 align=middle> sta a:<BR>";
esatta[5] = "C";
commento[5] = ", è la parte comune di tutte le figure geometriche che compongono il disegno.";


// -- * --
txtA[6]="è vero";  
txtB[6]="è falso";  
txtC[6]="a volte è vero";  
txtD[6]="è un'opinione";  
txtE[6]="non è sempre vero";  
txtF[6]="";  
txtG[6]="";  
t[6]= "Una retta è la linea più breve che congiunge due punti.<BR>";
esatta[6] = "A";
commento[6] = "";

// -- * --
txtA[7]="una bevanda analcolica e amarognola ricavata dal caramello<BR>";  
txtB[7]="un agrume che ha un gusto che sta tra l'arancio amaro e il mandarino<BR>";  
txtC[7]="una bevanda tonica e dissetante ricavata dalla chinina<BR>";  
txtD[7]="il succo amarognolo ricavato dalla spremitura del bergamotto";  
txtE[7]="";  
txtF[7]="";  
txtG[7]="";  
t[7]= "Il chinotto è:<BR>";
esatta[7] = "B";
commento[7] = "";

// -- * --
txtA[8]="6&nbsp;&nbsp;&nbsp;";
txtB[8]="10&nbsp;&nbsp;&nbsp;";
txtC[8]="14&nbsp;&nbsp;&nbsp;";
txtD[8]="16&nbsp;&nbsp;&nbsp;<BR>";
txtE[8]="";
txtF[8]="";
txtG[8]="";
t[8]= "Inserisci il numero che completa la serie:<BR><B>8 - 11 - 10 - 9 - 12 - 7 - ... - 5</B><BR>";
esatta[8] = "C";
commento[8] = ", ci sono due serie alternate che procedono rispettivamente con +2 e -2";

// -- * --
txtA[9]="<img src='18_02_10_a_domanda.gif' align=middle height=100>";   
txtB[9]="<img src='18_02_10_b_domanda.gif' align=middle width=100>";    
txtC[9]="<img src='18_10_d_domanda.gif' align=middle width=100>";    
txtD[9]="<img src='18_02_10_d_domanda.gif' align=middle height=100>";   
txtE[9]="";
txtF[9]="";   
txtG[9]="";
t[9]= "Indica l'immagine con cui continua la serie:<BR><img src='18_02_10_a_domanda.gif' width=100 align=middle>&nbsp;&nbsp;&nbsp;<img src='18_02_10_b_domanda.gif' width=100 align=middle>&nbsp;&nbsp;&nbsp;<img src='18_10_c_domanda.gif' width=100 align=middle>&nbsp;&nbsp;&nbsp;<img src='18_10_d_domanda.gif' width=100 align=middle>&nbsp;&nbsp;&nbsp;<img src='18_10_e_domanda.gif' width=100 align=middle>&nbsp;&nbsp;&nbsp;...<BR><BR><BR>";
esatta[9] = "C";
commento[9] = "<BR>La figura viene fatta ruotare in senso antiorario (+3), orario (+1), antiorario (+4), orario (+1), antiorario (+5)";


// -- 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");
}


