/***********************************************
* JavaScriptKit.com Multiple Choice Quiz Script (http://www.javascriptkit.com)
* Copyright 2003 JavaScript Kit- http://www.javascriptkit.com
* This notice and footnote must stay intact for use
* Visit JavaScript Kit (http://www.javascriptkit.com/) for full source code
***********************************************/

//Enter total number of Pitanjes:
var totalPitanjes=12

//Enter the solutions corresponding to each Pitanje:
var correctchoices=new Array()
correctchoices[1]='b' //Pitanje 1 solution
correctchoices[2]='c' //Pitanje 2 solution, and so on.
correctchoices[3]='c'
correctchoices[4]='b'
correctchoices[5]='a'
correctchoices[6]='c'
correctchoices[7]='a'
correctchoices[8]='b'
correctchoices[9]='c'
correctchoices[10]='a'
correctchoices[11]='b'
correctchoices[12]='a'

/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null
for (q=1;q<=totalPitanjes;q++){
	var thePitanje=eval("document.myquiz.Pitanje"+q)
	for (c=0;c<thePitanje.length;c++){
		if (thePitanje[c].checked==true)
		actualchoices[q]=thePitanje[c].value
		}
		
	if (actualchoices[q]!=correctchoices[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
window.location="results.htm"
}


function showsolution(){
var win2=window.open("","win2","width=200,height=370, scrollbars")
win2.focus()
win2.document.open()
win2.document.write('<title>Resenja</title>')
win2.document.write('<body bgcolor="#FFFFFF">')
win2.document.write('<center><font face="Verdana">')
win2.document.write('<center><h3>Resenje testa</h3></center>')
for (i=1;i<=totalPitanjes;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
wrong=1
}
if (wrong==1){
win2.document.write("Pitanje "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
win2.document.write("Pitanje "+i+"="+correctchoices[i]+"<br>")
}
win2.document.write('</center></font>')
win2.document.write('<center><font face="Verdana">')
win2.document.write("<h5>Resenja obelezena crvenom bojom su ona na koje niste dali tacan odgovor!</h5>")
win2.document.close()
}
