function loadQuotes() {
   new Ajax.Request('/files/quotes_main.txt', {
      method: 'get',
      onSuccess: function(t) {
         var quotesraw = t.responseText;
         quotesorig = quotesraw.split('\n');
         quotes = quotesorig.slice();
         changeQuote();
      }
   });
}

function changeQuote() {
   if (quotes.length == 0) {
      quotes = quotesorig.slice();
   }
   $('quote').fade({
      afterFinish: function() {
         var quotetmp = quotes.shift().split('|');
         thisquote = quotetmp[0];
         thistimer = quotetmp[1] * 1000;
         $('quote').appear({
            beforeStart: function() {
               $('quote').update(thisquote);
            },
            afterFinish: function() {
               setTimeout(changeQuote, thistimer);
            }
         });
      }
   });
}

function changeSlideshow() {
   c++;
   if (c > 9) { c = 1; }
   $('ssbox').setStyle({background: 'url(/img/slideshow/'+c+'.jpg) no-repeat center center'});
}

function d (txt) {
   if (typeof(console) == 'object') {
      console.log(new Date + ': ' + txt);
   }
}

Event.observe(window, 'load', function() {
   c = 1;
   new PeriodicalExecuter(changeSlideshow, 3);
});
