function QuoteScroller(speed)
{
   this.updateCounter = 0;
   this.speed = speed;
   this.currentQuote = getRandomQuote() + getRandomQuote();
}

var scrollerArray = new Array();
scrollerArray[0] = new QuoteScroller(8);
scrollerArray[1] = new QuoteScroller(6);
scrollerArray[2] = new QuoteScroller(10);
scrollerArray[3] = new QuoteScroller(3);
scrollerArray[4] = new QuoteScroller(9);
scrollerArray[5] = new QuoteScroller(11);

if(!document.all)
{
   document.captureEvents(Event.MOUSEMOVE);
}

document.onmousemove = updateText;
function initText()
{
   // initialise each scroller with 2 quotes
   // (make sure it's long enough to fill the bubble)
   for(var i=0; i<scrollerArray.length; i++)
   {
      document.movingTextForm.elements['movingText' + get2Digits(i)].value = scrollerArray[i].currentQuote;
   }
}

function updateText()
{
   // make sure we're not updating before the form is declared
   if(document.movingTextForm)
   {
      for(var i=0; i<scrollerArray.length; i++)
      {
         // time to update this scroller?
         scrollerArray[i].updateCounter++;
         if(scrollerArray[i].updateCounter >= scrollerArray[i].speed)
         {
            // chop off the first character, and add one to the end from our current quote
            document.movingTextForm.elements['movingText' + get2Digits(i)].value = document.movingTextForm.elements['movingText' + get2Digits(i)].value.substring(1) + scrollerArray[i].currentQuote.charAt(0);

            // check if we've used all of the current quote yet. if so, get a new one
            if(scrollerArray[i].currentQuote.length <= 1)
            {
               scrollerArray[i].currentQuote = getRandomQuote();
            }
            else
            {
               scrollerArray[i].currentQuote = scrollerArray[i].currentQuote.substring(1);
            }

            scrollerArray[i].updateCounter = 0;
         }
      }
   }
}

function get2Digits(digit)
{
   if(digit < 10)
   {
      return ("0" + digit);
   }
   else
   {
      return ("" + digit);
   }
}

function getRandomDigit()
{
   return Math.round(Math.random());
}

