var quotes = [
  '"Sufferfest of the year"  <em>&#8212;<a href="http://thedailypage.com/">Isthmus</a></em>',
  '"The designer of this route was evil and sadistic." <em>&#8212;<a href="http://www.djwriter.com/cycling/dayrides/reports/hhh03.html">David Johnsen</a></em>',
  '"Why?  Because we can." <em>&#8212;<a href="http://www.mtn.org/tcbc/events/hhh-2003-report.htm">Twin Cities Bicycling Club</a></em>',
  '"The hardest day of cycling I\'ve ever done. It was epic!" <em>&#8212;Ben Neff, Cronometro team</em>',
  '"Harder than the Assault on Mt. Mitchell." <em>&#8212;Nolan Culberson</em>',
  '"This ride is destined to become legendary around the Midwest. It\'s going to attract a lot of insane people." <em>&#8212; Cronometro rider</em>',
  '"Amazing scenery, but scenery becomes secondary when you can\'t feel your legs!" <em>&#8212;the Iowa Big Dogs</em>',
  '"Five thousand feet of climbing is a very tough century. Ten thousand is unreal." <em>&#8212;the Iowa Big Dogs</em>'
];
var start = 0;
var tm_max = 10000;
var tm_fade = 2000;
var tm_step = 200;
var tm_out = null;
var lastcolor = "";
function rotquote()
{
   var tm = (new Date()).getTime() - start;
   var e;
   if (tm >= tm_max)
   {
      var n = Math.floor(Math.random()*quotes.length);
      e = document.getElementById("quote");
      e.innerHTML = quotes[n];
      start = (new Date()).getTime();
      tm = 0;
   }
   var opac = tm < tm_fade ? 255.0*tm/tm_fade : (tm > tm_max-tm_fade ? 255.0*(tm_max - tm)/tm_fade : 255.0);
   var color = Math.floor(opac);
   if (color != lastcolor)
   {
      lastcolor = color;
      //window.status = "rgb("+color+","+color+","+color+") "+tm;
      if (e == null)
         e = document.getElementById("quote");
      e.style.color = "rgb("+color+","+color+","+color+")";
   }
   tm_out = setTimeout("rotquote()", color == 255 ? tm_max-tm-tm_fade : tm_step);
}
function stopquote()
{
   clearTimeout(tm_out);
   var e = document.getElementById("quote");
   e.style.color = "#FFFFFF";   
}
function startquote()
{
   if (quotes.length > 0)
   {
      var e = document.getElementById("quote");
      e.onclick = stopquote;
      tm_out = setTimeout("rotquote()", tm_step);
   }
}
