NewHeadings = new Array(
"",
"<h1>Church Away Day</h1>",
"<h1>The Return of the Podcast</h1>",
"<h1>Come and Visit Us</h1>"
);
//"<h1>Christmas Celebration 2009</h1>",
//"<h1>Prayer at the Bognor Market</h1>",
//King's Gate's Recent Move

NewContents = new Array (
"",
"<p>On Sunday 12th September we'll be having an Away day at Green Pastures, Hambledon. For more information click on the link on the right of the page or contact the office.</p>",
"<p>The long awaited return of the podcast is here. There's lots to download so just follow the link on the right of the page for more.</p>",
"<p>The church meets each Sunday at the Rowland Rank Centre from 10:30am. For directions please see our 'How to Find Us' page.</p>"
);
//"<p>On Sunday 20th December 2009, we are having a Christmas celebration for the whole family starting at 10:45am. There will be mince pies and refreshments afterwards.</p>",
//"<p>A big thanks to all those who have been praying on Saturday Mornings at Bognor Market! We will be returning in the Spring.</p>",
//"<p>Don't forget to look out for us as we are praying for people at Bognor Market on Saturdays from 10:30am.</p>",
//The Church has recently moved location. We will now be meeting at the Rowland Rank Centre on Sunday Mornings. For directions please see our 'How to Find Us' page.
//"<p>For those who haven't heard, the King's Gate Church now has a podcast available. You can now download talks from a Sunday morning for free! See our 'Podcast' page for details.</p>"


//For above sunday bit = 
SundayTalksHeadings = new Array(
"<h1>Sunday 10th January</h1>",
//Week 0 above Week 1 below
"<h1>Sunday 17th January</h1>",
//Week 2
"<h1>Sunday 24th January</h1>",
//Week 3
"<h1>Sunday 31st January</h1>",
//Week 4
"<h1>Sunday 7th February</h1>",
//Week 5
"<h1>Sunday 14th February</h1>",
//Week 6
"<h1>Sunday 21st February</h1>",
//Week 7
"<h1>Sunday 28th February</h1>",
//Week 8
"<h1>Sunday 7th March</h1>",
//Week 9
"<h1>Sunday 14th March</h1>",
//Week 10
"<h1>Sunday 21st March</h1>",
//Week 11
"<h1>Sunday 28th March</h1>",
//Week 12
"<h1>Sunday 4th April</h1>",
//Week 13
"<h1>Sunday 11th April</h1>",
//Week 14
"<h1>Sunday 18th April</h1>",
//Week 15
"<h1>Sunday 25th April</h1>",
//Week 16
"<h1>Sunday 2nd May</h1>",
//Week 17
"<h1>Sunday 9th May</h1>",
//Week 18
"<h1>Sunday 16th May</h1>",
//Week 19
"<h1>Sunday 23rd May</h1>",
//Week 20
"<h1>Sunday 30th May</h1>",
//Week 21
"<h1>Sunday 6th June</h1>",
//Week 22
"<h1>Sunday 13th June</h1>",
//Week 23
"<h1>Sunday 20nd June</h1>",
//Week 24
"<h1>Sunday 27th June</h1>",
//Week 25
"<h1>Sunday 4th July</h1>",
//Week 26
"<h1>Sunday 11th July</h1>",
//Week 27
"<h1>Sunday 18th July</h1>",
//Week 28
"<h1>Sunday 25th July</h1>",
//Week 29
"<h1>Sunday 1st August</h1>",
//Week 30
"<h1>Sunday 8th August</h1>",
//Week 31
"<h1>Sunday 15th August</h1>",
//Week 32
"<h1>Sunday 22nd August</h1>",
//Week 33
"<h1>Sunday 29th August</h1>",
//Week 34
"<h1>Sunday 5th September</h1>",
//Week 35
"<h1>Sunday 12th September</h1>",
//Week 36 
"<h1>Sunday 19th September</h1>",
//Week 37
"<h1>Sunday 26th September</h1>",
//Week 38
"<h1>Sunday 3rd October</h1>",
//Week 39
"<h1>Sunday 10th October</h1>",
//Week 40
"<h1>Sunday 17th October</h1>",
//Week 41
"<h1>Sunday 24th October</h1>",
//Week 42
"<h1>Sunday 31st October</h1>",
//Week 43
"<h1>Sunday 7th November</h1>",
//Week 44
"<h1>Sunday 14th November</h1>",
//Week 45
"<h1>Sunday 21st November</h1>",
//Week 46
"<h1>Sunday 28th November</h1>",
//Week 47
"<h1>Sunday 5th December</h1>",
//Week 48
"<h1>Sunday 12th December</h1>",
//Week 49
"<h1>Sunday 19th December</h1>",
//Week 50
"<h1>Sunday 26th December</h1>",
//Week 51
"<h1>Sunday 2nd January</h1>"
//Week 52
);

