// Define global variables and arrays
var qI	= 0;
var checker11 = true;
var choice11	= new Array();
var correctans11 	= 0;
var nextq 	= 1;
var quiz11;

function itemReset() {	//resets everything
	qI 	= 0;
	choice11 = new Array();
	correctans11 	= 0;
	nextq	= 1;
	}
	
function busted11() {
	alert('Sorry, you only get one shot at each question.');
	quiz11.history.forward(); 
	quiz11.focus();
	}
	
function book()	{
	parent.location.href='/licensing/learnerdrivers/1464.asp';
	quiz11.document.close();
	}
	
function restart(){
	parent.location.href="/licensing/learnerdrivers/1465.asp"
	quiz11.document.close();
	}

function startquiz11(openStatus, whetherOrNot) {		// Administer the test and record the ans
		
	checker11 = openStatus;
		
	if (whetherOrNot < qI) { 
		busted11(); 
		return; 
		}
	
	if (checker11) { 
		quiz11 = window.open('','QuizOne','width=640,height=480,scrollbars=yes');
		//quiz11.moveTo(150,150);		
		quiz11.focus(); 
		!checker11;
		}
	
	if (qI == qus11.length) { 
		gradeTest11(); 
		return; 
		}
	displayeleven();
	}

function quizeleven(number,question,optionA,optionB,optionC,ans,img) {    
	this.number = number;
	this.question=question; 
	this.optionA = optionA;
	this.optionB=optionB;    
	this.optionC=optionC; 
	this.ans = ans; 
	this.img = img;  
	return this;
	}
	
function displayeleven()	{	// display questions
	
	// Write the qusestons and answrs options to the new window
	quiz11.document.clear();
	quiz11.document.open();
	quiz11.document.writeln('<html><head><title>Learners Practice Quiz 11</title>');
	quiz11.document.writeln('<link href="/css/purple.css" rel="stylesheet" type="text/css">');
	quiz11.document.writeln('</head><body bgcolor="\#ffffff\">');
	quiz11.document.writeln('<h3>Question '+ qus11[qI].number +'</h3>');
	quiz11.document.writeln('<table width=\'600\' cellspacing=\'5\'>');
	quiz11.document.writeln('<tr class=\'bg3\'><td align=\'left\' valign=\'top\' colspan=\'3\' height=\"40\">');
	quiz11.document.writeln('<p><b class=\'bodyhdr\'>' +qus11[qI].question+ '</b>');
	quiz11.document.writeln('</td></tr><td width=\'2\'>&nbsp;</td></tr>');
	quiz11.document.writeln('</td></tr><tr><td align=\'left\' valign=\'top\' width=\'35\' height=\'35\'><p>');
	quiz11.document.writeln('A&nbsp;<input type=\'radio\' name=\"answer\" value=\"a\" onClick="opener.choice11[opener.qI - 1] = this.value;\"></p>');
	quiz11.document.writeln('</td><td align=\'left\' valign=\'top\' width=\'340\' height=\'35\'>');	
	quiz11.document.writeln('<p>'+qus11[qI].optionA+'</p>');
	quiz11.document.writeln('</td><td valign=\'top\' width=\'200\'rowspan=\'4\' height=\"200\">');
	quiz11.document.writeln('<img border=\"0\" width=\"200\" height=\"200\" align=\"right\" src=\"'+qus11[qI].img+'\">');
	quiz11.document.writeln('</td></tr><tr><td align=\'left\' valign=\'top\' width=\'35\' height=\'35\'><p>');
	quiz11.document.writeln('B&nbsp;<input type=\'radio\' name=\"answer\" value=\"b\" onClick="opener.choice11[opener.qI - 1] = this.value;\"></p>');
	quiz11.document.writeln('</td><td align=\'left\'valign=\'top\' width=\'340\' height=\'35\'>');
	quiz11.document.writeln('<p>'+qus11[qI].optionB+'</p>');
	quiz11.document.writeln('</td></tr><tr><td align=\'left\' valign=\'top\' width=\'35\' height=\'35\'><p>');
	quiz11.document.writeln('C&nbsp;<input type=\'radio\' name=\"answer\" value=\"c\" onClick="opener.choice11[opener.qI - 1] = this.value;\"></p>');
	quiz11.document.writeln('</td><td align=\'left\' valign=\'top\' width=\'340\' height=\'35\'>');
	quiz11.document.writeln('<p>'+qus11[qI].optionC+'</p>');
	quiz11.document.writeln('</td></tr><tr align=\'left\' valign=\"top\" align=\'left\'><td width=\'30\'height=\'95\'>&nbsp;</td></tr>');
	quiz11.document.writeln('<tr align=\'right\'><td colspan=\'3\'>');
	quiz11.document.writeln('<input type=\'button\' value=\"NEXT QUESTION\" onClick="opener.startquiz11(false,' +nextq+ ')\;">');  
	quiz11.document.writeln('</td></tr></table></body></html>');
	quiz11.document.close();
	// Increment variables for the next question
	qI++;
	nextq++;
	}

