/***********************************************
* 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
***********************************************/

var delay = 2000; //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 id="scrolling-testimonials"><span style="color:#677cbc; font-family:\'Century Gothic\', Arial, Helvetica, sans-serif;	font-size:15px;	font-weight:bold; font-style:italic; margin:0;">What People Are Saying > </span>'; //set opening tag, such as font declarations
fcontent[0]="<div class=\"testimonials\">\"Press On Veneers is such a good deal. I am a very happy customer!\" - Gigi Mac Lean of London</div>";
fcontent[1]="<div class=\"testimonials\">\"Your process is super! It was money well spent and we could not be happier.\" - Tom Kingston of Sydney</div>";
fcontent[2]="<div class=\"testimonials\">\"With my new white smile I have my self confidence back and I smile all the time.\" – Bernice</div>";
fcontent[3]="<div class=\"testimonials\">\"I no longer have to hide my mouth!\" – Will S of New Orleans, LA</div>";
fcontent[4]="<div class=\"testimonials\">\"After receiving the Press-On Veneers, Mom's trust in Brighter Image was affirmed.\" – Tess H of Flagstaff, AZ</div>";
fcontent[5]="<div class=\"testimonials\">\"Your staff really put my fears at ease.\" – Jill D of Atlanta, GA</div>";
fcontent[6]="<div class=\"testimonials\">\"I have many compliments on my natural looking smile.\" – Robert K of Oklahoma City, OK</div>";
fcontent[7]="<div class=\"testimonials\">\"You can't even tell that it is Press-On Veneers and not my teeth!\" – Luke P of Seattle, WA</div>";
fcontent[8]="<div class=\"testimonials\">\"You are an excellent dental lab!\" – Erin M of Boise, ID</div>";
fcontent[9]="<div class=\"testimonials\">\"The words 'thank you' hardly seem enough, But they're coming from the heart.\" – Ishiru N. of Tokyo</div>";
fcontent[10]="<div class=\"testimonials\">\"I look forward to being a Brighter Image client for many years.\" – Ashley B of Salt Lake City, UT</div>";
fcontent[11]="<div class=\"testimonials\">\"As a result of Press-On Veneers, I am much more confident\" – Luis V of Los Angeles, CA</div>";
fcontent[12]="<div class=\"testimonials\">\"I have yet to find a dental lab online of their caliber.\" – Timothy R of Midland, TX</div>";
fcontent[13]="<div class=\"testimonials\">\"Successful dental labs are involved from start to finish.\" – Thomas K - Lab Technician of Shreveport, LA</div>";
fcontent[14]="<div class=\"testimonials\">\"From my very first call you offered friendly, prompt & professional service.\" – Marcie K of Dublin</div>";
fcontent[15]="<div class=\"testimonials\">\"With Brighter Image's wonderful staff, you are not just a client, you are family!\" – Gene S -- Wichita, KS</div>";
fcontent[16]="<div class=\"testimonials\">\"How fortunate I was to have selected Brighter Image when ordering online!\" – Gayla M of Arlington, VA</div>";
fcontent[17]="<div class=\"testimonials\">\"I only wish I'd purchased Press-On Veneers about 10 years sooner.\" – Fred H of Tacoma, WA</div>";
fcontent[18]="<div class=\"testimonials\">\"I have a great smile thanks to you all.\" – Kellie C of Birmingham, AL</div>";
fcontent[19]="<div class=\"testimonials\">\"Your entire staff is some of the friendliest people I have ever spoken with.\" – Miles W of New York, NY</div>";
fcontent[20]="<div class=\"testimonials\">\"I was ashamed to smile before, but now I feel the freedom of laughter.\" – Xavier S of Oakland, CA</div>";
fcontent[21]="<div class=\"testimonials\">\"My smile has been restored thanks to Press-On Veneers!\" – Ken A of Orlando, FL</div>";
fcontent[22]="<div class=\"testimonials\">\"I'm so happy with my new smile. My teeth look like I just got braces removed!\" – Brandy S -- Hays, KS</div>";
closetag='</div>';


var fwidth='730px'; //set scroller width
var fheight='20px'; //set scroller height

var fadelinks=0;  //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="background-image:url("/images/testimonials-bg.png");width:'+fwidth+';height:'+fheight+';padding-top:15px;"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent
