// -- 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 = "16test.html";
// ##9
path_fine = "16test_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]="armadio";
txtB[0]="divano";
txtC[0]="comodino";
txtD[0]="cassettiera";
txtE[0]="copriletto";
txtF[0]="sedia";
txtG[0]="";
t[0]="Indica la parola da scartare:<BR>";
esatta[0] = "E";
commento[0] = "";


// -- * --
txtA[1]="LAZIO";
txtB[1]="NAPOLI";
txtC[1]="REGIONE";
txtD[1]="CAMPANIA";
txtE[1]="ITALIA";
txtF[1]="";
txtG[1]="";
t[1]="Completa la seguente proporzione: GENOVA sta a LIGURIA come ROMA sta a...<BR>";
esatta[1] = "A";
commento[1] = "";

// -- * --
txtA[2]="odiare";
txtB[2]="abbordare";
txtC[2]="fare attenzione";
txtD[2]="distrarsi";
txtE[2]="osservare";
txtF[2]="";
txtG[2]="";
t[2]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22badare\x22:<BR>";
esatta[2] = "C";
commento[2] = "";

// -- * --
txtA[3]="smontabile";
txtB[3]="portabile";
txtC[3]="intollerabile";
txtD[3]="tollerabile";
txtE[3]="";
txtF[3]="";
txtG[3]="";
t[3]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina al contrario di \x22sopportabile\x22:<BR>";
esatta[3] = "C";
commento[3] = "";

// -- * --
txtA[4]="ottusitą";
txtB[4]="prontezza";
txtC[4]="perspicacia";
txtD[4]="spigolositą";
txtE[4]="incapacitą";
txtF[4]="";
txtG[4]="";
t[4]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina al contrario di \x22acutezza\x22:<BR>";
esatta[4] = "A";
commento[4] = "";

// -- * --
txtA[5]="ATINZANA";
txtB[5]="NARIMABI";
txtC[5]="CRAMANADI";
txtD[5]="RELAMPO";
txtE[5]="ETINGNARA";
txtF[5]="SATIRALUA";
txtG[5]="";
t[5]= "Anagramma e indica la parola che non č una nazione:<BR>";
esatta[5] = "D";
commento[5] = ": Palermo. Le altre parole sono: Tanzania, Birmania, Danimarca, Argentina, Australia.";

// -- * --
txtA[6]="pallavolo";
txtB[6]="basket";
txtC[6]="automobilismo";
txtD[6]="canottaggio";
txtE[6]="bicicletta";
txtF[6]="";
txtG[6]="";
t[6]= "Indica qual č la parola da scartare:<BR>";
esatta[6] = "E";
commento[6] = ": la bicicletta non č uno sport.";

// -- * --
txtA[7]="balordo";
txtB[7]="ingordo";
txtC[7]="furfante";
txtD[7]="galantuomo";
txtE[7]="";
txtF[7]="";
txtG[7]="";
t[7]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22manigoldo\x22:<BR>";
esatta[7] = "C";
commento[7] = "";

// -- * --
txtA[8]="molto esperto";
txtB[8]="naufragato";
txtC[8]="suffragato";
txtD[8]="inesperto";
txtE[8]="";
txtF[8]="";
txtG[8]="";
t[8]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina al contrario di \x22navigato\x22:<BR>";
esatta[8] = "D";
commento[8] = "";

// -- * --
txtA[9]="unico";
txtB[9]="dispersivo";
txtC[9]="completo";
txtD[9]="apprensivo";
txtE[9]="globale";
txtF[9]="";
txtG[9]="";
t[9]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22complessivo\x22:<BR>";
esatta[9] = "E";
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");
}