function gradeTest11() {		// Increment the variables for the last time	
	qI++;
	nextq++;	
	
	for (var i = 0; i < qus11.length; i++) {		// Compare student ans with correct ans
		if (choice11[i] == qus11[i].ans) {
			correctans11++;
			}
		}	
	printResults11();	// Print the test results
	}
	
function printResults11() {		// Print the questions, answer options, and other info
	quiz11.document.clear();
	quiz11.document.open();
	quiz11.document.writeln('<html><head>');
	quiz11.document.writeln('<title>Quiz Eleven Results</title>');
	quiz11.document.writeln('<link href="css/purplelocal.css" rel="stylesheet" type="text/css">');
	quiz11.document.writeln('</head><body BGCOLOR=\"WHITE\">');						
	quiz11.document.writeln('<h3>Quiz Results</h3>');						
	quiz11.document.writeln('<p class=\'bodyhdr\'>Your score out of 30 is &nbsp;'+correctans11+'</p>');
	quiz11.document.writeln('<p>Here is how you scored individually for each question:</p><hr>');
	quiz11.document.writeln('<table width=\'600\' cellpadding=\'0\'>');
	
	for (var i = 0; i < qus11.length; i++) {
	
	quiz11.document.writeln('<tr valign=\"top\" align=\'left\'><td height=\'30\' width=\'20\'>');
	quiz11.document.writeln('<p><b>'+qus11[i].number+ '</b></td><td colspan=\'2\'><p>' +qus11[i].question+'</p>');
	quiz11.document.writeln('</td></tr><tr valign=\"top\" align=\'left\'><td height=\'20\'>');
	quiz11.document.writeln('<p>a.</td><td width=\'450\'><p>' +qus11[i].optionA+ '</td>');
	quiz11.document.writeln('<td width=\'100\' rowspan=\'3\'><img border=\"0\" width=\"100\" height=\"100\" src=\"'+qus11[i].img+'\">');
	quiz11.document.writeln('</td></tr><tr valign=\"top\" align=\'left\'><td height=\'20\'>');	
	quiz11.document.writeln('<p>b.</td><td><p>' +qus11[i].optionB+ '</td></tr>');
	quiz11.document.writeln('<tr valign=\"top\" align=\'left\'><td height=\'20\'>');
	quiz11.document.writeln('<p>c.</td><td><p>' +qus11[i].optionC+ '<p>');
	
	// Determine if the student answered each question appropriately, and display accordingly
	if (choice11[i] == qus11[i].ans) {
		quiz11.document.writeln('&nbsp;&nbsp;&nbsp;&nbsp;<b><font color=\"GREEN\">You answered this correctly.  Your answer was:\n' +qus11[i].ans+ '.</font></b>\n</td>');
				}		
		else { 
		quiz11.document.writeln('&nbsp;&nbsp;&nbsp;&nbsp;<b><font color=\"RED\">The correct answer is:\n' +qus11[i].ans+ '\n</font></b>'); 
		}

	quiz11.document.writeln('</td></tr><tr><td colspan=\'3\'><hr></td></tr>');
	}
	i++;	
	quiz11.document.writeln('</table>');
	// Add extra info about the ranking, questions, and application
	quiz11.document.writeln('<p>You can always <a href=# onclick=\'window.close(); opener.restart();\'"><B>retake</B></a> another quiz or go back and read the <a href=# onclick=\'window.close(); opener.book();\'">Drive Safe Book.</a></p><p>Remember to hit refresh or reload to get a new set of questions.');
	quiz11.document.writeln('</body></html>');
	quiz11.document.close();
	}
	
	
