// JavaScript Document

var quotes = new Array(
'<strong>Believe that life is worth living, and your belief will help create the fact</strong>',

'<strong>The grand essentials of happiness are:<br /> something to do, <br />something to love,<br/>and something to hope for.</strong>',

'<strong>The easiest way to enjoy life is to enjoy what you do every day - not dream of escaping it.</strong>',

'<strong>Live joyfully and peacefully, knowing that the right thoughts and the right efforts inevitably bring about the right results.</strong>',

'<strong>The doors we open and close each day decide the lives we live.</strong>',

'<strong>Do what you can, <br /> with what you have, <br />where you are.</strong>',

'<strong>Forget regret, or life is yours to miss.</strong>',

'<strong>Never look down on anybody unless you are helping them up</strong>',

'<strong>When you are content to be simply yourself and don\'t compare or compete, everybody will respect you.</strong>',

'<strong>Where there is love, there is life.</strong>',

'<strong>Hope achieves the impossible</strong>',

'<strong>When I find myself fading, I close my eyes and realise my friends are my energy.</strong>',

'<strong>They may forget what you said, but they will never forget how you made them feel.</strong>',

'<strong>The best way to cheer yourself up is to try to cheer up somebody else.</strong>',

'<strong>Laughter is the shortest distance between two people.</strong>',

'<strong>If you don\'t learn to laugh at troubles, you won\'t have anything to laugh at when you grow old.</strong>',

'<strong>Nobody ever died of laughter.</strong>',

'<strong>Use what talent you possess; the woods would be very silent if no birds sang except those that sang best.</strong>',

'<strong>Don\'t let life discourage you; <br />everyone who got where they are <br />had to begin where they were.</strong>',

'<strong>Without a struggle, there ccan be no progress.</strong>',

'<strong>Learn to embrace challenges because they are a gift in life and not a difficulty to be avoided.</strong>',

'<strong>To accomplish great things, we must not only act, but also dream; not only plan, but also believe.</strong>',

'<strong>Don\'t be afraid to take a big step. <br /> You can\'t cross a chasm in two small jumps.</strong>',

'<strong>When you learn to believe in yourself, your world will open up to you and you will find your path.</strong>',

'<strong>Only those that dare to fail greatly can ever achieve greatly.</strong>',

'<strong>Our greatest glory is not in never falling,<br /> but in rising every time we fall.</strong>',

'<strong>Success seems to be largely a matter of hanging on after others have let go.</strong>',

'<strong>It\'s always too early to quit.</strong>',

'<strong>Someone who aims at nothing is sure to hit it.</strong>',

'<strong>There are no shortcuts to any place worth going.</strong>',

'<strong>Even if you are on the right track, you\'ll get run over if you just sit there.</strong>',

'<strong>There are many ways of going forward, but only one way of standing still.</strong>',

'<strong>People take different roads seeking fulfilment and happiness.<br />Just because you\'re not on their road doesn\'t mean you\'ve gotten lost.</strong>',

'<strong>It is good to have an end to journey towards, but it\'s the journey that matters in the end.</strong>',

'<strong>Dance like no one\'s watching<br />Sing like no one\'s listening<br />Love like you\'ve never been hurt<br />And live like it\'s heaven on earth.</strong>',

'<strong>Aim for the stars; even if you only reach the moon, that\'s still a pretty good achievment</strong>',

'<strong>Be nice to yourself, in this world there are enough people that will tear you down, you don\'t need to do it too.'
);

var delay=10000; /* 10000ms = 10s */


var steps = 0;
var nextQuote=0;
function listQuotes() {
	for (var i=0; i<quotes.length; i++) {
		document.writeln("<p>"+quotes[i]+"</p>");
	}
}
function enterQuote() {
	document.getElementById("quote").innerHTML=quotes[nextQuote];
}
function startQuotes() {
	if (document.getElementById("quote")==null) return;
	nextQuote = Math.floor(Math.random()*quotes.length);
	enterQuote();
	document.getElementById("quote").style.color="#5e6d9d";
	steps = 0;
	setTimeout("fadeout()",delay);
}
function fadeout() {
	if (steps<23) {
		steps++;
		document.getElementById("quote").style.color="rgb("+(11*steps)+","+(51+9*steps)+","+(102+3*steps)+")";
		setTimeout("fadeout()",100);
	} else {
		document.getElementById("quote").style.color="rgb(254,248,177)";
		nextQuote=(nextQuote+1)%quotes.length;
		enterQuote();
		fadein();
	}
}
function fadein() {
	if (steps>0) {
		steps--;
		document.getElementById("quote").style.color="rgb("+(11*steps)+","+(51+9*steps)+","+(102+3*steps)+")";
		setTimeout("fadein()",100);
	} else {
		setTimeout("fadeout()",delay);
	}
}