// Sim time countdown (or countdown for anything, really)
// v2.1, rev 30 Sep 2002, Jester, jester@jestertrek.com
// Permission to steal granted as long as these three lines left intact

today   = new Date()
offset  = today.getTimezoneOffset() / 60        // Gets your timezone
simTime = new Date("January 7, 2003 2:00:00")   // Set time of sim in GMT
simTime.setHours(0 - offset)                    // 1-offset Oct thru Apr
// The preceeding line corrects for Daylight Savings Time
// Comment out the line if your region doesn't use this correction

msPerDay  = 24 * 60 * 60 * 1000
msPerHour = 60 * 60 * 1000
msPerMin  = 60 * 1000

for ( timeLeft = simTime.getTime() - today.getTime(); timeLeft < 0; timeLeft = timeLeft + (msPerDay * 7) ) {}
// This line automatically finds the date of your next sim, if the sim
// date that you specified above has already passed; reduces maintenance

daysLeft  = (timeLeft / msPerDay)
hoursLeft = (timeLeft / msPerHour)
minsLeft  = (timeLeft / msPerMin)
daysLeft  = Math.floor(daysLeft)
hoursLeft = Math.floor(hoursLeft) - (daysLeft * 24)
minsLeft  = Math.floor(minsLeft) - (daysLeft * 24 + hoursLeft) * 60

togodaysString = " days, "
if (daysLeft == 1) togodaysString = " day, "
togohoursString = " hours, and "
if (daysLeft == 0) togohoursString = " hours and "
if (hoursLeft == 1) togohoursString = " hour, and "
if (daysLeft == 0 && hoursLeft == 1) togohoursString = " hour and "
togominsString = " minutes. "
if (minsLeft == 1) togominsString = " minute. "
backString = hoursLeft + togohoursString + minsLeft + togominsString
frontString = "Time until our next sim: " + daysLeft + togodaysString
if (daysLeft == 0) frontString = "Time until our next sim: "
togoString = frontString + backString

// document.write(togoString)
document.write("<i>Coronado</i>'s final sim ever was 30 August 2004.  Thank you, <i>Coro</i> simmers!")