//For above sunday bit = 
SundayTalksContents = new Array(
"<p class='gaps'><strong>Speaker:</strong> Martin French</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 0 above Week 1 below
"<p class='gaps'><strong>Speaker:</strong> John France</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 2
"<p class='gaps'><strong>Speaker:</strong> Martin French</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 3
"<p class='gaps'><strong>Format:</strong> Testimony Meeting</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 4
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 5
"<p class='gaps'><strong>Speaker:</strong> John Swindell</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 6
"<p class='gaps'><strong>Speaker:</strong> Ben Leney</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 7
"<p class='gaps'><strong>Speaker:</strong> John France</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 8
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 9
"<p class='gaps'><strong>Speaker:</strong> Chris Birch</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 10
"<p class='gaps'><strong>Speaker:</strong> Martin French</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 11
"<p class='gaps'><strong>Speaker:</strong> John France</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 12
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 13
"<p class='gaps'><strong>Format:</strong> Martin French</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 14
"<p class='gaps'><strong>Format:</strong> Chris Birch</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 15
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 16
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 17
"<p class='gaps'><strong>Speaker:</strong> Martin French</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 18
"<p class='gaps'><strong>Speaker:</strong> Chris Birch</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 19
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 20
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 21
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 22
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 23
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 24
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 25
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 26
"<p class='gaps'><strong>Speaker:</strong> Mike French</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 27
"<p class='gaps'><strong>Speaker:</strong> John France</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 28
"<p class='gaps'><strong>Speaker:</strong> Martin French</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 29
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 30
"<p class='gaps'><strong>Speaker:</strong> Chris Birch</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 31
"<p class='gaps'><strong>Speaker:</strong> Ben Leney</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 32
"<p class='gaps'><strong>Speaker:</strong> John France</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 33
"<p class='gaps'><strong>Format:</strong> Testimony</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 34 - new week
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 35
"<p class='gaps'><strong>Format:</strong> Away Day!</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 36 
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 37
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 38
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 39
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 40
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 41
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 42
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 43
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 44
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 45
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 46
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 47
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 48
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 49
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 50
"<p class='gaps'><strong>Format:</strong> TBA</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>",
//Week 51
"<p class='gaps'><strong>Format:</strong> Body Ministry</p><p class='gaps'><strong>Start Time:</strong> 10:30am</p><p class='gaps'><strong>Location:</strong> Rowland Rank Centre, Aldwick, PO21 3QQ. See our 'How to Find Us' page for directions.</p>"
//Week 52,
);

//Calculate Current Week Number and change up 1 if we're looking at next week
//We consider weeks starting on a monday and the first week starts on the first monday in the year
var today = new Date()		
var yearstart = new Date()
var week
var WeekNo

yearstart.setFullYear(today.getFullYear());
yearstart.setMonth(0);
yearstart.setDate(1);
yearstart.setHours(0);
yearstart.setMinutes(0);
yearstart.setSeconds(0);
yearstart.setMilliseconds(0);

//if the first is not monday then set yearstart to monday.
if (yearstart.getDay() < 2){week = 2-yearstart.getDay();}
else {week = 9 - yearstart.getDay();}
yearstart.setDate(week);

// For testing the script
//today.setMonth(8);
//today.setDate(6);

//calculate the number of days since by dividing the difference in time by number of secs in day
WeekNo = Math.floor(((today.getTime() - yearstart.getTime())/86400000)/7);


var ImgNum = 0;
var ImgLength = NewHeadings.length - 1;

//Time delay between Slides in milliseconds
//var delay = 10000; slow down for the children's day thing
var delay = 12000;

var lock = false;
var run;
function chgImg(direction) {
ImgNum = ImgNum + direction;
if (ImgNum > ImgLength) {
ImgNum = 0;
}
if (ImgNum < 0) {
ImgNum = ImgLength;
}
// Now show either the sunday talk information or other information
if (ImgNum ==0){
document.getElementById("newsheadline").innerHTML = SundayTalksHeadings[WeekNo];
document.getElementById("newscontent").innerHTML = SundayTalksContents[WeekNo];
}
else {
document.getElementById("newsheadline").innerHTML = NewHeadings[ImgNum];
document.getElementById("newscontent").innerHTML = NewContents[ImgNum];
}

}

function auto() {
if (lock == true) {
lock = false;
document.getElementById("playpause").innerHTML = "Play";
window.clearInterval(run);
}
else if (lock == false) {
lock = true;
document.getElementById("playpause").innerHTML = "Pause";
run = setInterval("chgImg(1)", delay);
   }
}

function startup() {
chgImg(0);
auto();
}

