// JavaScript Document
/* 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] = "";
  arrFadeLinks[1] = "";
  arrFadeTitles[1] = "<b>Tom Rees, Head Teacher at Little Harrowden Primary Northants:</b><br><br>&quot;Great stuff Chris, just what we wanted! You have taken all of our ideas and turned them into something we are not just proud of, but our children and their paarents are equally enthusiastic!&quot;";
//  arrFadeLinks[2] = "";
//  arrFadeTitles[2] = "<b>Emma O'Brien, Head Teacher at Bozeat Primary Northants:</b><br><br>&quot;Website looks fab! Well done, we love it! We are particularly impressed with the way you worked so hard with us to get the colouring and style perfect for our school! I know it will become a focus for communication and your input has been invaluable.&quot;";
  arrFadeLinks[2] = "";
  arrFadeTitles[2] = "<b>Esther McIntosh, Head Teacher at Ecton Village Primary Northants:</b><br><br>&quot;I really love the website - it's perfect, just what we wanted, professional and clean! We changed our ideas a few times but you were very patient with us so a huge thanks for that! Thanks!&quot;";
  arrFadeLinks[3] = "";
  arrFadeTitles[3] = "<b>Pete Harpum, Managing Director at Harpum Consulting:</b><br><br>&quot;The website looks really great, thank you for all your hard work, we're so impressed with how you managed to get our site so high on Google after such a short time! Quite remarkable!&quot;";
  arrFadeLinks[4] = "";
  arrFadeTitles[4] = "<b>Justin Willson, Marketing Manager at Universal Office Automation:</b><br><br>&quot;I have to say, without your support, our company profile would be pretty flat! Your ideas and skills have made Universal a more viable alternative to our competitors!!&quot;";
  arrFadeLinks[5] = "";
  arrFadeTitles[5] = "<b>Quote from Ofsted Inspector May 2011:</b><br><br>&quot;...an excellent and informative website [referencing <a href=http://www.irchester.northants.sch.uk>Irchester Community Primary School's Website</a>]&quot;";
  arrFadeLinks[6] = "";
  arrFadeTitles[6] = "<b>Rakesh Parmar - ICT School Governor, Brambleside Primary, Northants:</b><br><br>&quot;Congratulations to the team involved in developing the website for Brambleside Community Primary School. There have been some excellent ideas, advice and and features built into the website which could not have been done without the expertise, design and eye for detail from Chris Elliott at Tapichre and Brambleside Community Primary School…</a>&quot;";
}


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

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