var qus11 = new Array();
qus11[0] =new quizeleven	("1","What is the speed limit in built-up areas where there are no speed limit signs? ","60km/h.","50km/h.","80km/h.","b","img/trans.gif","Q106 Speed")

qus11[1] =new quizeleven	("2","What should you do when a driver is indicating to overtake you?","Speed up if you are travelling under the speed limit.","Move as far to the left as possible and do not increase your speed.","Signal the driver to remain behind you if you think he or she is travelling too fast.","b","img/trans.gif","Q38 Position")

qus11[2] =new quizeleven	("3","Which vehicle must give way?","Neither vehicle has to give way.","Vehicle X.","Vehicle Y.","c","img/Q75.gif","Q75 ROW(2)")

qus11[3] =new quizeleven	("4","When approaching a STOP sign that has no line marked on the road, where must you stop?","Next to the STOP sign.","As close to the crossroad as possible without entering it.","Before the STOP sign.","b","img/trans.gif","Q101 Signs & Parking")

qus11[4] =new quizeleven	("5","Does a police officer directing traffic over-rule traffic signs and traffic lights?","No.","Yes, if it is daylight.","Yes.","c","img/trans.gif","Q27 Intersections")

qus11[5] =new quizeleven	("6","Are people over 65 years of age required to wear a seat belt?","No, if they are passengers.","Yes.","No, if they are driving.","b","img/trans.gif","Q55	Restraints ")

qus11[6] =new quizeleven	("7","Which vehicle must give way?","Vehicle X.","Vehicle Y.","Neither vehicle has to give way.","a","img/Q62.gif","Q62 ROW(1)")

qus11[7] =new quizeleven	("8","What is the minimum distance a vehicle is allowed to park after a bus stop or pedestrian crossing?","3 metres.","6 metres.","10 metres.","c","img/trans.gif","Q90 Signs & Parking")

qus11[8] =new quizeleven	("9","What must you do before pulling out from a parked position at a kerb?","Sound your horn.","Check your mirror, blind spot and indicate for at least 5 seconds prior to pulling out.","Adjust your passenger-side external mirror.","b","img/trans.gif","Q117 Stop & Indicate")

qus11[9] =new quizeleven	("10","On a two-way road with no lanes marked, what position must your vehicle be before making a right-hand turn?","Over the centre of the road.","As close to the left-hand side of the road as possible.","To the left of, the centre of the road.","c","img/trans.gif","Q53 Position")

qus11[10] =new quizeleven	("11","What should you do to improve safety when travelling in heavy rain? ","Use your headlights and watch out for pedestrains, cyclists and other hazards.","	Turn on your radio to block out the sound of the rain.","Drive the same as you would in dry weather conditions.","a","img/trans.gif","Q133 Vehicle")

qus11[11] =new quizeleven	("12","In which order should the vehicles proceed?","Vehicle X, then Y, then Z.","Vehicle Z, then Y, then X.","Vehicle X, then Z, then Y.","b","img/Q69.gif","Q69 ROW(1)")


qus11[12] =new quizeleven	("13","Is it an offence to refuse a breath test for alcohol?","No, providing you have a doctor's certificate.","Yes.","No.","b","img/trans.gif","Q5 Alcohol")

qus11[13] =new quizeleven	("14","If you are turning at traffic lights and pedestrians are crossing the road, what must you do?","Give way to pedestrians crossing the road.","Go if you are turning with a green arrow.","Ease your way through the pedestrians.","a","img/trans.gif","Q147 Vulnerable Road Users"	)

