// Grammar Monster © | Copyright Registration Number: 226604 | All rights reserved  


var q=1
var ans=1
var mid=""
var len=0
var rans=1
var rw=1
var choice="abcde"; chc=""; cl=1; chca = "eae--"
questin = new Array (50)
question = new Array (50)
qcheck = new Array (50)
questin[1] = "<font color=#0000AA><b>The old man in the shop punched a customer.</b></font>  Which word is an adjective?"
questin[2] = "<font color=#0000AA><b>Do not leave that poor dog in the car.</b></font>  Which word is an adjective?"
questin[3] = "<font color=#0000AA><b>The park is by a smelly old river near the windmill.</b></font>  Which word is an adjective?"
questin[4] = "<font color=#0000AA><b>I cannot reward such obvious incompetence.</b></font>  Which word is an adjective?"
questin[5] = "<font color=#0000AA><b>The pear-shaped tower is typical of his design.</b></font>  Which word is an adjective?"
questin[6] = "<font color=#0000AA><b>It's a wooden table with a marble top.</b></font>  Which word is an adjective?"
questin[7] = "<font color=#0000AA><b>She has one brown eye and one blue one.  Her lips are like rubies.</b></font>  Which word is an adjective?"
questin[8] = "<font color=#0000AA><b>This coffee is disgusting.  Are you the store manager?</b></font>  Which word is an adjective?"
questin[9] = "<font color=#0000AA><b>She lives like a recluse with a mangy parrot and a black cat.</b></font>  Which word is an adjective?"
questin[10] = "<font color=#0000AA><b>Bounce the red ball twice and the white one once.</b></font>  Which word is an adjective?"
questin[11] = "<font color=#0000AA><b>Pick an even number between one and ten.</b></font>  Which word is an adjective?"
questin[12] = "<font color=#0000AA><b>The cotton dress is too long.</b></font>  Which word is an adjective?"
questin[13] = "<font color=#0000AA><b>Pour the wine gravy over the beef but not the potatoes.</b></font>  Which word is an adjective?"
questin[14] = "<font color=#0000AA><b>Remove all plastic packaging from the inner box.</b></font>  Which word is an adjective?"

answer = new Array (200)
answr = new Array (200)
// answers to question 1
answr[1] = "#old"
answr[2] = ".man"
answr[3] = ".shop"
answr[4] = "old#The word 'old' describes the man.  Therefore, 'old' is an adjective."

// answers to question 2
answr[11] = ".leave"
answr[12] = "#poor"
answr[13] = ".car"
answr[14] = "poor#The word 'poor' describes the dog.  Therefore, 'poor' is an adjective."


// answers to question 3
answr[21] = ".windmill"
answr[22] = ".river"
answr[23] = "#smelly"
answr[24] = "smelly#The word 'smelly' describes the river.  Therefore, 'smelly' is an adjective."

// answers to question 4
answr[31] = ".reward"
answr[32] = "#obvious"
answr[33] = ".incompetence"
answr[34] = "obvious#The word 'obvious' describes incompetence.  Therefore, 'obvious' is an adjective."

// answers to question 5
answr[41] = ".of"
answr[42] = ".design"
answr[43] = "#pear-shaped"
answr[44] = "pear-shaped#The word 'pear-shaped' describes the tower.  Therefore, 'pear-shaped' is an adjective."

// answers to question 6
answr[51] = ".It"
answr[52] = ".table"
answr[53] = "#wooden"
answr[54] = "wooden#The word 'wooden' describes the table.  Therefore, 'wooden' is an adjective."

// answers to question 7
answr[61] = ".lips"
answr[62] = "#brown"
answr[63] = ".rubies"
answr[64] = "brown#The word 'brown' describes the eye.  Therefore, 'brown' is an adjective."

// answers to question 8
answr[71] = "#This"
answr[72] = ".manager"
answr[73] = ".is"
answr[74] = "This#The word 'This' describes the coffee.  Therefore, 'This' is an adjective."

