//TOTAL SOLUTIONS VARIABLE

var allquestions=45
var correctanswers=new Array()
correctanswers[1]='b' // PART 1
correctanswers[2]='a' 
correctanswers[3]='b' 
correctanswers[4]='c'
correctanswers[5]='c'
correctanswers[6]='b' // PART 2
correctanswers[7]='c'
correctanswers[8]='c'
correctanswers[9]='a'
correctanswers[10]='c'
correctanswers[11]='c' // PART 3
correctanswers[12]='b'
correctanswers[13]='a'
correctanswers[14]='b'
correctanswers[15]='a'
correctanswers[16]='b' // PART 4
correctanswers[17]='a' 
correctanswers[18]='a' 
correctanswers[19]='b'
correctanswers[20]='b'
correctanswers[21]='b' // PART 5
correctanswers[22]='b'
correctanswers[23]='b'
correctanswers[24]='b'
correctanswers[25]='c'
correctanswers[26]='b' // PART 6
correctanswers[27]='b'
correctanswers[28]='c'
correctanswers[29]='a'
correctanswers[30]='c'
correctanswers[31]='b' // PART 7
correctanswers[32]='a' 
correctanswers[33]='a' 
correctanswers[34]='a'
correctanswers[35]='b'
correctanswers[36]='b' // PART 8
correctanswers[37]='a'
correctanswers[38]='a'
correctanswers[39]='b'
correctanswers[40]='b'
correctanswers[41]='a' // PART 9
correctanswers[42]='b'
correctanswers[43]='b'
correctanswers[44]='b'
correctanswers[45]='b'

// TOTAL CALCULATION

function countsolution(){
var incorrect=null
for (q=1;q<=allquestions;q++){
	var thequestion=eval("document.ingIngresso.question"+q)
	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true)
		actualchoices[q]=thequestion[c].value
		}
		
	if (actualchoices[q]!=correctanswers[q]){ //process an incorrect choice
		if (incorrect==null)
		incorrect=q
		else
		incorrect+="/"+q
		}
	}

if (incorrect==null)
incorrect="a/b"
document.cookie='q='+incorrect
if (document.cookie=='')
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
top.topFrame.thecognome=document.ingIngresso.cognome.value;
window.location="ing_test_ingresso_risultati_A.htm"
}

// TOTAL SOLUTION

function getsolution(){
var win2=window.open("","win2","width=200,height=350, scrollbars")
win2.focus()
win2.document.open()
win2.document.write('<title>Solutions Part A</title>')
win2.document.write('<body bgcolor="#FFFFFF">')
win2.document.write('<center><h3>Solutions Part A</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=allquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
wrong=1
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctanswers[i].fontcolor("red")+"<br>")
wrong=0
}
else
win2.document.write("Question "+i+"="+correctanswers[i]+"<br>")
}
win2.document.write('</center></font>')
win2.document.write("<h5>Note: The solutions in red are the ones to the questions you had incorrectly answered.</h5>")
win2.document.close()
}

