var upFullDate = new Array();	// array for date calculations
var upData = new Array();		// array for calendar item detail for setupCalendar()

for (j=0;j<=100;j++)  			// initializing upFullDate to date type, middle must match for loop with i variable below
{
	upFullDate[j]=new Date();
}

function setupCalendar(arrayInstance,year,month,date,dateText)
{
	upFullDate[arrayInstance].setFullYear(year,(month - 1),date);
	upData[arrayInstance]=dateText;
}

function writeDate()
{
	var message = "";				// message to be displayed
	var now = new Date();			// today's date, calc'd by next line
	now.setFullYear(now.getFullYear(),now.getMonth(),now.getDate());
	var ufdMonth = new Date();
	var ufdYear = new Date();
	var ufdNow = new Date();
	var monthNames = new Array("Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec.");

	setupCalendar(0,2009,12,17,"Registration Open");
	setupCalendar(1,2009,12,19,"Commencement");
	setupCalendar(2,2010,01,04,"University Closed - Christmas Holiday 12/19/09 - 1/3/10");
	setupCalendar(3,2010,01,04,"University Offices Reopen");
	setupCalendar(4,2010,01,05,"Last Day to Pay Tuition for Pre-registered Students");
	setupCalendar(5,2010,01,07,"Registration Closed (5:01pm Jan. 4 - 4:30pm Jan7)");
	setupCalendar(6,2010,01,07,"Late Registration Opens (4:31pm)");
	setupCalendar(7,2010,01,07,"International Student Orientation (<a href='http://oia.louisiana.edu/new-students/orientation.shtml' target='_blank'>info</a>)");
	setupCalendar(8,2010,01,11,"Semester Begins");
	setupCalendar(9,2010,01,13,"Full Payment of Tuition/Fees Due");
	setupCalendar(10,2010,01,13,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(11,2010,01,13,"Classes Begin");
	setupCalendar(12,2010,01,18,"University Closed - Martin Luther King, Jr. Holiday");
	setupCalendar(13,2010,01,19,"Late Registration Closes (8:59pm");
	setupCalendar(14,2010,01,19,"Last Day to Drop/Add a Class");
	setupCalendar(15,2010,01,20,"First day to drop a class with a grade of W");
	setupCalendar(16,2010,01,20,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(17,2010,01,22,"Last Day to <a href='http://gradschool.louisiana.edu/forms/index.shtml' target='_blank'>Apply</a> for Candidacy (Master’s students who completed 12 or more hours)");
	setupCalendar(18,2010,01,26,"Thesis/Dissertation Workshop (Moody 103, 3pm & 5pm - <a href='http://gradschool.louisiana.edu/thesisflyersp10.pdf' target='_blank'>flyer</a>)");
	setupCalendar(19,2010,01,27,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(20,2010,02,02,"Last Day to <a href='http://gradschool.louisiana.edu/forms/index.shtml' target='_blank'>Apply</a> for Graduate Degree/Submit Graduation Checklist");
	setupCalendar(21,2010,02,02,"Last Day to change a class from credit to audit");
	setupCalendar(22,2010,02,03,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(23,2010,02,04,"Graduate Foreign Language Exams");
	setupCalendar(24,2010,02,10,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(25,2010,02,11,"Enrollment Deadline for <a href='http://bursar.louisiana.edu' target='_blank'>Tuition/Fees Payment Plan</a>");
	setupCalendar(26,2010,02,15,"Last Day to <a href='http://gradschool.louisiana.edu/forms/index.shtml' target='_blank'>Apply</a> for Graduate Fellowships");
	setupCalendar(27,2010,02,15,"Last Day to <a href='http://speechandlanguage.louisiana.edu/programs/masters.shtml' target='_blank'>Apply</a> for Admission to Speech Pathology & Audiology (Master’s)");
	setupCalendar(28,2010,02,16,"Mardi Gras Holiday - University Offices Closed (2/15/10 - 2/16/10)");
	setupCalendar(29,2010,02,17,"Mardi Gras Holiday - No Classes (2/15/10 - 2/17/10)");
	setupCalendar(30,2010,02,17,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(31,2010,02,23,"UL Lafayette Career Fair - <a href='http://careerservices.louisiana.edu' target='_blank'>Day I</a>");
    setupCalendar(32,2010,02,24,"UL Lafayette Career Fair - <a href='http://careerservices.louisiana.edu' target='_blank'>Day II</a>");
	setupCalendar(33,2010,02,24,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(34,2010,03,01,"Last Day to <a href='http://gradschool.louisiana.edu/forms/index.shtml' target='_blank'>Apply</a> for Graduate Assistantships");
	setupCalendar(35,2010,03,03,"Thesis/Dissertation Workshop (Moody 103, 3pm & 5pm - <a href='http://gradschool.louisiana.edu/thesisflyersp10-2.pdf' target='_blank'>flyer</a>)");
	setupCalendar(36,2010,03,03,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(37,2010,03,08,"Last Day to Drop a Class with a grade of W");
	setupCalendar(38,2010,03,10,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(39,2010,03,10,"<a href='http://gradschool.louisiana.edu/grad_school_workshopflyerSP10.pdf' target='_blank'>Grad School Workshop</a> (Moody Hall Room 103, 3:00pm)");
	setupCalendar(40,2010,03,17,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(41,2010,03,24,"Graduate School Information Workshop (tentative)");
	setupCalendar(42,2010,03,24,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(43,2010,03,29,"Graduate Foreign Language Exams");
	setupCalendar(44,2010,03,31,"Last Day to <a href='http://counseling.louisiana.edu/admissions.shtml' target='_blank'>Apply</a> for Admission to Counselor Education");
	setupCalendar(45,2010,03,31,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(46,2010,04,02,"Begin Spring Break/Easter Holiday - No Classes");
	setupCalendar(47,2010,04,07,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(48,2010,04,11,"End Spring Break/Easter Holiday");
	setupCalendar(49,2010,04,13,"Last Day to Resign from all classes");
	setupCalendar(50,2010,04,13,"Last Day to change a grade of I (earned fall or winter 2009)");
	setupCalendar(51,2010,04,14,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(52,2010,04,19,"Last Day to Submit Final Copies of Theses or Dissertations - <a href='http://gradschool.louisiana.edu/GR-Guide-Theses-Dissertations.pdf' target='_blank'>Guidelines</a>");
	setupCalendar(53,2010,04,21,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(54,2010,04,28,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(55,2010,04,30,"Last Day of Classes");
	setupCalendar(56,2010,05,03,"Final Exams Begin");
	setupCalendar(57,2010,05,05,"Mid-Exam Study Day");
	setupCalendar(58,2010,05,05,"Grad School On Location (<a href='http://gradschool.louisiana.edu/onlocationflyer.pdf' target='_blank'>info</a>)");
	setupCalendar(59,2010,05,07,"Final Exams End");
	setupCalendar(60,2010,05,15,"Commencement");

	var counter = parseInt("0");

	for (i=0;i<=100;i++) // middle setting (i<=1) determines number of entries in calendar
	{
		ufdNow = upFullDate[i];

		if(now<=ufdNow && counter<=6)
		{
			message = '<strong>' + monthNames[upFullDate[i].getMonth()] + ' ' + upFullDate[i].getDate() + ', ' + upFullDate[i].getFullYear() + '</strong>' + '<br>' + upData[i] + '<br><br>';
			document.writeln(message);
			counter = counter + 1;
		}
	}
}