/* Begin Random Sidebar Image Script */

var imgFilter = new Array (
"progid:DXImageTransform.Microsoft.RadialWipe(wipestyle=wedge)",
"progid:DXImageTransform.Microsoft.Blinds(bands=20, direction=right)",
"progid:DXImageTransform.Microsoft.Stretch(stretchstyle=push, bands=1)",
"progid:DXImageTransform.Microsoft.Slide(slidestyle=hide, bands=1)",
"progid:DXImageTransform.Microsoft.Iris(irisstyle=circle, motion=in",
"progid:DXImageTransform.Microsoft.RadialWipe(wipestyle=clock)",
"progid:DXImageTransform.Microsoft.Blinds(bands=1, direction=up)",
"progid:DXImageTransform.Microsoft.Slide(slidestyle=swap, bands=1)"
)

var timer
var sidebarNum = 0;

function stopTimer() {
	clearInterval(timer);
}

var imageCount = 0
var sidebarImages = new Array

function initSidebarImages() {
	imageCount = 0
	rs101.recordset.moveFirst()

	while (!rs101.recordset.EOF) {
		sidebarImages[imageCount] = ""
		sidebarImages[imageCount] +=
		rs101.recordset("sidebarimage")
		rs101.recordset.moveNext()
		imageCount++
	}

	initSlideShow()
}

function initSlideShow() {
	curFilter = 0;
	timer = setInterval("runSlideShow();",4000);
}

function stopSlideshow() {
	clearInterval(timer);
}

function startSlideshow() {
	timer = setInterval("runSlideShow();",50);
}

function pauseSlideshow() {
	if (btS.value == "Pause Slideshow") {
		btS.value = "Start Slideshow"
		stopSlideshow()
		window.focus();
		return
	}
	if (btS.value == "Start Slideshow") {
		btS.value = "Pause Slideshow"
		startSlideshow()
	}
	window.focus();
}

function runSlideShow() {
	if (!rs101.recordset.EOF) {
		rs101.recordset.MoveNext()
		sidebarNum += 1
	}
	if (rs101.recordset.EOF) {
		rs101.recordset.MoveFirst()
		sidebarNum = 0;
	}

//	document.images.sidebar.src = rs101.recordset("sidebarimage")
	document.getElementById("sidebar").src="http://lourdesparish.com/oll/images/Backgrounds/Sidebars/" + sidebarImages[sidebarNum];

	clearTimeout(timer);
	timer = setTimeout("runSlideShow()", 4000)
}
/* End Random Sidebar Image Script */




/* Begin Countdown Scripts */

function initCountdown() {
//alert(document.title)
 	if (document.title == "Home of http://lourdesparish.com/ - 100th Anniversary") {
		countdown();
	}
}

futureDate = new Date(2009,10,10,0,0,0);

function countdown() {
	dateNow = new Date();							
	dateDiff = futureDate.getTime() - dateNow.getTime();
	delete dateNow;

	if(dateDiff < 0) {
		document.getElementById('daysOut').innerHTML="Happy 100 Years!";
	} else {
		days = 0; hours = 0; mins  =0;secs = 0;out = "";

		dateDiff = Math.floor(dateDiff / 1000);

		days = Math.floor(dateDiff / 86400);
		dateDiff = dateDiff%86400;

		hours = Math.floor(dateDiff/3600);
		dateDiff = dateDiff%3600;

		mins = Math.floor(dateDiff/60);
		dateDiff = dateDiff%60;

		secs = Math.floor(dateDiff);

		if(days != 0) {
			days = days + " day" + ((days!=1)?"s":"") + ", ";
		}
		if(days != 0 || hours != 0) {
			hours = hours + " hour" + ((hours!=1)?"s":"") + ", ";
		}
		if(days != 0 || hours != 0 || mins != 0) {
			mins = mins + " minute" + ((mins!=1)?"s":"") + ", ";
		}
		secs = secs + " seconds";

		document.getElementById("daysOut").innerHTML = days;
		document.getElementById("hoursOut").innerHTML = hours;
		document.getElementById("minsOut").innerHTML = mins;
		document.getElementById("secsOut").innerHTML = secs;

		setTimeout("countdown()", 1000);
	}
}

/* End Countdown Scripts */


/* Begin Christmas Music Scripts */

function iniChristmasPage() {
//alert(document.title)
 	if (document.title == "Home of http://lourdesparish.com/ - Christmas") {
		initSongArray();
	}
}

var song = new Array()

function initSongArray() {
	j = 0
	Christmas2.recordset.moveFirst()
	while (!Christmas2.recordset.EOF) {
		song[j] = "templates/oll_church_july_2006/Media Files/Christmas2/" + Christmas2.recordset("song")
		Christmas2.recordset.moveNext()
//alert(song[j])
		j++
	}
//alert(song[26])
}

