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;
}

var shown;

resp=new Array("yours","you're","you","your")
corr=new Array("0","0","0","1")
quest001 = new Question(
"Question 1",
0,
"What's _______________ name?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("you are","you","are you","do you")
corr=new Array("0","0","0","1")
quest002 = new Question(
"Question 2",
0,
"Where ___________live?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("you are","are you","you","do you")
corr=new Array("0","0","0","1")
quest003 = new Question(
"Question 3",
0,
"What job _________ do?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("it costs?","is it costing?","costs it?","does it cost?")
corr=new Array("0","0","0","1")
quest004 = new Question(
"Question 4",
0,
"How much ___________<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("You are like","You like","Are you like","Do you like")
corr=new Array("0","0","0","1")
quest005 = new Question(
"Question 5",
0,
"________________ your job?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("is travel","travel","is travelling","travels")
corr=new Array("0","0","0","1")
quest006 = new Question(
"Question 6",
0,
"She _________ to work every day by bus.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("Wear you usually","You usually wear","Are you usually wearing","Do you usually wear")
corr=new Array("0","0","0","1")
quest007 = new Question(
"Question 7",
0,
"__________ a shirt and tie at work?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("Mr Smiths","Mr Smiths'","Mr Smith","Mr Smith's")
corr=new Array("0","0","0","1")
quest008 = new Question(
"Question 8",
0,
"She is __________ secretary.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("are you","were you","you went","did you go")
corr=new Array("0","0","0","1")
quest009 = new Question(
"Question 9",
0,
"Where ____________ on holiday last year.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("are speaking","do speak","speaks","speak")
corr=new Array("0","0","0","1")
quest010 = new Question(
"Question 10",
0,
"How many people ________ English in your company? <br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("you are like","you would like","you like","would you like")
corr=new Array("0","0","0","1")
quest011 = new Question(
"Question 11",
0,
"What _____________ to drink?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("you learn","are you learning","do you learn","have you been learning")
corr=new Array("0","0","0","1")
quest012 = new Question(
"Question 12",
0,
"How long __________ English?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("did you go to","were you in","are you in","have you been to")
corr=new Array("0","0","0","1")
quest013 = new Question(
"Question 13",
0,
"How many times ___________ Warsaw this year?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("the weather is","the weather is like","is the weather","is the weather like")
corr=new Array("0","0","0","1")
quest014 = new Question(
"Question 14",
0,
"What __________ in England?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("you will do","do you be doing","will you be do","are you doing")
corr=new Array("0","0","0","1")
quest015 = new Question(
"Question 15",
0,
"What ________________ tomorrow evening?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("saw her","will see her","have seen her","see her")
corr=new Array("0","0","0","1")
quest016 = new Question(
"Question 16",
0,
"If I _________ I will give her the message.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("am/will","were/will","am/would","were/would")
corr=new Array("0","0","0","1")
quest017 = new Question(
"Question 17",
0,
"If I ____ you, I _______ find a better job.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("wouldn't be","wasn't","won't be","wouldn't have been")
corr=new Array("0","0","0","1")
quest018 = new Question(
"Question 18",
0,
"I ___________ late for work yesterday if I had got up earlier.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("started","had been starting","was starting","had started")
corr=new Array("0","0","0","1")
quest019 = new Question(
"Question 19",
0,
"I was late for the meeting because when I arrived it _____________<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("can","will be","will","would")
corr=new Array("0","0","0","1")
quest020 = new Question(
"Question 20",
0,
"I didn't know that you __________ visit me today.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("does the train leave?","is the train leaving?","leaves the train?","the train leaves?")
corr=new Array("0","0","0","1")
quest021 = new Question(
"Question 21",
0,
"Could you tell me what time _____________ <br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("I have had","I am having","I have","I had")
corr=new Array("0","0","0","1")
quest022 = new Question(
"Question 22",
0,
"I wish ___________ less work to do today.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("will you have work","will you work","will you be working","will you have been working")
corr=new Array("0","0","0","1")
quest023 = new Question(
"Question 23",
0,
"How long ______________ for your company by the year 2010?<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("only","from","since","for")
corr=new Array("0","0","0","1")
quest024 = new Question(
"Question 24",
0,
"I haven't seen him __________ 10 years.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("expand","higher","rise","raise")
corr=new Array("0","0","0","1")
quest025 = new Question(
"Question 25",
0,
"My boss said that he is going to ______________ our pay next year.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("in spite of","because","despite","although")
corr=new Array("0","0","0","1")
quest026 = new Question(
"Question 26",
0,
"He has a full-time job __________ he doesn't have a work permit.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("we talk","we will talk","to talk","we talked")
corr=new Array("0","0","0","1")
quest027 = new Question(
"Question 27",
0,
"I'd rather _________ about it tomorrow.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("to hear","hearing","to be hearing","to hearing")
corr=new Array("0","0","0","1")
quest028 = new Question(
"Question 28",
0,
"I am looking forward ___________ from you.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("who","that","what","which")
corr=new Array("0","0","0","1")
quest029 = new Question(
"Question 29",
0,
"The company is called Siemens, _________ is German.<br><br>",
resp,
corr,
"",
1,
0,
0,
"");

resp=new Array("I got","I am getting","I get","do I get")
corr=new Array("0","0","0","1")
quest030 = new Question(
"Question 30",
0,
"No sooner __________ to work than the telephone starts to ring.<br><br>",
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,quest022,quest023,quest024,quest025,quest026,quest027,quest028,quest029,quest030)

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;
if (type<3) {
respcopy=new Array(numdo);corrcopy=new Array(numdo);
for (i=0; i<numdo; i++) respcopy[i]=questions[quest].response[i];
respcopy.sort(myrandom);
for (i=0; i<numdo; i++) {
for (ii=0; ii<numdo; ii++) {
if (respcopy[i]==questions[quest].response[ii]) {
corrcopy[i]=questions[quest].corrects[ii];break;}}}
questions[quest].response=respcopy;
questions[quest].corrects=corrcopy;}
document.write("\n")
document.write("       <div id=\"q")
document.write(numord)
document.write("\" style=\"display:none\">\n")
document.write("       <table border=\"0\" width=\"100%\" cellspacing=\"4\" cellpadding=\"10\">\n")
document.write("       <tr>\n")
document.write("       <td width=\"5%\" align=\"center\" valign=\"top\" bgcolor=\"steelblue\"><font face=\"Verdana,Arial\"\n")
document.write("      color=\"#ffffff\"><strong><small>")
document.write(numord)
document.write("</small></strong></font></td>\n")
document.write("       <td width=\"95%\" valign=\"top\" bgcolor=\"#ffffff\">\n")
document.write("       ")
if (questions[quest].img!="") {
document.write("\n")
document.write("          <p><img border=\"0\" src=\"")
document.write(questions[quest].img)
document.write("\"></p>\n")
document.write("       ")
}
document.write("\n")
document.write(" <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana,Arial\" color=\"#000080\"><strong><small>")
document.writeln(questions[quest].qstring)
document.write("</small></strong></font></p>\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("          &nbsp;")
document.write(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="+gadget+" name=\""+myname);
if (type<3) document.write("\" value=\""+i+"\">\n")
else document.write("\" class=\"input\" value=\"\">\n")
document.write(" <small><small><font face=\"Verdana,Arial\" color=\"#000000\">")
if (type<3) document.write(questions[quest].response[i]);
document.write("</font></small></small><br>\n")
document.write("       ")
}
document.write("</td>\n")
document.write("       </tr>\n")
document.write("       </table>\n")
document.write("       </div>\n")
document.write("       <div id=\"q")
document.write(numord)
document.write("a\" style=\"display:none\">\n")
document.write("       <p>\n")
document.write("          ")
if (quest<questions.length) {
document.write("\n")
document.write("          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" ")
document.write(" onClick=\"myshow("+(quest+2)+")\"")
document.write(" onmouseout=\"flipImage ('Next")
document.write(numord)
document.write("', 'NextImage_normal');\" onmouseover=\"flipImage ('Next")
document.write(numord)
document.write("', 'NextImage_up');\"><img alt=\"next question\" border=0 height=50 width=78 name=Next")
document.write(numord)
document.write(" src=\"m_next_button.gif\"></a></center>\n")
document.write("          ")
}
document.write("\n")
document.write("          ")
document.write("\n")
document.write("       </p>\n")
document.write("       </div>\n")
document.write("    ")
}
function doTest() {
var count, i, newq;
if (navigator.appName!="Microsoft Internet Explorer")
{
alert('This test can be used\nwith Microsoft Internet Explorer only');
return;
}
questions.sort(myrandom);
newq=questions.slice(0,30);questions=newq;
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 showquest(i,questions)
{
var j, type, numdo;
if (shown==false)
{





winr.document.write("</ul><br>\n");
shown=true;
}

}

function errore(uno,due,tre,i,questions)
{



}


function correct(wapf)
{
var i, ii, t, re, tmp, selection, multi, type, isnull, iswrong, iscorrect, evaluation=0, total=0, udat;
var numdo;
shown=false;
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 - <font size=3>please wait a few seconds</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++) {

shown=false;

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,"You selected checkbox  <i>"+questions[i].response[selection]+"</i> (This shouldn't have been selected.)",questions[i].explan,i,questions)
}} else {
if (questions[i].corrects[selection]=="1") {
iswrong=true;
if (multi) errore(questions[i].qname,"You did not select checkbox  <i>"+questions[i].response[selection]+"</i> (This should have been selected.)",questions[i].explan, i,questions);
}}
++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 correct answer was <i>"+okresp+"</i>",questions[i].explan, i,questions);
}
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></h3>")
{var voc=(total==1)?"":"s";winr.document.write("<br><b>Total score: "+total+" point"+voc+" out of 30.</b><br>");}

winr.document.write("<br><b>Evaluation:</b><br>"+GetEval(total)+"<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()': '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.")'
winr.document.write("<input type='button' value='Print...' onClick='"+printest+"'>&nbsp;&nbsp;&nbsp;&nbsp;")
winr.document.write("<input type='button' value='exit' 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>Created by BUSINESS E-LEARNING SERVICES</a></small></small></p>"
function myrandom(a,b)
{
var rc;
do {rc=Math.floor(Math.random()*3)-1;} while (rc==2);
return(rc);
}
function GetEval(total)
{
var minval, maxval, valstr, top, i;
minval=new Array(0,7,13,19,25);
maxval=new Array(6,12,18,24,30);
valstr=new Array("<p><font size=2 color=red><b>ELEMENTARY - Poziom 1</b></font></p>","<p><font size=2 color=red><b>PRE-INTERMEDIATE - Poziom 2</b><p>","<p><font size=2 color=red><b>INTERMEDIATE - Poziom 3</b>","<p><font size=2 color=red><b>UPPER INTERMEDIATE - Poziom 4</b>","<p><font size=2 color=red><b>ADVANCED - Poziom 5</b>");
top=minval.length;
for (i=0;i<top;i++) if (total>=minval[i] && total<=maxval[i]) break;
return(valstr[i]);}
var recent, recent2, recdone=false;
function myshow(count)
{
var id, id2;
if (count==questions.length+1) id=wq_final;
else id=eval("q"+count);
if (id!=wq_final) id2=eval("q"+count+"a");
else id2=wq_final2;
if (recdone==false) {
recent=wq_user;
recent2="";
recdone=true;}
recent.style.display="none";
if (recent2!="") recent2.style.display="none";
id.style.display="";
id2.style.display="";
if (id!=wq_final && questions[count-1].type>2) document.WapForm.elements[questions[count-1].qname].focus();
recent=id;recent2=id2;}

