// -- AUTHOR: Filippo Spadaro
// -- PROGRAMMER: Filippo Spadaro
// -- LASTREVIEW: 12 maggio 2001 
// -- SITE URL: http://www.geocities.com/nienteperniente

// -- rmbr: sostituire **test.js nelle importazioni JScript dei file HTML
path = "05test.html";
path_fine = "05test_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 pA = new Array();
var pB = new Array();
var pC = new Array();
var pD = new Array();


// -- NB: l'utente deve riempire solo i campi:
// -- txt*[*], t[*], r[*], p*[*]
// -- * --
txtA[0]="Travelling without moving";
txtB[0]="A funk odyssey";
txtC[0]="Emergency on planet earth";
txtD[0]="Little L";
t[0]="\x22So you make me love you,<BR>love you baby...\x22<BR>sono le parole di <I>Little L</I> dei Jamiroquai, pubblicata nel 2001; in quale CD: " + txtA[0] + ", " + txtB[0] + ", " + txtC[0] + ", " + txtD[0] + "?";
r[0]=txtB[0];
pA[0]=0;pB[0]=1;pC[0]=0;pD[0]=0;

// -- * --
txtA[1]="Are you gonna go my way";
txtB[1]="Circus";
txtC[1]="5";
txtD[1]="Mama said";
t[1]="<I>Always on the run</I>, il primo singolo di Lenny Kravitz è stato pubblicato nel 1991, in quale CD: " + txtA[1] + ", " + txtB[1] + ", " + txtC[1] + ", " + txtD[1] + "?";
r[1]=txtD[1];
pA[1]=0;pB[1]=0;pC[1]=0;pD[1]=1;

// -- * --
txtA[2]="The Joshua Tree";
txtB[2]="All that you can't leave behind";
txtC[2]="Achtung baby";
txtD[2]="Under a red blood sky";
t[2]= "In quale album, nel 2000, gli U2 hanno pubblicato <I>Beautiful day</I>: " + txtA[2] + ", " + txtB[2] + ", " + txtC[2] + ", " + txtD[2] + "?";
r[2]=txtB[2];
pA[2]=0;pB[2]=1;pC[2]=0;pD[2]=0;

// -- * --
txtA[3]="Kylie Minogue";
txtB[3]="Tanita Tikaram";
txtC[3]="Jennifer Lopez";
txtD[3]="Monica Anderson";
t[3]= "<I>Can't get you out of my head</I>, è il fortunato singolo di una giovane cantante pubblicato nel 2001, di chi si tratta: " + txtA[3] + ", " + txtB[3] + ", " + txtC[3] + ", " + txtD[3] + "?";
r[3]=txtA[3];
pA[3]=1;pB[3]=0;pC[3]=0;pD[3]=0;

// -- * --
txtA[4]="Travis";
txtB[4]="Coldplay";
txtC[4]="Train";
txtD[4]="The Ark";
t[4]= "<I>It takes a fool to remain the same</I> porta al successo internazionale nel 2001 una prima d'ora sconosciuta band europea, quale: " + txtA[4] + ", " + txtB[4] + ", " + txtC[4] + ", " + txtD[4] + "?";
r[4]= txtD[4];
pA[4]=0;pB[4]=0;pC[4]=0;pD[4]=1;

// -- * --
txtA[5]="Alan Sorrenti";
txtB[5]="Enrico Ruggeri";
txtC[5]="Tony Esposito";
txtD[5]="Edoardo Bennato";
t[5]= "<I>Non so che darei</I>, <I>Figli delle stelle</I>, <I>Dammi il tuo amore</I>, sono i titoli di alcuni grandi successi di mucica leggera degli anni '70. Di quale artista si tratta: " + txtA[5] + ", " + txtB[5] + ", " + txtC[5] + ", " + txtD[5] + "?";
r[5]= txtA[5];
pA[5]=1;pB[5]=0;pC[5]=0;pD[5]=0;

// -- * --
txtA[6]="Coldplay";
txtB[6]="Oasis";
txtC[6]="Travis";
txtD[6]="The Jon Spencer Blues Explosion";
t[6]= "<I>Why does it always rain on me</I> del 1999, <I>Sing</I> del 2001, sono i titoli di due successi pop di una band inglese. Di quale band di tratta: " + txtA[6] + ", " + txtB[6] + ", " + txtC[6] + ", " + txtD[6] + "?";
r[6]= txtC[6];
pA[6]=0;pB[6]=0;pC[6]=1;pD[6]=0;

// -- * --
txtA[7]="Avion Travel";
txtB[7]="883";
txtC[7]="Lunapop";
txtD[7]="Tiromancino";
t[7]= "<I>La descrizione di un attimo</I> è il titolo di fortunato brano composto da un gruppo italiano emrgente, pubblicato nel 2000. Di quale gruppo si tratta: " + txtA[7] + ", " + txtB[7] + ", " + txtC[7] + ", " + txtD[7] + "?";
r[7]= txtD[7];
pA[7]=0;pB[7]=0;pC[7]=0;pD[7]=1;

// -- * --
txtA[8]="Train";
txtB[8]="Oasis";
txtC[8]="Elio e le storie Tese";
txtD[8]="The Ark";
t[8]= "<I>Drops of Jupiter</I> è il titolo di un brano di successo, pubblicato nel 2001, di quale band si tratta: " + txtA[8] + ", " + txtB[8] + ", " + txtC[8] + ", " + txtD[8] + "?";
r[8]= txtA[8];
pA[8]=1;pB[8]=0;pC[8]=0;pD[8]=0;

// -- * --
txtA[9]="Sands of Nevada";
txtB[9]="What it is";
txtC[9]="Sailing to Philadelphia";
txtD[9]="Speedway at Nazareth";
t[9]= "<I>Sailing to Philadelphia</I> è il singolo trainante di un album pubblicato da Mark Knopfler nel 2000. Qual è il titolo di questo lavoro: " + txtA[9] + ", " + txtB[9] + ", " + txtC[9] + ", " + txtD[9] + "?";
r[9]= txtC[9];
pA[9]=0;pB[9]=0;pC[9]=1;pD[9]=0;


// -- 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[i].elements[0].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");
}


