TopDay = ",1,3,5,7,8,10,12,";
function ShortMe(end){
	if(dayTotal > end){
		for(i=dayTotal; i > end; i--){
			dayObj.options.length = dayObj.options.length-1;
		}
	}else if(dayTotal < end){
		for(i=dayTotal+1; i <= end; i++){
			var next = new Option(i,i,false,false);
			dayObj.options[dayObj.options.length] = next
		}			
	}	
}

function ChangeDay(num,style,count){
	// Style 1 is a list of dates, 2 is a series (1,2,3,4,5)
	count		= (count) ? count : 1;
	day			= (style == 1) ? "day"+count+"["+num+"]" : "day"+num;
	month		= (style == 1) ? "month"+count+"["+num+"]" : "month"+num;
	year		= (style == 1) ? "year"+count+"["+num+"]" : "year"+num;
	root		= document.plaster;
	dayTotal	= eval("root."+day+".options.length");
	dayObj		= eval("root."+day);		
	
	mSelect		= eval("root."+month)
	monthSelect	= mSelect.options[mSelect.selectedIndex].value;
	
	ySelect		= eval("root."+year);
	yearSelect	= ySelect.options[ySelect.selectedIndex].value;
	
	monthString	= ","+monthSelect+",";		
	
	limit		= 31;
	limit2		= 30;
	limit3		= 29;
	limit4		= 28;
	
	
	if(monthSelect == 2){
		if(yearSelect % 4 == 0){
			ShortMe(limit3);
		}else{
			ShortMe(limit4);
		}
	} else if(TopDay.indexOf(monthString,0) > -1 && dayTotal != limit){
		ShortMe(limit);
	} else if(TopDay.indexOf(monthString,0) == -1 && dayTotal != limit2){
		ShortMe(limit2)
	}
	
}