// answers to question 9
answr[81] = ".cat"
answr[82] = "#mangy"
answr[83] = ".lives"
answr[84] = "mangy#The word 'mangy' describes the parrot.  Therefore, 'mangy' is an adjective."

// answers to question 10
answr[91] = "#white"
answr[92] = ".bounce"
answr[93] = ".one"
answr[94] = "white#The word 'white' describes 'one'.  Therefore, 'white' is an adjective."


// answers to question 11
answr[101] = "#even"
answr[102] = ".pick"
answr[103] = ".number"
answr[104] = "even#The word 'even' describes the number.  Therefore, 'even' is an adjective."

// answers to question 12
answr[111] = "#cotton"
answr[112] = ".dress"
answr[113] = ".is"
answr[114] = "white#The word 'cotton' describes the dress.  Therefore, 'cotton' is an adjective."


// answers to question 13
answr[121] = "#wine"
answr[122] = ".gravy"
answr[123] = ".pour"
answr[124] = "wine#The word 'wine' describes the gravy.  Therefore, 'wine' is an adjective."


// answers to question 14
answr[131] = "#plastic"
answr[132] = ".box"
answr[133] = ".remove"
answr[134] = "plastic#The word 'plastic' describes the packaging.  Therefore, 'plastic' is an adjective."



function chan(){

// select three random questions

q=1

for (i = 0; i < 15; i++){qcheck[i]=0} 

while (q<4){

var cl = Math.ceil(14*Math.random())

if (qcheck[cl]==0){
	qcheck[cl]=1;
	question[q]=questin[cl];
	rans=((q-1)*10)+1; ans=((cl-1)*10)+1;
	answer[rans]=answr[ans];
	answer[rans+1]=answr[ans+1];
	answer[rans+2]=answr[ans+2];
	answer[rans+3]=answr[ans+3];
	q++}
}


q=1; ans=1; rans=1; rw=1
var x=document.getElementById('myTable').rows
while (q<4){
// random number

var cl = Math.ceil(3*Math.random())

// assign MyTable to x and y
var y=x[rw].cells
y[0].innerHTML="<br><font color=blue><b>Q" + q + "</b></font>&nbsp; " + question[q];rw++
// count to three
while (rans<4){
len=answer[ans].length
// the correct answer loop
if (answer[ans].substr(0,1)=="#"){
mid=answer[ans].substring(1,len)
var y=x[rw].cells
y[((cl-1)*2)+1].innerHTML=choice.substr(cl-1,1) + ". " + mid;
// add the letter of the correct answer to the chc string
chc=chc+choice.substr(cl-1,1)
rans++;cl++;ans++;
if (cl==4){cl=1}
}
// the wrong answer loop
if (rans<4){
len=answer[ans].length
mid=answer[ans].substring(1,len)
var y=x[rw].cells
y[((cl-1)*2)+1].innerHTML=choice.substr(cl-1,1) + ". " + mid;
rans++; cl++; ans++;
if (cl==4){cl=1}
}
}
rans=1;ans=ans+7
q++; rw++; 
}
}
function look(){
var x=document.getElementById('myTable').rows
document.getElementById('buttons').innerHTML="<input type='button' value='Renew the test' style='background-color:#222299; color: #ffffff;' onClick='chang()'>"

// bogus answer

chca = "-----"

chosen = "-"
for (i = 0; i < 3; i++) {
if (document.frm.r1[i].checked) {
chosen = document.frm.r1[i].value
}
}
chca=chosen + chca.substr(1,4)

chosen = "-"
for (i = 0; i < 3; i++) {
if (document.frm.r2[i].checked) {
chosen = document.frm.r2[i].value
}
}
chca=chca.substr(0,1) + chosen + chca.substr(2,3)

chosen = "-"
for (i = 0; i < 3; i++) {
if (document.frm.r3[i].checked) {
chosen = document.frm.r3[i].value
}
}
chca=chca.substr(0,2) + chosen + chca.substr(3,2)

cl=0; rw=0; chosen = "";
len=chc.length + 1
for (start=1; start < len; start++){
if (chca.substr(start-1,1)==chc.substr(start-1,1)){
 cl++;  mid="<img border=0 src=../images/bultick.gif width=11 height=11>"
 chosen=chosen + start + ":" + "<font color=green><b>" + chca.substr(start-1,1) + "</b></font>&nbsp; "}
 
else if (chca.substr(start-1,1)=="-"){mid=" <font color=red>no selection</font> <img border=0 src=../images/bulx.gif width=11 height=11>&nbsp;&nbsp;&nbsp;&nbsp;<span style='background-color: #FFFF00'>[<span onclick='shw(" + start + ",event)' class=curs>explanation</span>]</span>"; chosen=chosen + start + ":" + "<font color=black>nil</font>&nbsp; "}
else {mid="<img border=0 src=../images/bulx.gif width=11 height=11>&nbsp;&nbsp;&nbsp;&nbsp;<span style='background-color: #FFFF00'>[<span onclick='shw(" + start + ",event)' class=curs>explanation</span>]</span>"
chosen=chosen + start + ":" + "<font color=red><b>" + chca.substr(start-1,1) + "</b></font>&nbsp; "}


rw=start*2-1
var y=x[rw].cells
y[0].innerHTML="<br><font color=blue><b>Q" + start + "</b></font>&nbsp; " + question[start] + " " + mid
}
rw=start*2-1
var y=x[rw].cells
y[0].innerHTML="You selected: " + chosen + "<table border=0 cellspacing=0 cellpadding=0><tr><tr><td background='../images/yourscore.jpg' width=124 height=65 align=center valign=middle><b class=big>" + cl + "/" + (q-1) + "</b></td></tr></table>"}


