// JavaScript Document

function rotateImages() {
	var oCurPhoto = $('#photoShow div.current');
	var oNxtPhoto = oCurPhoto.next();
	if (oNxtPhoto.length == 0) /* At the last image */
		oNxtPhoto = $('#photoShow div:first');
	
	oCurPhoto.removeClass('current').addClass('previous');
	oNxtPhoto.css({opacity:0.0}).addClass('current').animate({opacity:1.0}, 1000,
		function() {
			oCurPhoto.removeClass('previous');
		});
}	
/* -------------------------------------------------------- */
function stPatsDay() {
// calculate number of days until St. Patrick's day
	var Today = new Date();
	var ThisDay = Today.getDate();
	var ThisMonth = Today.getMonth() + 1;
	var MonthName = MonthText(ThisMonth);
	var ThisYear = Today.getFullYear();
	var spDay = new Date("March, 17, 2011");
	spDay.setFullYear(ThisYear);
	if ((ThisMonth > 3) || (ThisMonth == 3 && ThisDay > 17)) // Set to calculate for next St. Pat's
	{														 // if this year's is past
		spDay.setFullYear(ThisYear + 1);
	} 
	var DaysLeftFraction = (spDay - Today)/(1000 * 60 * 60 *24);
	DaysLeft = Math.round(DaysLeftFraction);
	document.write("<h4>Today is "+MonthName + " " + ThisDay + ", " + ThisYear + "</h4>");
	if (DaysLeft > 1)
	{
		document.write("<h3>It's only " + DaysLeft + " days until our 30th St. Patrick's Day!!</h3>");
	}
	else
	{
		if (DaysLeftFraction <= 1 && DaysLeftFraction > 0)
		{
			document.write("<h2>Tomorrow is St. Patrick's Day!!</h2>");
		}
		else
		{
			document.write("<h2>Today is St. Patrick's Day!!<br><i>Come celebrate at Fat Alberts!</h2>");
		}
	}
		
}
function MonthText(MonthNumber)
{
	var Month = new Array();
	Month[1]="January";
	Month[2]="February";
	Month[3]="March";
	Month[4]="April";
	Month[5]="May";
	Month[6]="June";
	Month[7]="July";
	Month[8]="August";
	Month[9]="September";
	Month[10]="October";
	Month[11]="November";
	Month[12]="December";
	return Month[MonthNumber];
}

