// -- AUTHOR: Filippo Spadaro
// -- PROGRAMMER: Filippo Spadaro
// -- LASTREVIEW: 12 ottobre 2002
// -- SITE URL: http://utenti.lycos.it/nienteperniente

// -- rmbr: sostituire **test.js nelle importazioni JScript dei file HTML
// ##9
path = "08test.html";
// ##9
path_fine = "08test_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 r = new Array();
var esatta = new Array();
commento = new Array();



// -- NB: l'utente deve riempire solo i campi:
// -- txt*[*], t[*], r[*], p*[*]
// -- * --
txtA[0]="Un abito in seta";
txtB[0]="A mezzo posta";
txtC[0]="Un giubotto di pelle";
txtD[0]="Un porta in legno di ciliegio";
t[0]="Quale delle seguenti espressioni è l'unica corretta?<BR>";
esatta[0] = "C";
commento[0] = "";


// -- * --
txtA[1]="un miliardo";
txtB[1]="dieci miliardi";
txtC[1]="cento miliardi";
txtD[1]="mille miliardi";
t[1]="Il 'billion' inglese sta a significare:<BR>";
esatta[1] = "A";
commento[1] = "";

// -- * --
txtA[2]="rispondere ad un'affermazione";
txtB[2]="rispondere ad una risposta";
txtC[2]="asserire ad una affermazione";
txtD[2]="negare un'affermazione";
t[2]= "Replicare è:<BR>";
esatta[2] = "B";
commento[2] = ". Io affermo, tu rispondi, io replico.";

// -- * --
txtA[3]="una nota musicale";
txtB[3]="un pronome personale di terza persona singolare e plurale";
txtC[3]="un'affermazione";
txtD[3]="sè, riflessivo";
t[3]= "Con 'sì' si intende:<BR>";
esatta[3] = "C";
commento[3] = "";

// -- * --
txtA[4]="drive";
txtB[4]="dossier";
txtC[4]="gossip";
txtD[4]="briefing";
t[4]= "Un fascicolo in cui si raccolgono i documenti riguardanti una persona, un fatto, un argomento:<BR>";
esatta[4] = "B";
commento[4] = "";

// -- * --
txtA[5]="leasing";
txtB[5]="pacemaker";
txtC[5]="fitness";
txtD[5]="lifting";
t[5]= "Un intervento di chirurgia estetica atto ad eliminare le rughe e le imperfezioni del viso:<BR>";
esatta[5] = "D";
commento[5] = "";

// -- * --
txtA[6]="debacle";
txtB[6]="golpe";
txtC[6]="harakiri";
txtD[6]="jakpot";
t[6]= "Sconfitta clamorosa e inaspettata; tracollo, rovescio, disastro:<BR>";
esatta[6] = "A";
commento[6] = "";

// -- * --
txtA[7]="chiosco da giardino";
txtB[7]="di scarso valore, privo di classe";
txtC[7]="sos";
txtD[7]="la festa del primo maggio per gli inglesi (may day)";
t[7]= "Mayday:<BR>";
esatta[7] = "C";
commento[7] = ". Il mayday è una richiesta d'aiuto internazionale (dal francese m'aidez), l'equivalente dell'sos in aviazione.";

// -- * --
txtA[8]="cross";
txtB[8]="forfait";
txtC[8]="flop";
txtD[8]="crack";
t[8]= "Fallimento, crollo finanziario:<BR>";
esatta[8] = "D";
commento[8] = "";

// -- * --
txtA[9]="anchor man";
txtB[9]="outsider";
txtC[9]="palmares";
txtD[9]="aficionado";
t[9]= "Corrente o candidato politico, inizialmente non favorito, la cui vittoria costiturebbe o costituisce una sorpresa:<BR>";
esatta[9] = "B";
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");
}


