arrImages = new Array(4);
arrImages[0] = "/images/church_spring.jpg";
arrImages[1] = "/images/church_early_autumn.jpg";
arrImages[2] = "/images/church_late_autumn_2.jpg";
arrImages[3] = "/images/church_winter.jpg";

arrAltText = new Array(4);
arrAltText[0] = "The church in spring";
arrAltText[1] = "The church in summer";
arrAltText[2] = "The church in autumn";
arrAltText[3] = "The church in winter";

function setSeasonImage(){
	var seasonIndex = getSeasonIndex();
	//alert(seasonIndex);
	//alert(arrImages[seasonIndex]);
	//alert(arrAltText[seasonIndex]);
	document.church_front_img.src = arrImages[seasonIndex];
	document.church_front_img.alt = arrAltText[seasonIndex];
}

function getSeasonIndex(){
	var seasonIndex = 0;
	today = new Date();
	month = today.getMonth() + 1;
	day = today.getDate();
	
	switch(month){
		case 1:
		case 2:
			seasonIndex = 3;
			break;
		case 3:	//vernal equinox ~March 20th
			if (day <= 20){
				seasonIndex = 3;
			} else {
				seasonIndex = 0;
			}
			break;
		case 4:
		case 5:
			seasonIndex = 0;
			break;
		case 6: //summer solstice ~June 21st
			if (day <= 21){
				seasonIndex = 0;
			} else {
				seasonIndex = 1;
			}
			break;
		case 7:
		case 8:
			seasonIndex = 1;
			break;
		case 9: //autumnal equinox ~Sept 22nd
			if (day <= 22){
				seasonIndex = 1;
			} else {
				seasonIndex = 2;
			}
			break;
		case 10:
		case 11:
			seasonIndex = 2;
			break;
		case 12: //winter solstice ~Dec 21st
			if (day <= 21){
				seasonIndex = 2;
			} else {
				seasonIndex = 3;
			}
			break;
	}
	return seasonIndex;
}
