// JavaScript Document


var hour, minute, seconds, milliseconds, weekday, day, month, yy, year, startTime, popup, field;

var months = new makeArray('January','February','March',
    'April','May','June','July','August','September',
    'October','November','December');

var weekdays = new makeArray('Sunday','Monday','Tuesday',
    'Wednesday','Thursday','Friday','Saturday');

date = new Date();
hour = date.getHours();
minute = date.getMinutes();
seconds = date.getSeconds();
milliseconds = date.getMilliseconds();
weekday  = date.getDay() + 1;
day  = date.getDate();
month = date.getMonth() + 1;
yy = date.getYear();
year = (yy < 1000) ? yy + 1900 : yy;
startTime = date.getTime();

function makeArray() {
     for (i = 0; i<makeArray.arguments.length; i++)
          this[i + 1] = makeArray.arguments[i];
}

function showDay(intDayOfWeek, intMonth, intYear, intEarliest) {
// intEarliest is the earliest day on which the holiday can occur.
// for example, if November 1st is a Thursday, then Thanksgiving
// is on the 22nd (the 4th Thursday), which is the earliest it 
// can occur. It can occur as late as the 28th.
// intDayOFWeek is the numeric day of the week. eg Thanksgiving
// is on a Thursday which is the 5th day of the week.
	for (i = intEarliest; i <= intEarliest + 6; i++) {
		dtDate = new Date(intMonth + '/' + i + '/' + intYear)
		if (dtDate.getDay() + 1 == intDayOfWeek){
			document.write(weekdays[dtDate.getDay() + 1] + ", " + months[intMonth] + " " + i + ", " + intYear); 
		}
	}
}

// showDate available formats.....
//		"mm/dd/yyyy"
//		"dd/mm/yyyy"
//		"dddd, mm dd, yyyy"
//		"dddd, mm dd, yyyy hh:ss"

function showDate (format) {
  switch (format) {
    case "mm/dd/yyyy":      document.write(month + "/" + day + "/" + year);      break;
    case "dd/mm/yyyy":      document.write(day + "/" + month + "/" + year);      break;
    case "dddd, mm dd, yyyy":      document.write(weekdays[weekday] + ", " + months[month] + " " + day + ", " + year);      break;
	 case "dddd, dd mm, yyyy":      document.write(weekdays[weekday] + ", " + day + " " + months[month]  + ", " + year);      break;
    case "dddd, mm dd, yyyy hh:ss":      document.write(weekdays[weekday] + ", " + months[month] + " " + day + ", " + year  + " " + time);      break;
    default:      document.write(month + "/" + day + "/" + year);      break;
  }

}