function playAlbum() {
//alert(document.all.songs.value)
//alert(song[document.all.songs.value])
var musicStr = ""
	var opt = song[document.all.songs.value]
//alert(opt)

	musicStr = "<object width='330' height='55' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>"
	musicStr = musicStr + "<br><param name='src' value='" + opt + "'>"
	musicStr = musicStr + "<br><param name='autoplay' value='true'>"
	musicStr = musicStr + "<br><param name='ShowStatusBar' value='true'>"
	musicStr = musicStr + "<param name='Volume' value='20'>"
	musicStr = musicStr + "</object>"


//alert(musicStr)

	document.getElementById("music").innerHTML = musicStr;
//	document.all.songs.selectedIndex = 0
}

/* End Music Scripts */


/* Begin Soothing Sounds Scripts */

function initSoundsPage() {
//alert(document.title)
 	if (document.title == "Home of http://lourdesparish.com/ - Soothing Sounds") {
		initSoundsArray();
	}
}

sound = new Array()

function initSoundsArray() {
	j = 0
	sounds1.recordset.moveFirst()
	while (!sounds1.recordset.EOF) {
		sound[j] = "'templates/oll_church_july_2006/Media Files/SoothingSounds/" + sounds1.recordset("sounds") + "'"
//alert(sound[j])
		sounds1.recordset.moveNext()
		j++
	}
}

function playSounds() {
var soundStr = ""
	opt = sound[document.all.sounds2.value]
//alert(opt)
	soundStr = "<object width='330' height='65' type='application/x-ms-wmp' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>"
	soundStr = soundStr + "<br><param name='src' value=" + opt + ">"
	soundStr = soundStr + "<br><param name='autostart' value='true'>"
	soundStr = soundStr + "<param name='ShowStatusBar' value='true'>"
	soundStr = soundStr + "</object>"

//alert(soundStr)

	document.getElementById("sound").innerHTML = soundStr;
}

/* End Soothing Sounds Scripts */


/* Begin Saints Page Scripts */

var opt
function chooseSound() {
var soundStr = ""
	opt = "templates/oll_church_july_2006/Media Files/Saints/" + document.all.sounds5.value
//alert(opt)
	soundStr = "<object width='330' height='65' type='application/x-ms-wmp' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>"
	soundStr = soundStr + "<br><param name='src' value='" + opt + "'>"
	soundStr = soundStr + "<br><param name='autostart' value='true'>"
	soundStr = soundStr + "<param name='ShowStatusBar' value='true'>"
	soundStr = soundStr + "</object>"

//alert(soundStr)

	document.getElementById("sound5").innerHTML = soundStr;
}

function openSaintsPdfFile() {
	if (document.all.saintsPDF.selectedIndex != 0) {
		page = "http://www.lourdesparish.com/oll/templates/oll_church_july_2006/Media Files/PDF Files/" + saintsPDF.options[saintsPDF.selectedIndex].value;
document.all.saintsPDF.selectedIndex = 0
		gotoPage2(page)
	}
}

function openSaintsBioFile() {
	if (document.all.saintsBio.selectedIndex != 0) {
		page = "http://www.lourdesparish.com/oll/templates/oll_church_july_2006/Media Files/Bio Files/" + saintsBio.options[saintsBio.selectedIndex].value;
//alert(page)
document.all.saintsBio.selectedIndex = 0
		gotoPage2(page)
	}
}

function gotoPage2(page) {
	window.open(page, "_blank", "toolbar=no, menubar=no, resizable=1, scrollbars=yes, status=no, width=800, height=600, left=0, top=0");
}
/***** End Saints Page Scripts *****/


/***** Station Page Scripts *****/

var stationFilter = new Array (
	"progid:DXImageTransform.Microsoft.Stretch(stretchstyle=push, bands=1)",
	"progid:DXImageTransform.Microsoft.Slide(slidestyle=hide, bands=1)"
)

var currentstation = 0;
var curStationFilters = 0;
var rss = new Object
var rsnum2;

function initStationsPage() {
 	if (document.title == "Home of http://lourdesparish.com/ - The Way Of The Cross") {
		getXMLdata2(rs1);
	}
}

function getXMLdata2(rsnum2) {
	rss = rsnum2.recordset
	initButtons2()
}

function initButtons2() {
	currentstation = 0;
	curStationFilters = 0;
	bs1.disabled = true
	bs2.disabled = false
	bs3.disabled = true
	bs4.disabled = false
	rss.moveFirst()

	stationImageArea.innerHTML = ""
	+ rss("stationimage")
	stationTitleArea.innerHTML = ""
	+ rss("stationtitle")
	stationBodyArea.innerHTML = ""
	+ rss("stationbody")
}

