// JavaScript Document

var intervalTimeValue = 20000;

var thoughts = ["Let others lead small lives, but not you. Let others argue over small things, but not you. Let others cry over small hurts, but not you. Let others leave their future in someone else's hands, but not you.",
				"Procrastination is opportunity's natural assasin.",
				"...You may be dissapointed if you fail but you are doomed if you don't try.",
				"You see things; and you say, \"Why?\" But I dream things that never were; and I say \"Why not?\"",
				"Few things are impossible to diligence and skill... Great works are performed not by strength, but perseverence.",
				"If you don't know where you are going, you will probably end up somewhere else.",
				"And the trouble is, if you don't risk anything, you risk even more.",
				"When you cease to dream, you cease to live.",
				"We are all born for love. It is the principle of existence and its only end.",
				"There's only one place where success comes before work... in the dictionary.",
				"The Universe will correspond to the nature of \"your song\".",
				"The harder I work, the luckier I get",
				"When you change the way you look at things, the things you look at change."
				];

var authors = ["Jim Rohn",
			   "Vicktor Kiam",
			   "Beverly Sills",
			   "George Bernard Shaw",
			   "Samuel Johnson",
			   "Dr. Laurence J. Peter",
			   "Erica Jong",
			   "Malcolm S. Forbes",
			   "Benjamin Disraeli",
			   "unknown",
			   "Michael Bernard Beckwith",
			   "Sam Goldwyn - Movie Producer",
			   "Anonymous"
			   ];

function changeUnit( unit ) {
	if( unit == "kilos" ) {
		document.getElementById( "kitcoPriceChart" ).src = "http://www.kitconet.com/charts/metals/silver/tny_ag_en_bpkg_2.gif";
	}
	else {
		document.getElementById( "kitcoPriceChart" ).src = "http://www.kitconet.com/charts/metals/silver/tny_ag_en_bpoz_2.gif";
	}
}

function getNextIndex() {
	var index = Math.floor( thoughts.length * Math.random() );
	return index;
}

function cycleThoughts() {
	var nextIndex = getNextIndex();
	document.getElementById( "thoughts" ).innerHTML = "\"" + thoughts[nextIndex] + "\"";
	document.getElementById( "author" ).innerHTML = authors[nextIndex];
}

function doLoad() {
	cycleThoughts();
	setInterval( "cycleThoughts()", intervalTimeValue );
}