/*
* File Name    :quotes.js
* Dependencies :none
*/

var texts = new Array(
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Nothing is more terrible than activity without insight.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Thomas Carlyle </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;It is every man&#39;s obligation to put back into the world at least the equivalent of what he takes out of&nbsp;it.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Albert Einstein</strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;How wonderful it is that nobody need wait a single moment before starting to improve the world.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Anne Frank</strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Michelangelo</strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Don&#39;t compromise yourself. You are all you&#39;ve got.  &gt;&gt;</p><font  size='-2'><strong>Janis Joplin</strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Nothing is more terrible than activity without insight.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Thomas Carlyle </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Failure is only the opportunity to begin again more intelligently.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Henry Ford </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Individual commitment to a group effort - that is what makes a team work, a company work, a civilization work.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Vince Lombardi </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Do not follow where the path may lead. Go instead where there is no path and leave a trail.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Unknown  </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;If you want truly to understand something, try to change it.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Kurt Lewin </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;A man can succeed at almost anything for which he has unlimited enthusiasm.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Charles M. Schwab </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Do what you can, where you are, with what you&#39;ve got.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Theodore Roosevelt </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;...the highest level of human motivation is a sense of personal contribution.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Steven Covey </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Nothing great was ever achieved without enthusiasm.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Ralph Waldo Emerson </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;We must use time wisely and forever realize that the time is always ripe to do right.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Nelson Mandela </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Nearly all men can stand adversity, but if you want to test a man&#39;s character, give him power.  &gt;&gt;</p><font  size='-2'><strong>Abraham Lincoln </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;The return we reap from generous actions is not always evident.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Francesco Guiccardini </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;To measure the man, measure his heart.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Malcolm Stevenson Forbes </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;We make a living by what we get, but we make a life by what we give.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Winston Churchill </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Imagination is more important than knowledge.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Albert Einstein</strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;The very esseence of leadership is that you have a vision. You can&#39;t blow an uncertain trumpet.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Theodore Hesburgh </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;The one thing that doesn&#39;t abide by majority rule is a person&#39;s conscience.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Harper Lee </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;It&#39;s better to be a lion for a day than a sheep all your life.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Sister Elizabeth Kenny </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;The heresy of one age becomes the orthodoxy of the next.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Helen Keller </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Leap, and the net will appear.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Julie Cameron </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Truth is always exciting. Speak it, then. Life is dull without it.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Pearl Buck </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;The reward for conformity is everyone likes you but yourself.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Rita Mae Brown </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;The secret of getting ahead is getting started.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Sally Berger </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Even if you&#39;re on the right track, you&#39;ll get run over if you just sit there.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Will Rogers </strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;It is every man&#39;s obligation to put back into the world at least the equivalent of what he takes out of&nbsp;it.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Albert Einstein</strong></font>",
"<font color='{COLOR}'><p>&lt;&lt;&nbsp;Those who stand for nothing fall for anything.&nbsp;&gt;&gt;</p><font  size='-2'><strong>Alexander Hamilton</strong></font>"
);


var bgcolor = "#e5a111"; // background color, must be valid browser hex color (not color names)
var fcolor = "#841e1d"; // foreground or font color
var steps = 20; // number of steps to fade
var show = 5000; // milliseconds to display message
var sleep = 30; // milliseconds to pause inbetween messages
var loop = true; // true = continue to display messages, false = stop at last message

// Do Not Edit Below This Line
var colors = new Array(steps);
getFadeColors(bgcolor,fcolor,colors);
var color = 0;
var text = 0;
var step = 1;
var t;

// fade: magic fader function
function fade() {

// insert fader color into message
var text_out = texts[text].replace("{COLOR}", colors[color]); // texts should be defined in user script, e.g.: var texts = new Array("<font color='{COLOR}' sized='+3' face='Arial'>howdy</font>");

// actually write message to document
document.getElementById("quotebody").innerHTML = text_out; 
// select next fader color
color += step;

// completely faded in?
if (color >= colors.length-1) {
step = -1; // traverse colors array backward to fade out

// stop at last message if loop=false
if (!loop && text >= texts.length-1) return; // loop should be defined in user script, e.g.: var loop=true;
}

// completely faded out?
if (color == 0) {
step = 1; // traverse colors array forward to fade in again

// select next message
text += 1;
if (text == texts.length) text = 0; // loop back to first message
}

// subtle timing logic...
t= setTimeout("fade()", (color == colors.length-2 && step == -1) ? show : ((color == 1 && step == 1) ? sleep : 50)); // sleep and show should be defined in user script, e.g.: var sleep=30; var show=500;
}
// getFadeColors: fills Colors (predefined Array)
// with color hex strings fading from ColorA to ColorB

// note: Colors.length equals the number of steps to fade
function getFadeColors(ColorA, ColorB, Colors) {
len = Colors.length;

// strip '#' signs if present
if (ColorA.charAt(0)=='#') ColorA = ColorA.substring(1);
if (ColorB.charAt(0)=='#') ColorB = ColorB.substring(1);

// substract rgb compents from hex string
var r = HexToInt(ColorA.substring(0,2));
var g = HexToInt(ColorA.substring(2,4));
var b = HexToInt(ColorA.substring(4,6));
var r2 = HexToInt(ColorB.substring(0,2));
var g2 = HexToInt(ColorB.substring(2,4));
var b2 = HexToInt(ColorB.substring(4,6));

// calculate size of step for each color component
var rStep = Math.round((r2 - r) / len);
var gStep = Math.round((g2 - g) / len);
var bStep = Math.round((b2 - b) / len);

// fill Colors array with fader colors
for (i = 0; i < len-1; i++) {
Colors[i] = "#" + IntToHex(r) + IntToHex(g) + IntToHex(b);
r += rStep;
g += gStep;
b += bStep;
}
Colors[len-1] = ColorB; // make sure we finish exactly at ColorB
}

// IntToHex: converts integers between 0-255 into a two digit hex string.
function IntToHex(n) {
var result = n.toString(16);
if (result.length==1) result = "0"+result;
return result;
}

//Advance on Click
function Advance() {
clearTimeout(t);
step = 1;
text += 1;
setTimeout("fade()", (color == colors.length-2 && step == -1) ? show : ((color == 1 && step == 1) ? sleep : 50));
}
// HexToInt: converts two digit hex strings into integer.
function HexToInt(hex) {
return parseInt(hex, 16);
}
// body tag must include: onload="fade()" bgcolor="#e5a111" where bgcolor equals bgcolor in javascript above
document.body.bgColor = '#FFFFFF';
window.onload=fade;
 
// End -->
