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

selec = new Array (100)
ans = new Array (100)
selec[11]="=Gavin said that we are not getting a water dispenser, which as far as I am concerned, is the final word. |#Gavin said that we are not getting a water dispenser, which, as far as I am concerned, is the final word."
selec[12]="#In Seattle, Rocky - a dog sentenced to death for his part in a robbery - was released and banished from the town. |=In Seattle, Rocky, a dog sentenced to death for his part in a robbery, was released and banished from the town." 
selec[13]="=This was not however the way it was intended. |#This was not, however, the way it was intended."  
selec[14]="#Rip James, a 23-year-old beggar from Hale, left his 4-million-pound mansion to live on the streets. |=Rip James - a 23-year-old beggar from Hale - left his 4-million-pound mansion to live on the streets." 

ans[11]="...water dispenser, which, as far as I am concerned, is the final word.#The phrase <font color=yellow>as far as I am concerned</font> is a parenthesis (i.e. just additional information). It should be separated from the rest of the sentence with commas or dashes."
ans[12]="In Seattle, Rocky - a dog sentenced to death for his part in a robbery - was released...#The phrase <font color=yellow>a dog sentenced to death for his part in a robbery</font> is just additional information about Rocky. It should be separated from the rest of the sentence with commas, brackets or dashes. (In this case, dashes are better than commas as a comma has already been used after 'Seattle'.)"
ans[13]="This was not, however, the way it was intended.#In this instance, the word <font color=yellow>however</font> is a parenthesis. The sentence still makes sense when it is removed. It should be separated from the rest of the sentence with commas or dashes."
ans[14]="Rip James, a 23-year-old beggar from Hale, left his 4-million-pound mansion to live...#The phrase <font color=yellow>a 23-year-old beggar from Hale</font> is just additional information about Rip James. It should be separated from the rest of the sentence with commas, brackets or dashes. (In this case, commas are better than dashes as there are lots of hyphens in the sentence, which look very similar to dashes.)"

selec[21]="=Desperate robber Tommy Millar 36 was jailed for robbing his father's grocery store. |#Desperate robber Tommy Millar, 36, was jailed for robbing his father's grocery store."
selec[22]="=However, four years ealier in Atlanta, Sir Redgrave, who won his fifth gold medal in the coxless fours in Sydney, had planned to give up rowing. |#However, four years ealier in Atlanta, Sir Redgrave - who won his fifth gold medal in the coxless fours in Sydney - had planned to give up rowing."
selec[23]="#Afterwards, according to the referee, Wells threw an egg at his kitchen window. |=Afterwards according to the referee, Wells threw an egg at his kitchen window."
selec[24]="#Simon Taylor, 41, of Hitchin, Bedfordshire - dressed in evening wear and with a champagne picnic and roses - took his partner on a boat trip to pop the question. |=Simon Taylor, 41, of Hitchin, Bedfordshire, dressed in evening wear and with a champagne picnic and roses, took his partner on a boat trip to pop the question."

ans[21]="Desperate robber Tommy Millar, 36, was jailed...#Tommy's age is a parenthesis (i.e. just additional information about Tommy). It should be separated from the rest of the sentence with commas or dashes."
ans[22]="However, four years ealier in Atlanta, Sir Redgrave - who won his fifth gold medal in the coxless fours in Sydney - had...#The clause <font color=yellow>who won his fifth gold medal in the coxless fours in Sydney</font> is just additional information. It should be separated from the rest of the sentence with commas, brackets or dashes. (In this case, dashes are better than commas as commas have already been used after 'However' and 'Atlanta'.)"
ans[23]="Afterwards, according to the referee, Wells threw...#The phrase <font color=yellow>according to the referee</font> is a parenthesis. It should be separated from the rest of the sentence with brackets, commas or dashes."
ans[24]="Simon Taylor, 41, of Hitchin, Bedfordshire - dressed in evening wear and with a champagne picnic and roses - took his partner...#The phrase <font color=yellow>dressed in evening wear and with a champagne picnic and roses</font> is just additional information about Simon Taylor. It should be separated from the rest of the sentence with commas, brackets or dashes. (In this case, dashes are better than commas as commas have already been used after 'Taylor', '41' and 'Hitchin'.)"