function updateButtons2(buttonNumber) {

	if(buttonNumber == "1") {
		rss.MoveFirst()
		currentstation = 0;
		curStationFilters = 0;
		bs1.disabled = true
		bs2.disabled = false
		bs3.disabled = true
		bs4.disabled = false
		doManualstations()
	}
	if (buttonNumber == "2") {
		if (currentstation < rss.recordcount - 1) {
			rss.MoveNext()
			currentstation += 1
			bs1.disabled = false
			bs2.disabled = false
			bs3.disabled = false
			bs4.disabled = false
		}
		if (currentstation == rss.recordcount - 1) {
			rss.MoveLast()
			currentstation = rss.recordcount - 1
			bs1.disabled = false
			bs2.disabled = true
			bs3.disabled = false
			bs4.disabled = true
		}
		doManualstations()
	}
	if (buttonNumber == "3") {
		if (currentstation > 0) {
			rss.MovePrevious()
			currentstation --
			bs1.disabled = false
			bs2.disabled = false
			bs3.disabled = false
			bs4.disabled = false
		}
		if (currentstation == 0) {
			rss.MoveFirst()
			currentstation = 0;
			bs1.disabled = true
			bs2.disabled = false
			bs3.disabled = true
			bs4.disabled = false
		}
		doManualstations()
	}
	if (buttonNumber == "4") {
		rss.MoveLast()
		currentstation = rss.recordcount - 1
		bs1.disabled = false
		bs2.disabled = true
		bs3.disabled = false
		bs4.disabled = true
		doManualstations()
	}
}

function doManualstations() {

	stationCell.style.filter = stationFilter[0]
	stationCell.filters[0].apply()

	stationImageArea.innerHTML = ""
	+ rss("stationimage")
	stationTitleArea.innerHTML = ""
	+ rss("stationtitle")
	stationBodyArea.innerHTML = ""
	+ rss("stationbody")

	stationCell.filters[0].play()
}
/***** End Station Page Scripts *****/


/***** Humor Page Scripts *****/

var jokeFilter = new Array (
	"progid:DXImageTransform.Microsoft.Stretch(stretchstyle=push, bands=1)",
	"progid:DXImageTransform.Microsoft.Slide(slidestyle=hide, bands=1)"
)

var currentJoke = 0;
var curFilter = 0;
var rs = new Object
var rsnum;
var num;

function initHumorPage() {
 	if (document.title == "Home of http://lourdesparish.com/ - Good Humor Page") {
		getXMLdata(rs5, "5");
	}
}

function getXMLdata(rsnum, n) {
	rs = rsnum.recordset
	num = parseInt(n)
	initButtons()
}

function initButtons() {
//alert(num)

	currentJoke = 0;
	curFilter = 0;
if (num != "18") {
	b1.disabled = true
	b2.disabled = false
	b3.disabled = true
	b4.disabled = false
	rs.moveFirst()
	doManualJokes()
} else {
	b1.disabled = true
	b2.disabled = true
	b3.disabled = true
	b4.disabled = true
}
	jokeCell.filters[0].apply()
	jokeTitleArea.innerHTML = ""
	+ rs("jokeTitle")
	jokeBodyArea.innerHTML = ""
	+ rs("jokebody")
	jokeCell.filters[0].play()
}

function updateButtons(buttonNumber) {

	if(buttonNumber == "1") {
		rs.MoveFirst()
		currentJoke = 0;
		curFilter = 0;
		b1.disabled = true
		b2.disabled = false
		b3.disabled = true
		b4.disabled = false
		doManualJokes()
	}
	if (buttonNumber == "2") {
		if (currentJoke < rs.recordcount - 1) {
			rs.MoveNext()
			currentJoke += 1
			b1.disabled = false
			b2.disabled = false
			b3.disabled = false
			b4.disabled = false
		}
		if (currentJoke == rs.recordcount - 1) {
			rs.MoveLast()
			currentJoke = rs.recordcount - 1
			b1.disabled = false
			b2.disabled = true
			b3.disabled = false
			b4.disabled = true
		}
		doManualJokes()
	}
	if (buttonNumber == "3") {
		if (currentJoke > 0) {
			rs.MovePrevious()
			currentJoke --
			b1.disabled = false
			b2.disabled = false
			b3.disabled = false
			b4.disabled = false
		}
		if (currentJoke == 0) {
			rs.MoveFirst()
			currentJoke = 0;
			b1.disabled = true
			b2.disabled = false
			b3.disabled = true
			b4.disabled = false
		}
		doManualJokes()
	}
	if (buttonNumber == "4") {
		rs.MoveLast()
		currentJoke = rs.recordcount - 1
		b1.disabled = false
		b2.disabled = true
		b3.disabled = false
		b4.disabled = true
		doManualJokes()
	}
}

