//creo la funzione che controlla la validità dei dati inseriti
function datiValidi(text)
{
	var myRegExp = /[^\d\-d]/;
	return !(myRegExp.test(text));
}
function TotaleQuest1()
{
//creo la variabile di riduzione del codice
	var qst1 = document.quest1;
//creo le variabili per ogni item
	var it1 = parseInt(qst1.itm1.value);
	var it2 = parseInt(qst1.itm2.value);
	var it3 = parseInt(qst1.itm3.value);
	var it4 = parseInt(qst1.itm4.value);
	var it5 = parseInt(qst1.itm5.value);
	var it6 = parseInt(qst1.itm6.value);
	var it7 = parseInt(qst1.itm7.value);
	var it8 = parseInt(qst1.itm8.value);
	var it9 = parseInt(qst1.itm9.value);
	var it10 = parseInt(qst1.itm10.value);
	var it11 = parseInt(qst1.itm11.value);
	var it12 = parseInt(qst1.itm12.value);
	var it13 = parseInt(qst1.itm13.value);
//creo la variabile per il calcolo del totale
	var totale = it1+it2+it3+it4+it5+it6+it7+it8+it9+it10+it11+it12+it13;
//faccio apparire il totale
	qst1.textot1.value=totale;
}
function ControllaQuest1()
{
//creo la variabile di riduzione del codice
	var qst1 = document.quest1;
//creo la variabile per annullare l'invio del modulo se è compilato erroneamente
	var returnValue = false;
//imposto le condizioni di verifica
	if (qst1.itm1.value == "" || qst1.itm1.value < -3 || qst1.itm1.value > 3 || datiValidi(qst1.itm1.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm1.focus();
	}
	else if (qst1.itm2.value == "" || qst1.itm2.value < -3 || qst1.itm2.value > 3 || datiValidi(qst1.itm2.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm2.focus();
	}
	else if (qst1.itm3.value == "" || qst1.itm3.value < -3 || qst1.itm3.value > 3 || datiValidi(qst1.itm3.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm3.focus();
	}
	else if (qst1.itm4.value == "" || qst1.itm4.value < -3 || qst1.itm4.value > 3 || datiValidi(qst1.itm4.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm4.focus();
	}
	else if (qst1.itm5.value == "" || qst1.itm5.value < -3 || qst1.itm5.value > 3 || datiValidi(qst1.itm5.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm5.focus();
	}
	else if (qst1.itm6.value == "" || qst1.itm6.value < -3 || qst1.itm6.value > 3 || datiValidi(qst1.itm6.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm6.focus();
	}
	else if (qst1.itm7.value == "" || qst1.itm7.value < -3 || qst1.itm7.value > 3 || datiValidi(qst1.itm7.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm7.focus();
	}
	else if (qst1.itm8.value == "" || qst1.itm8.value < -3 || qst1.itm8.value > 3 || datiValidi(qst1.itm8.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm8.focus();
	}
	else if (qst1.itm9.value == "" || qst1.itm9.value < -3 || qst1.itm9.value > 3 || datiValidi(qst1.itm9.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm9.focus();
	}
	else if (qst1.itm10.value == "" || qst1.itm10.value < -3 || qst1.itm10.value > 3 || datiValidi(qst1.itm10.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm10.focus();
	}
	else if (qst1.itm11.value == "" || qst1.itm11.value < -3 || qst1.itm11.value > 3 || datiValidi(qst1.itm11.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm11.focus();
	}
	else if (qst1.itm12.value == "" || qst1.itm12.value < -3 || qst1.itm12.value > 3 || datiValidi(qst1.itm12.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.focus();
	}
	else if (qst1.itm13.value == "" || qst1.itm13.value < -3 || qst1.itm13.value > 3 || datiValidi(qst1.itm13.value)==false)
	{
		alert ("Prego inserire solo un valore ammesso dalle risposte.");
		qst1.itm13.focus();
	}
	else
	{
		returnValue = true;
		TotaleQuest1();
	}
	return returnValue;
}