﻿// JScript File

function countDays() {
todaysDate = new Date()
var thisYear = todaysDate.getFullYear()
var yearDiff = thisYear - 1886
var thisMonth = todaysDate.getMonth() + 1
var monthDiff = thisMonth - 6
if (monthDiff < 0) {
	yearDiff--
	monthDiff = thisMonth + 6 
}
lastMonth = thisMonth - 1
if (lastMonth == 1 || lastMonth == 3 || lastMonth == 5 || lastMonth == 7 || lastMonth == 8 || lastMonth == 10 || lastMonth == 12) {
lastDayDiff = 13 
} else {
	if (lastMonth == 2) {
		if (thisYear % 4 == 0) {
			lastDayDiff = 11 
		} else {
			lastDayDiff = 10
		}
	} else {
		lastDayDiff = 12
	}

}
var thisDay = todaysDate.getDate()
var dayDiff = thisDay - 18
if (dayDiff < 0) {
	if (monthDiff != 0) {
	monthDiff--
	dayDiff = lastDayDiff + thisDay } 
	else {
	yearDiff--
	dayDiff = lastDayDiff + thisDay
	}}
var dateDiff = "Stout is " + yearDiff + " years, " + monthDiff + " months and " + dayDiff + " days old today!"
document.write(dateDiff)
}