// -- AUTHOR: Filippo Spadaro
// -- PROGRAMMER: Filippo Spadaro
// -- LASTREVIEW: 13 febbraio 2002
// -- SITE URL: http://utenti.lycos.it/nienteperniente

	var t = new Array();
	var r = new Array();
	t[0]= "Quali tra le frazioni che seguono &egrave; la maggiore?<BR>1/11&nbsp;&nbsp;2/11&nbsp;&nbsp;3/11&nbsp;&nbsp;6/11";
	r[0]= "D - 6/11";
	t[1]= "364157 : 723 = ... (approssimativamente)";
	r[1]= "B - 500";
	t[2]= "Quali tra le frazioni che seguono &egrave; la maggiore?<BR>1/2&nbsp;&nbsp;3/4&nbsp;&nbsp;3/5&nbsp;&nbsp;7/12";
	r[2]= "B - 3/4";
	t[3]= "3876 : 12,84 = ... (approssimativamente)";
	r[3]= "C - 300";
	t[4]= "Un'automobile percorre 100km in 1 ora. Quante ore impiegherą per percorrere 350km?";
	r[4]= "D - 3h e 30m";
	t[5]= "Completare la proporzione, sostituendo x e y con i rispettivi numeri:<BR>10 : x = y : 1024";
	r[5]= "D - 64, 160";
	t[6]= "608 &#183; 450 = ... (approssimativamente)";
	r[6]= "A - 270000";
	t[7]= "Quante rette passano per due punti?";
	r[7]= "B - Una sola";
	t[8]= "10099 + 999 = ..";
	r[8]= "C - 11098";
	t[9]= "Quanti anni devono passare perch&eacute; 2500 euro investiti al 4% annuo diano un interesse semplice di 300 euro?";
	r[9]= "D - 3";


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;
	createTempCookie("ordine", 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", null);
}


