preload("images/header.png");
preload("images/content.png");
preload("images/footer.png");

var url = document.URL;  
if (url[url.length-1] === '/')
{
	url = url.substring(0,url.length-1);
}
var filename = url.substring(url.lastIndexOf('/') + 1).toLowerCase();

function phpFunction(parent,func)
{
	if (window.XMLHttpRequest)
  	{
  		var xmlhttp=new XMLHttpRequest();
  	}
	else
  	{
  		var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
  	{
  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
    			document.getElementById(parent).innerHTML=xmlhttp.responseText;
    		}
  	}
	xmlhttp.open("GET",func,true);
	xmlhttp.send();
}

function addLeaders()
{
	window.scroller = new scroller(20);
	scroller.addImage(1,"images/bobleadershipapp.png","Robert Clarke","Senior Pastor");
	scroller.addImage(2,"images/simonleadershipapp.png","Simon Pastorello","Assistant Pastor");
	scroller.addImage(3,"images/kevanleadershipapp.png","Kevan Lane","Church Elder");
	scroller.addImage(4,"images/johnleadershipapp.png","John Wilson","Deacon");
	scroller.addImage(7,"images/baileyleadershipapp.png","David Bailey","Deacon");
	scroller.addImage(6,"images/hickenleadershipapp.png","David Hicken","Deacon");
	scroller.addImage(5,"images/peterleadershipapp.png","Peter Warren","Deacon");
	scroller.addImage(8,"images/randipleadershipapp.png","Randip Bhogal","Deacon");
}

function loadMainSlides()
{
	window.sshow = new SlideShow();
	sshow.addSlide('images/1.jpg','Welcome...','null',7000);
	sshow.addSlide('images/2.jpg','Jesus Said...','null',7000);
	sshow.addSlide('images/3.jpg','Join us...','null',7000);
	sshow.addSlide('images/4.jpg','Kingdom Kids...','null',7000);
	sshow.startSlides();
}

function loadListenOnlineTabs()
{
	phpFunction('tabcontent_1','getSermon.php');
	phpFunction('tabcontent_2','getSeries.php');
	phpFunction('tabcontent_3','getStudy.php');
	phpFunction('tabcontent_4','getSpeaker.php');
}

function loadTestimonies()
{
window.slidescroller = new SlideScroller("slidescroller");
slidescroller.addSlide(1,"images/debbie_testimony.jpg","Debbie","I was brought up in a Christian home but for many years I didn’t want to know! I felt that I could live my life without God and that I had all the time in the world. I had always felt that I had had religion thrust down my throat and had always hated going to church. In no way was I going to give my parents the satisfaction of accepting Christ.<br><br>As a teenager the only reason why I kept going to church was to run the church crèche as I have always loved working with children. When I went to college I thought that I had escaped from Christianity for ever but found myself continually coming into contact with other Christians.<br><br>I was invited to go away for the weekend to a convention but only went to socialise. I ended up talking with my friends until the early hours of the morning. They kept witnessing to me but I kept putting up barriers and a wall of excuses. I knew that the Lord was speaking to me, in fact He had been for quite sometime but I was determined not to give in. That night however I accepted Christ as my saviour and although the way has not always been easy God has always been faithful.<br><br>The biggest barrier was going back to my parents and giving them the satisfaction that I had accepted Christ as I had been antagonistic for many years. It turned out that they knew in their hearts what was going to happen and from that moment our relationship has never been as strong. Much has happened since then but the Lord has always been there for me. The Lord Jesus Christ is central to my life and I live to please Him & do His will.");

slidescroller.addSlide(1,"images/susan_testimony.jpg","Susan","What a wonderful journey this life is- at times! I had a difficult childhood surrounded by violence and alcoholism. I always hoped that there was a God, but couldn't see how there could be because of all that was going on in my life. I realised that I was very damaged emotionally by it all and ended up getting married for all the wrong reasons. After 11 years, we were divorced and then my own drinking kicked off. God lead me to Alcoholics Anonymous where I learned that God was real. He wanted me to get to know Him on a personal level.<br><br>As the years went by in sobriety he was there for me through every difficult time to guide me closer to him.<br><br>A few years ago I had a car accident. Through this experience, I was led to attend a church that taught me that Jesus was alive and real and that my relationship with God could be so much deeper. Jesus could forgive all my past sins and lead me into forgiveness for all the hurts that I had suffered. So I have put all my trust in Jesus and my relationship with him has deepened and I know that I couldn't get through this life without him. He has promised me eternal life to live with Him!");

slidescroller.addSlide(1,"images/sue_testimony.jpg","Sue","I used to be a Jehovah’s Witness for 13 years and as the years went by I became more and more unhappy, questions were arising that were not being answered.<br><br>Eventually I stopped going to the meetings, I became very upset, and I started to think about my life over the years. How I had been obedient doing the things I was asked to do, going out on door to door work, attending all the meetings and trying very hard to be faithful to God. But I did not have a relationship with God; my prayers went up but God did not respond. Five years ago, I met my husband Dave who is a born again Christian. At the time I thought \"Oh no, not more religion, I have had enough. I don't want to go down that road again!\" One Sunday night, he asked if I wanted to go to church with him and I said alright. So I went and when I walked into the church I could feel the presence of God. I found it strange and as the night progressed I really enjoyed being there.<br><br>Over the next few days I really started to think. One of the ladies said to me \"what do you want?\" I replied \"I want what you have because I had never experienced this before.\" Then I had a Dream. I knew this meant something; there and then I asked Jesus to forgive my sins and to come into my heart.<br><br>That was five years ago and I can honestly say that was the best thing I have ever done in my life. God has blessed me in so many ways. I have a wonderful husband and we both have given our lives to God to do his work and share the message with as many people who will listen. I thank the Lord for giving me another chance praise the Lord.");

slidescroller.addSlide(1,"images/bailey_testimony.jpg","David","Before I became a Christian, I was a typical lad- I lived for pleasure and self-gain. I did believe in God though; I even believe He answered my prayers. But I saw Him as some kind of heavenly vending machine. He was simply there to give me what I wanted.<br><br>In 2003 I attended a Christian's wedding where I got talking to other born-again believers. After chatting with them I realised I had a 'lazy' kind of faith. There was a banging in my heart and my eyes were opened. Three weeks later I attended church. I saw all the bad things in my life, so I invited the Lord into my heart.<br><br>I now have clear conscience, for 'there is now no condemnation for those in Christ Jesus'.");

slidescroller.addSlide(1,"images/randip_testimony.jpg","Randip","I was brought up as a Sikh and used to regularly attend the Sikh Temple. When I was about 13 years of age, I started really searching for God. I had been brought up to live a good life and believed this was the way to a better life as a Sikh. I was told by my family 'once a Sikh, always a Sikh'.<br><br>One day the Jehovah’s Witnesses came to the door and persuaded me to attend their meetings and I started to study with them. However, at the age of 15, a real Christian witnessed to my mother whom she invited to our house for tea. He witnessed to us and told us about Jesus Christ who came into the world to save sinners, about His death and resurrection. We were invited to the Elim Pentecostal Church in Blackburn where I gave my heart to the Lord after listening to the late Pastor Stanley Beresford. Shortly afterwards I was baptised.<br><br>It was a joy to see the rest of the family come to know Jesus as their personal Saviour.");
}