function doManualJokes() {
window.scrollTo(0,0)
	jokeCell.style.filter = jokeFilter[0]
	jokeCell.filters[0].apply()

	jokeTitleArea.innerHTML = ""
	+ rs("jokeTitle")
	jokeBodyArea.innerHTML = ""
	+ rs("jokebody")
//alert(rs("jokebody"))
	jokeCell.filters[0].play()
}

N = (document.all) ? 0 : 1;
var ob;
function MD(e) {
if (N) {
ob = document.layers[e.target.name];
X=e.x;
Y=e.y;
return false;
}
else {
ob = event.srcElement.parentElement.style;
X=event.offsetX;
Y=event.offsetY;
   }
}
function MM(e) {
if (ob) {
if (N) {
ob.moveTo((e.pageX-X), (e.pageY-Y));
}
else {
ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
ob.pixelTop = event.clientY-Y + document.body.scrollTop;
return false;
      }
   }
}
function MU() {
ob = null;
}

if (N) {
document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}
document.onmousedown = MD;
document.onmousemove = MM;
document.onmouseup   = MU;

function rotate(piece) {
	var degrees = d.value
//alert(degrees )
	if (piece == "p1") {
		piece1.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation=" + degrees + ");"
	}
	if (piece == "p2") {
		piece2.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation=" + degrees + ");"
	}
	if (piece == "p3") {
		piece3.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation=" + degrees + ");"
	}
	if (piece == "p4") {
		piece4.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation=" + degrees + ");"
	}
}

/***** End Humor Page Scripts *****/


/**********************************/

function getImage(image_name, desc, w) {
	document.all.lgPic.src = image_name
	document.all.lgPic.width = w
	subtitle.innerHTML = desc
}

var monthNames = new Array(
	"Jan.", "Feb.", "Mar.", "Apr.",
	"May", "Jun.", "Jul.", "Aug.", "Sep.",
	"Oct.", "Nov.", "Dec."
);

function getDaysInMonth(month, year) {
	var leapYear = "false"
	var ckLeapYr = new Date("February 29, "+ year)
	var leapDay  = ckLeapYr.getDate()
	if (leapDay == 29) {leapYear = "true"} else {leapYear = "false"}
	if (month == 1)
		return (leapYear == "true") ? 29 : 28;
	else
		return ttlDaysInMonth[month];
}

var today = new Date();

function initDates() {
//alert(document.title)
 	if (document.title == "Home of http://lourdesparish.com/ - Weekly Annals") {
 		this.now   = new Date();
		this.year  = this.now.getFullYear();
		var thisYear = this.year
		var thisYearA = thisYear - 1
		var thisYearB = thisYear
		var thisYearC = thisYear + 1
//var thisMonth = today.getMonth()
//alert(thisMonth)
//alert()
		optYearsAnnals.innerHTML = "<select onchange='getDatesBulletins(document.all.months.value);' id='years' class='fnt14b'><br><option value=" + thisYearA + ">" + thisYearA + "</option><br><option value=" + thisYearB +">" + thisYearB + "</option><br><option value=" + thisYearC +">" + thisYearC + "</option><br></select>"

//alert(thisYearC)

 	 	annalsInstructions.innerHTML = "To View A Document, Click On A Date Button<br><br>"
 	 	document.all.months.selectedIndex = today.getMonth()
//alert(thisMonth)
		document.all.years.value = today.getYear()
	 	getDatesBulletins(today.getMonth()+1)
	}
//alert()
 	if (document.title == "Home of http://lourdesparish.com/ - Paw Prints") {
 		this.now   = new Date();
		this.year  = this.now.getFullYear();
		var thisYear = this.year
//alert(thisYear)
		var thisYearA = thisYear - 1
		var thisYearB = thisYear
		var thisYearC = thisYear + 1
//alert(optYearsPP.innerHTML)
		optYearsPP.innerHTML = "<select onchange='getDatesPawPrints(document.all.monthsPP.value);' id='yearsPP' class='fnt14b'><br><option value=" + thisYearA + ">" + thisYearA + "</option><br><option value=" + thisYearB +">" + thisYearB + "</option><br><option value=" + thisYearC +">" + thisYearC + "</option><br></select>"


	 	PPInstructions.innerHTML = "To View A Document, Click On A Date Button<br><br>"
	 	document.all.monthsPP.selectedIndex = today.getMonth()
		document.all.yearsPP.value = today.getYear()
	 	getDatesPawPrints(today.getMonth()+1)
 	}

 	if (document.title == "Home of http://lourdesparish.com/ - Alumni Directory") {
		this.now   = new Date();
		this.year  = this.now.getFullYear();
		var thisYear = this.year
		var thisYearA = 1940

		optYearsClasses.innerHTML = ""
var x = "<select onchange='setPageAlumniOptClass(this.value);' id='yearsClasses' class='fnt12b'><br />"
var y = ""
		for (i = thisYearA ; i <= thisYear; i++) {
			y = y + "<option value=" + i + ">" + i + "</option><br>"
		}
 //alert(y)

		optYearsClasses.innerHTML = x + y + "</select>"
		document.all.yearsClasses.value = today.getYear()
//alert(optYearsClasses.innerHTML)
	}
}

