function Question (qname,
type,
qstring,
response,
comment,
corrects,
explan,
score,
ifcorrect,ifwrong,ifnull,
img)
{this.qname=qname;
this.type=type;
this.qstring=qstring;
this.response=response;
this.comment=comment;
this.corrects=corrects;
this.explan=explan;
this.score=score;
this.ifcorrect=ifcorrect;
this.ifwrong=ifwrong;
this.ifnull=ifnull;
this.img=img;
}

var zin=1,top=0, mycount=0, waitTime=3420, qright=0, mycomment;
var global=new Array(3);
var recent, recent2, recdone=false, opera7, opera=CheckOpera56();
function cachewrite(s,idx){global[idx]+=s;}
function CheckOpera56()
{
var version;
if (navigator.userAgent.toLowerCase().indexOf('opera') == -1) return false;
version=parseInt(navigator.appVersion.toLowerCase());
if (version>6) {opera7=true; return false;}
if (version<5) return false;
return true;
}
resp=new Array("Give an arm signal as well as using your indicators","Signal so that other drivers can slow down for you","Look over your shoulder for a final check","Select a higher gear than normal")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest001 = new Question(
"Question 1",
0,
"Before you make a U-turn in the road, you should<br><br>Mark one answer",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Just after a bend","In a one-way street","On a 30 mph road","Approaching a dip in the road")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest002 = new Question(
"Question 2",
0,
"In which of these situations should you avoid overtaking?<br><br>Mark one answer",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Stop immediately","Answer it immediately","Pull up in a suitable place","Pull up at the nearest curb")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest003 = new Question(
"Question 3",
0,
"Your mobile phone rings while you are travelling. You should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Loud music","Arguing with a passenger","Using a mobile phone","Putting in a cassette tape","Stopping to regularly to rest","Pulling up to tune the radio")
corr=new Array("1","1","1","1","0","0")
comm=""
valu=""
quest004 = new Question(
"Question 4",
1,
"Which of the following may cause loss of concentration on a long journey?<br><br>Mark four answers.",
resp,
comm,
corr,
"",
valu,
0,
0,
0,
"");

resp=new Array("Stop and wait for the green light","Stop and wait for the red light","Give way to pedestrians waiting to cross","Give way to pedestrians already on the crossing")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest005 = new Question(
"Question 5",
0,
"At a pelican crossing the flashing amber light means you MUST<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Using the rear door of a hatchback car","Reversing into a parking space","Following another vehicle too closely","Driving with rear fog lights on")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest006 = new Question(
"Question 6",
0,
"'Tailgating' means<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("One second","Two seconds","Three seconds","Four seconds")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest007 = new Question(
"Question 7",
0,
"You are following a vehicle on a wet road. You should leave a time gap of at least<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("To be seen when driving at high speed","To use if broken down in a dangerous position","To make them more visible in thick fog","To warn drivers following closely to drop back")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest008 = new Question(
"Question 8",
0,
"Why are vehicles fitted with rear fog lights?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("In the right-hand lane","In the left-hand lane","In either lane, depending on the traffic","Just left of the centre line")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest009 = new Question(
"Question 9",
0,
"You are in a one-way street and want to turn right. You should position yourself<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Toucan","Puffin","Pelican","Zebra")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest010 = new Question(
"Question 10",
0,
"At which type of crossing are cyclists allowed to ride across with pedestrians?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Give way to pedestrians who are crossing","Encourage pedestrians to cross","Not move until the green light appears","Stop even if the crossing is clear")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest011 = new Question(
"Question 11",
0,
"You are approaching a pelican crossing. The amber light is flashing. You must<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Increase your speed","Sound your horn","Flash your headlights","Drive slowly past","Give plenty of room","Rev your engine")
corr=new Array("0","0","0","1","1","0")
comm=""
valu=""
quest012 = new Question(
"Question 12",
1,
"You are driving along a country road. A horse and rider are approaching. What should you do?<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Be patient and wait","Sound your horn","Carry on","Wave then to cross")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest013 = new Question(
"Question 13",
0,
"You stop for pedestrians waiting to cross at a zebra crossing. They do not start to cross. What should you do?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Braking","Steering","Changing gear","Parking")
corr=new Array("1","1","0","0")
comm=""
valu=""
quest014 = new Question(
"Question 14",
1,
"Which TWO are badly affected if the tyres are under-inflated?<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
0,
0,
0,
"");

resp=new Array("Between 10 pm and 6 am in a built-up area","At any time in a built-up area","Between 11.30 pm and 7 am in a built-up area","Between 11.30 pm and 6 am on any road")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest015 = new Question(
"Question 15",
0,
"You must NOT sound your horn<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Engines produce more power","Exhaust systems easier to replace","Engines run quietly","Exhaust fumes cleaner")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest016 = new Question(
"Question 16",
0,
"Catalytic converters are fitted to make the<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Always at major road works","Used to increase traffic speed","At toll-bridge approaches only","Traffic calming measures")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest017 = new Question(
"Question 17",
0,
"Road humps, chicanes, and road narrowings are<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Take it to a local authority site","Put it in the dustbin","Break it into pieces","Leave it on wasteland","Take it to a garage","Burn it in a fire")
corr=new Array("1","0","0","0","1","0")
comm=""
valu=""
quest018 = new Question(
"Question 18",
1,
"How should you dispose of a used battery?<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Poor steering control","Accelerating around bends","Staying in high gears","Harsh braking and accelerating")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest019 = new Question(
"Question 19",
0,
"What is the most likely cause of high fuel consumption?<br><br>Mark one answer?",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Battery acid","Distilled water","Engine oil","Engine coolant")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest020 = new Question(
"Question 20",
0,
"The fluid level in your battery is low. What should you top it up with?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Look at a map","Contact your local garage","Look in your vehicle handbook","Check your vehicle registration document")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest021 = new Question(
"Question 21",
0,
"Before starting a journey it is wise to plan your route. How can you do this?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("10%","20%","30%","40%")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest022 = new Question(
"Question 22",
0,
"What percentage of all emissions does road transport account for?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Twice the normal distance","Give times the normal distance","Seven times the normal distance","Ten times the normal distance")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest023 = new Question(
"Question 23",
0,
"Braking distances on ice can be<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Two times","Three times","Five times","Ten times")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest024 = new Question(
"Question 24",
0,
"Freezing conditions will affect the distance it takes you to come to a stop. You should expect stopping distances to increase by up to<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("The suspension","The grip of the tyres","The braking","The exhaust")
corr=new Array("0","1","1","0")
comm=""
valu=""
quest025 = new Question(
"Question 25",
1,
"On very hot weather the road surface can become soft. Which TWO of the following will be most affected?<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
0,
0,
0,
"");

resp=new Array("Pass close","Pass quickly","Pass wide","Pass immediately")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest026 = new Question(
"Question 26",
0,
"What should you do when overtaking a motorcyclist in strong winds?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Reduce speed in good time","Switch lanes at any time to make progress","Choose an appropriate lane in good time","Keep the correct separation distance","Increase speed to pass through quickly","Follow other motorists closely to avoid long queues")
corr=new Array("1","0","1","1","0","0")
comm=""
valu=""
quest027 = new Question(
"Question 27",
1,
"To avoid a collision when entering a contraflow system, you should<br><br>Mark three answers.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Worn tyres","Driver error","Other vehicles","Pedestrians")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest028 = new Question(
"Question 28",
0,
"What is the most common cause of skidding?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Drive at a slow speed in as high gear as possible","Use the handbrake if the wheels start to slip","Brake gently and repeatedly","Drive in a low gear at all times")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest029 = new Question(
"Question 29",
0,
"You are driving on an icy road. How can you avoid wheelspin?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Brake firmly and not turn the steering wheel","Steer carefully to the left","Steer carefully to the right","Brake firmly and steer to the left")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest030 = new Question(
"Question 30",
0,
"You are turning left on a slippery road. The back of your vehicle slides to the right. You should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Brake firmly and quickly","Be ready to steer sharply","Use sidelights only","Brake gently in plenty of time")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest031 = new Question(
"Question 31",
0,
"When driving in falling snow you should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Turn the steering wheel towards the kerb","Park close to the bumper of another car","Park with two wheels on the kerb","Put the handbrake on firmly","Turn the steering wheel away from the kerb")
corr=new Array("1","0","0","1","0")
comm=""
valu=""
quest032 = new Question(
"Question 32",
1,
"You wish to park facing DOWNHILL. Which TWO of the following should you do?<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
0,
0,
0,
"");

resp=new Array("Aquaplane","Skid","Puncture","Wear")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest033 = new Question(
"Question 33",
0,
"Anti-lock brakes prevent wheels from locking. This means the tyres are less likely to<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Yes, you should plan to stop every half hour","Yes, regular stops help concentration","No, you will be less tired if you get there as soon as possible","No, only fuel stops will be needed")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest034 = new Question(
"Question 34",
0,
"You are planning a long journey. Do you need to plan rest stops?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Try not to react","Let them know how you feel","Flash your headlights several times","Sound your horn")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest035 = new Question(
"Question 35",
0,
"A driver does something that upsets you. You should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Overtake after checking your mirrors and signalling","Stay behind until you are past the junction","Accelerate quickly to pass before the junction","Slow down and prepare to overtake on the left")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest036 = new Question(
"Question 36",
0,
"You are following a slow-moving vehicle on a narrow country road. There is a junction just ahead on the right. What should you do?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Flash your lights to alert the driver","Sound your horn before overtaking","Overtake on the left if there is room","Stay behind and not overtake")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest037 = new Question(
"Question 37",
0,
"You think the driver in the vehicle in front has forgotten to cancel their right indicator. You should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("They need to listen for following traffic","Motorcycles do not have mirrors","Look around helps them balance as they turn","They need to check for traffic in their blind area")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest038 = new Question(
"Question 38",
0,
"Motorcyclists will often look round over their right shoulder just before turning right. This is because<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Ease off the accelerator and reduce your speed","Let go of the steering wheel and let it correct itself","Brake hard and hold the pedal down","Increase your speed as quickly as possible")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest039 = new Question(
"Question 39",
0,
"If a trailer swerves or snakes when you are towing it you should <br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("When moving off","On dual carriageways","When approaching junctions","On motorways")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest040 = new Question(
"Question 40",
0,
"Motorcyclists are particularly vulnerable<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Left","Right","Any direction","Straight ahead")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest041 = new Question(
"Question 41",
0,
"You are approaching two cyclists. They approach a roundabout in the left-hand lane. In which direction should you expect the cyclists to go?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("The large vehicle can easily hide an overtaking vehicle","The large vehicle can turn suddenly","The large vehicle is difficult to steer in a straight line","The large vehicle can easily hide vehicles from the left")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest042 = new Question(
"Question 42",
0,
"You are waiting to emerge left from a minor road. A large vehicle is approaching from the right. You have time to turn, but you should wait. Why?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("The brakes do not work as well","You will be dazzled by oncoming headlights","The engine will take longer to warm up","It is more difficult to see events ahead")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest043 = new Question(
"Question 43",
0,
"Why should you always reduce your speed when travelling in fog?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Go back to the main road","Do an emergency stop","Stop at a passing place","Put on your hazard warning lights")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest044 = new Question(
"Question 44",
0,
"You see a vehicle coming towards you on a single-track road. You should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Left","Right","Centre","Either the right or centre")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest045 = new Question(
"Question 45",
0,
"On a three-lane motorway which lane should you normally use?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("The tyres make a rumbling noise","The tyres make hardly any noise","The steering becomes heavier","The steering becomes lighter")
corr=new Array("0","1","0","1")
comm=""
valu=""
quest046 = new Question(
"Question 46",
1,
"How can you tell if you are driving on ice?<br><br>Mark Two answers.",
resp,
comm,
corr,
"",
valu,
0,
0,
0,
"");

resp=new Array("Three years after the date it was issued","10,000 miles","One year after the date it was issued","30 000 miles")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest047 = new Question(
"Question 47",
0,
"An MOT certificate is normally valid for<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Reassure then constantly","Offer them a cigarette","Keep them warm","Avoid moving them if possible","Avoid leaving them alone","Give them a warm drink")
corr=new Array("1","0","1","1","1","0")
comm=""
valu=""
quest048 = new Question(
"Question 48",
1,
"You are at the scene of an accident. Someone is suffering from shock. You should<br><br>Mark four answers.",
resp,
comm,
corr,
"",
valu,
0,
0,
0,
"");

resp=new Array("Turn the steering wheel slowly to each side","Accelerate to increase your speed","Stop as quickly as you can","Slow down very gradually")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest049 = new Question(
"Question 49",
0,
"How can you stop a caravan snaking from side to side?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Gearbox","Steering","Handling","Battery life","Journey time")
corr=new Array("0","1","1","0","0")
comm=""
valu=""
quest050 = new Question(
"Question 50",
1,
"Overloading your vehicle can seriously affect the<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
0,
0,
0,
"");

questions = new Array (
quest001,quest002,quest003,quest004,quest005,quest006,quest007,quest008,quest009,quest010,quest011,quest012,quest013,quest014,quest015,quest016,quest017,quest018,quest019,quest020,quest021,quest022,quest023,quest024,quest025,quest026,quest027,quest028,quest029,quest030,quest031,quest032,quest033,quest034,quest035,quest036,quest037,quest038,quest039,quest040,quest041,quest042,quest043,quest044,quest045,quest046,quest047,quest048,quest049,quest050)

function doQuestion(quest)
{
var numdo;
var numord=eval(quest+1);
var i=-1, ii, type, myname, gadget;
type=questions[quest].type;
numdo=type>=3?1:questions[quest].response.length;


document.writeln ("<a name=\""+questions[quest].qname+"\"></a>")
document.write("\n")
document.write("    <tr>\n")
document.write("      <td width=\"5%\" align=\"center\" valign=\"top\" bgcolor=\"#E6E6FF\"><font face=\"Verdana\"\n")
document.write("      color=\"#000080\"><strong><small>")
document.write(numord)
document.write("</small></strong></font></td>\n")
document.write("      <td width=\"95%\" valign=\"top\" bgcolor=\"#F4F4FF\"><font face=\"Verdana\"><font color=\"#000080\"><strong><small>\n")
document.write("      ")
if (questions[quest].img!="") {
document.write("\n")
document.write("         <img border=\"0\" hspace=\"10\" vspace=\"5\" align=\"left\" src=\"")
document.write(questions[quest].img)
document.write("\">\n")
document.write("      ")
}
document.write("\n")
document.write("      ")
document.writeln(questions[quest].qstring)
document.write("</small></strong></font><br>\n")
document.write("      <br><small><small>\n")
document.write("      ")
for (i=0; i<numdo; i++) {
myname=questions[quest].qname;
gadget="radio";
if (type>=3) gadget="text";
else if (type==1) {
myname+="_"+(i<9?"0":"")+(i+1);
gadget="checkbox";}
document.write("\n")
document.write("         ")
document.write(type==7?"<textarea name=\""+myname+"\" rows=5 cols=30 class=\"input\">":" <input type="+gadget+" name=\""+myname);
if (type<3) document.write("\" value=\""+i+"\">\n")
else document.write(type==7?"</textarea>":"\" class=\"input\" value=\"\">\n")
if (type<3) document.write(questions[quest].response[i]);
document.write("<br>\n")
document.write("      ")
}
document.write("\n")
document.write("      </small></small></font></td>\n")
document.write("    </tr>\n")
document.write("    ")
}
function doTest() {
var count, i;
questions.sort(myrandom);
for (i=0; i<questions.length; i++) {
questions[i].qname="Question "+(i+1);}
count=questions.length;
for (i=0; i<count; i++) doQuestion(i);
}
function fill(s,l){
s=s+""
for (y=1;y<=l;y++)
if (s.length>=l) break; else s="0"+s;
return s
}
function CheckQName(wapf,ii,i,multi,selection){
var len;
if (!multi) return(wapf.elements[ii].name==questions[i].qname);
len=questions[i].qname.length;
if (wapf.elements[ii].name.substring(0,len)!=questions[i].qname) return false;
if (wapf.elements[ii].name.substring(len,len+1)!="_") return false;
if (eval(wapf.elements[ii].name.substring(len+1,len+3))==(selection+1)) return true;
return false;
}
function errore(uno,due,tre)
{
if (!errori) global[1]="<H3>You have made the following errors</H3>";
++errori;
cachewrite("<p><b>"+uno+"</b><br>"+due+"<br>"+mycomment+tre+"</p>",2);
mycomment="";
}
function testIE5plus(){
var pos=navigator.appVersion.lastIndexOf('MSIE ');
if (pos != -1) {
pos+=5;
if (eval(navigator.appVersion.charAt(pos))>4)
return true;}
return false;}
function correct(wapf)
{
var i, ii, t, re, tmp, selection, multi, multipage=0, type, isnull, iswrong, iscorrect, evaluation=0, total=0, udat;
errori=waitTime=0;
udat=new Array();
for (i=0, ii=0; i<wapf.elements.length; i++)
{tmp=wapf.elements[i];
if (tmp.name.substring(0,13)=="Quiz.UserData"){
t=tmp.name.substring(14,tmp.name.length);
re=new RegExp("_", "g");
t=t.replace(re," ");
udat[ii++]=t+": <i>"+tmp.value+"</i><br>";
if (opera) tmp.value="";}}
global[0]=global[2]="";
global[1]="<h3>Congratulations, you haven't made any errors</h3>";
cachewrite("<html><head><title>Results</title><BASE target='_blank'></head><body bgcolor='#FFFFFF'><font face='Verdana, Arial'><table border=0 cellpadding=0 cellspacing=0 width='100%' bgcolor='#C0C0C0'><tr><td width='100%'><font face='Verdana, Arial' size=5 color='#FFFFFF'><b>&nbsp;Results</b></font></td></tr></table>",0)
now= new Date()
cachewrite("<small><p>"+fill((now.getMonth()+1),2)+"/"+fill(now.getDate(),2)+"/"+now.getYear()+"&nbsp;&nbsp;"+fill(now.getHours(),2)+":"+fill(now.getMinutes(),2)+"</p>",0)
cachewrite("<b>Driving Theory Test 01</b><br><br>\n",0);
if (udat.length>0) {
cachewrite("<b>Information</b><br>\n",0);
for (i=0; i<udat.length; i++) cachewrite(udat[i],0);}
if (opera7 && multipage) {
for (i=0; i<questions.length; i++) {
id=document.getElementById("q"+(i+1));
id2=document.getElementById("q"+(i+1)+"a");
id.style.display=id2.style.display="block";}}

for (i=0; i<questions.length; i++) {
if (opera && multipage) {
id=document.getElementById("q"+(i+1));
id2=document.getElementById("q"+(i+1)+"a");
id.style.visibility=id2.style.visibility="visible";}
type=questions[i].type;
if (type==1) multi=1;
else multi=0;
isnull=true;
iscorrect=false;iswrong=false;
selection=0;
evaluation=0;
mycomment="";
for (ii=0; ii<wapf.elements.length; ii++) {
if (CheckQName(wapf,ii,i,multi,selection)) {
if (type>=3 && wapf.elements[ii].value!="") {
isnull=false;
if (wapf.elements[ii].value.toLowerCase()==questions[i].corrects.toLowerCase()) iscorrect=true;
else iswrong=true;
++selection;}
else if (wapf.elements[ii].checked) {
if (questions[i].score!="") evaluation+=questions[i].score[selection];
if (isnull) isnull=false;
if (questions[i].corrects[selection]=="1") iscorrect=(iswrong==false)?true:false;
else {
iswrong=true;
if (multi && questions[i].corrects!='') errore(questions[i].qname,"The checkbox  <i>"+questions[i].response[selection]+"</i>  shouldn't have been selected.",questions[i].explan)
}
if (questions[i].comment!="" && questions[i].comment[selection]!="")
mycomment+=((iscorrect || questions[i].corrects=='')?"<b>"+questions[i].qname+"</b><br>":"")+"<small>"+questions[i].comment[selection]+"</small><br>";
} else {
if (questions[i].corrects[selection]=="1") {
iswrong=true;
if (multi && questions[i].corrects!='') errore(questions[i].qname,"The checkbox  <i>"+questions[i].response[selection]+"</i>  should have been selected.",questions[i].explan);
}}
++selection;
}}
if (multi==false && (isnull || iswrong)) {
var okresp="", z;
if (type>=3) okresp=questions[i].corrects;
else {
for (z=0; z<questions[i].corrects.length; z++) {
if (questions[i].corrects[z]==1) {
okresp=questions[i].response[z];
break;
}}}
if (okresp!="") errore(questions[i].qname,"The right answer was <i>"+okresp+".</i>",questions[i].explan);
}
if (mycomment!="") cachewrite(mycomment,2);
if (questions[i].corrects!="") ++qright;
if (isnull) evaluation+=questions[i].ifnull;
else if (iswrong) evaluation+=questions[i].ifwrong;
else if (iscorrect) evaluation+=questions[i].ifcorrect;
total+=evaluation;}
if (qright==0) global[1]="<br>";
if (errori) cachewrite("<br><b>You have made "+errori+" "+(errori==1?"error":"errors")+".</b>",2);
cachewrite("<br><b>Total score: "+total+".</b><br>",2);

cachewrite("</small><hr noshade><center><form>",2)
printest=(((navigator.appName=="Netscape") && (navigator.appVersion.charAt(0)>="4")) || (testIE5plus() == true))? "print()": "alert('This button can be used with Netscape Navigator 4 or Microsoft Internet Explorer 5 only. If you want to print with other browsers, please select the Print command in the File menu.')"
cachewrite("<input type='button' value='Print...' onClick='"+printest+"'>&nbsp;&nbsp;&nbsp;&nbsp;",2)
cachewrite("<input type='button' value='Close' onClick='window.close()'></form></center>",2)
cachewrite(aknw,2)
winr=window.open('','wapres', 'titlebar=1,location=0,directories=0,menubar=1,toolbar=0,scrollbars=1,resizable=1,status=1')
for (i=0; i<3; i++) winr.document.write(global[i]);winr.document.close()
if ((opera || opera7) && multipage) {
document.forms[0].elements[0].value='Print...';
document.forms[0].elements[1].value='Close';
for (i=0; i<questions.length-1; i++) {
id=document.getElementById("q"+(i+1));
id2=document.getElementById("q"+(i+1)+"a");
opera?id.style.visibility=id2.style.visibility="hidden":id.style.display=id2.style.display="none";}}
}
aknw="<br><p align='center'><small><small>Created and managed with <a title='Click here to visit WebQuiz site' href='http://www.smartlite.it/go.asp?OLDLP' target = '_blank'>SmartLite WebQuiz</a></small></small></p>"
function myrandom(a,b)
{
var rc;
do {rc=Math.floor(Math.random()*3)-1;} while (rc==2);
return(rc);
}
function update_time(t) {
self.status=t;}
function stms(s){
if (Math.abs(tmMx)>=3600){
h=Math.floor(s/3600);m=Math.floor((s%3600)/60);s=((s%3600)%60);return fill(h,2)+':'+fill(m,2)+':'+fill(s,2);
}else{m=Math.floor(s/60);s=s%60;return fill(m,2)+':'+fill(s,2);}}
function shtm(t){
tmVl=t+1;update_time(stms(Math.abs(t)))
if (waitTime==0) return;
tmId = setTimeout('shtm(tmVl)',1000)
if (t==((tmMx>0)? tmMx : 0)){
clearTimeout(tmId)
alert('Time is over, correcting questionnaire now.')

correct(document.WapForm)}}
function checkTime(){
tmMx=-waitTime;
if (tmMx!=0){
alert('Time to complete your questionnaire is: '+stms(Math.abs(tmMx))+'\n\nPlease check time count.');
shtm((tmMx>0) ? 0 : tmMx)}}
