function populate(dayfield,monthfield,yearfield,giorno,mese,anno)
{
	var temp=0;
	var today= new Date();
	var day= today.getDate();
	var month= today.getMonth();
	var year= today.getFullYear();
	
	var monthtext=['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
	
	var dayfield=document.getElementById(dayfield)
	var monthfield=document.getElementById(monthfield)
	var yearfield=document.getElementById(yearfield)
	
	dayfield.style.fontSize=monthfield.style.fontSize=yearfield.style.fontSize="10px";
	monthfield.style.fontSize="10px";

	for (var i=0; i <31 ; i++){
		var x= String(i+1);
		dayfield.options[i] = new Option(x,x);
		if(giorno!=""){
			if(x==giorno) dayfield.options[i].selected=true;
		}else if(i==day) dayfield.options[i].selected=true;
	}

	for(var i=0;i<12;i++){
		monthfield.options[i] = new Option(monthtext[i],i)
		if(mese!=""){
			if(i==mese-1) monthfield.options[i].selected=true;
		} else if(i==month) monthfield.options[i].selected=true;
	}

	for (var y=0; y<100; y++){
		yearfield.options[y]=new Option(year-99+y, year-99+y)
		if(anno!=""){
			if(anno==year-99+y) {
				yearfield.options[y].selected=true;
			}
		} else if(y==99) yearfield.options[y].selected=true;
		
	}
}

function populate2(dayfield,monthfield,yearfield){
	var t3=0;
	
	var dayfield=document.getElementById(dayfield)
	var monthfield=document.getElementById(monthfield)
	var yearfield=document.getElementById(yearfield)
	var yearselected

	if(monthfield.options[1].selected) 	{
		
		for (var y=0; y<99; y++){
			if(yearfield.options[y].selected){
				yearselected=y;
			}
		}
		if(yearfield.options[yearselected].value%4==0) t3=29
		else t3=28
	}else if(monthfield.options[8].selected||monthfield.options[3].selected||monthfield.options[5].selected||monthfield.options[10].selected) t3=30;
	else t3=31;

	for(i=0;i<31;i++){
		dayfield.options[i]=null;
	}

	for (var i=0; i <t3 ; i++){
	var x= String(i+1);
	dayfield.options[i] = new Option(x);
	}

	
}
