// -- AUTHOR: Filippo Spadaro
// -- PROGRAMMER: Filippo Spadaro
// -- LASTREVIEW: 5 agosto 2003
// -- SITE URL: http://utenti.lycos.it/nienteperniente

// -- rmbr: sostituire **test.js nelle importazioni JScript dei file HTML
path = "15test.html";
path_fine = "15test_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 r = new Array();
commento = new Array();

var pA = new Array();
var pB = new Array();
var pC = new Array();
var pD = new Array();
var pE = new Array();

// -- NB: l'utente deve riempire solo i campi:
// -- txt*[*], t[*], r[*], p*[*]
// -- * --
txtA[0]="<B>cassa&nbsp;&nbsp;</B>";
txtB[0]="<B>denaro&nbsp;&nbsp;</B>";
txtC[0]="<B>moneta&nbsp;&nbsp;</B>";
txtD[0]="<B>finanza&nbsp;&nbsp;</B>";
txtE[0]="<B>spesa&nbsp;&nbsp;</B>";
t[0]="Fra le cinque parole della serie, individua la parola che ha caratteristiche essenziali comuni con \x22gettone\x22:<BR>";
r[0]=txtC[0];
pA[0]=0;pB[0]=0;pC[0]=1;pD[0]=0;pE[0]=0;
commento[0] = "";

// -- * --
txtA[1]="<img src='15_02_b_domanda.gif' width=95 align=middle>";
txtB[1]="<img src='15_02_c_domanda.gif' width=95 align=middle>";
txtC[1]="<img src='15_02_d_domanda.gif' width=95 align=middle>";
txtD[1]="<img src='15_02_e_domanda.gif' width=95 align=middle>";
txtE[1]="<img src='15_02_f_domanda.gif' width=95 align=middle>";
t[1]="Se <img src='15_02_a_domanda.gif' width=95 align=middle> sta a <img src='15_02_b_domanda.gif' width=95 align=middle> allora <img src='15_02_c_domanda.gif' width=95 align=middle> sta a:<BR><BR><BR>";
r[1]=txtD[1];
pA[1]=0;pB[1]=0;pC[1]=0;pD[1]=1;pE[1]=0;
commento[1] = "";

// -- * --
txtA[2]="<img src='15_03_b_domanda.gif' width=110 align=middle>";
txtB[2]="<img src='15_03_c_domanda.gif' width=95 align=middle>";
txtC[2]="<img src='15_03_d_domanda.gif' width=95 align=middle>";
txtD[2]="<img src='15_03_e_domanda.gif' width=110 align=middle>";
txtE[2]="<img src='15_03_f_domanda.gif' width=120 align=middle>";
t[2]= "Se <img src='15_03_a_domanda.gif' width=120 align=middle> sta a <img src='15_03_b_domanda.gif' width=110 align=middle> allora <img src='15_03_c_domanda.gif' width=95 align=middle> sta a:<BR><BR><BR>";
r[2]=txtC[2];
pA[2]=0;pB[2]=0;pC[2]=1;pD[2]=0;pE[2]=0;
commento[2] = "";

// -- * --
txtA[3]="<img src='15_04_b_domanda.gif' width=140 align=middle>";
txtB[3]="<img src='15_04_c_domanda.gif' width=120 align=middle>";
txtC[3]="<img src='15_04_d_domanda.gif' width=110 align=middle>";
txtD[3]="<img src='15_04_e_domanda.gif' width=90 align=middle><BR>";
txtE[3]="<img src='15_04_f_domanda.gif' width=120 align=middle>";
t[3]= "<img src='15_04_a_domanda.gif' hspace=10 width=130 align=left>La figura a sinistra può essere composta da quattro dei cinque frammenti rappresentati sotto. Indicate qual è l'intruso!<BR><BR><BR><BR><BR>";
r[3]=txtA[3];
pA[3]=1;pB[3]=0;pC[3]=0;pD[3]=0;pE[3]=0;
commento[3] = "La composizione è la seguente: <img src='15_04_risposta.gif' align=middle width=130>";

// -- * --
txtA[4]="<img src='15_05_d_domanda.gif' width=95 align=middle>";    
txtB[4]="<img src='15_05_e_domanda.gif' width=95 align=middle>";    
txtC[4]="<img src='15_05_f_domanda.gif' width=95 align=middle>";    
txtD[4]="<img src='15_05_g_domanda.gif' width=95 align=middle>";
txtE[4]="<img src='15_05_h_domanda.gif' width=95 align=middle>";   
t[4]= "Se <img src='15_05_a_domanda.gif' width=95 align=middle> sta a <img src='15_05_b_domanda.gif' width=95 align=middle> allora <img src='15_05_c_domanda.gif' width=95 align=middle> sta a:<BR><BR><BR>";
r[4]= txtE[4];
pA[4]=0;pB[4]=0;pC[4]=0;pD[4]=0;pE[4]=1;
commento[4] = "";

