/**
This script creates an array of Quotation objects. It then selects a quotation from this array at random, and writes it out.
*/


// Quotation object
function Quotation(words, sourcePerson, sourceInfo)
{
  this.words = words;
  this.sourcePerson = sourcePerson;
  this.sourceInfo = sourceInfo;
  if (this.sourceInfo == undefined)
  {
    this.sourceInfo = "";
  }
}

// Quotation array - the list of quotes. To add a new quote just copy the last new Quotation line in this block and change
// the words, source and extra info as necessary.
var quotations = new Array
(
  new Quotation("Civilisation means, above all, an unwillingness to inflict unnecessary pain. Within the ambit of that definition, those of us who heedlessly accept the commands of authority cannot yet claim to be civilized men and women...", "Harold Laski", "The Dangers of Obedience"),
  new Quotation("It has become appallingly obvious that our technology has exceeded our humanity.", "Albert Einstein"),
  new Quotation("The human givens approach gives us a larger frame of reference to work from and has enormous potential for unifying diverse strands of thinking in psychology.", "Dr Kevin Epps", "Psychologist"),
  new Quotation("Learning is not compulsory... neither is survival.", "W. Edwards Deming"),
  new Quotation("People must have one another; it is nature's law.", "Fontaine")
);

function pickRandomQuote()
{
  var index = Math.floor(Math.random() * quotations.length);
  var quote = quotations[index];
  return quote;
}

function writeRandomQuote()
{
  var quote = pickRandomQuote();
  document.write("<p class='quoteWords'>&#147;" +quote.words +"&#148;</p>");
  document.write("<p class='quoteSource'>"+quote.sourcePerson+"<br/><i>"+quote.sourceInfo+"</i></p>");
}