var yr
function getDatesBulletins(monthNum) {

	var year		= document.all.years.value
//alert(year)
	var month		= monthNames[monthNum - 1]
	var ttlMonthDays	= getDaysInMonth(monthNum - 1, year)
	yr = year.substr(2,2)

	if (monthNum < 10) { monthNum = "0"+monthNum }

	DatesBulletins.innerHTML = ""

	for (j = 1; j <= ttlMonthDays; j++) {
		var checkday = new Date(month + " " + j + ", " + year);
		if (j < 10) { j = "0" + j }

		if (checkday.getDay() == 0) {
			var x = "<button class='commonButton' id=" + j + " onclick='setPageBulletins(this.id);' class='commonButton2'>" + month + " " + j  + "</button>&nbsp;&nbsp;"
			DatesBulletins.innerHTML += x
		}
	}
	window.focus()
}

function setPageBulletins(day) {
	num = parseInt(document.all.docs.value)
	mn  = parseInt(document.all.months.value)
	if (mn < 10) { mn = "0" + mn}

	switch (num) {
	case 1:
		page = "http://lourdesparish.com/oll/images/Church/Bulletin/PDF_Files/bulletin" + mn + day + yr + ".pdf"
		break;
	case 2:
		page = "http://lourdesparish.com/oll/images/Church/Pastoral_Letters/pastoralletter" + mn + day + yr + ".pdf"
		break;
	}
//alert(page)

	gotoPage2(page)
}

var yrPP
var numPP
function getDatesPawPrints(num) {

	var year		= document.all.yearsPP.value
	var month		= monthNames[num - 1]
	var ttlMonthDays	= getDaysInMonth(num - 1, year)
	yrPP = year.substr(2,2)
	if (num < 10) { num = "0"+num}
	numPP = num

	DatesPawPrints.innerHTML = ""

	for (j = 1; j <= ttlMonthDays; j++) {
		var checkday = new Date(month + " " + j + ", " + year);
		if (j < 10) { j = "0" + j }

		if (checkday.getDay() == 4) {
			var y = "<button class='commonButton' id=" + j + " onclick='setPagePawPrints(this.id, numPP);' class='commonButton2'>" + month + " " + j  + "</button>&nbsp;&nbsp;"
			DatesPawPrints.innerHTML += y
		}
	}
}

function setPagePawPrints(day, mn) {
	page = "http://lourdesparish.com/oll/images/School/PDF_Files/pp_" + mn + day + yrPP + ".pdf"
	gotoPage2(page)
}

function setPageAlumniOptClass(optYear) {
//alert(optYear)
	page = "http://lourdesparish.com/oll/images/Alumni/Class_PDF_Files/" + optYear + ".pdf"
	gotoPage2(page)
}

/**********************************/


/**********************************/

function gotoPage(page) {
	window.location = page
}

function initPage(page, num) {
	main_content.innerHTML = page

	switch (num) {
	case 1:
		initNewsItems();
		docs.selectedIndex = 0;
		break;
	case 2:
		clearTimeout(newsTimer);
		docs.selectedIndex = 0;
		break;
	case 3:
		clearTimeout(newsTimer);
		showStaffMembers(churchStaff);
		docs.selectedIndex = 0;
		break;
	case 4:
		clearTimeout(newsTimer);
		showCouncilMembers(pcMembers);
		docs.selectedIndex = 0;
		break;
	case 5:
		clearTimeout(newsTimer);
		showPrayerGroups(prayerVine);
		docs.selectedIndex = 0;
		break;
	case 6:
		clearTimeout(newsTimer);
		showPrayerGroups(prayerLine);
		docs.selectedIndex = 0;
		break;
	case 7:
		clearTimeout(newsTimer);
		displayNews(flc2);
		docs.selectedIndex = 0;
		break;
	case 8:
		clearTimeout(newsTimer);
		docs.selectedIndex = 0;
		break;
	case 9:
		clearTimeout(newsTimer);
		displayData(ministry1);
		docs.selectedIndex = 0;
		break;
	case 10:
		clearTimeout(newsTimer);
		displayData(music1);
		docs.selectedIndex = 0;
		break;
	case 16:
		clearTimeout(newsTimer);
		displayNews(local1);
		docs.selectedIndex = 0;
		break;
	case 17:
		clearTimeout(newsTimer);
		displayNews(helping2);
		docs.selectedIndex = 0;
		break;
	case 40:
		clearTimeout(newsTimer);
		docs.selectedIndex = 3;
		break;
	}
}

