/* Tickler.js
This is the file that provides seasonal messages to several screens based on message date.
Revised 1/22/98 to allow multiple events on the same day.  Revised test for multiple 11/11/99.*/
<!--
function print() {
	 document.write("Big Date: " + this.bdate
	  + "<br>gt1a: " + this.gt1a
	  + "<br>gt1b: " + this.gt1b
	  + "<br>eve: " + this.eve
	  + "<br>eqday: " + this.eqday + "<p>");
	}

function printa() {
	var message="<P align=center><font color=brown size=5>"+else_msg
	if (daysLeft >1){ message= "<p align=center><B>"+this.gt1a+daysLeft+this.gt1b+"</B>"}
	if (daysLeft==1){message = "<p align=center><font color=green>"+this.eve+"</B>"}
	if (daysLeft==0){message = "<p align=center><font color=green>"+this.eqday+"</B>"}
	document.write(message);

	}

function event(bdate,gt1a,gt1b,eve,eqday) {
	this.bdate = new Date(bdate);
 	this.gt1a = gt1a;
 	this.gt1b = gt1b;
	this.eve = eve;
	this.eqday = eqday;
 	this.print = print;
	this.printa = printa;
	}

//Construct a date variable for 0000 hours today
		var now= new Date();		// Current date & time
		var year = now.getYear()
		if(year < 1900)
		{
			year = year + 1900;
		}
		var month = now.getMonth()
		var day = now.getDate()
		var today= new Date(year,month,day)

// set dotest to 1 to substitute the testdate for today. set to 0 for normal operation
var testdate=new Date("10/14/99");
var dotest= 0
if(dotest==1){today = testdate;}

// Event data entry starts below
//Do not overwrite last event.  It is my stopper.
// If you add rather than change events, adjust the num_events value below
//Recommend that first ten event numbers be reserved for one-shot events
//Recommend that Events 10 thru -? be repeating yearly events

var num_events = 50;

// Go for it
var library = new Object();
library[0] = new event(
	"12/29/2000",
	"Event in ",
	" days. <br>Wednesday, December 13, 3:00 - 4:30 at the Doubletree Hotel.",
	"Event tomorrow. <br>3:00 - 4:30 at the Doubletree Hotel.",
	"Event today. <br>3:00 - 4:30 at the Doubletree Hotel."
	);
library[1] = new event(
	"1/13/2001",
	"New Years Party in ",
	" days on Jan 13. ",
	"New Years Party tomorrow night.",
	"New Years Party tonight.  What are you doing here?"
	);
library[2] = new event(
	"12/7/2002",
	"You have ",
	" days until this site's First Birthday.",
	"Tomorrow marks 1 years of service for this site",
	"Today marks one full year since this site was created.<br><img src='file://us-cho-03/data_2/eng/dept280/home/anigifs/trans_bg/10cakecp.gif' height=120> Happy Birthday to me. "
	);
library[3] = new event(
	"1/24/2003",
	"You have ",
	" days until the Colossal Week of Rounds at St Petersburg FL. with Goss, Rumble and Worlock.",
	"Tomorrow is the Colossal Week of Rounds at St Petersburg FL.",
	"Colossal Week of Rounds at St Petersburg FL. starts today. "
	);
library[4] = new event(
	"2/21/2003",
	"The Roundarama Round Dance Weekend in York PA. starts in  ",
	" days .",
	"The Roundarama Round Dance Weekend starts tomorrow.",
	"<The Roundarama Round Dance Weekend starts tonight."
	);
library[5] = new event(
	"12/21/2000",
	"In  ",
	" days you need to power down your computer and UPS for the holidays.",
	"Before you go home tomorrow, <br>you should power down your computer and UPS for the holidays.<br>Power will be down longer than your UPS can handle.",
	"<font color=blue>Please turn off your computer and UPS before you leave today. <br><font color=red> Have a wonderful holiday."
	);