function loadMenus()
{
	if (window.menus)
	{
		return;
	}

	window.menus = new Array();

	var aboutmenu = new menu("about");
	aboutmenu.additem("About Us","about.php");
	aboutmenu.additem("Our Beliefs","ourbeliefs.php");
	aboutmenu.additem("What to Expect","expect.php");
	aboutmenu.additem("Leadership","leadership.php");
	aboutmenu.additem("Testimonies","testimonies.php");
	aboutmenu.additem("Our History","history.php");
	aboutmenu.additem("Missionaries","missionaries.php");
	aboutmenu.additem("Our Location","findus.php");
	menus[menus.length] = aboutmenu;

	var minismenu = new menu("minis");
	minismenu.additem("Sunday Services","ministries.php?ministry=1");
	minismenu.additem("Bible Studies","ministries.php?ministry=2");
	minismenu.additem("Homegroups","ministries.php?ministry=3");
	minismenu.additem("Russian Fellowship","ministries.php?ministry=5");
	minismenu.additem("Over 50s Fellowship","ministries.php?ministry=6");
	minismenu.additem("Prayer Meetings","ministries.php?ministry=7");
	minismenu.additem("Socials","ministries.php?ministry=8");
	minismenu.additem("Ferrier Court","ministries.php?ministry=9");
	minismenu.additem("Church Walks","ministries.php?ministry=11");
	menus[menus.length] = minismenu;

	var eventsmenu = new menu("events");
	eventsmenu.additem("Weekly Events","events.php");
	eventsmenu.additem("Special Events","events.php?events_type=1");
	menus[menus.length] = eventsmenu;

	var youthmenu = new menu("youth");
	youthmenu.additem("Youth Group","youth.php");
	youthmenu.additem("Junior Church","juniorchurch.php");
	youthmenu.additem("Joint Youth Meeting","jym.php");
	youthmenu.additem("Kingdom Kids","kingdomkids.php");
	menus[menus.length] = youthmenu;
}

addLoadEvent(loadMenus);

if (filename == "leadership.php")
{
	addLoadEvent(addLeaders);
}
else if ((filename.length === 0) || (filename == "index.php") || (filename == "www.elimblackburn.org") || (filename == "elimblackburn.org"))
{
	preload("images/1.jpg");
	preload("images/2.jpg");
	preload("images/3.jpg");
	preload("images/4.jpg");
	addLoadEvent(loadMainSlides);
}
else if (filename == "listen.php")
{
	addLoadEvent(loadListenOnlineTabs);
}
else if (filename == "testimonies.php")
{
	addLoadEvent(loadTestimonies);
}
