/***********************************************
* 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 = 5000; //set delay between message change (in miliseconds)
var maxsteps=50; // 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 align="center" style="font: normal 14px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<STRONG>1.</STRONG> (of 15) <STRONG>A man's low self esteem symptoms (moving)...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/a-mans-low-self-esteem.html'  title='Click here to visit - enjoy!'>Low Self Esteem Symptoms Page</a>";

fcontent[1]="<STRONG>2.</STRONG> (of 15) <STRONG>How to build your self esteem...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/building-self-esteem.html'  title='Click here to visit - enjoy!'>Building Self Esteem Page</a>";

fcontent[2]="<STRONG>3.</STRONG> (of 15) <STRONG>Latest Monthly Marvel video...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/monthly-marvel-quotes.html#VisitorPages'  title='Click here to visit - enjoy!'>Monthly Marvel Newsletter Archive</a>";

fcontent[3]="<STRONG>4.</STRONG> (of 15) <STRONG>How to make the world a better place...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/how-to-change-the-world.html'  title='Click here to visit - enjoy!'>How to Change the World Page</a>";

fcontent[4]="<STRONG>5.</STRONG> (of 15) <STRONG>Are these your top 10 fears?...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/top-10-fears.html'  title='Click here to visit - enjoy!'>Top 10 Fears Page</a>";

fcontent[5]="<STRONG>6.</STRONG> (of 15) <STRONG>Fantastic inspirational poems here...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/inspirational-poems.html'  title='Click here to visit - enjoy!'>Inspirational Poems Page</a>";

fcontent[6]="<STRONG>7.</STRONG> (of 15) <STRONG>How to find happiness. It's easy!...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/finding-happiness.html'  title='Click here to visit - enjoy!'>Finding Happiness Page</a>";

fcontent[7]="<STRONG>8.</STRONG> (of 15) <STRONG>All about goal setting. Forget the 'how'!...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/goal-setting.html'  title='Click here to visit - enjoy!'>Goal Setting Page</a>";

fcontent[8]="<STRONG>9.</STRONG> (of 15) <STRONG>Learn something new (new year resolutions)...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/common-new-year-resolutions-8.html'  title='Click here to visit - enjoy!'>Learn Something New (Resolutions) Page</a>";

fcontent[9]="<STRONG>10.</STRONG> (of 15) <STRONG>Self improvement ideas - trust your gut!...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/self-improvement-ideas.html'  title='Click here to visit - enjoy!'>Self Improvement Ideas Page</a>";

fcontent[10]="<STRONG>11.</STRONG> (of 15) <STRONG>Great inspirational YouTube videos...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/inspirational-videos.html'  title='Click here to visit - enjoy!'>Inspirational Videso Page</a>";

fcontent[11]="<STRONG>12.</STRONG> (of 15) <STRONG>Funny inspirational quotes...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/funny-inspirational-quotes.html'  title='Click here to visit - enjoy!'>Funny Inspirational Quotes Page</a>";

fcontent[12]="<STRONG>13.</STRONG> (of 15) <STRONG>Inspirational courage quotes (Weekly Wonder)...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/inspirational-courage-quotes.html'  title='Click here to visit - enjoy!'>Inspirational Courage Quotes Page</a>";

fcontent[13]="<STRONG>14.</STRONG> (of 15) <STRONG>Paula Renaye's hardline self-help story...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/paula-renayes-inspirational-story.html'  title='Click here to visit - enjoy!'>Paula Renaye's Inspirational Story Page</a>";

fcontent[14]="<STRONG>15.</STRONG> (of 15) <STRONG>Top 10 common new year resololutions...</STRONG><br>Visit <a href='http://www.selfhelpcollective.com/common-new-year-resolutions.html'  title='Click here to visit - enjoy!'>New Year Resolutions Page</a>";
closetag='</div>';

var fwidth='435px'; //set scroller width
var fheight='60px'; //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="border:1px solid white;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

