/* 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://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[0] = "A bookstore is one of the only pieces of evidence we have that people are still thinking. -- Jerry Seinfeld<br><br>A bore is a man who, when you ask him how he is, tells you. -- Bert Leston Taylor, The So-Called Human Race (1922)";

  arrFadeLinks[1]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[1] = "A boy can learn a lot from a dog: obedience, loyalty, and the importance of turning around three times before lying down. -- Robert Benchley<br><br>A fact is a simple statement that everyone believes. It is innocent, unless found guilty. A hypothesis is a novel suggestion that no one wants to believe. It is guilty, until found effective. -- Edward Teller";

  arrFadeLinks[2]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[2] = "A great many people think they are thinking when they are really rearranging their prejudices. -- William James<br><br>A happy childhood has spoiled many a promising life. -- Robertson Davies, 'What's Bred in the Bone'";

  arrFadeLinks[3]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[3] = "A happy childhood is poor preparation for human contacts. -- Colette<br><br>A lifetime is more than sufficiently long for people to get what there is of it wrong. -- Piet Hein, 'Grooks'";

  arrFadeLinks[4]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[4] = "A little nonsense now and then, is relished by the wisest men. -- Anonymous, Also used in 'Charlie and the Chocolate Factory'<br><br>A man is not idle because he is absorbed in thought. There is a visible labor and there is an invisible labor. -- Victor Hugo";

  arrFadeLinks[5]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[5] = "A man is rich in proportion to the number of things he can afford to let alone. -- Henry David Thoreau<br><br>A timid person is frightened before a danger, a coward during the time, and a courageous person afterward. -- Jean Paul Richter";

  arrFadeLinks[6]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[6] = "A true friend is the greatest of all blessings, and that which we take the least care of all to acquire. -- Francois de La Rochefoucauld<br><br>A truly great book should be read in youth, again in maturity and once more in old age, as a fine building should be seen by morning light, at noon and by moonlight. -- Robertson Davies";

  arrFadeLinks[7]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[7] = "A wise man gets more use from his enemies than a fool from his friends. -- Baltasar Gracian<br><br>All truths are easy to understand once they are discovered; the point is to discover them. -- Galileo Galilei";
  
  arrFadeLinks[8]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[8] = "Almost all absurdity of conduct arises from the imitation of those whom we cannot resemble. -- Samuel Johnson<br><br>An intellectual is a man who takes more words than necessary to tell more than he knows. -- Dwight D. Eisenhower";

  arrFadeLinks[9]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[9] = "An opinion should be the result of thought, not a substitute for it. -- Jef Mallett, Frazz, 04-04-07<br><br>And remember, no matter where you go, there you are. -- Earl Mac Rauch, from 'Buckaroo Bansai'";

  arrFadeLinks[10]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[10] = "Anger is the feeling that makes your mouth work faster than your mind. -- Evan Esar<br><br>Another unsettling element in modern art is that common symptom of immaturity, the dread of doing what has been done before. -- Edith Wharton";

  arrFadeLinks[11]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[11] = "Any great truth can -- and eventually will -- be expressed as a cliche -- a cliche is a sure and certain way to dilute an idea. For instance, my grandmother used to say, 'The black cat is always the last one off the fence.' I have no idea what she meant, but at one time, it was undoubtedly true. -- Solomon Short<br><br>Art is science made clear. -- Jean Cocteau";

  arrFadeLinks[12]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[12] = "Ask yourself whether you are happy and you cease to be so. -- John Stuart Mill<br><br>Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind. -- Dr. Seuss";

  arrFadeLinks[13]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[13] = "Books have the same enemies as people: fire, humidity, animals, weather, and their own content. -- Paul Valery<br><br>I love quotations because it is a joy to find thoughts one might have, beautifully expressed with much authority by someone recognized wiser than oneself. -- Marlene Dietrich";

  arrFadeLinks[14]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[14] = "A fine quotation is a diamond on the finger of a man of wit, and a pebble in the hand of a fool. -- Joseph Roux<br><br>I often quote myself. It adds spice to my conversation.  -- George Bernard Shaw";

  arrFadeLinks[15]  = "http://www.cdroms.com.au/cd/cd-duplication.html";
  arrFadeTitles[15] = "I improve on misquotation. -- Cary Grant";
}



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

var m_FadeOut =10;
var m_FadeIn=0;
var m_Fade = 0;
var m_FadeStep = 5;
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, 50);
  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)
  {
  }
}