function showStaffMembers(rs) {
	staff.innerHTML = ""
	rs.recordset.moveFirst()
	while (!rs.recordset.EOF) {
		staff.innerHTML +=
		"<table class=table_3 cellpadding=3 width=600>" +
		"<tr><td class=f12 align=left width=200>" +
		rs.recordset("col1") +
		"</td><td class=f12 align=left width=200>" +
		rs.recordset("col2") +
		"</td><td class=f12 align=left width=200>" +
		rs.recordset("col3") +
		"</td></tr></table>"
		rs.recordset.moveNext()   
	}
}

function showCouncilMembers(rs) {
	council.innerHTML = ""
	rs.recordset.moveFirst()
	while (!rs.recordset.EOF) {
		council.innerHTML +=
		"<table class=table_3 cellpadding=3 width=400>" +
		"<tr><td class=f12 align=left width=200>" +
		rs.recordset("col1") +
		"</td><td class=f12 align=left width=200>" +
		rs.recordset("col2") +
		"</td></tr></table>"
		rs.recordset.moveNext()
	}
}

function showPrayerGroups(rs) {
	prayers.innerHTML = ""
	rs.recordset.moveFirst()
	while (!rs.recordset.EOF) {
		prayers.innerHTML +=
		"<table class=table_3 cellpadding=3 width=600>" +
		"<tr><td class=f16i align=center width=600>" +
		rs.recordset("title") +
		"</td></tr>" +
		"<tr><td class=f12 align=left width=600>" +
		rs.recordset("body") +
		"</td></tr></table>"
		rs.recordset.moveNext()   
	}
}

function setDisplay(data, title) {
	titleArea.innerHTML = ""
	titleArea.innerHTML +=
	"<table cellspacing=3>" +
	"<tr>" +
	"<td class=f14 align=center width=600>" +
		title +
	"</td>" +
	"</tr>" +
	"</table>" +
	"<br>"
	bodyArea.innerHTML = data
}

function displayNews(rsnum) {
	var rs = rsnum.recordset
	rs.moveFirst()
	titleArea.innerHTML = ""
	titleArea.innerHTML +=
//	"<table cellspacing=3>" +
//	"<tr>" +
//	"<td class=f14i align=center width=650>" +
		rs("title")
//	"</td>" +
//	"</tr>" +
//	"</table>"

	bodyArea.innerHTML = ""
	rs.moveFirst()
	while (!rs.EOF) {
		bodyArea.innerHTML +=
			rs("item") +
			"<br><br>" +
			"<center>" +
			"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +
			"</center>" +
			"<br>"
		rs.moveNext()
	}
}

function displayData(rsnum) {
	var rs = rsnum.recordset
	rs.moveFirst()
	titleArea.innerHTML = ""
	titleArea.innerHTML +=
	rs("title") +
	"<br>"

	bodyArea.innerHTML = ""
	rs.moveFirst()
	while (!rs.EOF) {
		bodyArea.innerHTML +=
			rs("body")
		rs.moveNext()
	}
}

/**********************************/


/***** Calendar Code *****/

var weekday	= new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thusday", "Friday", "Saturday");
var dayNames	= new Array("Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat.");
var ttlDaysInMonth	= new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var monthNames	= new Array("Jan.", "Feb.", "Mar.", "Apr.",
			"May", "Jun.", "Jul.", "Aug.", "Sep.",
			"Oct.", "Nov.", "Dec.");

function getDaysInMonth(month, year) {
	var leapYear = "false"
	var ckLeapYr = new Date("February 29, "+ year)
	var leapDay  = ckLeapYr.getDate()
	if (leapDay == 29) {leapYear = "true"} else {leapYear = "false"}
	if (month == 1)
		return (leapYear == "true") ? 29 : 28;
	else
		return ttlDaysInMonth[month];
}

function initCalendar() {
//alert(document.title)
 	if (document.title == "Home of http://lourdesparish.com/ - Calendar") {
//alert(document.title)
		d = new Date();
		document.all.month.selectedIndex = d.getMonth();
		doCalendar();
	}
}

function getTodaysDate() {
	this.now   = new Date();
	this.month = this.now.getMonth();
	this.day   = this.now.getDate();
	this.year  = this.now.getFullYear();
}

todaysDate = new getTodaysDate();

