var lastNum = 5;	//Holds the previously visible one
var timeoutVal = 20000; //2500;  //This is the 'normal' image swap interval

//Pre-load images
/*if (document.images)
{
	//home page images
	pic1 = new Image(200,181); 
	pic1.src = "images/imageSwap1.jpg"; 

	pic2 = new Image(200,181); 
	pic2.src = "images/imageSwap2.jpg"; 

	pic3 = new Image(200,181); 
	pic3.src = "images/imageSwap3.jpg"; 

	pic4 = new Image(200,181); 
	pic4.src = "images/imageSwap4.jpg"; 
}*/

function swapText()
{
	//setTimeout("changeText()", timeoutVal);
	setTimeout(function() { throb(0); }, 0);
}

function changeText()
{
	if (lastNum!=5)//0)
	{
		document.getElementById("divTextMessage" + lastNum.toString()).style.visibility = "hidden";
	}
	if (lastNum==4)
	{
		timeoutVal = 20000;
		document.getElementById("divImage1").style.display = "none";
		document.getElementById("divImage2").style.display = "block";
	}
	else
	{
		document.getElementById("divImage2").style.display = "none";
		document.getElementById("divImage1").style.display = "block";
	}
	if (lastNum==5)
	{
		lastNum = 1;
		timeoutVal = 1500; //2500;
	}
	else
	{
		if (lastNum != 4) { timeoutVal = 1500; } //2500; }
		lastNum++;
	}
	/*if (document.images)
	{
		document.getElementById("imgImageSwap").src = eval("pic" + lastNum + ".src");
	}*/
	//alert(timeoutVal);
	document.getElementById("divTextMessage" + lastNum.toString()).style.visibility = "visible";
	swapText();
}

var hash = new Array();
//initialize at a random value
hash[0] = Math.floor(Math.random()*27);
function throb(item) {

  // If the hash array does not have an entry for this item, initialise it at 2
  if (!hash[item]) hash[item] = 2;

  // Send a fade command, using the hash array to tell us what parameters we should use
  fader[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));

  // Call this function again for this same item after a certain amount of time
  setTimeout(function() { throb(item); }, (hash[item] % 2) ? 100 : 8000);

  // If we have exceeded the number of messages in this fader, start over again at 2
  if (++hash[item] > fader[item].msg.length * 2 - 1) hash[item] = 2;
}


//look for special QueryString parameters
var qs = new Querystring();
if (qs.contains("pdf"))
{
	var pdfVal = qs.get("pdf");
	if (pdfVal == "1")
	{
		window.open("downloads/FOLAWFVersionOrderBlank2010.pdf", "_blank");
	}
	else
	{
		window.open("downloads/FOLFHVersionOrderBlank2010.pdf", "_blank");
	}
}

var fader = new Array();
fader[0] = new fadeObject('folGifts', 'bbbbbb', '000000', 30, 30);

fader[0].msg[1] = "In loving memory of Genevieve Raines<br/><font size='2'>by Alabaster First United Methodist Church</font>";
fader[0].msg[2] = "In loving memory of Howard &amp; Irene Baxendale<br/><font size='2'>by Alabaster First United Methodist Church</font>";
fader[0].msg[3] = "In honor of Dorothy &amp; James Carl Thompson<br/><font size='2'>by Linda Applebaum</font>";
fader[0].msg[4] = "In loving memory of Louise &amp; Jack Murchison<br/><font size='2'>by Marianne &amp; Mitch Bunch</font>";
fader[0].msg[5] = "In loving memory of J. P. Strozier<br/><font size='2'>by Marianne &amp; Mitch Bunch</font>";
fader[0].msg[6] = "In honor of Mavis Strozier<br/><font size='2'>by Marianne &amp; Mitch Bunch</font>";
fader[0].msg[7] = "In loving memory of Mark &amp; Ann Norton<br/><font size='2'>by Carol &amp; Buddie Carroll</font>";
fader[0].msg[8] = "In loving memory of Florence Norton Dill<br/><font size='2'>by Carol &amp; Buddie Carroll</font>";
fader[0].msg[9] = "In honor of Dwayne &amp; Lynnda Owen<br/><font size='2'>by The Alan Easdon Family</font>";
fader[0].msg[10] = "In honor of Hannah Easdon<br/><font size='2'>by The Alan Easdon Family</font>";
fader[0].msg[11] = "In memory of Harold K. Easdon<br/><font size='2'>by the Alan Easdon Family</font>";
fader[0].msg[12] = "In honor of Dorothy N. Mitchell, Aunt<br/><font size='2'>by Mr. &amp; Mrs. Clifford Lee Lipford, Jr.</font>";
fader[0].msg[13] = "In loving memory of Louise N. Mitchell, Mother<br/><font size='2'>by Mr. &amp; Mrs. Clifford Lee Lipford, Jr.</font>";
fader[0].msg[14] = "In loving memory of Helen P. McCandliss<br/><font size='2'>by Her Sons</font>";
fader[0].msg[15] = "In loving memory of Mr. &amp; Mrs. Gene McClellan<br/><font size='2'>by Steve &amp; Mary Jane McClellan</font>";
fader[0].msg[16] = "In honor of Mrs. Mary Ellen Porter<br/><font size='2'>by Steve &amp; Mary Jane McClellan</font>";
fader[0].msg[17] = "In loving memory of Dr. L. E. Porter<br/><font size='2'>by Steve &amp; Mary Jane McClellan</font>";
fader[0].msg[18] = "In honor of Marvin Daniel Sellers<br/><font size='2'>by Larry Sellers</font>";
fader[0].msg[19] = "In honor of Mrs. Dorothy Thompson<br/><font size='2'>by James C. Thompson, Husband</font>";
fader[0].msg[20] = "<font size='2'>To the Jewell D. Dennison Endowment Fund:</font><br/>In loving memory of Mr. &amp; Mrs. A. L. Tomlin<br/><font size='2'>by Wray &amp; Mary Margaret Tomlin</font>";
fader[0].msg[21] = "<font size='2'>To the Jewell D. Dennison Endowment Fund:</font><br/>In loving memory of Dr. F. S. Harper<br/><font size='2'>by Wray &amp; Mary Margaret Tomlin</font>";
fader[0].msg[22] = "<font size='2'>To the Jewell D. Dennison Endowment Fund:</font><br/>In loving memory of Mrs. Dorothy L. Clay<br/><font size='2'>by Wray &amp; Mary Margaret Tomlin</font>";
fader[0].msg[23] = "<font size='2'>To the Jewell D. Dennison Endowment Fund:</font><br/>In honor of Mary Margaret Tomlin<br/><font size='2'>by Wray Tomlin, Husband</font>";
fader[0].msg[24] = "In loving memory of Iris Hardee, Mother<br/><font size='2'>by Pam Wade</font>";
fader[0].msg[25] = "In loving memory of Evelyn Syfrett<br/><font size='2'>by Barbara &amp; Larry Westholm</font>";
fader[0].msg[26] = "In loving memory of J. W. Syfrett<br/><font size='2'>by Barbara &amp; Larry Westholm</font>";