library[6] = new event(
	"12/19/2000",
	"There are ",
	" days until the Holiday deadine for LBR entries (10AM Wednesday)",
	"Your time for the week should be entered in LBR before 10 AM tomorrow.",
	"Be sure you have entered your time for the week by 10 Am today."
	);
library[7] = new event(
	"1/1/98",
	"You have ",
	" days until ",
	"Tomorrow is ",
	"Today is "
	);
library[8] = new event(
	"1/1/98",
	"You have ",
	" days until ",
	"Tomorrow is ",
	"Today is "
	);
library[9] = new event(
	"1/14/2001",
	"You have ",
	" days until our CMM Level 3 Assessment (Mid-January?).",
	"Tomorrow is the first day of our CMM Level 3 Assessment.",
	"Today is the first day of our CMM Level 3 Assessment."
	);

library[10] = new event(
	"2/2/2001",
	"You have ",
	" days until Groundhog Day",
	"Groundhog Day is Tomorrow. ",
	"Today is Groundhog Day. (He saw his shadow.)<img src='file://us-cho-03/data_2/eng/dept280/gifs/grndhog.gif' height=120>"
	);
library[11] = new event(
	"2/12/2001",
	"You have ",
	" days until Lincoln's Birthday",
	"Tomorrow is Lincoln's Birthday",
	"Today is Lincoln's Birthday<img src='file://us-cho-03/data_2/eng/dept280/gifs/lincoln.gif' height=120>"
	);
library[12] = new event(
	"2/14/2001",
	"You have ",
	" days until Valentines Day.",
	"Valentines Day is Tomorrow",
	"Happy Valentines Day<img src='file://us-cho-03/data_2/eng/dept280/gifs/heart.gif' height=120>"
	);
library[13] = new event(
	"2/19/2001",
	"You have ",
	" days Washington's Birthday (observed) a.k.a Presidents Day.",
	"Tomorrow is Washington's Birthday (observed)",
	"Today is Washington's Birthday (observed) / President's Day..a FED Holiday<img src='file://us-cho-03/data_2/eng/dept280/gifs/georgew.gif' height=120>"
	);
library[14] = new event(
	"2/22/2001",
	"You have ",
	" days until George Washington's Birthday.",
	"George Washington's Birthday is Tomorrow",
	"Today is George Washington's Birthday"
	);
library[15] = new event(
	"4/16/2001",
	"You have ",
	" days until Federal Tax Deadline.",
	"Tomorrow is the Federal Tax Deadline.",
	"Federal Tax Deadline is today."
	);
library[16] = new event(
	"3/17/2001",
	"You have ",
	" days until St. Patrick's Day.",
	"Tomorrow is St. Patrick's Day",
	"Today is St. Patrick's Day<img src='file://us-cho-03/data_2/eng/dept280/gifs/shamrock.gif' height=120>"
	);
library[17] = new event(
	"4/1/2001",
	"You have ",
	" days until April Fool's Day.",
	"Tomorrow is April Fool's Day",
	"Today is April Fools Day."
	);
library[18] = new event(
	"3/20/2001",
	"You have ",
	" days until Spring.",
	"Tomorrow is the first day of Spring",
	"Spring has sprung<img src='file://us-cho-03/data_2/eng/dept280/gifs/spring.gif' height=120>"
	);
//
library[19] = new event(
	"5/11/2003",
	"You have ",
	" days until Mother's Day.",
	"Tomorrow is Mother's Day",
	"Happy Mother's Day"
	);
library[20] = new event(
	"5/15/2003",
	"You have ",
	" days until the Virginia State Festival in Williamsburg.",
	"Tomorrow is the first day of the Virginia State Festival in Williamsburg.",
	"Today is the First day of the Virginia State Festival in Williamsburg. "
	);
library[21] = new event(
	"5/18/2003",
	"You have ",
	" days until the First Day of the week long Spring Accent on Rounds at Fontana.",
	"Tomorrow is the First Day of the week long Spring Accent on Rounds at Fontana.",
	"Today is  the First Day of the week long Spring Accent on Rounds at Fontana."
	);
