function datepicker(id, numberDaysInAdvance, numberYears)
{
	this.id = id;
	this.numberDaysInAdvance = numberDaysInAdvance;
	this.numberYears = numberYears;
	this.curDate = new Date();
	this.curYear = this.curDate.getFullYear();
	this.months = new Array ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
	this.daySelect = document.getElementById(this.id + 'Day');
	this.monthSelect = document.getElementById(this.id + 'Month');
	this.yearSelect = document.getElementById(this.id + 'Year');
	this.build = build;
}

function build()
{
	with (this)
	{
		// Create day options.
		for(i = 1 ; i <= 31 ; i++ )
		{
	    	this.daySelect.options[i-1] = new Option(i,i);
	  	}

	  	// Create month options.
		for(i = 0 ; i < this.months.length ; i++ )
		{
	    	this.monthSelect.options[i] = new Option(this.months[i],this.months[i]);
	  	}

	  	// Create year options.
	  	var i = 0;
		for(j = this.curYear ; j <= this.curYear+(this.numberYears-1) ; j++ )
		{
			this.yearSelect.options[i] = new Option(j,j);
			i++;
		}

		// Set selected day and month.
		var date = new Date(this.curDate.getTime() + (this.numberDaysInAdvance * 86400000));
		var day = date.getDate();
		var month = date.getMonth();

		this.daySelect.selectedIndex = day-1;
		this.monthSelect.selectedIndex = month;
	}
}

