//Thoroughly modifed scripts from dynamic drive.


/***********************************************
* 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 = 14000; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=30; // 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(120,120,120); // end color (red, green, blue)

var fcontent=new Array();
fcontent[0]="Imagination is more important than knowledge.<span>&#151; Albert Einstein</span>";
fcontent[1]="Success seems to be largely a matter of hanging on after others have let go.<span>&#151; William Feather</span>";
fcontent[2]="We are what we repeatedly do. Excellence, therefore, is not an act but a habit.<span>&#151; Aristotle</span>";
fcontent[3]="Everything should be made as simple as possible, but not one bit simpler.<span>&#151; Albert Einstein</span>";
fcontent[4]="Even if you are on the right track, you'll get run over if you just sit there.<span>&#151; Will Rogers</span>";
fcontent[5]="If you can find a path with no obstacles, it probably doesn't lead anywhere.<span>&#151; Frank A. Clark</span>";
fcontent[6]="We are continually faced with a series of great opportunities brilliantly disguised as insoluble problems.<span>&#151; John W. Gardner</span>";
fcontent[7]="The best way to have a good idea is to have lots of ideas.<span>&#151; Linus Pauling</span>";
fcontent[8]="Lots of folks confuse bad management with destiny.<span>&#151; Kim Hubbard</span>";
fcontent[9]="Turbulence is opportunity. Embrace turbulence and use it for change.<span>&#151; Ramsay Clark</span>";
fcontent[10]="The best way to predict the future is to invent it.<span>&#151; Alan Kay</span>";
fcontent[11]="No matter what business you're in, you can't run in place or someone will pass you by.<span>&#151; Jim Valvano</span>";
fcontent[12]="Do ... or do not. There is no try.<span>&#151; YODA</span>";
fcontent[13]="One can never consent to creep when one feels an impulse to soar.<span>&#151; Helen Keller</span>";
fcontent[14]="If you don't drive your business you will be driven out of business.<span>&#151; Bertie Charles Forbes</span>";
fcontent[15]="Problems are only opportunities in work clothes.<span>&#151; Henry J. Kaiser</span>";
fcontent[16]="Whenever an individual or a business decides that success has been attained, progress stops.<span>&#151; Thomas J. Watson Jr.</span>";
fcontent[17]="I was taught that the way of progress is neither swift nor easy.<span>&#151; Marie Curie</span>";
fcontent[18]="Pleasure in the job puts perfection in the work.<span>&#151; Aristotle</span>";
fcontent[19]="Energy and persistence conquer all things.<span>&#151; Benjamin Franklin</span>";
fcontent[20]="Small opportunities are often the beginning of great enterprises.<span>&#151; Demosthenes</span>";
fcontent[21]="A wise man will make more opportunities than he finds.<span>&#151; Sir Francis Bacon</span>";
fcontent[22]="Never promise more than you can perform.<span>&#151; Publilius Syrus</span>";
fcontent[23]="A good reputation is more valuable than money.<span>&#151; Publilius Syrus</span>";
fcontent[24]="You can't build a reputation on what you are going to do.<span>&#151; Henry Ford</span>";
fcontent[25]="The way to gain a good reputation is to endeavor to be what you desire to appear.<span>&#151; Socrates</span>";
fcontent[26]="Define success the way customers do.<span>&#151; Gordon Bethune</span>";
fcontent[27]="In any moment of decision the best thing you can do is the right thing, the next best thing is the wrong thing, and the worst thing you can do is nothing.<span>&#151; Theodore Roosevelt</span>";
fcontent[28]="Our two geatest problems are gravity and paper work.  We can lick gravity, but sometimes the paper work is over whelming.<span>&#151; Dr. Wernher von Braun</span>";
fcontent[29]="To go places and do things that have never been done before &#150 that's what living is all about.<span>&#151; Michael Collins</span>";
fcontent[30]="He is most free from danger, who, even when safe, is on his guard.<span>&#151; Publilius Syrus</span>";

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()
{
  var div = document.getElementById("quotes");

  index=Math.floor(Math.random() * fcontent.length);

  if (DOM2)
  {
    div.innerHTML=fcontent[index];
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.quotes.innerHTML=fcontent[index];
}


/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step)
{
  if(step < maxsteps)
  {
    document.getElementById("quotes").style.color=getstepcolor(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }
  else
  {
    clearTimeout(fadecounter);
    document.getElementById("quotes").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("colorfadeInv("+step+")", delay);

  }
}
function colorfadeInv(step)
{
  if(step > 0)
  {
    document.getElementById("quotes").style.color=getstepcolor(step);
    step--;
    fadecounter=setTimeout("colorfadeInv("+step+")",stepdelay);
  }
  else
  {
    clearTimeout(fadecounter);
    document.getElementById("quotes").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")";
    setTimeout("changecontent()", stepdelay);
  }
}


/*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="quotes"></div>');

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