function doCalendar() {
	todaysDate = new getTodaysDate();
	var year = document.all.year[document.all.year.selectedIndex].text;
	var theCal = new Date(year, document.all.month.selectedIndex, 1);
	var rowStartPos = theCal.getDay();
	var day = 999;
	var dayCounter = 0;
	if ((todaysDate.year == theCal.getFullYear()) && (todaysDate.month == theCal.getMonth())) day = todaysDate.day;

	var weekRows = document.all.calendar.tBodies.dayList;
	var intTtlDaysInMonth =	getDaysInMonth(theCal.getMonth(), theCal.getFullYear());
	for (var intWeek = 0; intWeek < weekRows.rows.length; intWeek++)
		for (var intDay = 0; intDay < weekRows.rows[intWeek].cells.length; intDay++) {
			var cell = weekRows.rows[intWeek].cells[intDay];
			if ((intDay == rowStartPos) && (dayCounter == 0)) dayCounter = 1;
			/***** Highlight today's date *****/
			cell.className = (day == dayCounter) ? "today" : "";

			if ((dayCounter > 0) && (dayCounter <= intTtlDaysInMonth))
				cell.innerText = dayCounter++
			else
				cell.innerText = "";
		}
}

function showCal() {
	doCalendar()
}

/***** End Calendar Code *****/

var today = new Date();

var num  = ""
function setPage(day) {
//alert(day)
	num = parseInt(document.all.docs.value)
	mn  = parseInt(document.all.month.selectedIndex + 1)
	if (mn < 10) { mn = "0" + mn}
	if (day < 10) { day = "0" + day}
	var year = document.all.year.value
	yr = year.substr(2,2)
	switch (num) {
	case 1:
		page = "BULLETIN/Bulletins/bulletin" + mn + day + yr + ".pdf"
		break;
	case 2:
		page = "BULLETIN/Pastoral_Letters/pastoralLetter" + mn + day + yr + ".htm"
		break;
	case 3:
		page = "BULLETIN/Homilies/homily" + mn + day + yr + ".htm"
		break;
	case 4:
		page = "SCHOOL/PDF_Files/pp_" + mn + day + yr + ".pdf"
		break;
	case 5:
		page = "BULLETIN/Prayers_Of_The_Faithful/prayers" + mn + day + yr + ".htm"
		break;
	}
//alert(page)
	gotoPage(page)
}

/***** End Calendar Code *****/


function  setMonths2() {
	document.all.months.selectedIndex = 0
}

function doCalendar2() {

	switch (document.all.months.selectedIndex) {
	case 1:
		window.location = "Calendar/HTML_Files/january.htm"
		break;
	case 2:
		window.location = "Calendar/HTML_Files/february.htm"
		break;
	case 3:
		window.location = "Calendar/HTML_Files/march.htm"
		break;
	case 4:
		window.location = "Calendar/HTML_Files/april.htm"
		break;
	case 5:
		window.location = "Calendar/HTML_Files/may.htm"
		break;
	case 6:
		window.location = "Calendar/HTML_Files/june.htm"
		break;
	case 7:
		window.location = "Calendar/HTML_Files/july.htm"
		break;
	case 8:
		window.location = "Calendar/HTML_Files/august.htm"
		break;
	case 9:
		window.location = "Calendar/HTML_Files/september.htm"
		break;
	case 10:
		window.location = "Calendar/HTML_Files/october.htm"
		break;
	case 11:
		window.location = "Calendar/HTML_Files/november.htm"
		break;
	case 12:
		window.location = "Calendar/HTML_Files/december.htm"
		break;
	}

	document.all.months.selectedIndex = 0
//alert(document.all.months[document.all.months.selectedIndex].text)
}


function newWindow() {
	pg = "Bulletin/fathersLetter.doc"
	pgWindow = window.open(Pg, 'pgWin', 'left=0, top=0, width=600, height=600, menubar=yes, scrollbars=yes');
	pgWindow.focus();
}

function turnOn(cell) {
	cell.filters[0].apply();
	cell.style.backgroundColor = "000070";
	cell.style.color = "cccccc";
	cell.filters[0].play();
}

function turnOff(cell) {
	cell.filters[0].apply();
	cell.style.backgroundColor = "";
	cell.style.color = "000070";
	cell.filters[0].play();
}

/***** Begin Prayer Vive Form Submission *****/

function addDelimiter(inputString) {

    var inString = inputString;

    if (inString.indexOf("?") == -1) {
        inString += "?";
    }
    else {
        inString += "&";
    }
    return inString;
}

