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

selec = new Array (3)
correct = new Array (100)
selec[1] = " | Neither the bike nor the lorry #was =were able to avoid the ice. | There #is =are blood or red sauce on his shirt. | Neither prawns nor mussels =has #have that much zinc. | Only a lion or tiger =possess #possesses the power to cause that much carnage. | Neither Anne nor the maids =considers #consider the plant a nuisance. | The lawyer =does&nbsp;not&nbsp;know #knows neither her age nor occupation. "

correct[11] = "Neither the bike nor the lorry was able to avoid the ice.#If both elements (here: bike & lorry) are singular then the verb should be singular too. The word &quot;bike&quot; is singular (i.e. not bikes) and so is &quot;lorry&quot;; therefore, the verb is singular (i.e. &quot;was&quot; and not &quot;were&quot;)."
correct[12] = "There is blood or red sauce on his<br>shirt.#If both elements (here: blood & sauce) are singular then the verb should be singular too. The word &quot;blood&quot; is singular and so is &quot;sauce&quot;; therefore, the verb is singular (i.e. &quot;is&quot; and not &quot;are&quot;). "
correct[13] = "Neither prawns nor mussels have that much zinc.#If at least one of the elements (here: prawns & mussels) is plural then the verb should be plural too.   The word &quot;prawns&quot; is plural (as is &quot;mussels&quot;); therefore, the verb is plural (i.e. &quot;have&quot; and not &quot;has&quot;). "
correct[14] = "Only a lion or tiger possesses the power to cause that much carnage.#If both elements (here: lion & tiger) are singular then the verb should be singular too. The words &quot;lion&quot; and &quot;tiger&quot; are both singular; therefore, the verb is singular (i.e. &quot;possesses&quot; and not &quot;possess&quot;). Note: he possesses, they possess "
correct[15] = "Neither Anne nor the maids consider the plant a nuisance.#If at least one of the elements (here: Anne & maids) is plural then the verb should be plural too.   The word &quot;Anne&quot; is singular, but &quot;maids&quot; is plural; therefore, the verb is plural (i.e. &quot;consider&quot; and not &quot;considers&quot;). Note: he considers, they consider "
correct[16] = "The lawyer knows neither her age nor occupation.#Be careful not to use a <a href='../glossary/double_negative.htm' target='_blank'><font color=white><u>double negative</u></font></a> when using the pairing neither/nor."



selec[2] = " | Neither Keegan nor Beardsley #was =were able to score during ninety minutes of play. | Either shark predation or scavenging #is =are evident from the findings on the beach. | The estate manager stated it #was =was&nbsp;not neither a wolf nor a dog. | Neither lemon juice nor apple-cider vinegar #cures =cure acne according to some dermatologists. | Overcooked sprouts or cauliflower =ruins #ruin his meals every time. | Neither Mark nor Julie #understands =understand the reasoning behind the decision. "

correct[21] = "Neither Keegan nor Beardsley was able to score...#If both elements (here: Keegan & Beardlsey) are singular then the verb should be singular too. &quot;Keegan&quot; is singular and so is &quot;Beardsley&quot;; therefore, the verb is singular (i.e. &quot;was&quot; and not &quot;were&quot;)."
correct[22] = "Either shark predation or scavenging is evident...#If both elements (here: predation & scavenging) are singular then the verb should be singular too. The word &quot;predation &quot; is singular and so is &quot;scavenging&quot;; therefore, the verb is singular (i.e. &quot;is&quot; and not &quot;are&quot;)."
correct[23] = "The estate manager stated it was neither a wolf nor a dog.#Be careful not to use a <a href='../glossary/double_negative.htm' target='_blank'><font color=white><u>double negative</u></font></a> when using the pairing neither/nor. In terms of sentence structure, this is similar to: 'He knows nothing'. 'He does not know nothing' is an example of a double negative. It means he knows something."
correct[24] = "Neither lemon juice nor apple-cider vinegar cures acne according to...#If both elements (here: juice & vinegar) are singular then the verb should be singular too. The word &quot;juice&quot; is singular and so is &quot;vinegar&quot;; therefore, the verb is singular (i.e. &quot;cures&quot; and not &quot;cure&quot;).  Note: he cures, they cure"
correct[25] = "Overcooked sprouts or cauliflower ruin his meals every time.#If at least one of the elements (here: sprouts & cauliflower) is plural then the verb should be plural too.   The word &quot;sprouts&quot; is plural (unlike &quot;cauliflower&quot;, which is singular); therefore, the verb is plural (i.e. &quot;ruin&quot; and not &quot;ruins&quot;). Note: he ruins, they ruin"
correct[26] = "Neither Mark nor Julie understands the reasoning behind the decision.#If both elements (here: Mark & Julie) are singular then the verb should be singular too. &quot;Mark&quot; is singular and so is &quot;Julie&quot;; therefore, the verb is singular (i.e. &quot;was&quot; and not &quot;were&quot;). Note: he understands, they understand"

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; var qu=1
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; qu=1
for (i = 0; i < len; i++){
if (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)=="|"){words[wc]="<br><br><img src=../images/q"+qu+".gif>&nbsp; ";qu++}
	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;}

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/bultik.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='bottommsg'></span></th></tr></table>"

len=chosen.indexOf('#')

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

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


// check the text

function look(){
wc=0; score = 0; wrong=0; missed = 0; tc = 0; qu=1
for (i = 0; i < len; i++){
if (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 (mid.substr(sw,1)=="|"){words[wc]="<br><br><img src=../images/q"+qu+".gif>&nbsp; ";qu++}
	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(){
mar=0
if (ques==1 && mar ==0){ques=2;mid=selec[2]; mar=1}
if (ques==2 && mar==0){ques=1;mid=selec[1]; mar=1}
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()
}






























































