﻿var delay = 6000; //set delay between message change (in miliseconds)
var maxsteps=30; // 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(255,255,255); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: normal 12px Trebuchet MS; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="&ldquo;<em>The home I was looking to buy was on the water and I had several specific concerns. I was pleased with the way that Jeremy handled my questions and how quickly he fit me into his schedule, as time was of the essence.  I now own that home and thanks to HOMEEXTENT Inspection Services, there were no surprises.&rdquo;</em><br /> Jonathan F. Crystal Beach ON.";
fcontent[1]="&ldquo;<em>Jeremy took his time to explain things in a non-technical way. This was extremely important give the fact that I was a first time buyer and heavily reliant upon Jeremy to find anything not obvious to the naked eye. I would recommend HOMEEXTENT Inspection Services to my family and friend without hesitation as his customer service and professionalism were remarkable!&rdquo;</em><br /> Patrick W. Grimsby ON.";
fcontent[2]="&ldquo;<em>When you live 2700 kilometers away, buying your dream home can be a nightmare. Getting documents and information back and forth between HOMEEXTENT Inspection Services in Ontario and us in Alberta was as quick and easy as being a block away. It was detailed information we could rely on to make good decisions. Jeremy, You made our dream home come true!&rdquo;</em><br /> Georgia M.  Red Deere, ALB.";
fcontent[3]="&ldquo;<em>As a single mom, it was kind of scary choosing a home inspector. Thankfully, HOMEEXTENT Inspection Services was recommended to me and they were GREAT! Jeremy took time with me to explain how my new house works as a system and even told me how to make it more energy efficient!&rdquo;</em><br /> Debbie V. Niagara Falls ON.";
fcontent[4]="&ldquo;<em>HOMEEXTENT Inspection Services handled the inspection of my house with high professional attitude and was always ready to answer my numerous questions even when it meant that he had to stop what he were doing. The fee that was charged was one of the best for my buck.  I will not hesitate to recommend Jeremy to any of my friends. HOMEEXTENT Inspection Services is very reliable and dependable&rdquo;</em><br /> Carmen C. St. Catharines ON.";
fcontent[5]="&ldquo;<em>Jeremy did an perfect job of showing and explaining to me his in-depth findings and reporting. I am recommending HOMEEXTENT Inspection Services to any of my friends who are looking for a Home Inspection. Thanks!!&rdquo;</em><br /> Danny D. Welland ON.";
fcontent[6]="&ldquo;<em>Thanks for the report and the information on the rebate programs.Andrew and I enjoyed meeting you and we thank you for conducting such a thorough inspection on 7 Heywood. In particular, we valued very much the time you took to explain your findings and to answer our questions. We learned a great deal and we feel better about our decision to purchase this house.&rdquo;</em><br /> Linda & Andrew St. Catharines ON.";
fcontent[6]="&ldquo;<em>The contractor was paid to install the insulation but looks like it was forgotton.  The current owners will have the contractor install the missing insulation in the attice before th home is sold.  The extra $40 for the thermal imaging scan saved us $1,200 down the road!&rdquo;</em><br /> Scott Putman St. Catharines ON.";


closetag='</div>';

var fwidth='100%'; //set scroller width
var fheight='100px'; //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=0;
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" style="border:0px solid black;width:'+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

