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("Accelerate hard","Maintain your speed","Be ready to stop","Brake hard")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest001 = new Question(
"Question 1",
0,
"You are approaching traffic lights that have been on green for sometime. You should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Sound the horn","Use the mirrors","Select a higher gear","Flash your headlights")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest002 = new Question(
"Question 2",
0,
"Which of the following should you do before stopping?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Restrict your view","Improve your driving","Distract your attention","Help your concentration")
corr=new Array("1","0","1","0")
comm=""
valu=""
quest003 = new Question(
"Question 3",
1,
"Objects hanging from your interior mirror may<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Receiving a call","Suitably parked","Driving at less than 30 mph","Driving an automatic vehicle")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest004 = new Question(
"Question 4",
0,
"You should only use a mobile phone when<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Look round before you move off","Use all the mirrors on the vehicle","Look round after moving off","Use the exterior mirror only","Give a signal if necessary","Give a signal after moving off")
corr=new Array("1","1","0","0","1","0")
comm=""
valu=""
quest005 = new Question(
"Question 5",
1,
"When you are moving off from behind a parked car you should<br><br>Mark three answers",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("There may be another vehicle coming","They may not be looking","It is safer for you to carry on","They may not be ready to cross")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest006 = new Question(
"Question 6",
0,
"You should never wave people across at pedestrian crossings because<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Motorway maintenance","Bomb disposal","Blood transfusion","Police patrol","Breakdown recovery")
corr=new Array("0","1","1","1","0")
comm=""
valu=""
quest007 = new Question(
"Question 7",
1,
"Which of the following vehicles will use blue flashing beacons?<br><br>Mark three answers.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Speed up","Slow down","Hold you speed","Change direction")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest008 = new Question(
"Question 8",
0,
"A long, heavily laden lorry is taking a long time to overtake you. What should you do?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("They use diesel power","They use quieter roads","They use electric power","They do not operate during rush hour")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest009 = new Question(
"Question 9",
0,
"Supertrams or Light Rapid Transit (LRT) systems are environmentally friendly because<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Under-inflated","Of different makes","Over-inflated","New and hardly used")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest010 = new Question(
"Question 10",
0,
"You will use more fuel if your tyres are <br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Left with parking lights on","Left with no lights on","Right with parking lights on","Right with dipped headlights on")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest011 = new Question(
"Question 11",
0,
"You are parking on a two-way road at night. The speed limit is 40 mph. You should park on the<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Your journey will take longer","You will have a more pleasant journey","You will cause more pollution","Your stress levels will be greater")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest012 = new Question(
"Question 12",
0,
"Planning your journey to avoid busy times has a number of advantages. One of these is<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Reduced pollution","Increased fuel consumption","Reduced exhaust emissions","Increased road safety")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest013 = new Question(
"Question 13",
0,
"Rapid acceleration and heavy braking can lead to<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Using the brakes","Making a hill start","Turning into a narrow road","Passing pedal cyclists")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest014 = new Question(
"Question 14",
0,
"In windy conditions you need to take extra car when<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("On a narrow country lane","On an open stretch of road","On a busy stretch of road","On a long, straight road")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest015 = new Question(
"Question 15",
0,
"Where are you most likely to be affected by a side wind?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("53 metres (175 feet)","60 metres (197 feet)","73 metres (240 feet)","96 metres (315 feet)")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest016 = new Question(
"Question 16",
0,
"In good conditions, what is the typical stopping distance at 70 mph?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("The lowest gear you can","The highest gear you can","A high engine speed","The handbrake and footbrake together")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest017 = new Question(
"Question 17",
0,
"You are trying to move off on snow. You should use<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Slow down before you reach the bend","Gently apply your handbrake","Firmly use your footbrake","Coast into the bend","Avoid sudden steering movements")
corr=new Array("1","0","0","0","1")
comm=""
valu=""
quest018 = new Question(
"Question 18",
1,
"You are driving in freezing conditions. What should you do when approaching a sharp bend?<br><br>Mark two answers.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Obtain car insurance","Understand road signs","React very quickly","Give signals correctly")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest019 = new Question(
"Question 19",
0,
"An elderly person's driving ability could be affected because they may be unable to<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Brake and stop only for large vehicles","Brake sharply to a stop before looking","Be prepared to brake sharply to a stop","Be prepared to stop for any traffic")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest020 = new Question(
"Question 20",
0,
"You are approaching a crossroads. The traffic lights have failed. What should you do?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("They give a wider field of vision","They totally cover blind spots","They make it easier to judge the speed of following traffic","They make following traffic look bigger")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest021 = new Question(
"Question 21",
0,
"Why are mirrors often slightly curved (convex)?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("To restrict the flow of traffic","To warn you of oncoming traffic","To enable you to change lanes early","To prevent you changing lanes")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest022 = new Question(
"Question 22",
0,
"Why are place names printed on the road surface?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Traffic in both directions can use the middle lane to overtake","Traffic can travel faster in poor weather conditions","Traffic can overtake on the left","Traffic uses the middle lane for emergencies only")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest023 = new Question(
"Question 23",
0,
"Some two-way roads are divided into three lanes. Why are these particularly dangerous?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("An ambulance","A fire engine","A doctor on call","A disabled person's vehicle")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest024 = new Question(
"Question 24",
0,
"You are on a dual carriageway. Ahead you see a vehicle with an amber flashing light. What could this be?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Moped riders can use it","A traffic warden controls it","Two flashing lights control it","Cyclists can use it")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest025 = new Question(
"Question 25",
0,
"A toucan crossing is different from other crossings because<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Near the brow of a hill","In a lay-by","Where the kerb is raised","Where the kerb has been lowered for wheelchairs","At or near a bus stop")
corr=new Array("1","0","0","1","1")
comm=""
valu=""
quest026 = new Question(
"Question 26",
1,
"In which THREE places would parking cause an obstruction to others?",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Opposite another parked vehicle","In a quiet road","Opposite a traffic island","In a secure car park")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest027 = new Question(
"Question 27",
0,
"You are away from home and have to park your vehicle overnight. Where should you leave it?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Make you more comfortable","Help you to avoid neck injury","Help you to relax","Help you to maintain your driving position")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest028 = new Question(
"Question 28",
0,
"The most important reason for having a properly adjusted head restraint is to<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Park in an unlit area","Hide the radio with a blanket","Park near a busy junction","Install a security-coded radio")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest029 = new Question(
"Question 29",
0,
"How can you help to prevent your car radio from being stolen?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Park near a police station","Put them under the driver's seat","Lock then out of sight","Park in an unlit side road")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest030 = new Question(
"Question 30",
0,
"You are parking your car. You have some valuables, which you are unable to take with you. What should you do?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Aerial","Windows","Bumper","Lights","Mirrors","Number plates")
corr=new Array("0","1","0","1","1","1")
comm=""
valu=""
quest031 = new Question(
"Question 31",
1,
"Before starting a journey in freezing weather you should clear ice and snow from your vehicle's<br><br>Mark four answers.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Stop and check the tyres","Stop and dry the brakes","Check your exhaust","Test your brakes")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest032 = new Question(
"Question 32",
0,
"You have driven through a flood. What is the first thing you should do?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Stop and take a break","Shout abusive language","Gesture to them with your hand","Follow their car, flashing your headlights")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest033 = new Question(
"Question 33",
0,
"A driver's behaviour has upset you. It may help if you<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Travel at a reduced speed","Always travel at the speed limit","Position in the centre of the road","Only slow down if pedestrians are near")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest034 = new Question(
"Question 34",
0,
"In areas where there are 'traffic calming' measures you should<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Looking for traffic behind you","Reflections of traffic in shop windows","Making eye contact with other road users","Checking for traffic in your interior mirror")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest035 = new Question(
"Question 35",
0,
"You are waiting to emerge at a junction. Parked vehicles restrict your view. What can help you to see traffic on the road you are joining?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Inform your local police station","Avoid using motorways","Always drive accompanied","Inform the licensing authority")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest036 = new Question(
"Question 36",
0,
"After passing your driving test, you suffer from ill health. This affects your driving. You MUST<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("One-way street","Pedestrians","Traffic congestion","Parked vehicles")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest037 = new Question(
"Question 37",
0,
"You are turning left into a side road. What hazards should you be especially aware of?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Overtaking you on the left","Following you closely","Emerging from the side road","Overtaking on your right")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest038 = new Question(
"Question 38",
0,
"You intend to turn right into a side road. Just before turning you should check for motorcyclists who might be<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Physically disabled","Deaf only","Blind only","Deaf and blind")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest039 = new Question(
"Question 39",
0,
"You see a pedestrian with a white stick and red band. This means that the person is<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("To give acceleration space to overtake quickly on blind spots","To get the best view of the road ahead","To leave a gap in case the vehicle stops and rolls back","To offer other drivers a safe gap if they want to overtake you")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest040 = new Question(
"Question 40",
0,
"Before overtaking a large vehicle you should keep well back. Why is this?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Cyclists","Motorcyclists","High-sided vehicles","Cars")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest041 = new Question(
"Question 41",
0,
"Which of these is LEAST likely to be affected by crosswinds?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("8 mph (12 km/h)","18 mph (29 km/h)","28 mph (45 km/h)","38 mph (61 km/h)")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest042 = new Question(
"Question 42",
0,
"In front of you is a class 3 powered vehicle (powered wheeled) driven by a disabled person. These vehicles have a maximum speed of<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Overtake the motorcyclist immediately","Keep well back","Stay level with the motorcyclist","Keep close to the motorcyclist")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest043 = new Question(
"Question 43",
0,
"It is very windy. You are behind a motorcyclist who is overtaking a high-sided vehicle. What should you do?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Use only your sidelights","Always use your headlights","Always use your rear fog lights","Use your headlights only in bad weather")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest044 = new Question(
"Question 44",
0,
"You are on a well-lit motorway at night. You must<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("By changing to a lower gear","By selecting reverse gear","By changing to a higher gear","By selecting neutral")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest045 = new Question(
"Question 45",
0,
"How can you use the engine of your vehicle to control your speed?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Fuel spillage will occur","Engine damage may be caused","You will have less steering and braking control","It will wear tyres out more quickly")
corr=new Array("0","0","1","0")
comm=""
valu=""
quest046 = new Question(
"Question 46",
0,
"Why could keeping the clutch down or selecting neutral for long periods of time be dangerous?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Prevent overtaking","Reduce rest stops","Prevent tailgating","Reduce congestion")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest047 = new Question(
"Question 47",
0,
"The aim of an Active Traffic Management scheme on a motorway is to<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Variable speed limits","Contraflow systems","National speed limits","Lane closures")
corr=new Array("1","0","0","0")
comm=""
valu=""
quest048 = new Question(
"Question 48",
0,
"On a motorway what is used to reduce traffic bunching?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("Emergency vehicles emerging","Buses pulling out","Trams crossing in front","Cyclists riding across")
corr=new Array("0","0","0","1")
comm=""
valu=""
quest049 = new Question(
"Question 49",
0,
"At toucan crossings, apart from pedestrians you should be aware of&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
0,
0,
"");

resp=new Array("20 mph","30 mph","40 mph","50 mph")
corr=new Array("0","1","0","0")
comm=""
valu=""
quest050 = new Question(
"Question 50",
0,
"You are on a road that has no traffic signs. There are streetlights. What is the speed limit?<br><br>Mark one answer.",
resp,
comm,
corr,
"",
valu,
1,
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>Theory Test 02</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)}}
