// JavaScript Document
function ShowMonthDropDown()
{
	var monthArray = new Array("January","February","March","April","May","June","July","August",
							   "September","October","November","December");
	
	var dateName ="";
	var time = new Date();
	var month = time.getMonth();
	var date = month - 12;
	var future = month + 0;
	var dateName = monthArray[month];
	var selected = " selected ";	/* Current month is selected */

	document.writeln ("<SELECT name=\"ScheduledMonth\" id=\"ScheduledMonth\" size=\"1\">");
	do {
		month = date;
		if (month >= 12) {
			month = month - 12;
		}
		if (month < 0) {
			month = month + 12;
		}
		dateName = monthArray[month];
		month++;
		document.writeln ("<OPTION name=\"" + dateName + "\" value=\"" + month + "\"" + selected + ">" + dateName + "</OPTION>");
		date++;
		selected = "";	/* All the other months are not selected */
	}
	while (date < future)
	document.writeln ("</SELECT>");
}
//  End ShowMonthDropDown

function ShowYearDropDown()
{
	var time = new Date();
	var year = time.getFullYear();
	var date = year - 0; /* start at this year */
	var future = year + 1; /* end at next year */
	var selected = " selected ";	/* current year is selected */

	document.writeln ("<SELECT name=\"ScheduledYear\" id=\"ScheduledYear\" size=\"1\">");
	do {
		document.writeln ("<OPTION value=\"" + date + "\"" + selected + ">" + date + "</OPTION>");
		date++;
		selected = "";	/* All the other years are not selected */
	}
	while (date <= future)
	document.writeln ("</SELECT>");
}
//  End ShowYearDropDown

function ShowDayDropDown()
{
	var day = 1;
	var dayStr = "";
	document.writeln ("<SELECT name=\"ScheduledDay\" id=\"ScheduledDay\" size=\"1\"><OPTION value=\"\">Day");
	do {
		dayStr = day;
		if ( day < 10 ) dayStr = "0" + String(day);
		document.writeln ("<OPTION value=\"" +day +"\">" +dayStr+ "</OPTION>");
		day++;
	}
	while (day <= 31)
	document.writeln ("</SELECT>");
}
// End ShowDayDropDown

function ShowHourDropDown()
{
	var hour = 1;
	document.writeln ("<SELECT name=\"ScheduledHour\" id=\"ScheduledHour\" size=\"1\"><OPTION value=\"\">Hour");
	do {
		document.writeln ("<OPTION value=\"" + hour + "\">" + hour + "</OPTION>");
		hour++;
	}
	while (hour <= 12)
	document.writeln ("</SELECT>");
}
//  End ShowHourDropDown

function ShowMinDropDown()
{
	var myMin = 0;
	var myMinStr = "";
	document.writeln ("<SELECT name=\"ScheduledMin\" id=\"ScheduledMin\" size=\"1\"><OPTION value=\"\">Min");
	do {
		myMinStr = myMin;
		if ( myMin < 10 ) myMinStr = "0" + String(myMin);
		document.writeln ("<OPTION value=\"" + myMin + "\">" + myMinStr + "</OPTION>");
		myMin += 5;
	}
	while (myMin <= 55)
	document.writeln ("</SELECT>");
}

function isFuture(y,m,d)
{
	var today = new Date();
	var sched = new Date();
	//ignore hours, minutes and seconds for now
	today.setHours(0,0,0,0);
	sched.setHours(0,0,0,0);
	sched.setFullYear(y,m,d);
	if ( today.getTime() > sched.getTime() ) return false;
	return true;
}
//  End ShowMinDropDown
function DisplayDate(f) {
	var selectedindex = f.ScheduledMonth.selectedIndex;
	var myMonthName = "";
	var myMonthNumber = 0;
	if ( selectedindex >= 0 ) {
		myMonthName = f.ScheduledMonth.options[selectedindex].text;
		myMonthNumber = f.ScheduledMonth.options[selectedindex].value;
	}
	var myDate = myMonthName + " " + f.ScheduledDay.value + ", " + f.ScheduledYear.value ;
	var myTime = f.ScheduledHour.value + ":" + f.ScheduledMin.value + " " + f.AMPM.value + " " + f.TimeZone.value + " Time Zone";
	var msg = "Is Past";
	if ( isFuture(f.ScheduledYear.value, myMonthNumber - 1, f.ScheduledDay.value) ) msg = "Is Future";
	
	alert ( myDate + "\n" + myTime + "\n" + msg);
	return false;
}






