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(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 style="padding:0.5em;"><p style="font-size: 0.8em; margin-top: 0.5em;">'; //set opening tag, such as font declarations
fcontent[0]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;Rebecca is not allocated transport. I (Mum) have to do all the transporting. Our council plans to cut transport to all service users.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[1]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;Chris has an assessment and review at his day centre this week. He goes 4 days a week to his centre now. This could be reduced.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[2]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;Now I have to pay for attending the farm where I work through direct payments plus transport costs.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[3]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;A shortage of places makes us wonder what will happen when James finishes his 3 days at college a week.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[4]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;Rachel gets very bored. Where we live there is not a lot going on - only a drop in centre.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[5]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;Mike's workshop has closed. He has at present not been given any work.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[6]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;We pay for transport now but did not before.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[7]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;My life is very restricted now compared to what I've become used to over the last 3 years.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[8]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;I am struggling to find out what services are available to me in my area.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[9]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;There is a long waiting list to get your own accomodation.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[10]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;There is a lack of funding for people with learning disabilities.&quot;<br/><br/><p style='text-align:right;font-size: 0.8em'>- all names have been changed.</p>";
fcontent[11]="<strong><div style='font-size: 1.5em; *font-size: 1em;'>The crisis in social care:<br/>what people are telling us</div></strong><br/>&quot;I left school in July 2007. Since then I have moved into supported living but have no daytime activities so sit at home.&quot;<br/><br/><p style='text-align:right; font-size: 0.8em'>- all names have been changed.</p>";


//fcontent[2]="Because there was no local day care centre available, Robin was told of some daytime activities (eg. Netball). Because these don't start till 10am, they were not appropriate as I start work at 9am and didn't want a carer coming in the house for the intervening time.";
//fcontent[0]="<b>What\'s new?</b><br>New scripts added to the Scroller category!<br><br>The MoreZone has been updated. <a href='../morezone/index.htm'>Click here to visit</a>";
//fcontent[0]="Dean attends the employment preparation training team. He likes to do grounds maintenance. He goes 5 days a week. He cannot stay there forever - they aim to find him employment - within the city. It is a very good place a lot of his school friends go there. We didn't find anywhere else suitable for him.";
closetag='</p></div>';

var fwidth=''; //set scroller width
var fheight='160px'; //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 #50c7e7; width:'+fwidth+';height:'+fheight+'; margin: 0em 0em 0.4em 0em;"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent

