// -- 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 = "02test.html";
path_fine = "02test_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]="Lou Reed";
txtB[0]="Elvis Costello";
txtC[0]="Chuck Berry";
txtD[0]="Elvis Presley";
t[0]="Chi fu l'artista che negli anni '50 compose le canzoni rock <I>Maybellene</I>, <I>School day</I>, <I>No particular place to go</I> e <I>Almost grown</I>: " + 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]="Paul Anka";
txtB[1]="Gino Vannelli";
txtC[1]="Jimmy Fontana";
txtD[1]="Sergio Endrigo";
t[1]="Nel 1957 compose il grande successo <I>Diana</I>. Chi fu: " + txtA[1] + ", " + txtB[1] + ", " + txtC[1] + ", " + txtD[1] + "?";
r[1]=txtA[1];
pA[1]=1;pB[1]=0;pC[1]=0;pD[1]=0;

// -- * --
txtA[2]="Gino Paoli";
txtB[2]="Luigi Tenco";
txtC[2]="Ricky Gianco";
txtD[2]="Patty Pravo";
t[2]= "Il suo pezzo d'esordio nel 1959 fu <I>Ciao ti dirò</I>, probabilmente il primo brano rock 'made in italy'. Di chi stiamo parlando: " + txtA[2] + ", " + txtB[2] + ", " + txtC[2] + ", " + txtD[2] + "?";
r[2]=txtC[2];
pA[2]=0;pB[2]=0;pC[2]=1;pD[2]=0;

// -- * --
txtA[3]="Ricky Gianco";
txtB[3]="Gino Paoli";
txtC[3]="Luigi Tenco";
txtD[3]="Angelo Branduardi";
t[3]= "<I>Lontano, lontano</I>, <I>Mi sono innamorato di te</I> e <I>Vedrai, vedrai</I> sono alcune intense e amare canzoni composte negli anni '60 da uno dei seguenti artisti italiani: " + txtA[3] + ", " + txtB[3] + ", " + txtC[3] + ", " + txtD[3] + "?";
r[3]=txtC[3];
pA[3]=0;pB[3]=0;pC[3]=1;pD[3]=0;

// -- * --
txtA[4]="Patty Pravo";
txtB[4]="Janis Joplin";
txtC[4]="Veronica delle Ronettes";
txtD[4]="Brenda Lee";
t[4]= "Pur manifestando rumorosamente la propria presenza nelle file del pubblico, le ragazze sono praticamente assenti tra i pionieri del rock'n'roll. Una cantante però entrerà nella leggenda con <I>Dynamite</I> (1958) e <I>I'm sorry</I> (1960), chi fu: " + 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]="Ronettes";
txtB[5]="Crystals";
txtC[5]="Shangri Las";
txtD[5]="Bananarama";
t[5]= "<I>Be my baby</I>, <I>Walking in the rain</I> e <I>Do I love you</I> sono alcuni dei brani di un gruppo femminile di rock'n'roll degli anni '60. Di chi 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]="Edoardo Vianello";
txtB[6]="Eddie Cochran";
txtC[6]="Buddy Holly";
txtD[6]="Janis Joplin";
t[6]= "<I>Summertime blues</I> fu composto negli anni '50 da uno dei seguenti artisti: " + txtA[6] + ", " + txtB[6] + ", " + txtC[6] + ", " + txtD[6] + "!";
r[6]= txtB[6];
pA[6]=0;pB[6]=1;pC[6]=0;pD[6]=0;

// -- * --
txtA[7]="Gene Vincent";
txtB[7]="Eddie Cochran";
txtC[7]="Tom Parker";
txtD[7]="Janis Joplin";
t[7]= "<I>Be bop a lula</I> fu composto sul finire degli anni '50 da uno dei seguenti artisti: " + txtA[7] + ", " + txtB[7] + ", " + txtC[7] + ", " + txtD[7] + "!";
r[7]= txtA[7];
pA[7]=1;pB[7]=0;pC[7]=0;pD[7]=0;

// -- * --
txtA[8]="Ennio Morricone";
txtB[8]="Ricky Nelson";
txtC[8]="Jimi Hendrix";
txtD[8]="John Mayall";
t[8]= "Little Richard alla fine degli anni '50 si proclamava \x27re del rock'n'roll\x27, né più né meno di Elvis Presley. Geloso del proprio titolo, vietava ai musicisti che l'accompagnano di comporttarsi come lui. L'avere ignorato questo rigido precetto procurò ad un artista, che successivamente passerà alla storia del rock, di vennire cacciato dal suo gruppo. Di chi si trattò: " + txtA[8] + ", " + txtB[8] + ", " + txtC[8] + ", " + txtD[8] + "?";
r[8]= txtC[8];
pA[8]=0;pB[8]=0;pC[8]=1;pD[8]=0;

// -- * --
txtA[9]="Jimi Hendrix";
txtB[9]="Chuck Berry";
txtC[9]="Elvis Presley";
txtD[9]="John Mayall";
t[9]= "Chi fu il cantante americano soprannominato 'The King of rock'n'roll':" + 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");
}