qus11[14] =new quizeleven	("15","What should you do if an injured person is not breathing?","Tilt person’s head back to open the airway and start mouth-to-mouth resuscitation.","Place person in the coma position.","Turn person onto their back, lift jaw and tilt head back to open airway; give 2 effective breaths, if no signs of life begin cardio-pulmonary resuscitation (CPR).","c","img/trans.gif","Q20 Emergency")

qus11[15] =new quizeleven	("16","Which vehicle must give way?","Neither vehicle has to give way.","Vehicle X.","Vehicle Y.","b","img/Q78.gif","Q78 ROW(2)")

qus11[16] =new quizeleven	("17","Which of the following statements is correct?","Passengers in vehicles are less likely to be injured in a crash if they are wearing seat belts.","The nature of injuries in motor vehicle crashes is not related to the wearing of seat belts.","Passengers in rear seats of a vehicle are not required to wear seat belts.","a","img/trans.gif","Q60 Restraints")

qus11[17] =new quizeleven	("18","How should you apply your brakes when driving in wet weather?","Heavily, to dry the brakes out.","Carefully, to avoid skidding.","Sharply, so that you can grip the road.","b","img/trans.gif","Q134 Vehicle")

qus11[18] =new quizeleven	("19","Which of the following statements is correct?","Alcohol has no effect on your driving ability.","Alcohol makes you react faster to hazards.","Alcohol makes you react more slowly to hazards.","c","img/trans.gif","Q3 Alcohol")

qus11[19] =new quizeleven	("20","Which of the following statements is correct?","Vehicle X may overtake Y.","Vehicle X must not overtake Y.","Vehicle X may overtake Y, only in a 60km/h area.","b","img/Q43.gif","Q43 Position")

qus11[20] =new quizeleven	("21","For how long must you indicate before you overtake a vehicle?","Long enough to give other road users sufficient warning of your intention.","At least 10 metres.","At least 100 metres.","a","img/trans.gif","Q119 Stop & Indicate")

qus11[21] =new quizeleven	("22","What is the maximum speed learner drivers (L-plates) are allowed to travel?","110km/h.","90km/h.","100km/h.","c","img/trans.gif","Q108 Speed")

qus11[22] =new quizeleven	("23","At a railway crossing, are you allowed to cross if the train has passed, but the lights are still flashing?","Yes.","No.","Yes, unless the crossing has boom gates.","b","img/trans.gif","Q23 Intersections")

qus11[23] =new quizeleven	("24","Who must give way?","The pedestrian X.","Vehicle Y.","Neither has to give way.","b","img/Q145.gif","Q145 Vulnerable Road Users")

qus11[24] =new quizeleven	("25","Which vehicle must give way?","Neither vehicle has to give way.","Vehicle Y.","Vehicle X.","b","img/Q81.gif","Q81 ROW(2)")

qus11[25] =new quizeleven	("26","If you are turning right at traffic lights and the light is green (as shown in the diagram), what should you do?","Turn only if you can do so without interfering with other traffic.","Wait until the light changes to red and then turn quickly.","Do not move until the light changes to yellow and then turn quickly.","a","img/Q31.gif","Q31 Intersections")

qus11[26] =new quizeleven	("27","What is the meaning of this sign?","Caution, you are approaching a one-way street.","Caution, you are approaching a '\T'\ junction.","Caution, no through road.","b","img/Q104.gif","Q104 Signs & Parking")

qus11[27] =new quizeleven	("28","What is the legal blood alcohol concentration (BAC) for drivers with a full licence?","Less than 0.02%.","Less than 0.05%.","Less than 0.08%.","b","img/trans.gif","Q7 Alcohol")

qus11[28] =new quizeleven	("29","Which vehicle must give way?","Neither vehicle has to give way.","Vehicle Y.","Vehicle X.","c","img/Q70.gif","Q70 ROW(1)")

qus11[29] =new quizeleven	("30","Which is the correct path for the vehicle to take when turning right at an intersection?","X is the correct path.","Y is the correct path.","Both paths are correct.","a","img/Q51.gif","Q51 Position")
