<!--
shireMonths = new Array("Afteryule","Solmath","Rethe","Astron","Thri midge","Forelithe",
"Afterlithe","Wedmath","Halimath","Winterfilth","B lommath","Foreyule");
numDays = new Array(30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30);
daysToAdd = new Array(10, 11, 9, 10, 10, 11, 8, 9, 10, 10, 11, 11);
var x = new Date();
theYear = x.getYear();
theMonth = x.getMonth();
theDate = x.getDate();
// theYear = 2004;
// theMonth = 0;
// theDate = 24;
shireDate = theDate;
shireMonth = theMonth;
shireYear = theYear;
if (isLeap())
{
daysToAdd[2] += 1;
daysToAdd[3] += 1;
daysToAdd[4] += 1;
daysToAdd[5] += 1;
}
shireDate += daysToAdd[shireMonth];
monthName = shireMonths[shireMonth];
hasDay = true;
if (shireDate > numDays[shireMonth])
{
shireDate -= numDays[shireMonth];
shireMonth++;
monthName = shireMonths[shireMonth];
if (shireMonth > 11)
{
shireMonth = 0;
monthName = shireMonths[shireMonth];
shireYear += 1;
shireDate -= 2;
if (shireDate < 1)
{
if (shireDate == -1) shireYear -= 1;
monthName = 'Yule';
shireDate +=2;
}
}
if ((shireMonth == 6)&&(!isLeap))
{
shireDate -= 3;
if (shireDate == -2) { monthName = 'Lithe'; shireDate = 1; }
if (shireDate == 0) { monthName = 'Lithe'; shireDate = 2; }
if (shireDate == -1) { monthName = 'Midyear\'s Day'; shireDate = ''; hasDay = false; }
}
if ((shireMonth == 6)&&(isLeap))
{
shireDate -= 4;
if (shireDate == 0) { monthName = 'Lithe'; shireDate = 2; }
if (shireDate == -1) { monthName = 'Overlithe'; shireDate = ''; hasDay = false; }
if (shireDate == -2) { monthName = 'Midyear\'s Day'; shireDate = ''; hasDay = false; }
if (shireDate == -3) { monthName = 'Lithe'; shireDate = 1; }
}
}

function isLeap()
{
isLeap = false;
if( (theYear % 4 == 0) && //*** Leap year
((theYear % 100 != 0) || (theYear % 400 ==0)) ) isLeap = true;
return isLeap;
}

function getShireDate()
{
getShireDate = shireDate;
return getShireDate;
}

function getShireMonth()
{
getShireMonth = monthName;
return getShireMonth;
}

function getShireYear()
{
if (shireYear < 1900) { shireYear += 1900; }
getShireYear = shireYear;
return getShireYear;
}

function getShireDay()
{
shireDays = new Array("Sterday","Sunday","Monday","Trewsday","Heve nsday","Mersday","Highday");
if ((shireMonth < 6) && (hasDay))
{
cumDate = shireDate + (shireMonth * 30);
remDate = cumDate % 7;
getShireDay = shireDays[remDate];
}
if ((shireMonth > 5) && (hasDay))
{
cumDate = shireDate + ((shireMonth - 6) * 30);
remDate = cumDate % 7;
getShireDay = shireDays[remDate];
}
if (!hasDay) getShireDay = '';
if ((monthName == 'Yule') || (monthName == 'Lithe'))
{
if (shireDate == 1) getShireDay = 'Highday';
if (shireDate == 2) getShireDay = 'Sterday';
}
return getShireDay;
}
//-->
