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

selec = new Array (3)
correct = new Array (100)



selec[1]= "=Who's #Whose note is that in the kitchen area asking #who's =whose been stealing the biscuits?  I know #who's =whose behind the thieving. It's a small rat, #who's =whose learnt to open the biscuit jar."


correct[11]= "Whose note is that in the kitchen...#'Whose' is the possessive form of who. It means 'belonging to whom'. In this example, it is used to ask to whom the note belongs.  'Whose' usually sits before a noun. In this example, the noun is 'note'." 
correct[12]= "...asking who's been stealing the biscuits?#<font color=#cc2222>Who's</font> is a contraction of <font color=#cc2222>who is</font> or <font color=#cc2222>who has</font>. This is a 100% rule. In this example, it expands to <font color=#cc2222>who has</font>."
correct[13]= "I know who's behind the thieving.#<font color=#cc2222>Who's</font> is a contraction of <font color=#cc2222>who is</font>  or <font color=#cc2222>who has</font>. This is a 100% rule. In this example, it expands to <font color=#cc2222>who is</font>."
correct[14]= "It's a small rat, who's learnt to open the biscuit jar.#<font color=#cc2222>Who's</font> is a contraction of <font color=#cc2222>who is</font>  or <font color=#cc2222>who has</font>. This is a 100% rule. In this example, it expands to <font color=#cc2222>who has</font>."



selec[2]= "A man =who's #whose dog attacked a toddler outside a shop will not face prosecution, police confirmed today. The young boy, =who's #whose father was seen hitting the dog with a newspaper before the incident, suffered minor injuries to his arm.  The dog owner said: &quot;I am upset for the kid.  It's his father #who's =whose to blame.&quot; "

correct[21]= "A man whose dog attacked...#'Whose' is the possessive form of who. It means 'belonging to whom'. In this example, it is used to show that the dog belongs to the man. 'Whose' usually sits before a noun. In this example, the noun is 'dog'."
correct[22]= "The young boy, whose father was seen...#'Whose' is the possessive form of who. It means 'belonging to whom'. In this example, it is used to show that the father belongs to the boy (i.e. It's the boy's father).  'Whose' usually sits before a noun. In this example, the noun is 'father'." 
correct[23]= "It's his father who's to blame.#<font color=#cc2222>Who's</font> is a contraction of <font color=#cc2222>who is</font>  or <font color=#cc2222>who has</font>. This is a 100% rule. In this example, it expands to <font color=#cc2222>who is</font>."


selec[3]= "The woman =who's #whose garden weeds grew so high they could be seen from space has been evicted from her home. Mrs Kemp, #who's =whose been living in the flat for six years, allowed the weeds in her yard to swamp a child's swing and a garden shed. Mr Ramsey, =who's #whose flat is upstairs, claims he can pick blackberries from his window."


correct[31]= "The woman whose garden weeds grew so high...#'Whose' is the possessive form of who. It means 'belonging to whom'. In this example, it is used to show that the weeds belong to the woman.  'Whose' usually sits before a noun. In this example, the noun is 'weeds'."
correct[32]= "Mrs Kemp, who's been living...#<font color=#cc2222>Who's</font> is a contraction of <font color=#cc2222>who is</font>  or <font color=#cc2222>who has</font>. This is a 100% rule. In this example, it expands to <font color=#cc2222>who has</font>."
correct[33]= "Mr Ramsey, whose flat is upstairs...#'Whose' is the possessive form of who. It means 'belonging to whom'. In this example, it is used to show that the flat belongs to Mr Ramsey.  'Whose' usually sits before a noun. In this example, the noun is 'flat'."

selec[4]= "A zookeeper =who's #whose arm was bitten off by a lion has publicly thanked the surgeons =who's #whose skills over the past two days have succeeded in reattaching her arm.  The zookeeper, #who's =whose been working with lions for over a year, poked her finger through a 3cm opening between the bars when the 370-pound lion grabbed her."


