/***********************************************
* 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=5

//Enter the solutions corresponding to each question:
var correctchoices=new Array()
correctchoices[1]='c' //question 1 solution
correctchoices[2]='a' //question 2 solution, and so on.
correctchoices[3]='d'
correctchoices[4]='d'
correctchoices[5]='a'


var link=new Array()
link[1]= '  The correct answer is c.  A dirty fuel filter is NOT a likely cause.  A dirty fuel filter restricts pressure and will more likely show up under acceleration than at idle.' 
link[2]= '  The correct answer is a.  A dirty air filter is NOT a likely cause.  A dirty air filter will restrict air flow and reduce power.  The computer will compensate be reducing fuel injector pulse width and mileage will not likely change substantially.'
link[3]= '  The correct answer is d.  Wobble at very low ( 2 to 30 MPH) speed is most likely a separated tire. '
link[4]= '  The correct answer is d.  Whine on acceleration is most likely caused by the ring and pinion gears in the differential.'
link[5]= '  The correct answer is a.  A bad spark plug wire is NOT a likely cause.  A bad spark plug wire would cause a misfire which would richen the detected fuel/air mixture.'

/////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")
win2.focus()
win2.document.open()
win2.document.write('<title>Solution</title>')
win2.document.write('<body bgcolor="#FFFFFF">')
win2.document.write('<center><font face="Verdana, Arial"><font color="#bc0404"><h2>Answers So You Want To Be An Auto Tech?</h2></font></center></br>')
win2.document.write('<font face="Verdana, Arial" size=3>')
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("<b>Answer "+i+" is incorrect - </b>"+link[i]+"<br><br>")

wrong=0
}
else
win2.document.write("Answer "+i+" ("+correctchoices[i]+") is correct"+"<br><br>")
}
win2.document.write('</font>')
win2.document.write("<BR><BR><h5>Note: Answers are the most correct of choices offered, not the only possible correct answers.<BR><BR><BR>")
win2.document.close()
}

