msg = new Array("Dark brown is the river, golden is the sand. It flows along for ever, with trees on either hand. Green leaves a-floating, castles of the foam, boats of mine a-boating. Where will all come home? On goes the river and out past the mill, away down the valley, away down the hill. Away down the river, a hundred miles or more, other little children shall bring my boats ashore.",
"They told me you had been to her, and mentioned me to him, she gave me a good character, but said I could not swim. He sent them word I had not gone, we know it to be true, if she should push the matter on, what would become of you. I gave her one, they gave him two, you gave us three or more, they all returned from him to you, though they were mine before.")
msgl = new Array("69","77");
var word;
started = false;

function initiate() {
started = false;
msgType = msg[0];
word = msgl[0];
document.theForm.given.value = msgType;
}

function m() {
msg = new Array("As young readers like to know 'how people look', we will take this moment to give them a little sketch of the four sisters, who sat knitting away in the twilight, while the December snow fell quietly without, and the fire crackled cheerfully within. It was a comfortable room, though the carpet was faded and the furniture very plain, for a good picture or two hung on the walls, books filled the recesses, chrysanthemums and Christmas roses bloomed in the windows, and a pleasant atmosphere of home peace pervaded it.",
"The best of all. Granted - for private enjoyment; and for private enjoyment keep them. They are not at all the less written, you know, because you divide them. The couplet does not cease to be, nor does its meaning change. But take it away, and all appropriation ceases, and a very pretty gallant charade remains, fit for any collection. Depend upon it, he would not like to have his charade slighted much better than his passion. A poet in love must be encouraged in both capacities, or neither.")
msgl = new Array("90","89");
testNo = document.theForm.test.value;
msgType = msg[testNo];
word = msgl[testNo];
document.theForm.given.value = msgType
}

function e() {
msg = new Array('He was at last in pain at my long absence; and after consulting with the treasurer and the rest of the cabal, a person of quality was dispatched with the copy of the articles against me. This envoy had instructions to represent to the monarch of Blefuscu, "the great lenity of his master, who was content to punish me no farther than with the loss of mine eyes; that I had fled from justice; and if I did not return in two hours, I should be deprived of my title of NARDAC, and declared a traitor." The envoy further added, "that in order to maintain the peace and amity between both empires, his master expected that his brother of Blefuscu would give orders to have me sent back to Lilliput, bound hand and foot, to be punished as a traitor."',
'"Walter Elliot, born March 1, 1760, married, July 15, 1784, Elizabeth, daughter of James Stevenson, Esq. of South Park, in the country of Gloucester, by which lady (who died 1800) he has issue Elizabeth, born June 1, 1785; Anne, born August 9, 1787; a still-born son, November 5, 1789; Mary, born November 20, 1791." Precisely such had the paragraph originally stood from the printer\'s hands; but Sir Walter had improved it by adding, for the information of himself and his family, these words, after the date of Mary\'s birth - "Married, December 16, 1810, Charles, son and heir of Charles Musgrove, Esq. of Uppercross, in the county of Somerset," and by inserting most accurately the day of the month on which he had lost his wife.')
msgl = new Array("140","126");
testNo = document.theForm.test.value;
msgType = msg[testNo];
word = msgl[testNo];
document.theForm.given.value = msgType
}

function s() {
msg = new Array("Dark brown is the river, golden is the sand. It flows along for ever, with trees on either hand. Green leaves a-floating, castles of the foam, boats of mine a-boating. Where will all come home? On goes the river and out past the mill, away down the valley, away down the hill. Away down the river, a hundred miles or more, other little children shall bring my boats ashore.",
"They told me you had been to her, and mentioned me to him, she gave me a good character, but said I could not swim. He sent them word I had not gone, we know it to be true, if she should push the matter on, what would become of you. I gave her one, they gave him two, you gave us three or more, they all returned from him to you, though they were mine before.")
msgl = new Array("69","77");
testNo = document.theForm.test.value;
msgType = msg[testNo];
word = msgl[testNo];
document.theForm.given.value = msgType
}

function beginIt() {
if (!started) {
  day = new Date();
  startType = day.getTime();
  document.theForm.typed.value = "";
  document.theForm.typed.focus();
  started = true;
}
}

function selectChange(control) {
if (control[0].checked) {
  s();
}
else if (control[1].checked) {
  m();
}
else if (control[2].checked) {
  e();
}
}

function cheat() {
document.theForm.typed.focus();
}

function stopIt() {
if (started) {
  started = false;
  dayTwo = new Date();
  endType = dayTwo.getTime();
  totalTime = ((endType - startType) / 1000)
  spd = Math.round((word/totalTime) * 60);
}
strTyped = document.theForm.typed.value;
strGiven = document.theForm.given.value;
if (strTyped == strGiven) {
alert("\nYour accuracy is 100% and your speed is about " + spd + " words per minute!")
}
else if (strTyped == 0) {
   alert("Please try typing something!");
}
else {
   alert("Your gross speed is " + spd + " words per minute but unfortunately you made some errors.")
   }
}