// -- 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 = "09test.html";
// ##9
path_fine = "09test_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]="è sempre e solo civile";
txtB[0]="è sempre e solo militare";
txtC[0]="può essere civile o militare";
txtD[0]="può essere civile, militare o spaziale";
t[0]="Aeronautica:<BR>";
esatta[0] = "B";
commento[0] = ", dire aeronautica militare è pleonastico!";


// -- * --
txtA[1]="rave";
txtB[1]="after hours";
txtC[1]="hard discount";
txtD[1]="catering";
t[1]="Discoteca che apre al mattino:<BR>";
esatta[1] = "B";
commento[1] = "";

// -- * --
txtA[2]="anchor man";
txtB[2]="rapper";
txtC[2]="outsider";
txtD[2]="hacker";
t[2]= "Chiunque si consideri estraneo ad un ambiente sociale o ad un gruppo:<BR>";
esatta[2] = "C";
commento[2] = "";

// -- * --
txtA[3]="gardreil";
txtB[3]="gardrail";
txtC[3]="guardrail";
txtD[3]="guardreil";
t[3]= "Ringhiera di metallo o cemento posta ai margini delle strade per impedire l'uscita dei veicoli dalla carreggiata in caso di sbandamento:<BR>";
esatta[3] = "C";
commento[3] = "";

// -- * --
txtA[4]="fifty-fifty";
txtB[4]="exit poll";
txtC[4]="reportage";
txtD[4]="scoop";
t[4]= "Tecnica statistica di previsione dei risultati elettorali, consistente nell'analisi delle dichiarazioni di voto, effettuate all'uscita dai seggi, di un campione di elettori:<BR>";
esatta[4] = "B";
commento[4] = "";

// -- * --
txtA[5]="induttore";
txtB[5]="resistore";
txtC[5]="condensatore";
txtD[5]="transistor";
t[5]= "Dispositivo elettronico costruito da materiale semiconduttore che amplifica correnti e tensioni elettriche:<BR>";
esatta[5] = "D";
commento[5] = ". Per estensione, si usa per indicare la radio a transistor.";

// -- * --
txtA[6]="gossip";
txtB[6]="grunge";
txtC[6]="cheap";
txtD[6]="trash";
t[6]= "Letteralmente vuol dire spazzatura, usato soprattutto come aggettivo, riferito a spettacoli televisivi, teatrali, film o testi letterari di scarsissima qualità:<BR>";
esatta[6] = "D";
commento[6] = "";

// -- * --
txtA[7]="avventore";
txtB[7]="consulente";
txtC[7]="appassionato";
txtD[7]="cliente di passaggio";
t[7]= "Assiduo frequentatore, habitué:<BR>";
esatta[7] = "A";
commento[7] = "";

// -- * --
txtA[8]="garage";
txtB[8]="aviostazione";
txtC[8]="deposito";
txtD[8]="aviorimessa";
t[8]= "Sinonimo di hangar:<BR>";
esatta[8] = "D";
commento[8] = "";

// -- * --
txtA[9]="drive";
txtB[9]="go-kart";
txtC[9]="jet lag";
txtD[9]="rally";
t[9]= "Piccola autovettura monoposto, formata dagli organi indispensabili alla marcia e dal telaio, usata per hobby e per competizioni sportive:<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");
}


