// JavaScript Document

function setupFadeLinks() {

  arrFadeLinks[0] = "";

  arrFadeTitles[0] = "Therefore go and make disciples of all nations, baptizing them in the name of the Father and of the Son and of the Holy Spirit... -Matthew 28:19- NIV";

  arrFadeLinks[1] = "";

  arrFadeTitles[1] = "For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life. -John 3:16- NIV";

  arrFadeLinks[2] = "";

  arrFadeTitles[2] = "I can do all this through him who gives me strength. -Philippians 4:13- NIV";

  arrFadeLinks[3] = "";

  arrFadeTitles[3] = "And so we know and rely on the love God has for us. God is love. Whoever lives in love lives in God, and God in them. -1 John 4:16- NIV";

  arrFadeLinks[4] = "";

  arrFadeTitles[4] = "My goal is that they may be encouraged in heart and united in love, so that they may have the full riches of complete understanding, in order that they may know the mystery of God, namely, Christ... -Colossians 2:2- NIV";

}



// You can also play with these variables to control fade speed, fade color, and how fast the colors jump.



var m_FadeOut = 255;

var m_FadeIn=0;

var m_Fade = 0;

// Speed of Fade. Higher number = Faster fade

var m_FadeStep = 3;

// Length of time between FadeIn to FadeOut. 1000 = 1 sec.

var m_FadeWait = 10000;

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)

  {

  }

}
