<!-- Begin

//Edit History:
//[1] 01-04-07 CLS - FIX: Handle Christmas year properly
//			   UPD: Set dates for 2007 (comment = "//2007")
//
//[2] 01-07-08 CLS - UPD: Set dates for 2008 (comment = "//2008")
//
//[3] 01-01-09 CLS - UPD: Set dates for 2009 (comment = "//2009")
//			    UPD: Colors changed to match traditional calendar :)
//
//[4] 02-02-10 CLS - UPD: Set dates for 2010 (comment = "//2010")
//
//[5] 02-03-11 CLS - UPD: Set dates for 2011 (comment = "//2011")
//

// Start of Liturgical Season Code

function doAdventSeason() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center" bgcolor="white">');
	document.write('      <span class="subtitle" style="color:#8D38C9; font-size:13px">');
	document.write('        &nbsp;A<span class="smallcaps">dvent</span> S<span class="smallcaps">eason</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
}

function doChristmastide() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center">');
	document.write('      <span class="subtitle" style="color:white; font-size:13px">');
	document.write('        &nbsp;C<span class="smallcaps">hristmastide</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
}

function doEpiphanySeason() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center" bgcolor="white">');
	document.write('      <span class="subtitle" style="color:green; font-size:13px">');
	document.write('        &nbsp;E<span class="smallcaps">piphany</span> S<span class="smallcaps">eason</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
}

function doPreLentenSeason() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center" bgcolor="white">');
	document.write('      <span class="subtitle" style="color:#8D38C9; font-size:13px">');
	document.write('        &nbsp;P<span class="smallcaps">re</span>-L<span class="smallcaps">enten</span> S<span class="smallcaps">eason</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
}

function doLentenSeason() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center" bgcolor="white">');
	document.write('      <span class="subtitle" style="color:#8D38C9; font-size:13px">');
	document.write('        &nbsp;L<span class="smallcaps">enten</span> S<span class="smallcaps">eason</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');

	//doLentenBrochures();
}

function doPassiontide(today,holyWeek) {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center" bgcolor="white">');
	document.write('      <span class="subtitle" style="color:#8D38C9; font-size:13px">');
	document.write('        &nbsp;P<span class="smallcaps">assiontide</span>&nbsp;');
	document.write('      </span>');

	if (today >= holyWeek) {
		document.write('      <br>');
		document.write('      <span class="subtitle" style="color:#8D38C9; font-size:11px">');
		document.write('        H<span class="smallcaps">oly</span> W<span class="smallcaps">eek</span>');
		document.write('      </span>');
	}

	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');

	//doLentenBrochures();
}

function doLentenBrochures() {
	document.write('<br>');

	document.write('<div align="center">');

	document.write('<a href="/brochures/Lent_and_Holy_Week-2011.pdf" class="sidelink" onMouseOver="window.status=\'Lent and Holy Week 2011\';return true;" onMouseOut="window.status=\' \';return true;" target="_blank" title="Opportunities for Worship, Education, and Fellowship (PDF)">Lent and Holy Week 2011</a>');

	document.write('<br><span style="line-height: 50%"><br></span>');

	document.write('<a href="/brochures/The_Observance_of_an_Holy_Lent-2011.pdf" class="sidelink" onMouseOver="window.status=\'The Observance of an Holy Lent \(2011\)\';return true;" onMouseOut="window.status=\' \';return true;" target="_blank" title="Suggested Disciplines and Devotions (PDF)">The Observance of an<br>Holy Lent \(2011\)</a>');

	document.write('</div>');
}

function doEastertide() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center">');
	document.write('      <span class="subtitle" style="color:white; font-size:13px">');
	document.write('        &nbsp;E<span class="smallcaps">astertide</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');

	document.write('<br>');

	document.write('<div align="center">');

	document.write('  <img src="/picts/easter_cross_w_lily-51x72.gif" width="51" height="72" align="middle" alt="Easter Cross with Lily">');

	document.write('</div>');
}

function doAscensiontide() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center">');
	document.write('      <span class="subtitle" style="color:white; font-size:13px">');
	document.write('        &nbsp;A<span class="smallcaps">scensiontide</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
}

function doWhitsuntide() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center" bgcolor="white">');
	document.write('      <span class="subtitle" style="color:crimson; font-size:13px">');
	document.write('        &nbsp;W<span class="smallcaps">hitsuntide</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
}

function doTrinitySeason() {
	document.write('<TABLE align="center" border="1" cellpadding="0" cellspacing="0">');
	document.write('  <tr>');
	document.write('    <td align="center" bgcolor="white">');
	document.write('      <span class="subtitle" style="color:green; font-size:13px">');
	document.write('        &nbsp;T<span class="smallcaps">rinity</span> S<span class="smallcaps">eason</span>&nbsp;');
	document.write('      </span>');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
}

