/***********************************************
* Drop Down Date select script- by JavaScriptKit.com
* This notice MUST stay intact for use
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
***********************************************/

var monthtext=['','jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];

function populatedropdown(day_field, month_field, year_field) {
	var today=new Date()
	var dayfield=document.getElementById(day_field)
	var monthfield=document.getElementById(month_field)
	var yearfield=document.getElementById(year_field)
	
	/*dayfield.options[0] = new Option('dd  ','');
	monthfield.options[0] = new Option('mm','');
	yearfield.options[0] = new Option('yyyy  ','');*/

	for (var i=1; i<=31; i++)
		dayfield.options[i]=new Option(zeroPad(i,2), i)

	//dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day

	for (var m=1; m<=12; m++)
		//monthfield.options[m]=new Option(monthtext[m],m)
		monthfield.options[m]=new Option(zeroPad(m,2) +" ("+monthtext[m]+")",m)

	//monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month
	var thisyear=today.getFullYear()
	for (var y=1; y<20; y++) {
		yearfield.options[y]=new Option(thisyear, thisyear)
		thisyear-=1
	}

	//yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
}

//populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select)
window.onload=function(){
	populatedropdown("daydropdown", "monthdropdown", "yeardropdown")
}


function zeroPad(num,count)
{
var numZeropad = num + '';
while(numZeropad.length < count) {
numZeropad = "0" + numZeropad;
}
return numZeropad;
}
