<!--//
var day_name = new Array("Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday");
var month_name = new Array("December", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "January");
var ending = new Array("0", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "st", "nd");

function writeURL(dd,mm,yy)
	{
	var yearbit = "";
	yearbit = (yearbit + yy);
	if (yy < 10)
		{
		yearbit = ("0" + yearbit)
		}

	var monthbit = "";
	monthbit = (monthbit + mm);
	if (mm < 10)
		{
		monthbit = ("0" + monthbit)
		}

	var daybit = "";
	daybit = (daybit + dd);
	if (dd < 10)
		{
		daybit = ("0" + daybit)
		}

	var inclhtm = yearbit + monthbit + daybit;
	return inclhtm;
	}

function write_in_full(day_no,dd,mm)
{
	var feast_name="";
	if (feast[mm][dd] != "")
	{
		feast_name = ", " + feast[mm][dd];
	}
	
	var in_full = day_name[(day_no+1)] + " " + dd + ending[dd] + " " + month_name[mm] + feast_name;

	return in_full;
	}

function imagein()
	{
	var today = new Date();
	var date_no = today.getDate();
	var month_no = today.getMonth();
	month_no +=1;
	var imagename="p"+month_no+"_"+date_no+".jpg";
	document.write('<img src=\"http://www.jesuit.ie/prayer/images/picsbyno/' + imagename + '\" border=0 alt=\"Sacred Space\" height=120 vspace=2 name="dailypic">');
	}

function enlarge_dailypic()
	{
	this.dailypic.height=200;
	}
	
function contract_dailypic()
	{
	this.dailypic.height=120;
	}
	
function notice(url)
{
	window.open(url, "notice", "height=320, width=300, toolbar=no, scrollbars=yes, resizable=yes, pageXOffset=100, pageYOffset=100")
}

function print_dates()
{
	var days_in_month = new Array(31,31,28,31,30,31,30,31,31,30,31,30,31,31);

	var today = new Date();
	var weekday_no = today.getDay();
	var date_no = today.getDate();
	var month_no = today.getMonth();
	month_no +=1;
	var year_no = (today.getYear())%100;
	
	if ((year_no % 4) == 0)
		{
		days_in_month[2] = 29;
		}
	
	// NOW FOR YESTERDAY;
	var yweekday_no = weekday_no - 1;
	var ydate_no = (date_no - 1);
	var ymonth_no = month_no;
	var yyear_no = year_no;
	if (date_no == 1)
		{
		ymonth_no = (month_no - 1);
			if (month_no == 1)
				{
				ymonth_no = 12;
				yyear_no = year_no - 1;
				}
		ydate_no = days_in_month[ymonth_no]
		}

	// NOW FOR TOMORROW;
	var tweekday_no = weekday_no + 1;
	var tdate_no = (date_no + 1);
	var tmonth_no = month_no;
	var tyear_no = year_no;

	if (date_no == days_in_month[month_no])
		{
		tmonth_no = (month_no + 1);
		tdate_no = 1;
			if (month_no == 12)
				{
				tmonth_no=1;
				tyear_no = (year_no + 1);
					if (year_no == 99)
						{
						tyear_no = 0
						}
				}
		}

	// NOW FOR the next day of TOMORROW;
	var ttweekday_no = tweekday_no + 1;
	var ttdate_no = (tdate_no + 1);
	var ttmonth_no = tmonth_no;
	var ttyear_no = tyear_no;

	if (tdate_no == days_in_month[tmonth_no])
		{
		ttmonth_no = (tmonth_no + 1);
		ttdate_no = 1;
			if (tmonth_no == 12)
				{
				ttmonth_no=1;
				ttyear_no = (tyear_no + 1);
					if (tyear_no == 99)
						{
						ttyear_no = 0
						}
				}
		}

	var reftext = "./dailyprayer.jsp?lang=en&ver=full&date=";
	reftext = "javascript:dailyprayer(\"";

	document.write("<center><font face=\"Verdana,Arial,Graphite Light Narrow ATT\">");
	document.write("<font size=4 color=#404060>Choose the day you want from the selection below:</font><br><br><br>");
	document.write("<font size=4 color=#906000>");
	document.write('<A HREF = ' + reftext + writeURL(ydate_no,ymonth_no,yyear_no) + '\")>');
	document.write(write_in_full(yweekday_no,ydate_no,ymonth_no) + "</a><br><br>");

	document.write('<A HREF = ' + reftext + writeURL(date_no,month_no,year_no) + '\")>');
	document.write(write_in_full(weekday_no,date_no,month_no) + "</a><br><br>");

	document.write('<A HREF = ' + reftext + writeURL(tdate_no,tmonth_no,tyear_no) + '\")>');
	document.write(write_in_full(tweekday_no,tdate_no,tmonth_no) + "</a><br><br>");

	if (( tmonth_no == 2) && ( tdate_no == 28 ))
	{
		document.write("<a href=http://www.jesuit.ie/prayer/index_retreat.htm>- Sacred Space Retreat Day Online -</a><br><br>");
	}

	// if today is Friday,
	if (weekday_no == 5) {
		document.write('<A HREF = ' + reftext + writeURL(ttdate_no,ttmonth_no,ttyear_no) + '\")>');
		document.write(write_in_full(ttweekday_no,ttdate_no,ttmonth_no) + "</a><br><br>");
	}

	document.write('<font size=2><b>The &#39;Feb 28th Sacred Space Retreat Day&#39; will be available online during Lent.<br><a href=http://www.jesuit.ie/prayer/index_retreat.htm>Click here for the retreat</a> when you are free, and fix your own time schedule.</b></font>');

	document.write("<br><br>");
	document.write("</font></font>");
	
	document.write("<form name=\"form1\"><font face=\"Arial, Graphite Light Narrow\" size=2 colour=#604000><input type=\"radio\" name=\"radio1\" value=\"full\" checked> Full version &nbsp; &nbsp; <input type=\"radio\" name=\"radio1\" value=\"basic\"> Basic version&nbsp; &nbsp; <input type=\"radio\" name=\"radio1\" value=\"print\"> Printer Friendly version<hr width=420>");

	document.write("If today's date isn't here, please check the date setting on your computer.</font></form></center>");
}

function dailyprayer_jsp(date)
{
	var version = "";
	var lang = "en";
	if (document.form1.radio1[0].checked == true) {version = "full";}
	if (document.form1.radio1[1].checked == true) {version = "basic";}
	if (document.form1.radio1[2].checked == true) {version = "print";}
	
	var dailyprayer = "./dailyprayer.jsp?lang=" + lang + "&version=" + version + "&date=" + date; 
	document.location = (dailyprayer);
}

function dailyprayer_bak(date)
{
	var version = "";
	var lang = "en";
	if (document.form1.radio1[0].checked == true) {version = "full";}
	if (document.form1.radio1[1].checked == true) {version = "basic";}
	if (document.form1.radio1[2].checked == true) {version = "print";}
	
	setCookie("prayerdate", date);
	setCookie("lang", lang);
	var dailyprayer = "./prayer_" + version + ".htm"; 
	document.location = (dailyprayer);
}

function dailyprayer(date)
{
	var version = "";
	if (document.form1.radio1[0].checked == true) {version = "ej";}
	if (document.form1.radio1[1].checked == true) {version = "eh";}
	if (document.form1.radio1[2].checked == true) {version = "ep";}
	
	var dailyprayer = "./" + version + date + ".htm"; 
	document.location = (dailyprayer);
}
	
//-->