// Marquee.js V 1.1 10/25/2007 by J. Bradley Reck
// start by calling fadetext()

hex = 0;
var textpos = 0;
var timeToWait = 3.5;

function fadetext() {
  hex = 0;
  setTimeout("textfadeout()", timeToWait * 1000);
}

function textfadeout() {
  // fade text id' as Marquee to white
  if(hex < 255) { //If color is not white yet
     hex += 11; // increase color darkness
     document.getElementById("Marquee").style.color="rgb("+hex+","+hex+","+hex+")";
    setTimeout("textfadeout()",42); 
   } else {
     setTimeout("rotateText()",1000); // wait one second
  }
}

function textfadein() { 
  // fade text id' as Marquee to black
  if(hex > 0) { //If color is not black yet
    hex -= 11; // increase color darkness
    document.getElementById("Marquee").style.color="rgb("+hex+","+hex+","+hex+")";
    setTimeout("textfadein()",42);
   } else {
   fadetext();
  }
}

function changetext(newText){   document.getElementById("Marquee").innerHTML=newText; }

// Change Marquee text and display time
function rotateText() {
     textpos = textpos + 1;
     if(textpos == newText.length) { textpos = 0; }
     timeToWait = newText[textpos][1];
     changetext(newText[textpos][0]);
     textfadein();
}