<!-- Paste this code into an external JavaScript file named: marquee.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Mike Hudson :: http://www.afrozeus.com */

function setupFadeLinks() {
//  arrFadeLinks[0] = "http://javascriptsource.com/snippets/popup-blocker-detection.html";
//  arrFadeTitles[0] = "1. Popup Blocker Detection";

/*
  arrFadeLinks[0] = "http://javascriptsource.com/snippets/popup-blocker-detection.html";
  arrFadeTitles[0] = "1. Popup Blocker Detection";
  arrFadeLinks[1] = "http://javascriptsource.com/forms/code-box-editor.html";
  arrFadeTitles[1] = "2. Code Box Editor";
  arrFadeLinks[2] = "http://javascriptsource.com/miscellaneous/mailto.html";
  arrFadeTitles[2] = "3. mailTo";
  arrFadeLinks[3] = "http://javascriptsource.com/cookies/delicious-cookies.html";
  arrFadeTitles[3] = "4. Delicious Cookies";
  arrFadeLinks[4] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[4] = "5. insertAfter()";
*/
  arrFadeLinks[0] = "http://javascriptsource.com/snippets/popup-blocker-detection.html";
  arrFadeTitles[0] = "&quot No one knows what will be. But you can prepare for what might be.&quot ~Aegean Wealth Management Founder";

  arrFadeLinks[1] = "http://javascriptsource.com/forms/code-box-editor.html";
  arrFadeTitles[1] = "&quot When goods increase, they are increased that eat them.&quot  ~Ecclesiastes 5:11";

  arrFadeLinks[2] = "http://javascriptsource.com/miscellaneous/mailto.html";
  arrFadeTitles[2] = "&quot Money is like manure.  You have to spread it around or it smells.&quot  ~J. Paul Getty";

  arrFadeLinks[3] = "http://javascriptsource.com/snippets/popup-blocker-detection.html";
  arrFadeTitles[3] = "&quot I would like to live as a poor man with lots of money.&quot  ~Pablo Picasso";

  arrFadeLinks[4] = "http://javascriptsource.com/snippets/popup-blocker-detection.html";
  arrFadeTitles[4] = "&quot Rule No.1: Never lose money. Rule No.2: Never forget rule No.1.&quot  ~Warren Buffett ";




  arrFadeLinks[5] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[5] = "&quot No complaint is more common than that of a scarcity of money.&quot  ~Adam Smith";

  arrFadeLinks[6] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[6] = "&quot The investor's chief problem - and even his worst enemy - is likely to be himself.&quot ~Benjamin Graham";

  arrFadeLinks[7] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[7] = "&quot One of the major biases in risky decision making is optimism. Optimism is a source of high-risk thinking.&quot ~Daniel Kahneman";

  arrFadeLinks[8] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[8] = "&quot Wealth is well known to be a great comforter.&quot ~Plato";

  arrFadeLinks[9] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[9] = "&quot The best way to destroy the capitalist system is to debauch the currency.&quot ~Vladimir Lenin";

  arrFadeLinks[10] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[10] = "&quot Because we live in a largely free society, we tend to forget how limited is the span of time and the part of the globe for which there has ever been anything like political freedom: the typical state of mankind is tyranny, servitude, and misery.&quot   ~ Milton Friedman";

  arrFadeLinks[11] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[11] = "&quot Gold and silver are no doubt subject to fluctuations, from the discovery of new and more abundant mines; but such discoveries are rare, and their effects, though powerful, are limited to periods of comparatively short duration.&quot   ~ David Ricardo";

  arrFadeLinks[12] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[12] = "&quot 'Emergencies' have always been the pretext on which the safeguards of individual liberty have been eroded.&quot   ~ Friedrich August von Hayek ";

  arrFadeLinks[13] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[13] = "&quot Probability is not about the odds, but about the belief in the existence of an alternative outcome, cause, or motive.&quot   ~ Nassim Nicholas Taleb ";

  arrFadeLinks[14] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[14] = "&quot Let every man divide his money into three parts, and invest a third in land, a third in business, and a third let him keep by him in reserve.&quot  ~ Talmud ";



}





// You can also play with these variables to control fade speed, fade color, and how fast the colors jump.

//var m_FadeOut = 1000;
var m_FadeOut = 255;
var m_FadeIn=0;
var m_Fade = 0;
var m_FadeStep = 3;
//var m_FadeStep = 13;

//var m_FadeWait = 1600;
//var m_FadeWait = 5000;
var m_FadeWait = 8000;
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);
  //m_iFadeInterval = setInterval(fade_ontimer, 100);
  m_iFadeInterval = setInterval(fade_ontimer, 70);
  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]; //uncomment this to make the text links.
}

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)
  {
  }
}