var chosen = ""; var len = 0; var perv = ""; var vtor = ""; var shw = ""; var qu = 0; var short = 0; var pervans = ""; var vtorans = ""; var tot = 0; var set = 0; var wher = ""

len = Math.ceil(2*Math.random()); set = len*10

function text(){
for (k = 1; k < 5; k++){
chosen = selec[k + set]
len=chosen.indexOf('|')
if (chosen.substr(0,1)=="-" || chosen.substr(len+1,1)=="-"){short=1}
qu++; shw = shw + "<img src=../images/q"+qu+".gif><span id=msg" + qu + "></span><span id=les" + qu + "></span><br>"
perv = chosen.substr(1,len-1)
vtor = chosen.substr(len+2, (chosen.length))
if (chosen.substr(0,1)=="-" || chosen.substr(0,1)=="="){pervans = "wrong"; vtorans = "right"} 
else {pervans = "right"; vtorans = "wrong"} 
if (short==0){shw = shw + "<Input type = radio Name = r" + qu + " Value = '"+ pervans +"'>" + perv + "<br>";}
if (short==1){shw = shw + "<Input type = radio Name = r" + qu + " Value = '"+ pervans +"'>" + perv + "&nbsp;&nbsp;";}
shw = shw + "<Input type = radio Name = r" + qu + " Value = '" + vtorans +"'>" + vtor + "<br>";
short = 0; 
}
document.getElementById('topmsg').innerHTML=shw;
}


function cler(){
chosen = ""; len = 0; perv = ""; vtor = ""; shw = ""; qu=0; short = 0; pervans = ""; vtorans = ""; tot = 0
document.getElementById('btmmsg').innerHTML="";
text()
}


function nexttest(){
qu = 0
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()'>"
if (set==10){set=20; qu=1}
if (set==20 && qu==0) {set=10}
document.getElementById('popup').innerHTML="";
cler()
}



function look() {
tot = 0; qu = 0; short = 0
if (document.frm.r1[0].checked && document.frm.r1[0].value=="right"){
document.getElementById('msg1').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot=tot+100}
else { 
document.getElementById('msg1').innerHTML="&nbsp;<img src=../images/bulx.gif>";}
if (document.frm.r1[1].checked && document.frm.r1[1].value=="right"){
document.getElementById('msg1').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot++} 

if (document.frm.r2[0].checked && document.frm.r2[0].value=="right"){
document.getElementById('msg2').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot=tot+100}
else { 
document.getElementById('msg2').innerHTML="&nbsp;<img src=../images/bulx.gif> (Your answer is not wrong, but it is not very tidy.)";}
if (document.frm.r2[1].checked && document.frm.r2[1].value=="right"){
document.getElementById('msg2').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot++}


if (document.frm.r3[0].checked && document.frm.r3[0].value=="right"){
document.getElementById('msg3').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot=tot+100}
else { 
document.getElementById('msg3').innerHTML="&nbsp;<img src=../images/bulx.gif>";}
if (document.frm.r3[1].checked && document.frm.r3[1].value=="right"){
document.getElementById('msg3').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot++}


if (document.frm.r4[0].checked && document.frm.r4[0].value=="right"){
document.getElementById('msg4').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot=tot+100}
else { 
document.getElementById('msg4').innerHTML="&nbsp;<img src=../images/bulx.gif> (Your answer is not wrong, but it is not very tidy.)";}
if (document.frm.r4[1].checked && document.frm.r4[1].value=="right"){
document.getElementById('msg4').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot++}


for (k = 1; k < 5; k++){
wher = "les" + k
document.getElementById(wher).innerHTML="&nbsp;&nbsp;<span class=small onclick=showcorrect(" + (k + set) + ",event)><font class=curs color=blue>Explanation</font></span>";

}

qu = parseInt(tot/100); short = tot - (qu*100); tot = qu + short

document.getElementById('btmmsg').innerHTML="&nbsp;You scored " + tot + " out of 4<br><br>"
document.getElementById('buttons').innerHTML="<input type='button' value='Next test' style='background-color: #222299; color: #ffffff;' onClick='nexttest()'>"
}

function showcorrect(a,e){
chosen = ans[(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 > 260){posx = 200}

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=521 cellpadding=3 cellspacing=0 background='../images/footer.jpg' style='border: 6px solid #0000FF'><tr><th align=left width=511 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="";}













