
/* 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='http://www.saintthomaselson.org.uk/fileadmin/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]="'A lively and growing Church'";
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]="'A lively and growing Church'";
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]="Fridays Youth Club 7-9pm Friday Nights in the Church Hall.";
message_array[22]="Sundays 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 slightdelay() {

        img = document.getElementById('steimage');
	img.style.visibility = 'visible';
	// setOpacity(img, 0);
        // fadeIn('steimage',0);

}

function swapimage() {
	
	// random image
		picnumber = 1 + (Math.floor(Math.random()* pictotal));

		writeit('<img id="steimage" class="hiddenphoto" src="'+picdir+'/'+picnumber+'.jpg">', 'photo');
		window.setTimeout("slightdelay()", 200);
	
	
    window.setTimeout("swapimage();",10000);

}; 

// swapimage

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 1;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}

function fadeOut(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity >= 0) {
      setOpacity(obj, opacity);
      opacity -= 1;
      window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);
    }
  }
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}