function setupFadeLinks() {
  arrFadeLinks[0] = "http://www.ecu.edu/history/";
  arrFadeTitles[0] = "History is one of the oldest disciplines of the modern university.";
  arrFadeLinks[1] = "http://www.ecu.edu/history/";
  arrFadeTitles[1] = "It has been taught at Yale University since the 1760s and Harvard University has had a Department of History since 1839.";
  arrFadeLinks[2] = "http://www.ecu.edu/history/";
  arrFadeTitles[2] = "The utility and value of a History degree has been long accepted in American society.";
  arrFadeLinks[3] = "http://www.ecu.edu/history/";
  arrFadeTitles[3] = "And what is this value?";
  arrFadeLinks[4] = "http://www.ecu.edu/history/";
  arrFadeTitles[4] = "Students of history know that a people cannot transform their present, nor map out their future, without a proper understanding of their shared past.";
  arrFadeLinks[5] = "http://www.ecu.edu/history/";
  arrFadeTitles[5] = "Historians understand that the global leadership to which America aspires requires an understanding of the world in which America finds itself.";
  arrFadeLinks[6] = "http://www.ecu.edu/history/";
  arrFadeTitles[6] = "Civic engagement, democratic politics, and economic development --few of these are possible without an understanding of history.";
  arrFadeLinks[7] = "http://www.ecu.edu/history/";
  arrFadeTitles[7] = "East Carolina University calls upon students to become leaders in the world of tomorrow.";
  arrFadeLinks[8] = "http://www.ecu.edu/history/";
  arrFadeTitles[8] = "An education in History is a necessary part of that call.";
}

// You can also play with these variables to control fade speed, fade color, and how fast the colors jump.

var m_FadeOut = 250;
var m_FadeIn=0;
var m_Fade = 0;
var m_FadeStep = 3;
var m_FadeWait = 9000;
var m_bFadeOut = true;

var m_iFadeInterval;

window.onload = Fadewl;

var arrFadeLinks;
var arrFadeTitles;
var arrFadeCursor = 0;
var arrFadeMax;

function Fadewl() {
  m_iFadeInterval = setInterval(fade_ontimer, 10);
  arrFadeLinks = new Array();
  arrFadeTitles = new Array();
  setupFadeLinks();
  arrFadeMax = arrFadeLinks.length-1;
  setFadeLink();
}

function setFadeLink() {
  var ilink = document.getElementById("fade_link");
  ilink.innerHTML = arrFadeTitles[arrFadeCursor];
  ilink.href = arrFadeLinks[arrFadeCursor];
}

function fade_ontimer() {
  if (m_bFadeOut) {
    m_Fade+=m_FadeStep;
    if (m_Fade>m_FadeOut) {
      arrFadeCursor++;
      if (arrFadeCursor>arrFadeMax)
        arrFadeCursor=0;
      setFadeLink();
      m_bFadeOut = false;
    }
  } else {
    m_Fade-=m_FadeStep;
    if (m_Fade<m_FadeIn) {
      clearInterval(m_iFadeInterval);
      setTimeout(Faderesume, m_FadeWait);
      m_bFadeOut=true;
    }
  }
  var ilink = document.getElementById("fade_link");
  if ((m_Fade<m_FadeOut)&&(m_Fade>m_FadeIn))
    ilink.style.color = "#" + ToHex(m_Fade);
}

function Faderesume() {
  m_iFadeInterval = setInterval(fade_ontimer, 10);
}

function ToHex(strValue) {
  try {
    var result= (parseInt(strValue).toString(16));

    while (result.length !=2)
            result= ("0" +result);
    result = result + result + result;
    return result.toUpperCase();
  }
  catch(e)
  {
  }
}
