function aggiorna (day, combomese,anno){
var index=parseInt(combomese.options[combomese.selectedIndex].value,10);
var remember =parseInt(day.options[day.selectedIndex].value);
var anni=parseInt(anno.options[anno.selectedIndex].value);
	var numItem=parseInt(day.options.length);
	var h=0;
switch(index){
			case 1:h=31
		
			break
			case 3:
			h=31
		
			break
			case 5:
			h=31
		
			break
			case 7:
			h=31
		
			break
			case 8:h=31
		
			break
			case 10:h=31
			
			break
			case 12: h=31
		
			break
			case 2:
			if ((parseInt(anni % 400)) == 0){
				h=29
				break
			}
			if ((parseInt(anni % 100)) == 0){
				h=28
				break
			}
			if ((parseInt(anni % 4)) == 0){
				h=29
				break
			}
			h=28;
			break
			default: h=30;
			}
if(h>numItem){
	 for(;numItem<h;numItem++){
	  day.options[numItem]=new Option(numItem+1,numItem+1);
	 }
	}
	else if(h<numItem){
	 for(;numItem>h;numItem--){
	  day.options[numItem-1]=null;
	 }
	}
index=parseInt(combomese.options[combomese.selectedIndex].value);
remember =parseInt(day.options[day.selectedIndex].value);
anni=parseInt(anno.options[anno.selectedIndex].value);
}

function isLeap(g,m,a){
if(m.selectedIndex==1){
	numItems=parseInt(g.options.length);
	year=parseInt(a.options[a.selectedIndex].value);
	w=0
	if ((parseInt(year % 400)) == 0){
				w=29
				
			} else
			if ((parseInt(year % 100)) == 0){
				w=28
				
			} else
			if ((parseInt(year % 4)) == 0){
				w=29
				
			} else{
			w=28;
			}
	
	if(w>numItems){
	 for(;numItems<w;numItems++){
	  g.options[numItems]=new Option(numItems+1,numItems+1);
	 }
	}
	else if(w<numItems){
	 for(;numItems>w;numItems--){
	  g.options[numItems-1]=null;
	 }
	}
	}
	index=parseInt(m.options[m.selectedIndex].value);
remember =parseInt(g.options[g.selectedIndex].value);
anni=parseInt(a.options[a.selectedIndex].value);
}








