/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

// ActionScript Communications Document
var delay = 10000; //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(200,200,200); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

var fcontent=new Array();
begintag=''; //set opening tag, such as font declarations, div tags
fcontent[0]="<a href='images/letter_cv.pdf' target='_blank'><p>Our experience on all projects was overwhelmingly positive, and BEC remains our consistent top choice as a General Contractor.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Larry Warshaw and Perry Lorenz</em></a>";
fcontent[1]="<a href='images/letter_fb.pdf' target='_blank'><p>If asked, we would highly recommend Bailey Elliott Construction as a quality contractor.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Fellowship Baptist Church</em></a>";
fcontent[2]="<a href='images/letter_eg.pdf' target='_blank'><p>Bailey Elliott Construction is extremely competent and they will go out of their way to satisfy you as a client.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Lee Combs</em></a>";
fcontent[3]="<a href='images/letter_cv.pdf' target='_blank'><p>We have worked with several other Contractors over the years, and our experience with BEC exceeds all others. <img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Constructive Ventures</em></a>";
fcontent[4]="<a href='images/letter_eg.pdf' target='_blank'><p>On many occasions I have been impressed by Bailey Elliott’s knowledge and resourcefulness in the construction process.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– The Emerson Group</em></a>";
fcontent[5]="<a href='images/letter_cv.pdf' target='_blank'><p>With BEC, we are always confident that we have chosen the right contractor.  We could not recommend these guys more.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Larry Warshaw and Perry Lorenz</em></a>";
fcontent[6]="<a href='images/letter_eg.pdf' target='_blank'><p>I have seen the Bailey Elliott principals, Scott Wilson and Keith Pool, put the interest of their clients ahead of their own interest.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Lee Combs</em></a>";
fcontent[7]="<a href='images/letter_cv.pdf' target='_blank'><p>BEC has the horsepower of a commercial contractor, but they also know how to properly manage the quality of finishes for a residential customer.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Constructive Ventures</em></a>";
fcontent[8]="<a href='images/letter_eg.pdf' target='_blank'><p>Bailey Elliott’s value in construction is not measured by an initial bid; instead it includes things such as quality, timeliness, satisfaction, and final cost.<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– The Emerson Group</em></a>";
fcontent[9]="<a href='images/letter_eg.pdf' target='_blank'><p>I appreciate Bailey Elliott’s dedication to customer service<img src='images/quotes_closed.png' width='16' height='13' border='0'></p><em>– Lee Combs</em></a>";
closetag=''; //set end tag, such as font declarations

var fwidth='180px'; //set scroller width
var fheight='250px'; //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";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