//	stat_quotes.js - Javascript to put random quotes on the stats page
//
//	Copyright (C) 2002-2011 Charles A Upsdell, All Rights Reserved; www.upsdell.com


// Set list of facts
	var Quote = new Array();
	// Add quotes to array, pre-sorted by author in reverse alphabetical order, except the last
	Quote[Quote.length] = new cQuote( 'The pure and simple truth is rarely pure and never simple', 'Oscar Wilde' );
	Quote[Quote.length] = new cQuote( 'Satan delights equally in statistics and in quoting scripture', 'H G Wells' );
	Quote[Quote.length] = new cQuote( 'Do not put your faith in what statistics say until you have carefully considered what they do not say', 'William W Watt' );
	Quote[Quote.length] = new cQuote( 'There is no safety in numbers, or in anything else', 'James Thurber' );
	Quote[Quote.length] = new cQuote( 'Ninety percent of everything is crap', 'Theodore Sturgeon' );
	Quote[Quote.length] = new cQuote( 'There are two kinds of statistics, the kind you look up and the kind you make up', 'Rex Stout' );
	Quote[Quote.length] = new cQuote( 'Statistics is the art of lying by means of figures', 'Wilhelm Stekel' );
	Quote[Quote.length] = new cQuote( 'Statistics are like lampposts: they are good to lean on, but they don\'t shed much light', 'Robert Storm-Petersen' );
	Quote[Quote.length] = new cQuote( '49% of all statistics are wrong', 'Statistics Canada' );
	Quote[Quote.length] = new cQuote( 'Oh, people can come up with statistics to prove anything. 14% of people know that', 'Homer Simpson;' );
	Quote[Quote.length] = new cQuote( 'The web of our life is of a mingled yarn, good and ill together', 'William Shakespeare' );
	Quote[Quote.length] = new cQuote( 'Man is a credulous animal, and must believe something; in the absence of good grounds for belief, he will be satisfied with bad ones', 'Bertrand Russell' );
	Quote[Quote.length] = new cQuote( 'A good decision is based on knowledge and not on numbers', 'Plato' );
	Quote[Quote.length] = new cQuote( 'Statistics will prove anything, even the truth', 'No&amp;euml;l Moynihan', 'No&euml;l Moynihan' );
	Quote[Quote.length] = new cQuote( 'Consumers are statistics; customers are people', 'Stanley Marcus' );
	Quote[Quote.length] = new cQuote( 'Statistics are like bikinis. What they reveal is suggestive, but what they conceal is vital', 'Aaron Levenstein' );
	Quote[Quote.length] = new cQuote( 'In ancient times they had no statistics, so they had to fall back on lies', 'Stephen B Leacock' );
	Quote[Quote.length] = new cQuote( 'Statistics: the mathematical theory of ignorance', 'Morris Klein' );
	Quote[Quote.length] = new cQuote( 'We make decisions in the dark of data', 'Stu Hunter' );
	Quote[Quote.length] = new cQuote( 'Definition of statistics: the science of producing unreliable facts from reliable figures', 'Evan Esar' );
	Quote[Quote.length] = new cQuote( 'Torture numbers, and they\'ll confess to anything', 'Gregg Easterbrook' );
	Quote[Quote.length] = new cQuote( 'Not everything that can be counted counts, and not everything that counts can be counted', 'Albert Einstein' );
	Quote[Quote.length] = new cQuote( 'Statistics: the only science that enables different experts using the same figures to draw different conclusions', 'Evan Esar' );
	Quote[Quote.length] = new cQuote( 'There are three kinds of lies: lies, damned lies, and statistics', 'Benjamin Disraeli (quoted by Mark Twain)' );
	Quote[Quote.length] = new cQuote( 'Perfect numbers like perfect men are very rare', 'Ren&amp;eacute; D&amp;eacute;scartes', 'Ren&eacute; D&eacute;scartes' );
	Quote[Quote.length] = new cQuote( 'Statistics are no substitute for judgment', 'Henry Clay' );
	Quote[Quote.length] = new cQuote( 'If you want to inspire confidence, give plenty of statistics. It does not matter that they should be accurate, or even intelligible, as long as there is enough of them', 'Lewis Carroll' );
	Quote[Quote.length] = new cQuote( 'A judicious man uses statistics, not to get knowledge, but to save himself from having ignorance foisted upon him', 'Thomas Carlyle' );
	Quote[Quote.length] = new cQuote( 'I can prove anything by statistics except the truth', 'George Canning' );
	Quote[Quote.length] = new cQuote( 'Men willingly believe what they wish', 'Julius Caesar' );
	Quote[Quote.length] = new cQuote( 'If enough data is collected, anything may be proved by statistical methods', 'Arthur Bloch' );
	Quote[Quote.length] = new cQuote( 'The manipulation of statistical formulas is no substitute for knowing what one is doing', 'Hubert M Blalock Jr' );
	Quote[Quote.length] = new cQuote( 'No statistic is perfect, but some are less imperfect than others', 'Joel Best' );
	Quote[Quote.length] = new cQuote( 'Before the curse of statistics fell upon mankind we lived a happy, innocent life, full of merriment and go, and informed by fairly good judgment', 'Hilarie Belloc' );
	Quote[Quote.length] = new cQuote( 'No lie is so false or inconclusive as that which is based on statistics', 'Hilarie Belloc' );
	Quote[Quote.length] = new cQuote( 'Like dreams, statistics are a form of wish fulfillment', 'J Baudrillard' );
	Quote[Quote.length] = new cQuote( 'Without data, all you are is just another person with an opinion' );
	Quote[Quote.length] = new cQuote( 'There are three kinds of liars &hellip; men, women, and statistics' );
	Quote[Quote.length] = new cQuote( 'Statistics is the art of never having to say you\'re wrong' );
	Quote[Quote.length] = new cQuote( 'Statistics means never having to say you\'re certain' );
	// This next quote must be the last
	Quote[Quote.length] = new cQuote( 'Get your facts first, and then you can distort them as much as you please: facts are stubborn, but statistics are more pliable', 'Mark Twain' );