function shw(q, e){

mid = answer[((q-1)*10)+4]


var posx = 0;
var posy = 0;

  // Get mouse position; IE & FF Compatibility!
  if (e.pageX || e.pageY)
  {
    posx = e.pageX;
    posy = e.pageY;
  }
  else if (e.clientX || e.clientY)
  {
    posx = e.clientX + document.body.scrollLeft
      + document.documentElement.scrollLeft;
    posy = e.clientY + document.body.scrollTop
      + document.documentElement.scrollTop;}

if (posx > 860){posx = 860}


document.getElementById('popup').style.left = parseInt(posx);
document.getElementById('popup').style.top = parseInt(posy);
document.getElementById('popup').style.display = 'block';

document.getElementById('popup').innerHTML="<table border=0 width=321 cellpadding=3 cellspacing=0 background='../images/footer.jpg' style='border: 6px solid #0000FF'><tr><th align=left width=311 style='color:white'><font color=yellow>THE ANSWER</font><br><br>&quot;<span id='toppmsg'></span>&quot; <img border=0 src=../images/bultickl.gif width=11 height=11></th><td width=20 align=right valign=top><span onclick='clos()'><img border=0 src=../images/close.gif width=15 height=15></span></td></tr><tr><th align=left colspan=2 style='color: white'><br><font color=yellow>WHY?</font><br><br><span id='btmmsg'></span></th></tr></table>"

len=mid.indexOf('#')

document.getElementById('toppmsg').innerHTML="<font color=white>" + mid.substr(0,len) + "</font>";
document.getElementById('btmmsg').innerHTML="<font color=white>" + mid.substr(len+1, (mid.length)+1) + "</font>";
}

function clos(){
document.getElementById('popup').innerHTML="";}

function chang(){
var x=document.getElementById('myTable').rows
var y=x[7].cells
y[0].innerHTML="&nbsp"
document.getElementById('buttons').innerHTML="<input type='button' value='Renew the test' style='background-color: #222299; color: #ffffff;' onClick='chang()'><input type='reset' value='Clear my answers'style='background-color:#222299; color: #ffffff;'><br><input type='button' value='Check my answers' style='background-color:GREEN; color: #ffffff;' onclick='look()'>";
var q=1
var ans=1
var mid=""
var len=0
var rans=1
var rw=1
var choice="abcde"; chc=""; cl=1; chca = "eae--"
clos()
chan()}







































