// -- 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 = "11test.html";
// ##9
path_fine = "11test_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 espediente che si mette in atto per eludere una difficoltà o per risolvere una situazione in modo abile e astuto";
txtB[0]="una cerchia ristretta di persone che emerge per qualità superiori";
txtC[0]="una cerchia di persone che sta intorno ad un personaggio importante";
txtD[0]="un gruppo di persone che si distingue per cultura, ceto sociale, potere politico o economico";
t[0]="Per entourage s'intende:<BR>";
esatta[0] = "C";
commento[0] = "";


// -- * --
txtA[1]="extasy";
txtB[1]="crack";
txtC[1]="lsd";
txtD[1]="eroina";
t[1]="Sostanza ottenuta purificando chimicamente la cocaina in modo da consentirne l'assunzione sotto forma di fumo:<BR>";
esatta[1] = "B";
commento[1] = "";

// -- * --
txtA[2]="Classifica dei vincitori di un premio";
txtB[2]="Corrente o candidato politico, inizialmente non favorito, la cui vittoria costiturebbe o costituisce una sorpresa";
txtC[2]="Elenco dei successi ottenuti in varie competizioni";
txtD[2]="Gruppo di persone al vertice di un settore (economico, artistico, ecc.)";
t[2]= "Quale delle seguenti definizioni di 'palmares' è l'unica errata?<BR>";
esatta[2] = "B";
commento[2] = "";

// -- * --
txtA[3]="buvette";
txtB[3]="fast food";
txtC[3]="catering";
txtD[3]="cargo";
t[3]= "Fornitura a domicilio di cibi e bevande; ristorazione:<BR>";
esatta[3] = "C";
commento[3] = "";

// -- * --
txtA[4]="cross";
txtB[4]="gap";
txtC[4]="en passant";
txtD[4]="jolly";
t[4]= "Divario, spazio intermedio tra due elementi (anche in senso figurato):<BR>";
esatta[4] = "B";
commento[4] = "";

// -- * --
txtA[5]="target";
txtB[5]="troupe";
txtC[5]="scoop";
txtD[5]="fan";
t[5]= "Obiettivo prefissato; pubblico al quale si intende rivolgersi:<BR>";
esatta[5] = "A";
commento[5] = "";

// -- * --
txtA[6]="password";
txtB[6]="menù";
txtC[6]="voucher";
txtD[6]="ticket";
t[6]= "Documento scritto, ricevuta che attesta il diritto a ricevere determinati servizi:<BR>";
esatta[6] = "C";
commento[6] = "";

// -- * --
txtA[7]="harakiri";
txtB[7]="origami";
txtC[7]="pendant";
txtD[7]="training";
t[7]= "Tecnica giapponese che permette di realizzare figure piegando fogli di carta con le mani, senza l'ausilio di nessuno strumento:<BR>";
esatta[7] = "B";
commento[7] = "";

// -- * --
txtA[8]="entourage";
txtB[8]="gazebo";
txtC[8]="gar&#231;onniere";
txtD[8]="loft";
t[8]= "Magazzino ristrutturato e adatto ad uso abitativo:<BR>";
esatta[8] = "D";
commento[8] = "";

// -- * --
txtA[9]="gulag";
txtB[9]="task-force";
txtC[9]="entourage";
txtD[9]="fan club";
t[9]= "Formazione militare costituita appositamente per compiere missioni speciali e frontegiare situazioni di emergenza; gruppo di esperti chiamati a risolvee un problema:<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");
}


