// -- 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 = "01test.html";
path_fine = "01test_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]="Frank Zappa";
txtC[0]="Brian Eno";
txtD[0]="Elvis Presley";
t[0]="\x22<I>Il rock'n'roll esisteva da tempo. Prima si chiamava rhythm'n'blues. Era già formidabile. Ed è diventato ancora più enorme. Allora si sono messi a dire che ha una cattiva influenza sui giovani. Per me il rock è musica, e basta. E sono anche sicuro che durerà un bel pezzo. Altrimenti per sostituirlo ci vorrà qualcosa di eccezionale. Davvero.</I>\x22 Chi ha pronunciato queste parole nel 1955: " + txtA[0] + ", " + txtB[0] + ", " + txtC[0] + ", " + txtD[0] + "?";
r[0]=txtD[0];
pA[0]=0;pB[0]=0;pC[0]=0;pD[0]=1;

// -- * --
txtA[1]="Gianni Morandi";
txtB[1]="Edoardo Vianello";
txtC[1]="Jimmy Fontana";
txtD[1]="Sergio Endrigo";
t[1]="<I>Abbronzatissima</I>, <I>Pinne, fucile e occhiali</I> e <I>Guarda come dondolo</I> sono alcuni dei più famosi brani di quale artista italiano:<BR>" + txtA[1] + ", " + txtB[1] + ", " + txtC[1] + ", " + txtD[1] + "?";
r[1]=txtB[1];
pA[1]=0;pB[1]=1;pC[1]=0;pD[1]=0;

// -- * --
txtA[2]="Nada";
txtB[2]="Donatella Moretti";
txtC[2]="Rita Pavone";
txtD[2]="Patty Pravo";
t[2]= "<I>Come te non c'è nessuno</I>, <I>Alla mia età</I> e <I>Datemi un martello</I> sono alcuni dei più famosi brani di quale artista italiana:<BR>" + 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]="Bill Haley and his Comets";
txtC[3]="Patti Smith";
txtD[3]="Loo Reed";
t[3]= "Chi registrò nell'aprile 1954 il noto pezzo <I>Rock around the clock</I>:<BR>" + txtA[3] + ", " + txtB[3] + ", " + txtC[3] + ", " + txtD[3] + "?";
r[3]=txtB[3];
pA[3]=0;pB[3]=1;pC[3]=0;pD[3]=0;

// -- * --
txtA[4]="I Flippers";
txtB[4]="The Rokes";
txtC[4]="Equipe 84";
txtD[4]="Los Marcellos Ferial";
t[4]= "Da quale tra i seguenti gruppi era accompagnato Edoardo Vianello quando cantava <I>I Watussi</I>:<BR>" + txtA[4] + ", " + txtB[4] + ", " + txtC[4] + ", " + txtD[4] + "?";
r[4]= txtA[4];
pA[4]=1;pB[4]=0;pC[4]=0;pD[4]=0;

// -- * --
txtA[5]="Ritchie Valens";
txtB[5]="Elvis Presley";
txtC[5]="Buddy Holly";
txtD[5]="Bill Haley";
t[5]= "L'autore di <I>La Bamba</I> fu: " + 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]="Eric Clapton";
txtC[6]="Buddy Holly";
txtD[6]="Janis Joplin";
t[6]= "<I>That'll be the day</I> e <I>Peggy Sue</I> sono alcuni dei successi composti negli anni '50, da quale artista: " + 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]="Gene Vincent";
txtB[7]="Eddie Cochran";
txtC[7]="Tom Parker";
txtD[7]="Janis Joplin";
t[7]= "<I>Love me tender</I> e <I>Crying up the chapel</I> sono alcune note ballad composte negli anni '50 da uno dei seguenti artisti: " + txtA[7] + ", " + txtB[7] + ", " + txtC[7] + ", " + txtD[7] + "!";
r[7]= txtC[7];
pA[7]=0;pB[7]=0;pC[7]=1;pD[7]=0;

// -- * --
txtA[8]="Cadillacs";
txtB[8]="Gene Vincent and his Blue Caps";
txtC[8]="Platters";
txtD[8]="Manhattan Transfer";
t[8]= "Il gruppo di Detroit che realizzò una favolosa serie di successi come <I>Only you</I>, <I>The great pretender</I> e <I>Smoke gets in your eyes</I>: " + 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]="Gene Vincent";
txtB[9]="Tom Parker";
txtC[9]="Little Richard";
txtD[9]="Buddy Holly";
t[9]= "<I>Lucille</I> e <I>Long tall Sally</I> sono alcune noti pezzi rock composti alla fine degli anni '50 da uno dei seguenti artisti: " + 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");
}


