/* 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] = "#";
  arrFadeTitles[0] = "I couldn't be happier with the work that 21centuryweb did for me. They responded very quickly to any changes that I wanted to make, and were very patient with me as I wasn't entirely sure what I wanted. Great product at a great price. I would recommend them to everyone.<img border=\"0\" width=\"20\" height=\"15\" src=\"http://www.21centuryweb.com/wp-content/themes/centurywebnew/images/quote2.gif\"><br><br><br><br><img border=\"0\" align=\"left\" width=\"35\" height=\"44\" hspace=\"3\" src=\"http://www.21centuryweb.com/wp-content/themes/centurywebnew/images/stephen_hayes_mccoy.gif\">Stephen Hayes-McCoy<br>Canada";
  arrFadeLinks[1] = "#";
  arrFadeTitles[1] = "I was very satisfied with the work and will use this firm in the future. Solid design, very responsive and job was done well ahead of schedule.<img border=\"0\" width=\"20\" height=\"15\" src=\"http://www.21centuryweb.com/wp-content/themes/centurywebnew/images/quote2.gif\"><br><br><br><br><img border=\"0\" align=\"left\" width=\"35\" height=\"44\" hspace=\"3\" src=\"http://www.21centuryweb.com/wp-content/themes/centurywebnew/images/karen-lee.gif\">Karen Lee<br>jewelry by karenlee";
  arrFadeLinks[2] = "#";
  arrFadeTitles[2] = "I started with one project and have completed several more... repeat business is a sure sign of a happy customer. Very good work from these guys!<img border=\"0\" width=\"20\" height=\"15\" src=\"http://www.21centuryweb.com/wp-content/themes/centurywebnew/images/quote2.gif\"><br><br><br><br><img border=\"0\" align=\"left\" width=\"35\" height=\"44\" hspace=\"3\" src=\"http://www.21centuryweb.com/wp-content/themes/centurywebnew/images/gary_jezorski.gif\">Gary Jezorski";
/*<!--  arrFadeLinks[3] = "#";
  arrFadeTitles[3] = "I started with one project and have completed several more... repeat business is a sure sign of a happy customer. Very good work from these guys!<img border=\"0\" width=\"20\" height=\"15\" src=\"http://192.168.1.52/www/21centuryweb.com/wp-content/themes/centuryweb/images/quote2.gif\"><br><br><br><br><img border=\"0\" align=\"left\" width=\"33\" height=\"33\" hspace=\"3\" src=\"http://192.168.1.52/www/21centuryweb.com/wp-content/themes/centuryweb/images/customer.jpg\">Gary Jezorski";-->*/
/*<!--  arrFadeLinks[4] = "http://javascriptsource.com/snippets/insertafter.html";
  arrFadeTitles[4] = "5. insertAfter()";-->*/
}

// 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;
var m_FadeStep = 3;
var m_FadeWait = 1600;
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, 30);
  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)
  {
  }
}
