/* 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] = "testimonials.asp";
  arrFadeTitles[0] = "We were especially pleased at the way in which the whole project was managed and how the work was carried out so efficiently. <br><br> Dave Stanton & Kathy Graham";
  arrFadeLinks[1] = "testimonials.asp";
  arrFadeTitles[1] = "I would like to thank you and your team for completing the work on our bathroom and downstairs cloakroom both on time and to a very high standard<br> Wendy Roberts";
  arrFadeLinks[2] = "testimonials.asp";
  arrFadeTitles[2] = "We are delighted with the outcome and rest assured we will not hesitate in recommending your services to other clients should the need arise.<br><br> Graham Salter";
  arrFadeLinks[3] = "testimonials.asp";
  arrFadeTitles[3] = "Vicki and I would like to thank you and your team for an excellent professional job and attention to detail.<br><br> Robert &amp; Vicky Cliff";
  arrFadeLinks[4] = "testimonials.asp";
  arrFadeTitles[4] = "We are delighted with the end result and were very impressed with your whole team and how you handled the project.<br><br> Mr &amp; Mrs Prescott";
}

// 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 = 3000;
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, 100);
  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)
  {
  }
}

