function fillDaysOfMonth(Month, Year){
	var daysInMonth = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
	
	var x = 1;
	
	var count = daysInMonth[Month-1];
	
	//leap year
	if(Month==1&&isLeapYear(Year)){
		count++;
	}
	
	//empty select
	selDay = document.getElementById("fromday");
	while(selDay.options.length > 0){
		selDay.removeChild(selDay.options[0]);
	}
	
	//fill select
	while(x <= count){
		option = document.createElement("option");
        option.value = x;
        option.text = x;
        selDay.options[selDay.options.length] = option;
		x++;
	}
}

function isLeapYear(Year){
	if(Year==null){
		return false;
	}else{
		if(eval(Year%4)==0){
			if(eval(Year%100)==0){
				if(eval(Year%400)==0){
					return true;
				}else{
					return false;
				}
			}else{
				return true;
			}
		}else{
			return false;
		}
	}
}