library[22] = new event(
	"7/11/2003",
	"You have ",
	" days until the North Carolina Round Dance Clinic with Bill and Carol Goss",
	"Tomorrow is the first day of  the North Carolina Round Dance Clinic with Bill and Carol Goss",
	"Today is the first day of the North Carolina Round Dance Clinic with Bill and Carol Goss"
	);
library[23] = new event(
	"7/16/03",
	"You have ",
	" days until the URDC Convention in Winston Salem N.C. - July 16 - 19.",
	"Tomorrow is the first day of  the URDC Convention in Winston Salem N.C.",
	"Today is  the first day of  the URDC Convention in Winston Salem N.C."
	);
library[24] = new event(
	"8/10/2003",
	"You have ",
	" days until the start of the Roundarama Institute<br>@ Purdue University",
	"The Roundarama Institute starts tomorrow.",
	"The Roundarama Institute starts today. "
	);
library[25] = new event(
	"8/14/2003",
	"Roundarama Institute continues ",
	" more days @ Purdue University.",
	"Roundarama Institute continues through tomorrow.",
	"Last day of Roundarama Institute."
	);
library[26] = new event(
	"4/1/2001",
	"You have ",
	" days until Daylight Savings Time Starts",
	"Set your clocks forward tonight for Daylight Savings Time",
	"Today is Daylight Savings Time<img src='file://us-cho-03/data_2/eng/dept280/gifs/dayltspr.gif' height=120>"
	);
library[27] = new event(
	"4/25/2001",
	"You have ",
	" days until Secretaries Day",
	"Tomorrow is Secretaries Day",
	"Today is Secretaries Day."
	);
library[28] = new event(
	"5/13/2000",
	"You have ",
	" days until Mother's Day.",
	"Tomorrow is Mother's Day",
	"Happy Mother's Day"
	);
library[29] = new event(
	"6/21/2001",
	"You have ",
	" days until Summer",
	"Tomorrow is the first day of Summer",
	"Today is the first day of Summer"
	);
library[30] = new event(
	"5/15/99",
	"You have ",
	" days until Armed Forces Day",
	"Tomorrow is Armed Forces Day",
	"Today is Armed Forces Day "
	);
library[31] = new event(
	"5/28/2001",
	"You have ",
	" days until Memorial Day",
	"Tomorrow is Memorial Day",
	"Today is Memorial Day"
	);
library[32] = new event(
	"6/14/2001",
	"You have ",
	" days until Flag Day",
	"Tomorrow is Flag Day",
	"Today is Flag Day"
	);
library[33] = new event(
	"6/17/2001",
	"You have ",
	" days until Father's Day",
	"Tomorrow is Father's Day",
	"Today is Father's Day"
	);
library[34] = new event(
	"7/4/2001",
	"You have ",
	" days until the 4th of July.  Sperry Holiday is July 4.",
	"Tomorrow is Independence Day",
	"Today is Independence Day"
	);
library[35] = new event(
	"8/3/2001",
	"You have ",
	" days until LMS Parent Child Day",
	"Tomorrow is Parent Child Day at LMS",
	"Today is LMS PArent Child Day"
	);
library[36] = new event(
	"9/3/2001",
	"You have ",
	" days until the Labor Day Holiday",
	"Tomorrow is Labor Day",
	"Today is Labor Day"
	);
library[37] = new event(
	"9/18/2001",
	"You have ",
	" days until Rosh Hashanah",
	"Rosh Hashanah starts at sundown ",
	"Today is Rosh Hashanah"
	);
library[38] = new event(
	"9/27/2001",
	"You have ",
	" days until Yom Kippur",
	"Yon Kippur starts at sundown",
	"Today is Yom Kippur"
	);