correct[41]= "A zookeeper whose arm was bitten off...#'Whose' is the possessive form of who. It means 'belonging to whom'. In this example, it is used to show that the arm belongs to the zookeeper.  'Whose' usually sits before a noun. In this example, the noun is 'arm'."
correct[42]= "...the surgeons whose skills...#'Whose' is the possessive form of who. It means 'belonging to whom'. In this example, it is used to show that the skills belong to the surgeons.  'Whose' usually sits before a noun. In this example, the noun is 'skills'."
correct[43]= "The zookeeper, who's been working with lions for over a year...#<font color=#cc2222>Who's</font> is a contraction of <font color=#cc2222>who is</font>  or <font color=#cc2222>who has</font>. This is a 100% rule. In this example, it expands to <font color=#cc2222>who has</font>."






ques = 0; var mid = ""

// choose a random sentence

ques = Math.ceil(2*Math.random())


mid = selec[ques]
var len = 0
var i = 0
var sw = 0
var ew = 0
var shw = ""
var wc = 0
var rep = ""
var ges = 0
var shr = 1
var score = 0; var wrong=0; var missed = 0; var total = 0; var tc=0; var totq = 0; var mar = 0; var nding=0
words = new Array (150)
check = new Array (150)
quest = new Array (20)
ans = new Array (150)
for (k = 0; k < 150; k++){check[k]=0}
for (k = 0; k < 150; k++){ans[k]=0}
len=mid.length

// check the text

function text(){
wc=0;
for (i = 0; i < len; i++){
if (mid.substr(i,1)==" " || mid.substr(i,1)=="," || mid.substr(i,1)=="."){
	ew=i+1; rep=mid.substr(i,1)
	if (mid.substr(sw,1)=="#" || mid.substr(sw,1)=="="){ans[wc]=1; sw++;}
	else {words[wc]=" " + mid.substr(sw, (ew-sw)) + " "}
	if (mid.substr(sw-1,1)=="="){ans[wc]=2;}
	if (check[wc]==1 && (ans[wc]==1 || ans[wc]==2)){words[wc]="<span class=curs onclick=sel('" + wc + "') style='background-color: #FFFF00'>" + mid.substr(sw, ((ew-sw)-1)) + "</span>" + rep}
	if (check[wc]==0 && (ans[wc]==1 || ans[wc]==2)){words[wc]="<span class=curs onclick=sel('" + wc + "') style='background-color: #FFFFFF'>" + mid.substr(sw, ((ew-sw)-1)) + "</span>" + rep}
	sw=ew
	wc++
}
}
display()
}


function display(){
shw=""; shr=1; totq=1; mar = 0
for (k = 0; k < wc; k++){
if (ans[k]==1 || ans[k]==2){shw = shw + "<font color=blue>" ; shr++;}
if (nding==1 && (ans[k]==1 || ans[k]==2)){mar = totq + (ques*10); shw = shw + "<span class=curs onclick=showcorrect(" + mar + ",event)>";}
shw = shw + words[k]
if (shr%2==0 && (ans[k]==1 || ans[k]==2)){shw = shw + "/ "}
if ((shr-1)%2==0 && (ans[k]==1 || ans[k]==2)){totq++}
if (nding==1 && (ans[k]==1 || ans[k]==2)){shw = shw + "</span>"}
if (ans[k]==1 || ans[k]==2){shw = shw + "</font>"}
}
document.getElementById('topmsg').innerHTML=shw;
sw=0
}

function sel(a){
chosen = ""; ges = 0; 
if (check[a]==0){check[a]=1; check[(a-1)]=0; a++; check[a]=0}
else {check[a]=0}
for (k = 0; k < wc ; k++){
if (check[k]==1){ges++}
}
document.getElementById('btmmsg').innerHTML="Number of selections: " + ges;

text()
}

function cler(){
for (k = 0; k < wc; k++){check[k]=0}
check[2]=1;sel(2)
text()
}

function showcorrect(a, e){
chosen = correct[(a)]

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;}

