var today=new Date();var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];function populate_date(oForm)
{var dayfield=document.getElementById("dayfield");var monthfield=document.getElementById("monthfield");var yearfield=document.getElementById("yearfield");for(x=0;x<12;x++){monthfield.options[x]=new Option(monthtext[x],x+1);}
var yr=today.getFullYear();for(var y=0;y<3;y++){yearfield.options[y]=new Option(yr,yr);yr+=1;}
monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()],today.getMonth()+1,true,true)
update_days(oForm);dayfield.options[today.getDate()-1]=new Option(today.getDate(),today.getDate(),true,true)}
function update_days(oForm)
{var dayfield=document.getElementById("dayfield");var monthfield=document.getElementById("monthfield");var yearfield=document.getElementById("yearfield");temp=dayfield.selectedIndex;for(x=dayfield.options.length;x>0;x--)
{dayfield.options[x]=null;}
mnth=parseInt(monthfield[monthfield.selectedIndex].value);yr=parseInt(yearfield.options[yearfield.selectedIndex].value);no_days=0;switch(mnth)
{case 4:case 6:case 9:case 11:no_days=30;break;case 2:leap(yr)?no_days=29:no_days=28;break;default:no_days=31;}
for(x=1;x<no_days+1;x++)
{dayfield.options[x-1]=new Option(x,x);}
if(temp==-1)dayfield.options[0].selected=true;else
dayfield.options[temp].selected=true;}
function leap(y){return(y%4==0&&!(y%100==0&&!(y%400==0)))};
