// JavaScript Document

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

var fcontent=new Array();
begintag='<div style="font-size: 11px; font-style: italic; color: #333333; float: right; padding: 5px; line-height: 13px; font-family: Verdana, Arial, Helvetica, sans-serif;">'; //set opening tag, such as font declarations
fcontent[0]="Whenever I call you always help - Mrs W";
fcontent[1]="Thanks to all your staff and volunteers—I couldn't make it without folks like you. - Ms A";
fcontent[2]="We would like to thank everyone for their help.  We don't know what we would do with out your help - R & F";
fcontent[3]="We would like to thank all who help us by volunteering so we can be independent in our home.  Your service and commitment has given us strength to go on.  Thank all of you for the help Faith in Action has given us. - A & J";
fcontent[4]="Thank you for your help.  The drivers have been so accommodating.  I really do not know how I could meet my obligations without your help…. - Mr S";
fcontent[5]="I want to thank you and especially Barbara who assisted me in getting my husband to his doctor’s appointment.  You and your volunteers are doing a much needed service to our community… - MS";
fcontent[6]="Thank you for being there when help is needed!  Thanks for everything - Mrs. V ";
fcontent[7]="I wish to express our most sincere appreciation to all of you for you continuing assistance in providing transportation to our numerous medical appointments.  I cannot imagine how we would manage without you.  Jean and Rita are always able to come thru for us even on the last minute requests.  Every volunteer we have met has been very kind, courteous, and professional. - Mr & Mrs N";
fcontent[8]="Because of your volunteer I attended a gathering of Senior Women for lunch.  It really was enjoyable for me and helped in making me feel less isolated.  Thanks so much to your volunteer and to Faith in Action - Mrs. K";
fcontent[9]="Thank you for the ride to the Geddy Outpatient Hospital.  It’s sure a comfort to know that Faith in Action is here in Williamsburg with all its wonderful volunteers, ready to help you when you are in need! - FD";
fcontent[10]="Our family appreciates your support shown towards our aunt…transporting her to visit her husband and everyday errands.  I do not know what she would have done without your assistance.  You are angels her on earth - The S Family";
fcontent[11]="Thank you all at WFIA for all of your help for me and for others like me.  Without you, each and every one of you, I would be in a nursing home by now, and like anyone else I would much rather stay in my own home.  I can't thank you all enough - KD";
fcontent[12]="Thank you for all the help you gave to my aunt.  When family is so far away it is reassuring to know that there are people in the world who take care of their neighbors - Mr W Manahawkin, NJ";
fcontent[13]="Thank you for being there when help is needed...";
fcontent[14]="Thanks again for all of your efforts to help me and others I need.  I know I rely upon the Faith in Action program so heavily, due to not having any family living to assist me in any way.  God bless you all for you kindness and selfless mercy’s in caring for all of us that so desperately need help - Ms D";
fcontent[15]="My many thanks to all of you there.  It's wonderful to know you can feel free to call for help - Mrs. C";
closetag='</div>';

var fwidth='600px'; //set scroller width
var fheight='100px'; //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, 5);
  }
  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:none;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
