var delay = 6000; //set delay between message change (in miliseconds)
var maxsteps=60; // number of steps to take to change from start color to endcolor
var stepdelay=40; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(213,205,183); // start color (red, green, blue)
var endcolor=new Array(102,102,102); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: italic 0.8em Verdana ; padding-left: 2em; padding-right: 2em; padding-top: 5em">'; //set opening tag, such as font declarations
fcontent[0]="We have been really pleased with your service. We are in the fortunate position of not needing to advertise elsewhere.  I just wanted to give you feedback to thank you for the excellent service you provide<br/><b>D. McGurrin, Pinnacle Builders Ltd";
fcontent[1]="Excellent publication for an individual and specialist company like ours to reach the local catchment area<br/><b>Denise Tarling, David Tinsley Fine Jewellery Design";
fcontent[2]="The Carshalton Beeches Directory is very professionally run and we have received an excellent response to our advert from both existing and new clients.  Following the success of our initial three month advert, we will continue to advertise in the directory in future<br/><b>Mark Cox, Modern Decor";
fcontent[3]="Advertising in The Directory has been by far the most successful advertising we have done for the salon.  We get more customers from this publication than any other, and the rates are excellent value. I recommend The Directory to friends and business associates whenever possible.<br/><b>Natalie Venes, Seven Hairdressing";  
fcontent[4]="I refer to The Directory at least twice a month to get details of local businesses.<br/><b>Mrs T, Downside Road";
fcontent[5]="From the first issue I thought it was a winner.<br/><b>Ms T, Fairway";
fcontent[6]="My company has advertised in The Directory from the very start and we are very pleased with the response our advert has generated.  The 'local' feel of the directory is very helpful as our customers like dealing with local tradesmen who have a permanent base in the area and aren't just an anonymous mobile number.<br/><b>Gareth Bird, Tiler and Bird Property Maintenance";
fcontent[7]="I think you are doing a fantastic job and providing a real service to the Community with both the Carshalton Beeches and Wallington Directories.<br/><b>J. Durbin, Holy Trinity Church";
fcontent[8]="This advertising really works for me where others have never been successful.<br/><b>S. Emmett, Simon Emmett Carpet Cleaning";
fcontent[9]="We have been advertising within both your Directories for a good period of time and we are extremely pleased with the response and have secured some good business as a result. We have tried most publications in the surrounding areas and find your Directories are providing the best response.<br/><b>Chris Blanks Managing Director Elwyns Windows Ltd";
fcontent[10]="I would like to thank you for an excellent service with the series of ads we ran this year. Easy submission of ads, great communication, quality publication and an increase in trade, for us it is the perfect tool for reaching our local customers<br/><b>David Wilkie, The Eagle Gallery";
fcontent[11]="I had my first booking within 24 hours. Excellent.<br/><b>Tamsin Orr, Ambience Home Furnishings";
closetag='</div>';

var fwidth='290px'; //set scroller width
var fheight='210px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=1;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=fcontent.length)
    index=0
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
  document.write('<div id="fscroller" '+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent


