var STAGES = 20;
var OVER_TIME = 2000;
var STATIC_TIME = 10000;

var r_text = new Array ();

r_text.push("&ldquo;Respect creates intellectual safety, the best environment for thinking&rdquo;<br/><br/>Nancy Kline");
r_text.push("&ldquo;If there are two equal actions, take the bolder one&rdquo;<br/><br/>General Slim");
r_text.push("&ldquo;Be the Change you want to see in the world&rdquo;<br/><br/>Ghandi");
r_text.push("&ldquo;We are the ones we&rsquo;ve been waiting for&rdquo;<br/><br/>from the poem The Hour of the Wolf from the Elders of Hopi Nation");
r_text.push("&ldquo;The world will never starve for want of wonders; but only for want of wonder&rdquo;<br/><br/>Gilbert Keith Chesterton");
r_text.push("&ldquo;There is nothing stronger in the world than gentleness&rdquo;<br/><br/>Han Suyin");
r_text.push("&ldquo;Do not follow where the path may lead. Go instead where there is no path and leave a trail. Only those who will risk going too far can possibly find out how far one can go&rdquo;<br/><br/>T S Elliot");
r_text.push("&ldquo;Imagination is more important than knowledge&rdquo;<br/><br/>Albert Einstein");
r_text.push("&ldquo;Effective Leadership is the aligning of strengths that make the weaknesses irrelevant&rdquo;<br/><br/>Peter Drucker");
r_text.push("&ldquo;If you want to go faster, go alone; if you want to go further, go together&rdquo;<br/><br/>African proverb");
r_text.push("&ldquo;We are what we think. All that we are arises with our thoughts. With our thoughts we make the world&rdquo;<br/><br/>Buddha");
r_text.push("&ldquo;People are the strength of the organization. Their levels of energy and interest determine capacity and capability. People design and hold strengths available to enhance the future through strategic conversations&rdquo;<br/><br/>Jane Galloway &ndash; Seiling &amp; Jackie Stavros");
r_text.push("&ldquo;If I were to wish for anything, I should not wish for wealth and power, but for the passionate sense of the potential, for the eye which, ever young and ardent, sees the possible.  Pleasure disappoints, possibility never&rdquo;<br/><br/>Kierkegaard");

r_text.push("&ldquo;Change the way you look at things and the things you look at change&rdquo;<br/><br/>Wayne Dyer");
r_text.push("&ldquo;When a community of People discovers that they share a concern, change begins. There is no power equal to a community discovering what it cares about.&rdquo;<br/><br/>Margaret Wheatley - <em>Turning to See One Another</em>");
r_text.push("&ldquo;Questions are openings for creating something new&rdquo;<br/><br/>Harrison");
r_text.push("&ldquo;What impact is my question having...is it helping to generate conversations about the good, the better, the possible...is it strengthening our relationships?&rdquo;<br/><br/>Cooperider &amp; Whitney");
r_text.push("&ldquo;If you keep on doing what you always did, you'll keep getting what you always got&rdquo;<br/><br/>anonymous saying");
r_text.push("&ldquo;If you ask the right questions before you make a choice, you will shift yourself away from automatic, repetitive cycles and toward deliberate, focussed steps that will lead you toward the future you desire. The right questions penetrate your denial systems and wake you up.&rdquo;<br/><br/>M Adams - <em>Change your questions Change your life</em>");

r_text.push("&ldquo;There is nothing so noble as public service&rdquo;<br/><br/>Barack Obama");
r_text.push("&ldquo;When the 'theys' go away and the 'we' shows up, people's awareness and capabilities change&rdquo;<br/><br/>Peter Senge et al - <em>Presence</em>");
r_text.push("Studs Terkel, from his book <em>Working</em>, who defined:<br/><br/>'work as &ldquo;a search for daily meaning as well as daily bread, for recognition as well as cash... in short, for a sort of life rather than a Monday through Friday sort of dying&rdquo;. We have the right to ask of work that it include meaning, recognition, astonishment and life'");

r_text.push("&ldquo;Allowing us to see both the forest and the trees&rdquo;<br/><br/>Barbara Fredrickson");
r_text.push("&ldquo;Large scale change is brought about through many small steps, micro-moments ... and the acts of human kindness.&rdquo;<br/><br/>Anne Radford 2009");
r_text.push("&ldquo;We have a lot to do. Let's go slowly.&rdquo;");
r_text.push("&ldquo;It's easier to ask for forgiveness than for permission&rdquo;");
r_text.push("&ldquo;We don't have to be Solomon to be serious. We can be serious and have fun.&rdquo;");

r_text.sort(function() {return 0.5 - Math.random()});

var colour1 = Array("FF","FD","D0");
var colour2 = Array("3D","00","60");

var qd = document.getElementById("quotes");

var quoteNumber = 0;
pickQuote();

var stage = 0;
fadeIn(); 

function pickQuote()
{
	qd.innerHTML = r_text[quoteNumber];
	quoteNumber++;
	quoteNumber = quoteNumber % r_text.length;
}
	
function fadeIn()
{
	setColour(stage/STAGES);
	stage++;
	if (stage <= STAGES)
	{
		setTimeout("fadeIn()", OVER_TIME/STAGES);
	}
	else
	{
		stage = 0;
		setTimeout("fadeOut()", STATIC_TIME);
	}
}

function fadeOut()
{
	setColour(1 - stage/STAGES);
	stage++;
	if (stage <= STAGES)
	{
		setTimeout("fadeOut()", OVER_TIME/STAGES);
	}
	else
	{
		pickQuote();
		stage = 0;
		fadeIn();
	}
}


function setColour(phase)
{
	var r = Math.floor(Math.floor("0x" + colour1[0]) + phase * (Math.floor("0x" + colour2[0]) - Math.floor("0x" + colour1[0])));
	var g = Math.floor(Math.floor("0x" + colour1[1]) + phase * (Math.floor("0x" + colour2[1]) - Math.floor("0x" + colour1[1])));
	var b = Math.floor(Math.floor("0x" + colour1[2]) + phase * (Math.floor("0x" + colour2[2]) - Math.floor("0x" + colour1[2])));
	var newColour = r * 65536 + g * 256 + b;
	qd.style.color = "#" + newColour.toString(16);
}



