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

selec = new Array (100)
ans = new Array (100)


selec[11]="=25 UFOs were sighted in 1996. |#Twenty-five UFOs were sighted in 1996."
selec[12]="#234 (two hundred and thirty-four) |=234 (two-hundred and thirty-four)"
selec[13]="#21,347 (twenty-one thousand three hundred and forty-seven)  |=21,347 (twenty one thousand three-hundred and forty-seven)."
selec[14]="=Put all the flour in the bucket and add 2 and a half dozen eggs. |#Put all the flour in the bucket and add 2-and-a-half dozen eggs."
selec[15]="=3-and-a-quarter million pounds were stolen from the vault. |#Three-and-a-quarter million pounds were stolen from the vault."

ans[11]="Twenty-five UFOs were sighted in 1996.#It is considered untidy to start sentences with figures."
ans[12]="234 (two hundred and thirty-four)#When writing numbers in full, hyphenate all numbers between 21 and 99 (except those divisible by 10)."
ans[13]="21,347 (twenty-one thousand three hundred and forty-seven)#When writing numbers in full, hyphenate all numbers between 21 and 99 (except those divisible by 10). This is correct as <font color=yellow>twenty-one</font> and <font color=yellow>forty-seven</font> are hyphenated."
ans[14]="Put all the flour in the bucket and add 2-and-a-half dozen eggs.#Expressions like <font color=yellow>four-and-a-quarter</font> are hyphenated when used as adjectives (e.g. three-and-a-half million people).  Expressions like these are <a href='../glossary/compound_adjectives.htm' target='_blank'><font color=white><u>compound adjectives</u></font></a> and should be hyphenated."
ans[15]="Three-and-a-quarter million pounds were stolen from the vault.#It is considered untidy to start sentences with figures."

selec[21]="#1,478 (one thousand four hundred and seventy-eight) |=1,478 (one-thousand four-hundred and seventy-eight)"
selec[22]="#He survived at sea for 3-and-a-half months. |=He survived at sea for 3 and a half months."
selec[23]="=78 of those affected had been with the bank for more than two decades. |#Seventy-eight of those affected had been with the bank for more than two decades."
selec[24]="#61 (sixty-one) |=61 (sixty one)"
selec[25]="#She weighed eight-and-three-quarter pounds when she was born. |=She weighed eight and three quarter pounds when she was born."


ans[21]="1,478 (one thousand four hundred and seventy-eight)#When writing numbers in full, hyphenate all numbers between 21 and 99 (except those divisible by 10). This is correct as <font color=yellow>seventy-eight</font> is hyphenated."
ans[22]="He survived at sea for 3-and-a-half months.#Expressions like <font color=yellow>3-and-a-half</font> are hyphenated when used as adjectives (e.g. three-and-a-half million people).  Expressions like these are <a href='../glossary/compound_adjectives.htm' target='_blank'><font color=white><u>compound adjectives</u></font></a> and should be hyphenated."
ans[23]="Seventy-eight of those affected had been with the bank for more than two decades.#It is considered untidy to start sentences with figures."
ans[24]="61 (sixty-one)#When writing numbers in full, hyphenate all numbers between 21 and 99 (except those divisible by 10)."
ans[25]="She weighed eight-and-three-quarter pounds when she was born.#Expressions like <font color=yellow>eight-and-three-quarter</font> are hyphenated when used as adjectives (e.g. three-and-a-half million people).  Expressions like these are <a href='../glossary/compound_adjectives.htm' target='_blank'><font color=white><u>compound adjectives</u></font></a> and should be hyphenated."


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 < 6; 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>";}
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>";}
if (document.frm.r4[1].checked && document.frm.r4[1].value=="right"){
document.getElementById('msg4').innerHTML="&nbsp;<img src=../images/bultick.gif>";tot++}


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





for (k = 1; k < 6; 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 5<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="";}













