function getActMonth() {
	var actDate = new Date();
	return actDate.getMonth();
}

function getActDay() {
	var actDate = new Date();
	return actDate.getDate();
}

function getActYear() {
	var actDate = new Date();
	return actDate.getYear();
}

function getActMonthLength(year) {
	var monthsLengths = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	if ((getActMonth() == 2) && (year % 4 == 0)) {
		monthsLengths[1] = 29;
	}
	return monthsLengths[getActMonth() - 1];
}

function displayDays(day,month,year,selectName) {
	monthsArray = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	if(!(year % 4) && month == 2) {
		monthsArray[1]=29;
	}
	
	to = monthsArray[parseInt(month)-1];
	o = eval("document.forms['calcrate']." + selectName);
	for(var i = 0; i < o.options.length; i++) {
		o.options[i]=null;
	}
	
	for(i = 1; i <= to; i++) {
		o.options[i-1]=new Option(i,i);
	}
	
	if ((day-1)>to) {
		o.selectedIndex=to-1;
	}
	else {
		o.selectedIndex=day-1;
	}
}
