/***********************************************
* 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 = 10 * 1000; //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=''; //set opening tag, such as font declarations
fcontent[0]="\"Humanity is acquiring all the right technology for all the wrong reasons.\"<br>&nbsp;&nbsp;-R. Buckminster Fuller (1895-1983)";
fcontent[1]="\"If knowledge can create problems, it is not through ignorance that we can solve them.\"<br>&nbsp;&nbsp;-Isaac Asimov (1920-1992).";
fcontent[2]="\"Knowledge is power.\"<br>&nbsp;&nbsp;-Sir Francis Bacon (1561-1626).";
fcontent[3]="\"God is a comedian playing to an audience too afraid to laugh.\"<br>&nbsp;&nbsp;-Voltaire (1694-1778).";
fcontent[4]="\"Once is happenstance. Twice is coincidence. Three times is enemy action.\"<br>&nbsp;&nbsp;-Auric Goldfinger, in Goldfinger by Ian L. Fleming (1908-1964).";
fcontent[5]="\"640K ought to be enough for anybody.\"<br>&nbsp;&nbsp;-Bill Gates (1955- ), in 1981.";
fcontent[6]="\"Remember: all the happiness in the world cannot buy money.\"<br>&nbsp;&nbsp;-Larry Fullerton (1946- ).";
fcontent[7]="\"Half this game is ninety percent mental.\"<br>&nbsp;&nbsp;-Yogi Berra (1925- ).";
fcontent[8]="\"Always do right - this will gratify some and astonish the rest.\"<br>&nbsp;&nbsp;-Mark Twain (1835-1910).";
fcontent[9]="\"For a list of all the ways technology has failed to improve the quality of life, please press three.\"<br>&nbsp;&nbsp;-Alice Kahn Ladas.";
fcontent[10]="\"It is better to have loved and lost than to have loved and won.\"<br>&nbsp;&nbsp;-Larry Fullerton (1946- ).";
fcontent[11]="\"My goal in life is to be the kind of person my dog thinks I am.\"<br>&nbsp;&nbsp;-Stephen R. Covey (1932-), author of 'The 7 Habits of Highly Effective People'.";
fcontent[12]="\"The problem with people who have no vices is that generally you can be pretty sure they're going to have some pretty annoying virtues.\"<br>&nbsp;&nbsp;-Elizabeth Taylor (1932-).";
fcontent[13]="\"Every society honors its live conformists and its dead troublemakers.\"<br>&nbsp;&nbsp;-Mignon McLaughlin (1913-1983).";
fcontent[14]="\"The scientific name for an animal that doesn't either run from or fight its enemies is lunch.\"<br>&nbsp;&nbsp;-Michael Friedman.";
fcontent[15]="\"The Linux philosophy is 'Laugh in the face of danger.' Oops. Wrong One. 'Do it yourself.' Yes, that's it.\"<br>&nbsp;&nbsp;-Linus Torvalds (1969-).";
closetag='';

var fwidth='auto'; //set scroller width
var fheight='auto'; //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" style="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