// Define cQuote class
function cQuote( quote, author1, author2 )
{
	this.quote = quote;
	this.author1 = (arguments.length >= 2) ? author1 : 'Anonymous';
	this.author2 = (arguments.length >= 3) ? author2 : this.author1;
}


// Write 2 random quotes (but not the last quote) where id 'ins_GetQuote' exists
function myGetQuote ()
{
	var oGetQuote = getElement( 'ins_GetQuote' );
	if ( oGetQuote == null )
		return;

	var nQuote;
	var oQuote = new cQuote();
	var sHTML = '';

	nQuote = Math.floor((Quote.length-1)*Math.random());	// Write even quote
	nQuote = (nQuote%2 == 1) ? --nQuote : nQuote ;
	oQuote = Quote[nQuote];
	sHTML += '<i class="quote">&ldquo;' + oQuote.quote + '&rdquo;</i> &#8212; ';
	sHTML += '<i>' + oQuote.author2 + '</i>';
	sHTML += '<br />~<br />\n';

	nQuote = Math.floor((Quote.length-1)*Math.random());	// Write odd quote
	nQuote = (nQuote%2 == 0) ? ++nQuote : nQuote ;
	nQuote = ( nQuote == Quote.length-1 ) ? 1 : nQuote ;
	oQuote = Quote[nQuote];
	sHTML += '<i class="quote">&ldquo;' + oQuote.quote + '&rdquo;</i> &#8212; ';
	sHTML += '<i>' + oQuote.author2 + '</i>';
	sHTML += '<br />~<br />\n';

	oGetQuote.innerHTML = sHTML;
}

// Write all the quotes (backwards from the 2nd last to the first, then the last) where id ins_GetQuotes' exists
function myGetQuotes ()
{
	var oGetQuotes = getElement( 'ins_GetQuotes' );
	if ( oGetQuotes == null )
		return;

	var nQuote;
	var oQuote = new cQuote();
	var sHTML = '';

	for ( nQuote = Quote.length-2; nQuote >= -1; nQuote-- )
	  {
		oQuote = (nQuote == -1) ? Quote[Quote.length-1] : Quote[nQuote];
		sHTML += '&lt;i class="quote"&gt;&amp;ldquo;' + oQuote.quote + '&amp;rdquo;&lt;/i&gt; &amp;#8212; ';
		sHTML += '&lt;i&gt;' + oQuote.author1 + '&lt;/i&gt;';
		sHTML += '&lt;br /&gt;~&lt;br /&gt;<br />\n';
	  }
	oGetQuotes.innerHTML = sHTML;
}


