// Typeface for buttons is Flareserif 821 BT 8pt
// Global variables
var isNav4, isIE4;
var range="";
var styleObj="";
if (parseInt(navigator.appVersion) >= 4) {
	if (navigator.appName=="Netscape") {
		isNav4=true
	} else {
		isIE4=true;
	}
}
// Select appropriate CSS link
if (isIE4) {
	links=document.all.tags("link");
	links[0].disabled=true;
	links[1].disabled=false;
}
// Get text for index page
text=new textArray(
"Praise be to God, who has not rejected my prayer or witheld his love from me! Psalm 66:20",
"With joy you will draw water from the wells of salvation. Isaiah 12:3",
"I am the Lord your God, who teaches you what is best for you, who directs you in the way you should go. Isaiah 48:17",
"We do not make requests of you because we are righteous, but because of your great mercy. Daniel 9:18",
"The work of God is this: to believe in the one he has sent. John 6:29",
"For no matter how many promises God has made, they are 'Yes' in Christ. 2 Corinthians 1:20",
"'Not by might nor by power, but by my Spirit,' says the Lord Almighty. Zechariah 4:6",
"The only thing that counts is faith expressing itself through love. Galatians 5:6",
"Your eyes will see the king in his beauty. Isaiah 33:17",
"'The silver is mine and the gold is mine,' declares the Lord Almighty. Haggai 2:8",
"God ... enables me to stand on the heights. 2 Samuel 22:34"
);
function textArray() {
		  for (i=0; i<textArray.arguments.length; i ++) {
		  this[i]=textArray.arguments[i];
		  }
		  this.length=textArray.arguments.length;
		  this.currentItem=0;
		  return(this);
}
// Get a random text to display on the home page (IE only)
function getText() {
		  if (isIE4) {
		  document.all.randomText.innerText=text[random()];
		  }
}
// Random number generator fromMcComb's Javascript Sourcebook
function random() {
		  rn=new rnGenerator();
		  theNumber=rn.next();
		  theNumber=""+theNumber; // now a string
		  theNumber=theNumber.substring(2, 3) // returns 3-2 (ie, 1) characters
		  return(theNumber);
}
function nextRn()  {
		  var Hi=this.seed / this.Q;
		  var Lo=this.seed % this.Q;
		  var Test=this.A * Lo-this.R * Hi;
		  if (Test>0) {
		  this.seed=Test;
		  } else {
		  this.seed=Test+this.M;
		  }
		  return(this.seed * this.oneOverM);
}
function rnGenerator() {
		  var D=new Date();
		  this.seed=2345678901+(D.getSeconds() * 0xFFFFFF)+(D.getMinutes() * 0xFFFF);
		  this.A=48271;
		  this.M=2147483647;
		  this.Q=this.M / this.A;
		  this.R=this.M % this.A;
		  this.oneOverM=1.0 / this.M;
		  this.next=nextRn;
}
//Preload right and left bits of title bars
var rightBar=new Image(158, 126);
rightBar="images/title-r.gif";
var leftBar=new Image(158, 126);
leftBar="images/title-l.gif";
var leftChoiceBar=new Image(158, 126);
leftChoiceBar="images/title-r-c.gif";
//Get last 15 characters of URL of current document and place in "endBit" variable
var url=window.location.href.toString();
var endBit=url.substring(url.length-15, url.length);
// If endBit signifies first page, preload appropriate navigational buttons
if ((endBit=="/bbb.ndo.co.uk/") || (endBit=="uk/index.shtml") || (endBit=="-2/wexp0001.htm")) {
var frontBit="";
} else {
var frontBit="../";
}
b0Out=new Image(108, 28);
b0Out.src=frontBit+"images/home1.gif";
b0Over=new Image(108, 28);
b0Over.src=frontBit+"images/home2.gif";
b0Down=new Image(108, 28);
b0Down.src=frontBit+"images/home3.gif";
b1Out=new Image(108, 28);
b1Out.src=frontBit+"images/intro1.gif";
b1Over=new Image(108, 28);
b1Over.src=frontBit+"images/intro2.gif";
b1Down=new Image(108, 28);
b1Down.src=frontBit+"images/intro3.gif";
b2Out=new Image(108, 28);
b2Out.src=frontBit+"images/sermons1.gif";
b2Over=new Image(108, 28);
b2Over.src=frontBit+"images/sermons2.gif";
b2Down=new Image(108, 28);
b2Down.src=frontBit+"images/sermons3.gif";
b3Out=new Image(108, 28);
b3Out.src=frontBit+"images/beat1.gif";
b3Over=new Image(108, 28);
b3Over.src=frontBit+"images/beat2.gif";
b3Down=new Image(108, 28);
b3Down.src=frontBit+"images/beat3.gif";
b4Out=new Image(108, 28);
b4Out.src=frontBit+"images/waters1.gif";
b4Over=new Image(108, 28);
b4Over.src=frontBit+"images/waters2.gif";
b4Down=new Image(108, 28);
b4Down.src=frontBit+"images/waters3.gif";
b5Out=new Image(108, 28);
b5Out.src=frontBit+"images/word1.gif";
b5Over=new Image(108, 28);
b5Over.src=frontBit+"images/word2.gif";
b5Down=new Image(108, 28);
b5Down.src=frontBit+"images/word3.gif";
b6Out=new Image(108, 28);
b6Out.src=frontBit+"images/james1.gif";
b6Over=new Image(108, 28);
b6Over.src=frontBit+"images/james2.gif";
b6Down=new Image(108, 28);
b6Down.src=frontBit+"images/james3.gif";
b7Out=new Image(108, 28);
b7Out.src=frontBit+"images/bb1.gif";
b7Over=new Image(108, 28);
b7Over.src=frontBit+"images/bb2.gif";
b7Down=new Image(108, 28);
b7Down.src=frontBit+"images/bb3.gif";
b8Out=new Image(108, 28);
b8Out.src=frontBit+"images/links1.gif";
b8Over=new Image(108, 28);
b8Over.src=frontBit+"images/links2.gif";
b8Down=new Image(108, 28);
b8Down.src=frontBit+"images/links3.gif";
b9Out=new Image(108, 28);
b9Out.src=frontBit+"images/galli1.gif";
b9Over=new Image(108, 28);
b9Over.src=frontBit+"images/galli2.gif";
b9Down=new Image(108, 28);
b9Down.src=frontBit+"images/galli3.gif";
b10Out=new Image(108, 28);
b10Out.src=frontBit+"images/areop1.gif";
b10Over=new Image(108, 28);
b10Over.src=frontBit+"images/areop2.gif";
b10Down=new Image(108, 28);
b10Down.src=frontBit+"images/areop3.gif";
b11Out=new Image(108, 28);
b11Out.src=frontBit+"images/sheep1.gif";
b11Over=new Image(108, 28);
b11Over.src=frontBit+"images/sheep2.gif";
b11Down=new Image(108, 28);
b11Down.src=frontBit+"images/sheep3.gif";
// Change each navigation button when mouse passes over it or is clicked on it
function swapButton(imgName, state) {
		  if (document.images) {
		  document.images[imgName].src=eval(imgName+state+".src")
		  }
}
// Areopagus routines
// If endBit signifies Areopagus and browser is not IE4 issue warning
if ((isNav4) && (endBit=="agus/areop.html")){
	alert ("Areopagus is much more exciting when viewed with Microsoft Internet Explorer 4 or 5. Other browsers let you see only half the action.");
}
// Create arrays of color for opening graphics of Areopagus
var colorIndex;
whiteToBlack = new colorArray ("FFFFFF", "FAFAFA", "F0F0F0", "E6E6E6", "DCDCDC", "D2D2D2", "C8C8C8", "BEBEBE", "B4B4B4", "AAAAAA", "A0A0A0", "969696", "8C8C8C", "828282", "787878", "6E6E6E", "646464", "5A5A5A", "505050", "464646", "3C3C3C", "323232", "282828", "1E1E1E", "141414", "0A0A0A", "050505", "000000")
blackToRed = new colorArray ("000000", "0A0000", "140000", "1E0000", "280000", "320000", "3C0000", "460000", "500000", "5A0000", "640000", "6E0000", "780000", "820000", "8C0000", "960000", "A00000", "AA0000", "B40000", "BE0000", "C80000", "D20000", "DC0000", "E60000", "F00000", "FA0000", "FF0000")
redToWhite = new colorArray ("FF0808",  "FF1010", "FF1818",  "FF2020", "FF2828",  "FF3030", "FF3838", "FF4040",  "FF4848", "FF5050",  "FF5858", "FF6060",  "FF6868", "FF7070",  "FF7878",  "FF8080",  "FF8888",  "FF9090",  "FF9898",  "FFA0A0",  "FFA8A8",  "FFB0B0",  "FFB8B8",  "FFC0C0",  "FFC8C8",  "FFD0D0",  "FFD8D8",  "FFE0E0",  "FFE8E8",  "FFF0F0",  "FFF8F8",  "FFFFFF")
function colorArray () {
	for (colorIndex = 0; colorIndex < colorArray.arguments.length; colorIndex ++) {
	this[colorIndex] = colorArray.arguments[colorIndex];
	}
	this.length = colorArray.arguments.length;
	this.currentItem = 0
	return (this);
}
var count1, count2, count3, count4, count5, trigger1, trigger2, trigger4, trigger5, colorChange1, colorChange2, colorChange4, colorChange5;
count1 = 0;
count2 = 0;
count3 = 0;
count4 = 0;
count5 = 0;
trigger1 = 0;
trigger2 = 0;
trigger4 = 0;
trigger5 = 0;
colorChange1 = 0;
colorChange2 = 0;
colorChange4 = 0;
colorChange5 = 0;
// Make text glide up
function glideUp (to, from) {
	var first = (isNav4) ? document.message1 : document.all.message1.style;
	if (to < from) {
	first.top = (from -= 2);
	count1 += 1;
	trigger1 = (count1 % 4);
	if ((trigger1 == 0) &&  (isIE4)) {
	colorChange1 += 1;
	first.color = whiteToBlack[colorChange1];
	}
	setTimeout ("glideUp (" + to + "," + from + ")", 50);
	}
}
// Make text glide down
function glideDown (from, to) {
	var second= (isNav4) ? document.message2 : document.all.message2.style;
	if (from < to) {
	second.top = (from += 2);
	count2 += 1;
	trigger2 = (count2 % 4);
	if ((trigger2 == 0) && (isIE4)) {
	colorChange2 += 1;
	second.color = whiteToBlack[colorChange2];
	}
	setTimeout("glideDown(" + from + "," + to + ")", 50);
	}
	else {
	if (isIE4) {
	glowRed();
	}
	}
}
// Make text glow red
function glowRed () {
	var first = (isNav4) ? document.message1 : document.all.message1.style;
	var second= (isNav4) ? document.message2 : document.all.message2.style;
	count3 += 1;
	if (count3 <= 27) {
	first.color = blackToRed[count3];
	second.color = blackToRed[count3]
	setTimeout ("glowRed ()", 60);
	}
	else {
	glideLeft (100, 360);
	glideRight (100, 360);
	}
}
// Make text glide left
function glideLeft (to, from) {
	var second= (isNav4) ? document.message2 : document.all.message2.style;
	if (to < from) {
	second.left = (from -= 2);
	count4 += 1;
	trigger4 = (count4 % 4);
	if ((trigger4 == 0) &&  (isIE4)) {
	colorChange4 += 1;
	second.color = redToWhite[colorChange4];
}
	setTimeout ("glideLeft (" + to + "," + from + ")", 50);
	}
}
// Make text glide right
function glideRight (from, to) {
	var first = (isNav4) ? document.message1 : document.all.message1.style;
	if (from < to) {
	first.left = (from += 2);
	count5+= 1;
	trigger5 = (count5 % 4);
	if ((trigger5 == 0) && (isIE4)) {
	colorChange5 += 1;
	first.color = redToWhite[colorChange5];
}
// Set timer
	setTimeout("glideRight(" + from + "," + to + ")", 50);
	}
	else {
	var first = (isNav4) ? document.message1 : document.all.message1.style;
	var second= (isNav4) ? document.message2 : document.all.message2.style;
	first.top = 353;
	first.left = 100;
	second.top = 0;
	second.left = 360;
	count1 = 0;
	count2 = 0;
	count3 = 0;
	count4 = 0;
	count5 = 0;
	trigger1 = 0;
	trigger2 = 0;
	trigger4 = 0;
	trigger5 = 0;
	colorChange1 = 0;
	colorChange2 = 0;
	colorChange4 = 0;
	colorChange5 = 0;
	glideUp(125, 353);
	glideDown(0, 228);
	}
}
// Link page 3 of Areopagus to page 4 or 5 depending on browser
function checkBrowser (changelink) {
	if (isIE4) location.href  = "areop4.html";
	else location.href = "areop5.html";
}
// Open a new window
function openWin(URL) {
	aWindow=window.open(URL,"god","toolbar=no,width=350,height=400,status=no,scrollbars=yes,resize=no,menubar=no");
}
// Open a new window for full-scale graphics
function openGif(URL) {
	aGif=window.open(URL,"illustration","toolbar=no,width=560,height=500,status=no,scrollbars=yes,resize=no,menubar=no");
}
// Switch one image for another
counter=1
function switchImage() {
	counter=counter+1;
	if (counter % 2) document.home.src='../images/ug.gif';
	else document.home.src='../images/ug2.jpg';
}
function playHome(){
	if (document.all){
		document.all.sound.src="sounds/sheep.wav";
	}
}
