var today = new Date ();

function populateMonths ( field )
{
	var maxMonths = 6;
	var theMonth = today.getMonth ();
	var theYear = today.getFullYear ();

	// empty all options
	field.options.length = 0;

	for ( i = 0; i < maxMonths; i++ )
	{	field[ i ] = new Option ( monthAsString ( theMonth ) + ' ' + theYear );
		field[ i ].value = ( monthAsString ( theMonth ) + '-' + theYear );

		if ( theMonth < 11 )
		{	++theMonth;
		}
		else
		{	theMonth = 0;
			++theYear;
		}
	}
}


function monthAsString ( theMonth )
{
	switch( theMonth )
	{	case 0: return "Jan";
		case 1: return "Feb";
		case 2: return "Mar";
		case 3: return "Apr";
		case 4: return "May";
		case 5: return "Jun";
		case 6: return "Jul";
		case 7: return "Aug";
		case 8: return "Sep";
		case 9: return "Oct";
		case 10: return "Nov";
		case 11: return "Dec";
	}
}

function setToday ( day )
{
	day.selectedIndex = ( today.getDate () - 1 );
}


function setArriveDate ()
{
	var theDay = document.getElementById ( 'arriveDay' );
	var theMonth = document.getElementById ( 'arriveMonth' );
	var theDate = document.getElementById ( 'arriveDate' );
	
	theDate.value = theDay[ theDay.selectedIndex ].value + '-' + theMonth[ theMonth.selectedIndex ].value;
}

populateMonths ( document.getElementById ( 'arriveMonth' ) );
setToday ( document.getElementById ( 'arriveDay' ) );
