var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];

function populatedropdown(dayfield, monthfield, yearfield, donotselecttoday){
	var today=new Date()
	var thisyear=today.getFullYear()
	var maxyear=120
	var dayfield=document.getElementById(dayfield)
	var monthfield=document.getElementById(monthfield)
	var yearfield=document.getElementById(yearfield)
	
	for (var i=0; i<31; i++)
		dayfield.options[i]=new Option(i+1, i+1)
	//select today's day
	if (!donotselecttoday)
		dayfield.options[today.getDate() - 1]=new Option(today.getDate(), today.getDate(), true, true)
	
	for (var m=0; m<12; m++)
		monthfield.options[m]=new Option(monthtext[m], m + 1)
	//select today's month
	if (!donotselecttoday)
		monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], today.getMonth() + 1, true, true)
		
	for (var y=0; y<=maxyear; y++){
	yearfield.options[y]=new Option(thisyear-maxyear, thisyear-maxyear)
	thisyear+=1
	}
	//select today's year
	if (!donotselecttoday)
		yearfield.options[maxyear]=new Option(today.getFullYear(), today.getFullYear(), true, true)
}