library[39] = new event(
	"10/12/2001",
	"You have ",
	" days until the real Columbus Day",
	"Tomorrow is the real Columbus Day",
	"Today is the real Columbus Day <img src='file://us-cho-03/data_2/eng/dept280/gifs/columbus.gif' height=120>"
	);
library[40] = new event(
	"10/31/2001",
	"You have ",
	" days until Halloween",
	"Tomorrow is Halloween",
	"Today is Halloween "
	);
library[41] = new event(
	"10/28/2001",
	"You have ",
	" days until Daylight Savings Time ends",
	"Don't forget to set your clocks back one hour tonight ",
	"Daylight Savings Time ended.  Did you set your clocks back? "
	);
library[42] = new event(
	"11/6/2001",
	"You have ",
	" days until Election Day",
	"Tomorrow is Election Day. Get out and Vote",
	"<Font color=blue>Today is <Font color=red><blink>Election Day.</blink><font color=blue>  Did you vote yet?</font>"
	);
library[43] = new event(
	"11/11/2001",
	"You have ",
	" days until Veteran's Day",
	"Tomorrow is Veteran's Day",
	"Today is Veteran's Day.  <img src='file://us-cho-03/data_2/eng/dept280/gifs/flaga.gif'>Thanks to all the Veterans."
	);
library[44] = new event(
	"11/22/2000",
	"You have ",
	" days until the 2 day Thanksgiving Holiday",
	"Tomorrow is Thanksgiving Day",
	"Happy Thanksgiving "
	);
library[45] = new event(
	"12/10/2001",
	"You have ",
	" days until <a href='http://marlo.com/hanukkah.htm'>Hanakkuh.</a>",
	"The 8 days of <a href='http://marlo.com/hanukkah.htm'>Hanakkuh.</a> start at sundown tomorrow",
	"Hanukkah starts at sundown today"
	);
library[46] = new event(
	"12/21/2001",
	"You have ",
	" days until Winter officially begins.",
	"Tomorrow is the first day of Winter.",
	"Today is the first day of Winter"
	);
library[47] = new event(
	"12/25/2004",
	"You have ",
	" days until Christmas",
	"It's Christmas Eve",
	"Merry Christmas"
	);
library[48] = new event(
	"1/1/2004",
	"You have ",
	" days until New Years Day",
	"It's New Years Eve.  <br>What are you doing here?<br> ",
	"Happy New Year"
	);
library[49] = new event(
	"1/1/2003",
	"You have run out of events in your list.  By the way, there are ",
	" days until the year 2002.",
	"Its New Years Eve",
	"Happy New Year"
	);
library[99] = new event(
	"1/1/2003",
	"You have run out of events in your list.  By the way, there are ",
	" days until the year 2003.",
	"Its New Years Eve",
	"Happy New Year"
	);

library.length = 5;

varholder = 99
for (var eventNum = 0; eventNum <num_events; ++eventNum) {
	if(varholder==99 && library[eventNum].bdate.getTime() - today.getTime() >= 0){
		varholder=eventNum;}
	if(varholder < 99 && library[eventNum].bdate - library[varholder].bdate < 0 && 		library[eventNum].bdate.getTime() - today.getTime() >= 0){
		varholder=eventNum;}
//	document.write(eventNum +", " + varholder +"<br>");
	}
var else_msg="Uhhh...something!"
for (var eventNum = 0; eventNum <num_events; ++eventNum) {

	// equality test below did not work for unknown reasons. Switched to abs( delta ) test.
	// if(library[eventNum].bdate == library[varholder].bdate) {

	if(Math.abs(library[varholder].bdate - library[eventNum].bdate)<2) {
		//Create constant to represent the number of milliseconds per day
		msPerDay = 24 * 60 * 60 * 1000 ; 

		//Subtract today from targetdate
		//Difference will be in milliseconds so we divide by milliseconds per day 
		daysLeft = Math.round((library[varholder].bdate.getTime() - today.getTime()) / msPerDay);
//document.write(eventNum);
		library[eventNum].printa();
	}
}
// -->

