// -- 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 = "14test.html";
// ##9
path_fine = "14test_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]="stupido";
txtB[0]="stupito";
txtC[0]="costante";
txtD[0]="solido";
txtE[0]="immobile";
txtF[0]="";
txtG[0]="";
t[0]="Quale parola significa il contrario di \x22volubile\x22?<BR>";
esatta[0] = "C";
commento[0] = "";


// -- * --
txtA[1]="rifiuto";
txtB[1]="introversione";
txtC[1]="apatia";
txtD[1]="rimprovero";
txtE[1]="";
txtF[1]="";
txtG[1]="";
t[1]="Una di queste parole ha un significato simile a \x22disaffezione\x22:<BR><BR>";
esatta[1] = "C";
commento[1] = "";

// -- * --
txtA[2]="BAMBINA";
txtB[2]="FEMMINA";
txtC[2]="MOGLIE";
txtD[2]="RAGAZZA";
txtE[2]="";
txtF[2]="";
txtG[2]="";
t[2]= "Completa la seguente proporzione: UOMO sta a MASCHIO come DONNA sta a:<BR>";
esatta[2] = "B";
commento[2] = "";

// -- * --
txtA[3]="accordo";
txtB[3]="convenienza";
txtC[3]="convezione";
txtD[3]="concessione";
txtE[3]="";
txtF[3]="";
txtG[3]="";
t[3]= "Una di queste parole ha un significato simile a \x22convenzione\x22:<BR><BR>";
esatta[3] = "A";
commento[3] = "";

// -- * --
txtA[4]="GAUCCAI";
txtB[4]="TARTO";
txtC[4]="IGARNA";
txtD[4]="NALABE";
txtE[4]="AZRZA";
txtF[4]="ZURLEMOZ";
txtG[4]="";
t[4]= "Anagramma le seguenti espressioni e indica la parola da scartare:<BR>";
esatta[4] = "D";
commento[4] = ": balena, č l'unico mammifero. Le altre parole sono: acciuga, trota, aringa, razza, merluzzo.";

// -- * --
txtA[5]="unitario";
txtB[5]="sussidiario";
txtC[5]="inventario";
txtD[5]="incompleto";
txtE[5]="";
txtF[5]="";
txtG[5]="";
t[5]= "Quale tra queste parole ha un significato che maggiormente si avvicina a \x22frammentario\x22?<BR>";
esatta[5] = "D";
commento[5] = "";

// -- * --
txtA[6]="saccheggiato";
txtB[6]="accaldato";
txtC[6]="lieto";
txtD[6]="afflitto";
txtE[6]="";
txtF[6]="";
txtG[6]="";
t[6]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina a \x22accorato\x22:<BR>";
esatta[6] = "D";
commento[6] = "";

// -- * --
txtA[7]="stimolare";
txtB[7]="reclutare";
txtC[7]="dissuadere";
txtD[7]="recitare";
txtE[7]="frenare";
txtF[7]="";
txtG[7]="";
t[7]= "Quale tra le seguenti parole ha un significato che maggiormente si avvicina al contrario di \x22incitare\x22:<BR>";
esatta[7] = "C";
commento[7] = "";

// -- * --
txtA[8]="tombola";
txtB[8]="monopoli";
txtC[8]="scopa";
txtD[8]="briscola";
txtE[8]="scacchi";
txtF[8]="alfiere";
txtG[8]="domino";
t[8]= "Indica qual č la parola da scartare:<BR>";
esatta[8] = "F";
commento[8] = ": l'alfiere non č un gioco.";

// -- * --
txtA[9]="detentore";
txtB[9]="oppositore";
txtC[9]="intrattenitore";
txtD[9]="difensore";
txtE[9]="";
txtF[9]="";
txtG[9]="";
t[9]= "Quale tra queste parole ha un significato che maggiormente si avvicina al contrario di \x22sostenitore\x22?<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");
}

