// JavaScript Document for 
// creating a drop-down date menu
// Created by M. Galloway on 10/20/09

document.write(' \
	<select name="Not_needed_after"> \
				  <option value="no need by" selected="selected">No Need By Date</option> \
				');

var monthname=new Array(12);
monthname[1]="January";
monthname[2]="February";
monthname[3]="March";
monthname[4]="April";
monthname[5]="May";
monthname[6]="June";
monthname[7]="July";
monthname[8]="August";
monthname[9]="September";
monthname[10]="October";
monthname[11]="November";
monthname[12]="December";

//Obtain today's date
var d_local = new Date();
// convert to milliseconds since Jan 1 1970
var localTime = d_local.getTime();
// obtain local UTC offset and convert to milliseconds
var localOffset = d_local.getTimezoneOffset() * 60000;
// obtain UTC time in milliseconds
var utc = localTime + localOffset;

var offset = 4; 	//4 hours. Offset for Eastern time from Universal time

// Add another hour to offset if on standard time, which starts 1st Sunday in November and ends 2nd Sunday in March
// We'll be an hour off for a week or two, but too hard to figure exact dates each year.
var month_num_real = d_local.getMonth();
if ((month_num_real < 2) || (month_num_real > 10)) { offset = 5; }

var eastern_time = utc + (3600000*offset);

var i;

for (i=0; i<=30; i++)
{
	//increment date. 86400000 milliseconds equals 1 day.
	var d = new Date(eastern_time + (86400000 * i));

	day_o_month = d.getDate();
	var month_num = d.getMonth();
	month_num += 1;
	var yr_num = d.getFullYear();

	if (i < 2)
	{ 
		document.write('<option value="rjdp'+month_num+'/'+day_o_month+'/'+yr_num+
			'">'+day_o_month+' '+monthname[month_num]+' '+yr_num+'*</option>');
	}
	else 
	{
		document.write('<option value="'+month_num+'/'+day_o_month+'/'+yr_num+
			'">'+day_o_month+' '+monthname[month_num]+' '+yr_num+'</option>');
	}

}


document.write(' \
 \
				</select> \
				');

