/***********************************************
* 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 questions:
var totalquestions=50

//Enter the solutions corresponding to each question:
var correctchoices=new Array()
correctchoices[1]='b' //question 1 solution
correctchoices[2]='a' //question 2 solution, and so on.
correctchoices[3]='a'
correctchoices[4]='b'
correctchoices[5]='a'
correctchoices[6]='b'
correctchoices[7]='b'
correctchoices[8]='a'
correctchoices[9]='a'
correctchoices[10]='b'
correctchoices[11]='a'
correctchoices[12]='a'
correctchoices[13]='b'
correctchoices[14]='b'
correctchoices[15]='a'
correctchoices[16]='b'
correctchoices[17]='a'
correctchoices[18]='b'
correctchoices[19]='b'
correctchoices[20]='a'
correctchoices[21]='a'
correctchoices[22]='a'
correctchoices[23]='b'
correctchoices[24]='a'
correctchoices[25]='a'
correctchoices[26]='b'
correctchoices[27]='b'
correctchoices[28]='b'
correctchoices[29]='b'
correctchoices[30]='a'
correctchoices[31]='a'
correctchoices[32]='b'
correctchoices[33]='a'
correctchoices[34]='a'
correctchoices[35]='b'
correctchoices[36]='b'
correctchoices[37]='a'
correctchoices[38]='a'
correctchoices[39]='b'
correctchoices[40]='a'
correctchoices[41]='b'
correctchoices[42]='a'
correctchoices[43]='b'
correctchoices[44]='b'
correctchoices[45]='a'
correctchoices[46]='b'
correctchoices[47]='b'
correctchoices[48]='a'
correctchoices[49]='b'
correctchoices[50]='b'

/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null
for (q=1;q<=totalquestions;q++){
	var thequestion=eval("document.myquiz.question"+q)
	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true)
		actualchoices[q]=thequestion[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=350, scrollbars")
win2.focus()
win2.document.open()
win2.document.write('<title>Solution</title>')
win2.document.write('<body bgcolor="#FFFFFF">')
win2.document.write('<center><h3>"Are You a Hippy" quiz answers</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=totalquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
wrong=1
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
win2.document.write("Question "+i+"="+correctchoices[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><p align='center'><small><a href='http://www.javascriptkit.com' target='_new'>JavaScript Kit quiz script</a></small>")
win2.document.close()
}