// -- * --
txtA[5]="0&nbsp;&nbsp;&nbsp;";
txtB[5]="3&nbsp;&nbsp;&nbsp;";
txtC[5]="6&nbsp;&nbsp;&nbsp;";
txtD[5]="7&nbsp;&nbsp;&nbsp;";
txtE[5]="8&nbsp;&nbsp;&nbsp;";
t[5]= "Con quale numero continua questa serie?<BR><img src='15_06_domanda.gif' width=530 align=middle><BR><BR>";
r[5]= txtC[5];
pA[5]=0;pB[5]=0;pC[5]=1;pD[5]=0;pE[5]=0;
commento[5] = ": 4 (-4), 0 (+5), 5 (-4), 1 (+5), 6 (-4), 2";

// -- * --
txtA[6]="<img src='15_07_d_domanda.gif' width=135 align=middle>";    
txtB[6]="<img src='15_07_e_domanda.gif' width=75 align=middle>";    
txtC[6]="<img src='15_07_f_domanda.gif' width=95 align=middle>";    
txtD[6]="<img src='15_07_g_domanda.gif' width=95 align=middle>";
txtE[6]="<img src='15_07_h_domanda.gif' width=135 align=middle>";   
t[6]= "Se <img src='15_07_a_domanda.gif' width=95 align=middle> sta a <img src='15_07_b_domanda.gif' width=90 align=middle> allora <img src='15_07_c_domanda.gif' width=85 align=middle> sta a:<BR><BR><BR>";
r[6]= txtC[6];
pA[6]=0;pB[6]=0;pC[6]=1;pD[6]=01;pE[6]=0;
commento[6] = "";

// -- * --
txtA[7]="<B>AAADCN&nbsp;</B>";
txtB[7]="<B>AAALTUGEM&nbsp;</B>";
txtC[7]="<B>AAELIGR&nbsp;</B>";
txtD[7]="<B>AAINNETGR&nbsp;</B>";
txtE[7]="<B>AAANATTL&nbsp;</B>";
t[7]= "Ecco delle parole con l'ordine delle lettere sconvolto. In quattro di esse si cela il nome di una nazione tranne in una. Qual è?:<BR><BR>";
r[7]= txtE[7];
pA[7]=0;pB[7]=0;pC[7]=0;pD[7]=0;pE[7]=1;
commento[7] = ": Atalanta. Le nazioni sono: Canada, Guatemala, Algeria, Argentina.";

// -- * --
txtA[8]="<img src='15_09_d_domanda.gif' width=95 align=middle>";
txtB[8]="<img src='15_09_e_domanda.gif' width=45 align=middle>";
txtC[8]="<img src='15_09_f_domanda.gif' width=45 align=middle>";
txtD[8]="<img src='15_09_g_domanda.gif' width=95 align=middle>";
txtE[8]="<img src='15_09_h_domanda.gif' width=45 align=middle>";
t[8]= "Se <img src='15_09_a_domanda.gif' width=95 align=middle> sta a <img src='15_09_b_domanda.gif' width=45 align=middle> allora <img src='15_09_c_domanda.gif' width=95 align=middle> sta a:<BR><BR><BR>";
r[8]= txtB[8];
pA[8]=0;pB[8]=1;pC[8]=0;pD[8]=0;pE[8]=0;
commento[8] = "";

// -- * --
txtA[9]="<img src='15_10_b_domanda.gif' width=80 align=middle>";
txtB[9]="<img src='15_10_c_domanda.gif' width=130 align=middle>";
txtC[9]="<img src='15_10_d_domanda.gif' width=130 align=middle>";
txtD[9]="<img src='15_10_f_domanda.gif' width=95 align=middle>";
txtE[9]="";
t[9]= "<img src='15_10_a_domanda.gif' hspace=10 width=130 align=left>La figura a sinistra può essere composta da tre dei quattro frammenti rappresentati sotto. Indicate qual è l'intruso!<BR><BR><BR><BR><BR>";
r[9]= txtD[9];
pA[9]=0;pB[9]=0;pC[9]=0;pD[9]=1;pE[9]=0;
commento[9] = "La composizione è la seguente: <img src='15_10_risposta.gif' align=middle width=130>";

// -- 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");
}


