// -- AUTHOR: Filippo Spadaro
// -- PROGRAMMER: Filippo Spadaro
// -- LASTREVIEW: 1 agosto 2003
// -- SITE URL: http://utenti.lycos.it/nienteperniente

// -- rmbr: sostituire **test.js nelle importazioni JScript dei file HTML
// ##9
path = "15test.html";
// ##9
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 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 4 risposte A - B - C - D sono obbligatorie, 
// -- mentre  E - F - G si possono omettere, basta inserire un 
// -- campo vuoto txt*[*]=""; nella prima delle tre che non si 
// -- vorrà visualizzare.

// -- * --
txtA[0]="TATTO";
txtB[0]="SENSI";
txtC[0]="UDITO";
txtD[0]="OLFATTO";
txtE[0]="TATTO";
txtF[0]="";
txtG[0]="";
t[0]="Completa la seguente proporzione: OCCHIO sta a VISTA come NASO sta a...<BR>";
esatta[0] = "D";
commento[0] = "";

// -- * --
txtA[1]="passare";
txtB[1]="esitare";
txtC[1]="transigere";
txtD[1]="soffermarsi";
txtE[1]="";
txtF[1]="";
txtG[1]="";
t[1]="Quale tra le seguenti parole ha un significato che maggiormente si avvicina al contrario di \x22transitare\x22:<BR>";
esatta[1] = "B";
commento[1] = "";

// -- * --
txtA[2]="sibilante";
txtB[2]="affascinante";
txtC[2]="meraviglioso";
txtD[2]="abbagliante";
txtE[2]="solito";
txtF[2]="";
txtG[2]="";
t[2]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22strabiliante\x22:<BR>";
esatta[2] = "C";
commento[2] = "";

// -- * --
txtA[3]="incupire";
txtB[3]="percuotere";
txtC[3]="asserire";
txtD[3]="intercettare";
txtE[3]="assopire";
txtF[3]="";
txtG[3]="";
t[3]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22colpire\x22:<BR>";
esatta[3] = "B";
commento[3] = "";

// -- * --
txtA[4]="TATRIGENU";
txtB[4]="CAPLISO";
txtC[4]="CUCRIDAC";
txtD[4]="SNISORI";
txtE[4]="DORAPILE";
txtF[4]="";
txtG[4]="";
t[4]= "Anagramma e indica quale nome illustre è da scartare:<BR>";
esatta[4] = "D";
commento[4] = ": Rossini. Gli altri sono tutti poeti: Pascoli, Carducci, Leopardi, Ungaretti.";

// -- * --
txtA[5]="ginepro";
txtB[5]="larice";
txtC[5]="olenadro";
txtD[5]="castagno";
txtE[5]="abete";
txtF[5]="ortica";
txtG[5]="";
t[5]= "Indica qual è la parola da scartare:<BR>";
esatta[5] = "F";
commento[5] = ": l'ortica non è un albero.";

// -- * --
txtA[6]="ARANCIONE";
txtB[6]="BLU";
txtC[6]="CIELO";
txtD[6]="SPAZIO";
txtE[6]="";
txtF[6]="";
txtG[6]="";
t[6]= "Completa la seguente proporzione: ROSSO sta a SANGUE come AZZURRO sta a...<BR>";
esatta[6] = "C";
commento[6] = "";

// -- * --
txtA[7]="complementare";
txtB[7]="similare";
txtC[7]="rasente";
txtD[7]="fondamentale";
txtE[7]="";
txtF[7]="";
txtG[7]="";
t[7]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22basilare\x22:<BR>";
esatta[7] = "D";
commento[7] = "";

// -- * --
txtA[8]="attenzione";
txtB[8]="disavventura";
txtC[8]="disavanzo";
txtD[8]="sbadataggine";
txtE[8]="";
txtF[8]="";
txtG[8]="";
t[8]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22disavvertenza\x22:<BR>";
esatta[8] = "D";
commento[8] = "";

// -- * --
txtA[9]="LUNACLIPE";
txtB[9]="NILOCRACHE";
txtC[9]="IMBOLANCO";
txtD[9]="TOLAPENNA";
txtE[9]="MEARELEPIMBI";
txtF[9]="GHENINOME";
txtG[9]="";
t[9]= "Anagramma e indica la parola che non è una maschera:<BR>";
esatta[9] = "E";
commento[9] = ": impermeabile. Le maschere anagrammate sono: Pulcinella, Arlecchino, Colombina, Pantalone, Meneghino.";


// -- 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");
}


