
/***********************************************
* Fading Scroller
***********************************************/

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(0,0,102); // start color (red, green, blue)
var endcolor=new Array(252,252,242); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font:normal 12px Arial; padding: 2px;">'; //set opening tag, such as font declarations
fcontent[0]="I can say for a fact that the times that I have been in the zone have been surreal. It's as if the rest of the table has dimmed and the noise  from the crowd has turned into a low background noise. <br><br>Really the only thing in focus was a line down the table towards the landing zone. I know my rolls were good but I can't even tell you how good, it was all mechanical and 3rd person and there was definitely applause.<br><br>-- Johnny B";
fcontent[1]="When you get in the zone, people will stay away from you and not speak to you. Ask any bowler what they do when someone is approaching the perfect 12 strikes.<br><br>When I am in the zone, I don’t have to think about it; I just block out the world and perform at my peak levels.<br><br>-- Frank K";
fcontent[2]="Congratulations on a well-written book.<br><br>I love the golf metaphor and in golf I always visualize the shot before I play it.<br><br> I do this also when shooting craps. I have actually visualized shooting a certain number and many times that number occurs when I shoot the shot.<br><br>--Rick";
fcontent[3]="I feel that the zone is a state where you let your body do what it has been trained to do. You stop thinking about what to do or why or how and just do it. <br><br>-- Scott";
fcontent[4]="During my longest rolls I was so deep in the Zone that I wasn't concerned about the outcome or even making my point.  I was totally relaxed, mind empty, calm, in a trance like state. I was able to tune out arguments and any other distractions that were happening at the table. <br><br>My end toss was picture perfect and the box numbers kept on coming and coming. The craps table ran out of chips and all that was left were dust marks where the chips had been.  Even a new chip fill didn't distract me.  <br><br>-- Howard N.";

closetag='</div>';

var fwidth='140px'; //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;


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

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);
  }
}


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);
	
  }   
}


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