function dayMakeFrom(d) {
	if (d.from_month.selectedIndex == 0 || d.from_month.selectedIndex == 2 || d.from_month.selectedIndex == 4 || d.from_month.selectedIndex == 6 || d.from_month.selectedIndex == 7 || d.from_month.selectedIndex == 9 || d.from_month.selectedIndex == 11) {
		jmmjaodF(d);
	}
	if (d.from_month.selectedIndex == 3 || d.from_month.selectedIndex == 5 || d.from_month.selectedIndex == 8 || d.from_month.selectedIndex == 10) {
		ajsnF(d);
	}
	if (d.from_month.selectedIndex == 1) {
		fF(d);
	}
}

function jmmjaodF(d) {
	var day = d.from_day.selectedIndex;
	//alert("jmmjaod - " + d.from_month.selectedIndex);
	document.getElementById('from_day').style.visibility = "visible";
	document.getElementById('from_year').style.visibility = "visible";
	var one = 0;
	var stopPoint = d.from_day.length;
	while (one < stopPoint) {
		d.from_day.remove(0);
		one++;
	}

	var listObj = d.from_day;
	var i = 1;
	var stopNum = 32;
	while (i < stopNum) {
		opt = document.createElement("option");
		if (i < 10) {
			opt.text = ("0" + i);
		}
		else {
			opt.text = (i);
		}
		d.from_day.add(opt);
		i++;
	}
	d.from_day.selectedIndex = day;
}

function ajsnF(d) {
	var day = d.from_day.selectedIndex;
	//alert("ajsn - " + d.from_month.selectedIndex);
	document.getElementById('from_day').style.visibility = "visible";
	document.getElementById('from_year').style.visibility = "visible";
	var one = 0;
	var stopPoint = d.from_day.length;
	while (one < stopPoint) {
		d.from_day.remove(0);
		one++;
	}

	var listObj = d.from_day;
	var i = 1;
	var stopNum = 31;
	while (i < stopNum) {
		opt = document.createElement("option");
		if (i < 10) {
			opt.text = ("0" + i);
		}
		else {
			opt.text = (i);
		}
		d.from_day.add(opt);
		i++;
	}
	if (day < stopNum-2) {
		d.from_day.selectedIndex = day;
	}
	else {
		d.from_day.selectedIndex = stopNum-2;
	}
}

function fF(d) {
	var day = d.from_day.selectedIndex;
	//alert("f - " + d.from_month.selectedIndex);
	document.getElementById('from_day').style.visibility = "visible";
	document.getElementById('from_year').style.visibility = "visible";
	var one = 0;
	var stopPoint = d.from_day.length;
	while (one < stopPoint) {
		d.from_day.remove(0);
		one++;
	}

	var listObj = d.from_day;
	var i = 1;
	var stopNum = 29;
	if (document.getElementById('leapYear').value == 1) {
		stopNum = 30;
	}
	while (i < stopNum) {
		opt = document.createElement("option");
		if (i < 10) {
			opt.text = ("0" + i);
		}
		else {
			opt.text = (i);
		}
		d.from_day.add(opt);
		i++;
	}
	if (day < stopNum-2) {
		d.from_day.selectedIndex = day;
	}
	else {
		d.from_day.selectedIndex = stopNum-2;
	}
}

function dayMakeTo(d) {
	if (d.to_month.selectedIndex == 0 || d.to_month.selectedIndex == 2 || d.to_month.selectedIndex == 4 || d.to_month.selectedIndex == 6 || d.to_month.selectedIndex == 7 || d.to_month.selectedIndex == 9 || d.to_month.selectedIndex == 11) {
		jmmjaodT(d);
	}
	if (d.to_month.selectedIndex == 3 || d.to_month.selectedIndex == 5 || d.to_month.selectedIndex == 8 || d.to_month.selectedIndex == 10) {
		ajsnT(d);
	}
	if (d.to_month.selectedIndex == 1) {
		fT(d);
	}
}

function jmmjaodT(d) {
	var day = d.to_day.selectedIndex;
	//alert("jmmjaod - " + d.to_month.selectedIndex);
	document.getElementById('from_day').style.visibility = "visible";
	document.getElementById('from_year').style.visibility = "visible";
	var one = 0;
	var stopPoint = d.to_day.length;
	while (one < stopPoint) {
		d.to_day.remove(0);
		one++;
	}

	var listObj = d.to_day;
	var i = 1;
	var stopNum = 32;
	while (i < stopNum) {
		opt = document.createElement("option");
		if (i < 10) {
			opt.text = ("0" + i);
		}
		else {
			opt.text = (i);
		}
		d.to_day.add(opt);
		i++;
	}
	d.to_day.selectedIndex = day;
}

function ajsnT(d) {
	var day = d.to_day.selectedIndex;
	//alert("ajsn - " + d.to_month.selectedIndex);
	document.getElementById('from_day').style.visibility = "visible";
	document.getElementById('from_year').style.visibility = "visible";
	var one = 0;
	var stopPoint = d.to_day.length;
	while (one < stopPoint) {
		d.to_day.remove(0);
		one++;
	}

	var listObj = d.to_day;
	var i = 1;
	var stopNum = 31;
	while (i < stopNum) {
		opt = document.createElement("option");
		if (i < 10) {
			opt.text = ("0" + i);
		}
		else {
			opt.text = (i);
		}
		d.to_day.add(opt);
		i++;
	}
	if (day < stopNum-2) {
		d.to_day.selectedIndex = day;
	}
	else {
		d.to_day.selectedIndex = stopNum-2;
	}
}

function fT(d) {
	var day = d.to_day.selectedIndex;
	//alert("f - " + d.to_month.selectedIndex);
	document.getElementById('from_day').style.visibility = "visible";
	document.getElementById('from_year').style.visibility = "visible";
	var one = 0;
	var stopPoint = d.to_day.length;
	while (one < stopPoint) {
		d.to_day.remove(0);
		one++;
	}

	var listObj = d.to_day;
	var i = 1;
	var stopNum = 29;
	if (document.getElementById('leapYear').value == 1) {
		stopNum = 30;
	}
	while (i < stopNum) {
		opt = document.createElement("option");
		if (i < 10) {
			opt.text = ("0" + i);
		}
		else {
			opt.text = (i);
		}
		d.to_day.add(opt);
		i++;
	}
	if (day < stopNum-2) {
		d.to_day.selectedIndex = day;
	}
	else {
		d.to_day.selectedIndex = stopNum-2;
	}
}

