function Question (qname,
type,
qstring,
response,
corrects,
explan,
ifcorrect,ifwrong,ifnull,
img)
{this.qname=qname;
this.type=type;
this.qstring=qstring;
this.response=response;
this.corrects=corrects;
this.explan=explan;
this.ifcorrect=ifcorrect;
this.ifwrong=ifwrong;
this.ifnull=ifnull;
this.img=img;
}

resp=""
corr="45"
quest001 = new Question(
"Question 1",
3,
"<font face=\"Times New Roman\" size=3>72-27</font>",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="682"
quest002 = new Question(
"Question 2",
3,
"11 x 62",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="18"
quest003 = new Question(
"Question 3",
3,
"(36<img src=\"wbqst3_1.PNG\" align=\"middle\" width=13 height=13 border=0>3) + 6",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="2144"
quest004 = new Question(
"Question 4",
3,
"32 x 67",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="77"
quest005 = new Question(
"Question 5",
3,
"216 - 139",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="4"
quest006 = new Question(
"Question 6",
3,
"36 <img src=\"wbqst6_1.PNG\" width=12 height=8 border=0>(4 + 5)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="8729"
quest007 = new Question(
"Question 7",
3,
"9481 - 752",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="25900"
quest008 = new Question(
"Question 8",
3,
"370 x 70",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="200"
quest009 = new Question(
"Question 9",
3,
"A rugby stadium holds 36,000 spectators. The ratio of police to spectators is to be 1:180. How many police officers will be needed? (Enter number only!)",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("5 Hours 45 Minutes","6 Hours 30 Minutes","6 Hours 45 Minutes","6 Hours 15 Minutes")
corr=new Array("0","0","1","0")
quest010 = new Question(
"Question 10",
0,
"Heavy winds during the week resulted in the suspension bridge being closed between the hours of 1345 and 1630 on Tuesday, 1005 and 1150 on Thursday, 0800 and 1015 on Friday. For how long (in hours and minutes) was the bridge closed altogether?",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="£8336.75"
quest011 = new Question(
"Question 11",
3,
"An incubator for the hospital costs £20,000. One fund raising group has raised £6,425.50 and another has raised £5,237.75 towards the cost of the equipment. How much more money has still to be raised?&nbsp; (Enter like £0000.00 )",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="5"
quest012 = new Question(
"Question 12",
3,
"A car travels a distance of 240 miles. For the first 10 miles and the last 20 miles it is travelling through built up areas and can only travel at an average speed of 20 miles per hour. For the rest of the journey it averages 60 miles per hour. How long does the journey take?&nbsp; (Enter number of hours only!)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="£7.18"
quest013 = new Question(
"Question 13",
3,
"In the local photo printing shop, it costs £3.99 to have a 36 exposure film developed. A special offer entitles you to 10% off if you have two films developed. How much would you pay to have two 36 exposure films developed?&nbsp; (Enter like &quot;£0.00&quot;)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="22.5"
quest014 = new Question(
"Question 14",
3,
"Loch Tay measures 9cm long on a road map where 4cm represents 10 kilometres. How long is Loch Tay? (1 kilometre = 100,000 cm)&nbsp; (Enter number only!).",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="50"
quest015 = new Question(
"Question 15",
3,
"During a march to demonstrate against unemployment, 16,000 people are expected in the city centre. The ratio of police to marchers is to be 1:320. How many police will be needed?&nbsp; (Enter number only!)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="6.50 am"
quest016 = new Question(
"Question 16",
3,
"Police attended a collision caused by ice on the road at 10.20. The gritter had been along the road three and a half hours previously. At what time (in 12 hour time) has the road been gritted? (Enter like &quot;0.00 am&quot;)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="£3450"
quest017 = new Question(
"Question 17",
3,
"The police forensic section has an equipment budget of £4,000. Staff bought four cameras at a cost of £550.75 each and developing equipment at £1247. How much did they spend? (Enter like &quot;£1234&quot;)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="£550"
quest018 = new Question(
"Question 18",
3,
"How much money is left? (Enter like &quot;£123&quot;)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="59.5"
quest019 = new Question(
"Question 19",
3,
"A cyclist travels at an average speed of 21 miles per hour for three and a half hours. A rambler walks at 4 miles per hour for the same time. How much further does the cyclist travel? (Enter number of miles only, like &quot;12.2&quot;)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="1128"
quest020 = new Question(
"Question 20",
3,
"A packet of breakfast cereal usually contains 940 grams. A special offer pack provides 20% extra for the same price. How much breakfast cereal do you get in the special offer pack? (1,000 grams = 1 kilogram)&nbsp; (Enter figure in grams, like &quot;1234&quot;)",
resp,
corr,
"",
1,
0,
0,
"");

resp=""
corr="165"
quest021 = new Question(
"Question 21",
3,
"The distance from Perth to Oban measures 66cm on the map. 4cm represents 10 kilometres. How far is it from Perth to Oban?&nbsp; (Enter number of kilometres only, like &quot;123&quot;)",
resp,
corr,
"",
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)

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>\n")
document.write("      <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" onmouseover=\"this.className='graybg'\" onmouseout=\"this.className='whitebg'\">\n")
document.write("      <tr height=5>\n")
document.write("        <td colSpan=5></td>\n")
document.write("      </tr>\n")
document.write("      <tr>\n")
document.write("        <td width=\"5%\" rowspan=\"3\"></td>\n")
document.write("        <td width=\"9%\" rowspan=\"3\" valign=\"top\" align=\"center\"><font face=\"Verdana\" size=\"7\" color=\"#C0C0C0\">")
document.write(numord)
document.write("</font></td>\n")
document.write("        <td width=\"1%\" rowspan=\"3\" background=\"s_vline.gif\">&nbsp;</td>\n")
document.write("        <td width=\"80%\" class=\"question\" valign=\"top\">\n")
document.write("         ")
if (questions[quest].img!="") {
document.write("\n")
document.write("         <img border=\"0\" hspace=\"10\" vspace=\"0\" 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("\n")
document.write("        </td>\n")
document.write("        <td width=\"5%\"></td>\n")
document.write("      </tr>\n")
document.write("      <tr height=10>\n")
document.write("        <td width=\"80%\"></td>\n")
document.write("        <td width=\"5%\"></td>\n")
document.write("      </tr>\n")
document.write("      <tr>\n")
document.write("        <td width=\"80%\" class=\"answer\">\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(" <input type="+gadget+" name=\""+myname);
if (type<3) document.write("\" value=\""+i+"\">\n")
else document.write("\" class=\"input\" value=\"\">\n")
if (type<3) document.write(questions[quest].response[i]);
document.write("<br>\n")
document.write("          ")
}
document.write("\n")
document.write("        </td>\n")
document.write("        <td width=\"5%\"></td>\n")
document.write("      </tr>\n")
document.write("      <tr height=5>\n")
document.write("        <td colSpan=5></td>\n")
document.write("      </tr>\n")
document.write("      </table>\n")
document.write("    </td>\n")
document.write("  </tr>\n")
document.write("  <tr height=10>\n")
document.write("    <td>&nbsp;</td>\n")
document.write("  </tr>\n")
document.write("  ")
}
function doTest() {
var count, i;

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) winr.document.write("<H3>You have made the following errors</H3>");
++errori;
winr.document.write("<p><b>"+uno+"</b><br>"+due+"<br>"+tre+"</p>");
}
function correct(wapf)
{
var i, ii, t, re, tmp, selection, multi, type, isnull, iswrong, iscorrect, evaluation=0, total=0, udat;
errori=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>";}}
winr=window.open('','wapres', 'titlebar=1,location=0,directories=0,menubar=1,toolbar=0,scrollbars=1,resizable=1,status=1')
winr.document.write("<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>")
now= new Date()
winr.document.write("<small><p>"+fill((now.getMonth()+1),2)+"/"+fill(now.getDate(),2)+"/"+now.getYear()+"&nbsp;&nbsp;"+fill(now.getHours(),2)+":"+fill(now.getMinutes(),2)+"</p>")
if (udat.length>0) {
winr.document.write("<b>Information</b><br>\n");
for (i=0; i<udat.length; i++) winr.document.write(udat[i]);}

for (i=0; i<questions.length; i++) {
type=questions[i].type;
if (type==1) multi=1;
else multi=0;
isnull=true;
iscorrect=false;iswrong=false;
selection=0;
evaluation=0;
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 (isnull) isnull=false;
if (questions[i].corrects[selection]=="1") iscorrect=(iswrong==false)?true:false;
else {
iswrong=true;
if (multi) errore(questions[i].qname,"The checkbox  <i>"+questions[i].response[selection]+"</i>  shouldn't have been selected.",questions[i].explan)
}} else {
if (questions[i].corrects[selection]=="1") {
iswrong=true;
if (multi) 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;
}}}
errore(questions[i].qname,"The right answer was <i>"+okresp+".</i>",questions[i].explan);
}
if (isnull) evaluation+=questions[i].ifnull;
else if (iswrong) evaluation+=questions[i].ifwrong;
else if (iscorrect) evaluation+=questions[i].ifcorrect;
total+=evaluation;}
if (errori) {var voc=(errori==1)?"":"s";winr.document.write("<br><b>You have made "+errori+" error"+voc+".</b>");}
else winr.document.write("<h3>Congratulations, you haven't made any errors</h3>")
{var voc=(total==1)?"":"s";winr.document.write("<br><b>Total score: "+total+" point"+voc+".</b><br>");}

winr.document.write("</small><hr noshade><center><form>")
printest=(((navigator.appName=='Netscape') && (navigator.appVersion.charAt(0)>='4')) || (navigator.appVersion.lastIndexOf('MSIE 5') !=-1))? 'print()': 'javascript:window.print()'
winr.document.write("<input type='button' value='Print...' onClick='"+printest+"'>&nbsp;&nbsp;&nbsp;&nbsp;")
winr.document.write("<input type='button' value='Close' onClick='window.close()'></form></center>")
winr.document.write(aknw)
winr.document.close()
if (navigator.appVersion.lastIndexOf('MSIE 3') == -1) nomsie3=true
else nomsie3=false
if (nomsie3) winr.focus()
}
aknw="<br><p align='center'><small><small>Copyright of <a title='Visit www.police-information.co.uk' href='http://www.police-information.co.uk' target = '_blank'>www.police-information.co.uk.   2003. All Rights Reserved.</a></small></small></p>"
