/***********************************************
* 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 = 16000; //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(192,192,192); // start color (red, green, blue)
var endcolor=new Array(255,255,183); // end color (red, green, blue)

function randOrd() {
	return (Math.round(Math.random())-0.5);
} 

var fcontent=new Array();
begintag='<div>'; //set opening tag, such as font declarations
fcontent[0]="1.7 million people take part in a Church of England service each month, a level that has been maintained since the turn of the millennium. Around one million participate each Sunday.";
fcontent[1]="Three million people participate in a Church of England service on Christmas Day or Christmas Eve.";
fcontent[2]="Thirty-nine per cent of the population attend a church service around Christmas, rising to 43 per cent among households with children and, nationally, 23 per cent among those of non-Christian faiths.";
fcontent[3]="The Church of England has the largest following of any denomination or faith in Britain today. Almost half the people in England regard themselves as belonging to the Church of England, while 7 in 10 consider themselves Christian.";
fcontent[4]="People support their local churches in many different ways at different points in their lives. Each year 3 in 10 attend regular Sunday worship and almost half attend a wedding in their local church, while still more attend a funeral there.";
fcontent[5]="In 2007, 43 per cent of adults attended a church or place of worship for a memorial service for someone who had died and 20 per cent were seeking a quiet space. Both these proportions are increases on 37 per cent and 19 per cent respectively in 2003 and 29 per cent and 12 per cent respectively in 2001.";
fcontent[6]="85 per cent of the population visit a church or place of worship in the course of a year, for reasons ranging from participating in worship to attending social events or simply wanting a quiet space.";
fcontent[7]="Every year, around 12 million people visit Church of England cathedrals, including almost 300,000 pupils on school visits. Three of England's top five historic 'visitor attractions' are York Minster, Canterbury Cathedral and Westminster Abbey.";
fcontent[8]="Seven in ten (70%) of the population agree that Church of England schools have a positive role in educating the nation's children.";
fcontent[9]="Approaching one million pupils are educated in more than 4,700 Church of England schools.";
fcontent[10]="At the end of 2007, there were 20,355 ministers licensed by Church of England dioceses, including clergy, readers and Church Army officers: one minister for every 2,500 people in England. The total does not include almost 1,600 chaplains to prisons, hospitals, the armed forces and in education, nor around 7,000 retired ministers with permission to officiate.";
fcontent[11]="The Church recommended 595 future clergy for ordination training in 2007, maintaining the upward trend since the mid-'90s. In 1994, 408 candidates were recommended for training.";
fcontent[12]="The Church ordained 552 new clergy in 2007, the highest number since the year 2000. Overall, 262 women and 290 men were ordained in 2007, with nearly half ordained to full-time, stipendiary ministry: 162 men and 102 women.";
fcontent[13]="More people do unpaid work for church organisations than any other organisation.  Eight per cent of adults undertake voluntary work for church organisations while sixteen per cent of adults belong to religious or church organisations.";
fcontent[14]="A quarter of regular churchgoers (among both Anglicans and other Christians separately) are involved in voluntary community service outside the church. Churchgoers overall contribute 23.2 million hours voluntary service each month in their local communities outside the church.";
fcontent[15]="The Church of England provides activities outside church worship in the local community for over half a million (515,000) children and young people (aged under 16 years) and 38,000 young people (aged 16 to 25 years). More than 136,000 volunteers run children / young people activity groups sponsored by the Church of England outside church worship.";
fcontent[16]="Nearly half the population (46%) think that central taxation, local taxation, the National Lottery or English Heritage should be 'primarily' responsible for providing money to maintain churches and chapels. These churches and cathedrals are largely supported by the efforts and financial support of local communities. Often, they are the focus of community life and service.";
fcontent[17]="There are 14,500 places of worship in England listed for their special architectural or historic interest, 85 per cent of which belong to and are maintained by the Church of England.";
fcontent[18]="The Church of England has more than 16,000 churches, serving every inch of the country and open to every local inhabitant. There are 42 mainland cathedrals, plus one in Peel on the Isle of Man and the Diocese in Europe's cathedral in Gibraltar.";
fcontent[19]="People value their local church and 72% consider it an important part of their local community: 58% believe it makes their neighbourhood a better place to live and 63% would be concerned if the local church was not there. Those who would be concerned include 38% of people with no religion and 38% of adherents of other faiths.";
fcontent[20]="Three church and cathedral locations are World Heritage Sites: Durham Castle and Cathedral, Canterbury Cathedral, St Augustine's Abbey & St Martin's Church, and Westminster Abbey and St Margaret's Church.";
fcontent[21]="Necessary repairs to all listed places of worship in England have been valued at &pound;925m over the next five years, or &pound;185m a year. &pound;110 million is currently spent on repairs to Church of England churches per annum, 70% of it raised by the congregations and local community.";
fcontent[22]="Total income from donors to the Church of England was nearly &pound;537 million in 2006 including &pound;70 million of reclaimed gift aid. Most of the regular committed giving of members of the C of E is by standing order.";
fcontent[23]="28,500 children attend Church of England schools in Chelmsford Diocese.";
fcontent[24]="Church attendance levels have been broadly stable for the last decade.";
fcontent.sort( randOrd );
closetag='</div>';

var fwidth='100%'; //set scroller width
var fheight='80px'; //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] + ")");
}