/***********************************************
* 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 = 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(194,21,28); // start color (red, green, blue)
var endcolor=new Array(255,255,255); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div>'; //set opening tag, such as font declarations
fcontent[0]="<em>Bobby Fowler, Jr. two-time NCSA National Champion and world titleholder, Texas Hall of Fame inductee, perennial member on the NSCA All-...</em><br /><br /><strong>Bobby Fowler, Jr.</strong>";
fcontent[1]="<em>After deciding to replace the factory pad on my BT-99, and talking to other shooters that were using KICK-EEZ Recoil Pads, I contacted ...</em><br /><br /><strong>Dennis of Faifield, IL</strong>";
fcontent[2]="<em>I doubt I have ever been so pleased by the performance of any other firearms related product! My T/C Encore in .308 has a rather nasty ...</em><br /><br /><strong>Jerry, Monument, CO</strong>";
fcontent[3]="<em>Installed and sanded down my KICK-EEZ recoil pad in about half an hour. Very easy to sand pad to match stock. Definitely helps tame tho...</em><br /><br /><strong>Michael of Collinsville, IL</strong>";
fcontent[4]="<em>Very nice, ground easy and oiled up nice. The best part about a KICK-EEZ recoil pad is you don\'t feel a THING when shooting!</em><br /><br /><strong>Thomas of Milwaukee, WI</strong>";
fcontent[5]="<em>When I first saw the KICK-EEZ Recoil Pad, I must say that I had my doubts as to how effective it would be to tame the kick of my 6 ½ l...</em><br /><br /><strong>Jim Lorbeski</strong>";
fcontent[6]="<em>Thank you very much for your generous donation for the ‘Fun Shoots” being held for brave military members recuperating from injurie...</em><br /><br /><strong>Ed Hoffer</strong>";
fcontent[7]="<em>I used this pad to extend the length on a Winchester 21 shotgun that had a curved butt. I found out from KICK-EEZ that you can put them...</em><br /><br /><strong>David of Mission Viejo, CA</strong>";
fcontent[8]="<em>I feel this is the best recoil pad I have ever used. Every new rifle or shotgun I purchase, the first thing I put on them is a KICK-EEZ...</em><br /><br /><strong>Jerry of Boise, ID</strong>";
fcontent[9]="<em>If there is a better quality recoil reducer available for a rifle, I haven\'t seen it. The KICK-EEZ recoil pad is exceptionally easy to ...</em><br /><br /><strong>Gary of Indio, CA</strong>";
fcontent[10]="<em>“I needed a pad for my Browning 525 and went on a web search. One of the GOOGLE sites was KICK-EEZ (www.kickeezproducts.com ) and up ...</em><br /><br /><strong>Mike Poore, PA</strong>";
fcontent[11]="<em>With 2 mobile workshops covering 30 states, we do more custom fitting sessions than any other shop in the country. Having carried the K...</em><br /><br /><strong>Todd Nelson</strong>";
fcontent[12]="<em>KICK-EEZ recoil pads are easy to fit to my Winchester Model 70 in .300 Win Mag. Brings the “felt recoil” down to the level of my cu...</em><br /><br /><strong>Joe of Houston, TX</strong>";
fcontent[13]="<em>I stock and install KICK-EEZ pads exclusively. I feel that they give the best balance of recoil reduction, ease of installation and app...</em><br /><br /><strong>Ken Rucker</strong>";
 
closetag='</div>';

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

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