
/* DHTML Imag Swap by Fr. Simon Rundell, This version (text only) July 2007

*/

var change_delay=10; //seonds
var msgtotal=25;
var message_array=new Array(msgtotal);
var pictotal = 59; // number of pictures in images folder;
var picdir='fileadmin/images';
//var picdir='../../images';

message_array[1]="...a vibrant faith, a warm welcome";
message_array[2]="Jesus said 'I came that you may have life - life in all its fullness' (John 10:10)";
message_array[3]="Parish Office 10-11am Saturdays in Church to book weddings and baptisms";
message_array[4]="Where you will always find a decent cup of coffee and a warm welcome!";
message_array[5]="Proclaiming the welcoming, inclusive Gospel of Christ to all";
message_array[6]="Sunday Parish Mass at 10am - family-friendly worship in a welcoming setting";
message_array[7]="Mass of Healing: Second Monday of Each Month at 7.30pm";
message_array[8]="Prayer Group: 4th Monday of Each Month at 7.30pm";
message_array[9]="wildly & radically inclusive";
message_array[10]="...small church, big heart!";
message_array[11]="...small church, big heart!";
message_array[12]="Parish Office 10-11am Saturdays in Church to book weddings & baptisms";
message_array[13]="Parish Office 10-11am Saturdays in Church to book weddings & baptisms";
message_array[14]="Parish Office 10-11am Saturdays in Church to book weddings & baptisms";
message_array[15]="Parish Office 10-11am Saturdays in Church to book weddings & baptisms";
message_array[16]="Proclaiming the welcoming, inclusive Gospel of Christ to all";
message_array[17]="Proclaiming the welcoming, inclusive Gospel of Christ to all";
message_array[18]="Sunday Parish Mass at 10am - family-friendly worship in a welcoming setting";
message_array[19]="Sunday Parish Mass at 10am - family-friendly worship in a welcoming setting";
message_array[20]="Sunday Parish Mass at 10am - family-friendly worship in a welcoming setting";
message_array[21]="<font face='KidTypePaint'>Fridays</font> Youth Club 7-9pm Friday Nights in the Church Hall.";
message_array[22]="<font face='KidTypePaint'>Sundays</font> fortnightly at the Vicarage with Fr. Simon and Lou";
message_array[23]="<i>'There is a definite buzz going on in this Church...'</i>";
message_array[24]="<i>'I like the family-friendly focus of worship and the lively music!'</i>";
message_array[25]="<i>'I like what you do with Children and Young people - we worship together'</i>";

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);


function replace_img() {

myTimer=window.setTimeout('replace_img()', 1000 * change_delay);
writeit(message_array[1 + (Math.floor(Math.random()* msgtotal))], "message");

}


function writeit(text,id)
{
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		x.document.open();
		x.document.write(text);
		x.document.close();
	}
}


function ChangePhoto(newPhoto) {
	// alert("here");
	img = document.getElementById('steimage');
	img.src=newPhoto;
	var width = img.naturalWidth;
	var height = img.naturalHeight;
	
if (width==0) width=233;
if (height==0) height=350;
	
	var newx = 350; // set to whatever you want the images max width to be.
	var newy = 233; // whatever you want the images maximum height to be.
	if ( width >= height ) {
	// landscape
	var tmpy = height*newx/width;
	if ( tmpy <= newy )
	newy = tmpy;
	else
	newx = width*newy/height;
	}
	else {
	// portrait
	tmpx = width*newy/height;
	if ( tmpx <= newx )
	newx = tmpx;
	else
	newy = height*newx/width;
	}
	img.width = newx;
	img.height = newy;

}

function swapimage() {
	
	// random image
		picnumber = 1 + (Math.floor(Math.random()* pictotal));

		writeit('<div align="center"><img id="steimage" src="'+picdir+'/'+picnumber+'.jpg" width=350 height=233></div>', "imagebar");
		window.setTimeout('ChangePhoto("'+picdir+'/'+picnumber+'.jpg")', 500);
	
	
    window.setTimeout("swapimage();",10000);

}; 

// swapimage
