										
function raoIsIE()
{
	var browserName=navigator.appName;
	var browserVersion=parseInt(navigator.appVersion); 
	return ((browserName=="Microsoft Internet Explorer" && browserVersion>=4)) ;
}

function checkForIE()
{
	if (!raoIsIE())
		window.location.href="page-ie-only.php";
}

function initText()
{
	str = document.cookie + ";";
	i = str.indexOf("UserFont");
	if (i < 0)
		return;

	j = str.indexOf(";", i);
	if (j < 0)
		return;

	setFontSize(parseFloat(unescape(str.substr(i+9, j-i-9))));

	i = str.indexOf("UserBold");
	if (i < 0)
		return;

	j = str.indexOf(";", i);
	if (j < 0)
		return;

	setFontWeight(unescape(str.substr(i+9, j-i-9)));
}

function setFontSize(n)
{
	var text=document.getElementsByTagName("p");
	if (text == null)
		return;
	
	var i;

	for (i=0; i<text.length; i++)
		text[i].style.fontSize = n + "pt";

	//write cookie
	var expiryDate = new Date();
	expiryDate.setTime(expiryDate.getTime() + 365*24*60*60*1000);

	document.cookie = "UserFont=" + escape(n) + "; expires=" + expiryDate.toGMTString();
}

function setFontWeight(which)
{
	var text=document.getElementsByTagName("p");
	if (text == null)
		return;

	var chk=document.getElementById("chkBold");
	if (chk==null)
		return;

	var i;

	if (which==null)
	{
		if (chkBold.src.lastIndexOf('Off') == -1)
			newWeight="normal";
		else
			newWeight="bold";
	}
	else
		newWeight=which;

	if (newWeight=="normal")
		chkBold.src="images/web/chkOff.gif";
	else
		chkBold.src="images/web/chkOn.gif";

	for (i=0; i<text.length; i++)
		text[i].style.fontWeight = newWeight;

	//write cookie
	var expiryDate = new Date();
	expiryDate.setTime(expiryDate.getTime() + 30*24*60*60*1000);

	document.cookie = "UserBold=" + escape(newWeight) + "; expires=" + expiryDate.toGMTString();
}


function setLinks()
{
	var img=document.getElementById('imgstr');
	img.style.display='none';

	var link=document.getElementById('linkstr');
	link.style.display='block';
}

function setPic()
{
	var img=document.getElementById('imgstr');
	img.style.display='block';

	var link=document.getElementById('linkstr');
	link.style.display='none';
}

/*
var arrChurchPics;
arrChurchPics = new Array();

var iArr=0;
arrChurchPics[iArr++]	="church-01";
arrChurchPics[iArr++]	="church-02";
arrChurchPics[iArr++]	="church-03";
arrChurchPics[iArr++]	="church-04";
arrChurchPics[iArr++]	="church-05";
arrChurchPics[iArr++]	="church-06";
arrChurchPics[iArr++]	="church-07";
arrChurchPics[iArr++]	="church-08";
arrChurchPics[iArr++]	="church-09";
arrChurchPics[iArr++]	="church-10";
arrChurchPics[iArr++]	="church-11";
arrChurchPics[iArr++]	="church-12";
arrChurchPics[iArr++]	="church-13";
arrChurchPics[iArr++]	="church-14";
arrChurchPics[iArr++]	="church-15";
arrChurchPics[iArr++]	="church-16";
arrChurchPics[iArr++]	="church-17";
arrChurchPics[iArr++]	="church-18";
*/

function doContact(page)
{
/*
	var pic;

	if (page=='PAGE_WELCOME')
		pic='church-01';
	else
	{
		var i = Math.round(Math.random() * 1000) % arrChurchPics.length;
		pic=arrChurchPics[i];
	}
*/
	var boxId=contactBoxId;

	drawBox(boxId);
	blankRow(boxId,8);
/*
	var imgStr="<a href=\"#\" title=\"Click for larger picture\"><div id=\"imgstr\" onclick=\"setLinks()\"><img src=\"images/church/" + pic + "-low.jpg\" width=\"164\" border=\"1\"></div></a>";

	var linkStr="<div id=\"linkstr\" class=\"mainSection\" style=\"display:none;\">";
	linkStr += "<table width=\"158\" border=\"1\" bordercolor=\"black\" bgcolor=\"#ccccee\"><tr><td height=\"120\" valign=\"center\" align=\"center\">";
	linkStr += "Choose<br /><a href=\"images/church/";
	linkStr += pic;
	linkStr += "-med.jpg\" target=\"_blank\" onclick=\"setPic()\">Medium Quality</a><br />or<br />"
	
	linkStr += "<a href=\"images/church/";
	linkStr += pic;
	linkStr += "-hi.jpg\" target=\"_blank\" onclick=\"setPic()\">High Quality</a>"
	linkStr += "</td></tr></table></div>";


	addRow(boxId, imgStr, 'center', '', 0);
	addRow(boxId, linkStr, 'center', '', 0);
*/

var imgStr="";
imgStr += '<table><tr><td id=\"imgstr\" width=\"100%\" style=\"border:0px solid black\" align=\"center\" valign=\"center\">';

	imgStr += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="133" height="100" id="SbcFade" align="middle">';
	imgStr += '<param name="allowScriptAccess" value="sameDomain" />';
	imgStr += '<param name="allowFullScreen" value="false" />';
	imgStr += '<param name="movie" value="SbcFade.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	<embed src="SbcFade.swf" quality="high" bgcolor="#ffffff" width="133" height="164" name="SbcFade" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	imgStr += '</object>';

imgStr += '</td></tr></table>';

addRow(boxId, imgStr, 'center', '', 0);

	blankRow(boxId,3);
	addRow(boxId, '<nobr>Spurgeon Baptist Church</nobr>', 'center', 'boxReference', 0);
	blankRow(boxId,3);
	addRow(boxId, '<nobr>Water Eaton Church Centre</nobr>', 'right', 'boxInfo', 0);
	addRow(boxId, '<nobr>Drayton Road</nobr>', 'right', 'boxInfo', 0);
	addRow(boxId, '<nobr>Bletchley</nobr>', 'right', 'boxInfo', 0);
	addRow(boxId, '<nobr>Milton Keynes</nobr>', 'right', 'boxInfo', 0);
	addRow(boxId, '<nobr>MK2 3RR</nobr>', 'right', 'boxInfo', 0);
	blankRow(boxId,8);
	addRow(boxId, '<nobr>Tel. 01908-376669 (WECC)</nobr>', 'right', 'boxInfo', 0);
	addRow(boxId, '<nobr>Tel. 01908-646649 (Minister)</nobr>', 'right', 'boxInfo', 0);
	addRow(boxId, '<nobr>Or contact us on <a href=\"mailto:r.a.ormesher@open.ac.uk\">email</a></nobr>', 'right', 'boxInfo', 0);
	blankRow(boxId,5);
	document.write("<br>");
}

function doVerse()
{
	var boxId=contactBibleVerse;
	
	drawBox(boxId);
	blankRow(boxId,5);
	addRow(boxId, '<div id=\"animText\"> </div>', 'center', 'boxInfo', 0);
	blankRow(boxId,5);
	addRow(boxId, '<nobr><div id=\"reference\"> </div></nobr>', 'right', 'boxReference', 0);
	blankRow(boxId,4);
	document.write("<br>");
}


function doRightPanel(page)
{
	doContact(page);
	doVerse();
}

function doImgLink(dir,img,width,height)
{
	document.write("<td align=\"center\" valign=\"center\"><a href=\"" + dir + "/pics/");
	document.write(img);
	document.write("\" target=\"_blank\"><img class=\"imgLink\" src=\"" + dir + "/thumbs/");
	document.write(img);
	document.write("\" width=\"" + width + "\" height=\"" + height + "\" title=\"Click to enlarge\"></a></td>");
}