function send2oll(f) {
//	var to	= "vineollstb@sbcglobal.net"
//	var subject	= "Prayer Request"
//	var subject	= f.Subject.value
	var newline = "\n";
	if (document.title == "Home of http://lourdesparish.com/ - Prayer Vine Email Form") {
		var to = "vineollstb@sbcglobal.net"
		var subject = "Prayer Request"
		var body = f.content.value
	} else if (document.title == "Home of http://lourdesparish.com/ - Parish Registration") {
//alert(document.title)
		var to = "parishsecretary@ollindy.org"
		var subject = "Parish Registration"
		var body = "Father: " + f.Father.value + "\n"
		body= body + "Mother: " + f.Mother.value + "\n"
		body= body + "Child #1: " + f.Child1.value + "\n"
		body= body + "Child #2: " + f.Child2.value + "\n"
		body= body + "Child #3: " + f.Child3.value + "\n"
		body= body + "Child #4: " + f.Child4.value + "\n"
		body= body + "Child #5: " + f.Child5.value + "\n"
		body= body + "Child #6: " + f.Child6.value + "\n"
		body= body + "Child #7: " + f.Child7.value + "\n"
		body= body + "Child #8: " + f.Child8.value + "\n"
		body= body + "Child #9: " + f.Child9.value + "\n"
		body= body + "Child #10: " + f.Child10.value
//alert(body)
	}

	var name	= f.Name.value
	var address1 = f.Address1.value
	var address2 = f.Address2.value
	var city	= f.City.value
	var state	= f.State.value
	var zip	= f.Zip.value
	var phone	= f.Phone.value
	var fax	= f.Fax.value
	var email	= f.Email.value

var data = ""
data += to

data = addDelimiter(data);
data += "Subject=" + escape(subject);

data = addDelimiter(data);

data += "Body=" + escape(name);

data += "%0D%0A" + escape(address1);

data += "%0D%0A" + escape(address2);

data += "%0D%0A" + escape(city);

data += ", " + escape(state);

data += " " + escape(zip);

data += "%0D%0A" + escape(phone);

data += "%0D%0A" + escape(fax);

data += "%0D%0A" + escape(email);

data += "%0D%0A%0A%0D%0D%0A" + escape(body);

//data += "mailto:" + data;

document.location = "mailto:" + data;

}

function send2ollFF(f) {
	var newline = "\n";
	var to = "parishsecretary@ollindy.org"
	var subject	= "Parish Faith Formation Survey"
	var body	= "		Survey of Parish Faith Formation Needs" + "\n\n\n"
	body = body + "Which of the above have you participated in?" + "\n"
	body = body + f.q1.value + "\n\n"
	body = body + "Which of the above faith-based opportunities would you consider participating in?" + "\n"
	body = body + f.q2.value + "\n\n"
	body = body + "What are the strengths of the above faith formation opportunities?" + "\n"
	body = body + f.q3.value + "\n\n"
	body = body + "What do you perceive as the weaknesses of the above faith formation opportunities?" + "\n"
	body = body + f.q4.value + "\n\n"
	body = body + "Put an asterisk by which of the following you would attend if they were offered." + "\n"
	if (f.opt1.checked) {
		body = body + "* Spirituality in Marriage" + "\n"
	} else {
		body = body + "Spirituality in Marriage" + "\n"
	}
	if (f.opt2.checked) {
		body = body + "* Bible Study" + "\n"
	} else {
		body = body + "Bible Study" + "\n"
	}
	if (f.opt3.checked) {
		body = body + "* Parish Mission" + "\n"
	} else {
		body = body + "Parish Mission" + "\n"
	}
	if (f.opt4.checked) {
		body = body + "* Spirituality in Parenting" + "\n"
	} else {
		body = body + "Spirituality in Parenting" + "\n"
	}
	if (f.opt5.checked) {
		body = body + "* Parish Retreat" + "\n"
	} else {
		body = body + "Parish Retreat" + "\n"
	}
	if (f.opt6.checked) {
		body = body + "* Ministry of Moms Sharing (MOMS)" + "\n\n"
	} else {
		body = body + "Ministry of Moms Sharing (MOMS)" + "\n\n"
	}
	body = body + "Other: " + f.opt7.value + "\n\n"

	body = body + "\n" + "Would you be willing to volunteer to help with any current or future faith formation opportunities?  If so, which ones?" + "\n"
	body = body + f.q5.value + "\n\n"
	body = body + "\n" + "Based on your answers above, which do you feel is the single most important faith formation opportunity that our parish offers?" + "\n"
	body = body + f.q6.value + "\n\n"
	body = body + "\n" + "What is the most important opportunity that you would like to see offered that is not currently available?" + "\n"
	body = body + f.q7.value + "\n\n"
	body = body + "\n" + "Comments:" + "\n"
	body = body + f.q8.value + "\n\n"

	body = body + "\n" + "Name:" + "\n"
	body = body + f.name.value + "\n"
	body = body + "\n" + "Phone:" + "\n"
	body = body + f.phone.value + "\n"

	var data = ""
	data += to
	data = addDelimiter(data);
	data += "Subject=" + escape(subject);
	data = addDelimiter(data);
	data += "Body=" + "%0D%0A%0A%0D%0D%0A" + escape(body);

	document.location = "mailto:" + data;

//alert(body)

}

/***** End Prayer Vive Form Submission *****/

function gotoPage3(page) {
	window.open(page, "_blank", "toolbar=no, menubar=no, resizable=1, scrollbars=yes, status=no, width=900, height=700, left=0, top=0");
}