posx = posx - 140
posy = posy - 148

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=350 cellpadding=0 cellspacing=0><tr><td><img src='../images/callout_top.gif' border='0' usemap='#smap'><map name='smap' id='smap'><area	shape='rect' coords='323,12,338,26' href='javascript: clos()'/></map></td></tr></table><table border=0 width=350 cellpadding=0 cellspacing=0 background='../images/callout_mid.gif'><tr><td><table cellpadding='7' cellspacing=0><tr><td valign='top'>&quot;<span id='toppmsg'></span>&quot; <img src='../images/bultik.gif'><h2>Why?</h2><span id='bottommsg'></span></td></tr></table></td></tr></table><table border=0 width=350 cellpadding=0 cellspacing=0><tr><td><img src='../images/callout_bot.gif' border='0'></td></tr></table>"

len=chosen.indexOf('#')

document.getElementById('toppmsg').innerHTML=chosen.substr(0,len);
document.getElementById('bottommsg').innerHTML=chosen.substr(len+1, (chosen.length)+1);
}

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


// check the text

function look(){
wc=0; score = 0; wrong=0; missed = 0; tc = 0; 
for (i = 0; i < len; i++){
if (mid.substr(i,1)==" " || mid.substr(i,1)=="." || mid.substr(i,1)==","){
	ew=i+1; rep=mid.substr(i,1)
	if (mid.substr(sw,1)=="#"){ans[wc]=1; sw++; tc++} 
      if (mid.substr(sw,1)=="="){ans[wc]=2; sw++;}
	words[wc]=mid.substr(sw, (ew-sw))
	if (check[wc]==1 && ans[wc]==2){words[wc]="<span style='background-color: #FFFF00'>" + mid.substr(sw, ((ew-sw)-1)) + "</span>" + rep + "<img border=0 src=../images/bulxw.gif width=25 height=11> "; wrong++}
	if (check[wc]==0 && check[wc-1]==0 && check[wc+1]==0 && ans[wc]==1){words[wc]="<span style='background-color: #FFCCCC'>" + mid.substr(sw, ((ew-sw)-1)) + "</span>" + rep + "<img border=0 src=../images/bulxw.gif width=25 height=11> "; missed++}
	if (check[wc]==1 && ans[wc]==1){words[wc]="<span style='background-color: #CCFFCC'>" + mid.substr(sw, ((ew-sw)-1)) + "</span>" + rep + "<img border=0 src=../images/bultickw.gif width=25 height=11> "; score++}

	
	sw=ew
	wc++}
}
nding=1; display(); 
total = score -(wrong + missed)
document.getElementById('btmmsg').innerHTML="<table border=0><tr><td><b>Total Selections:</b></td><td width=50 align=center>" + ges + "</td><td></td></tr><tr><td BGCOLOR=#CCFFCC>Correct selections:</td><td align=center>" + score + "</td><td><font color=#999999>(score: "+ score + ")</font></td></tr><tr><td BGCOLOR=#FFFF00>Wrong selections:</td><td align=center>" + wrong + "</td><td><font color=#999999>(score: "+ wrong*-1 + ")</font></td></tr><tr><td BGCOLOR=#FFCCCC>Missed answers:</td><td align=center>" + missed + "</td><td><font color=#999999>(score: "+ missed*-1 + ")</font></td></tr><tr><td><b>Total Score:<b></td><td align=center>" + total + "</td><td><font color=#999999>(highest possible score: " + tc + ")</font></td></tr></table><br><span class=big>Click on the answers for explanations</span>."

document.getElementById('buttons').innerHTML="<input type='button' value='Next Test' style='background-color: #222299; color: #ffffff;' onClick='nexttest()'>"

}

function nexttest(){
ques++;
if (ques==5){ques=1}
mid=selec[ques] 
for (k = 0; k < 150; k++){check[k]=0; ans[k]=0; words[k]=""}
var sw = 0
var ew = 0
nding = 0
len=mid.length
document.getElementById('popup').innerHTML="&nbsp;";
document.getElementById('btmmsg').innerHTML="<span id='btmmsg' class='mid'>&nbsp;</span>";
document.getElementById('buttons').innerHTML="<input type='button' value='Next test' style='background-color: #222299; color: #ffffff;' onClick='nexttest()'><input type='button' value='Clear my answers' style='background-color:#222299; color: #ffffff;' onclick='cler()'><input type='button' value='Check my answers' style='background-color:GREEN; color: #ffffff;' onclick='look()'>";
text()
}






















