function showLiturgicalSeason() {
	var today = new Date();
	var curMonth = curDate = 0;	//[1]
	curMonth = today.getMonth();	//[1]
	curDate = today.getDate();	//[1]
	var year = month = day = hours = minutes = seconds = 0;
	year = takeYear(today);		//takeYear is located in javascripts.js
	today = today.getTime();	//NN3

//Set Advent Start Date...
	var advent = new Date();
	day = 27; month = 11;		//2011
	advent.setDate(day);
	advent.setMonth(month-1);
	advent.setYear(year);
	advent.setHours(hours);
	advent.setMinutes(minutes);
	advent.setSeconds(seconds);
	advent = advent.getTime();

//Set Christmas Start Date...
	var christmas = new Date();
	day = 25; month = 12;		//Perpetual
	christmas.setDate(day);
	christmas.setMonth(month-1);

//[1] - below
//NOTE: Liturgical season begins with the first Sunday in Advent.
//      Hence year manipulation which follows.
//
//	christmas.setYear(year);
	if (curMonth == 11 && curDate >= 25) {		// Month = 0-11 in JavaScript!
		christmas.setYear(year);
		year = year + 1;					// For the seasons following
	}
	else if (curMonth == 0 && curDate <= 5) {		// Month = 0-11 in JavaScript!
		christmas.setYear(year-1);
	}
//[1] - above

	christmas.setHours(hours);
	christmas.setMinutes(minutes);
	christmas.setSeconds(seconds);
	christmas = christmas.getTime();

//Set Epiphany Start Date...
	var epiphany = new Date();
	day = 6; month = 1;		//Perpetual
	epiphany.setDate(day);
	epiphany.setMonth(month-1);
	epiphany.setYear(year);
	epiphany.setHours(hours);
	epiphany.setMinutes(minutes);
	epiphany.setSeconds(seconds);
	epiphany = epiphany.getTime();

//Set Pre-Lent Start Date...
	var preLent = new Date();
	day = 20; month = 2;		//2011
	preLent.setDate(day);
	preLent.setMonth(month-1);
	preLent.setYear(year);
	preLent.setHours(hours);
	preLent.setMinutes(minutes);
	preLent.setSeconds(seconds);
	preLent = preLent.getTime();

//Set Lent Start Date...
	var lent = new Date();
	day = 9; month = 3;		//2011
	lent.setDate(day);
	lent.setMonth(month-1);
	lent.setYear(year);
	lent.setHours(hours);
	lent.setMinutes(minutes);
	lent.setSeconds(seconds);
	lent = lent.getTime();

//Set Passion Start Date...
	var passion = new Date();
	day = 10; month = 4;		//2011
	passion.setDate(day);
	passion.setMonth(month-1);
	passion.setYear(year);
	passion.setHours(hours);
	passion.setMinutes(minutes);
	passion.setSeconds(seconds);
	passion = passion.getTime();

//Set Holy Week Start Date...
	var holyWeek = new Date();
	day = 17; month = 4;		//2011
	holyWeek.setDate(day);
	holyWeek.setMonth(month-1);
	holyWeek.setYear(year);
	holyWeek.setHours(hours);
	holyWeek.setMinutes(minutes);
	holyWeek.setSeconds(seconds);
	holyWeek = holyWeek.getTime();

//Set Easter Start Date...
	var easter = new Date();
	day = 24; month = 4;		//2011
	easter.setDate(day);
	easter.setMonth(month-1);
	easter.setYear(year);
	easter.setHours(hours);
	easter.setMinutes(minutes);
	easter.setSeconds(seconds);
	easter = easter.getTime();

//Set Ascension Start Date...
	var ascension = new Date();
	day = 2; month = 6;		//2011
	ascension.setDate(day);
	ascension.setMonth(month-1);
	ascension.setYear(year);
	ascension.setHours(hours);
	ascension.setMinutes(minutes);
	ascension.setSeconds(seconds);
	ascension = ascension.getTime();

//Set Whitsun Start Date...
	var whitsun = new Date();
	day = 12; month = 6;		//2011
	whitsun.setDate(day);
	whitsun.setMonth(month-1);
	whitsun.setYear(year);
	whitsun.setHours(hours);
	whitsun.setMinutes(minutes);
	whitsun.setSeconds(seconds);
	whitsun = whitsun.getTime();

//Set Trinity Start Date...
	var trinity = new Date();
	day = 19; month = 6;		//2011
	trinity.setDate(day);
	trinity.setMonth(month-1);
	trinity.setYear(year);
	trinity.setHours(hours);
	trinity.setMinutes(minutes);
	trinity.setSeconds(seconds);
	trinity = trinity.getTime();

	if (today >= advent &&
	    today < christmas) {
		doAdventSeason();
	}
	else if (today >= christmas &&
		   today < epiphany) {
		doChristmastide();
	}
	else if (today >= epiphany &&
		   today < preLent) {
		doEpiphanySeason();
	}
	else if (today >= preLent &&
		   today < lent) {
		doPreLentenSeason();
	}
	else if (today >= lent &&
		   today < passion) {
		doLentenSeason();
	}
	else if (today >= passion &&
		   today < easter) {
		doPassiontide(today,holyWeek);
	}
	else if (today >= easter &&
		   today < ascension) {
		doEastertide();
	}
	else if (today >= ascension &&
		   today < whitsun) {
		doAscensiontide();
	}
	else if (today >= whitsun &&
		   today < trinity) {
		doWhitsuntide();
	}
	else {
		doTrinitySeason();
	}
}

// End of Liturgical Season Code -->

