dimensione = screen.availWidth;
if ( dimensione >= 820 ) {
	assex = 470;
	assey = 240;
} else {
	assex = 470;
	assey = 240;
}
function catcalc(cal) {
	var date = cal.date;
	var time = date.getTime()
	// use the _other_ field
	var field = document.getElementById("datafine");
	if (field == cal.params.inputField) {
		field = document.getElementById("datainizio");
		time -= Date.DAY; // substract one week
	} else {
		time += Date.DAY; // add one week
	}
	var date2 = new Date(time);
	field.value = date2.print("%d/%m/%Y");
}
Calendar.setup({
	inputField     :    "datainizio",     // id of the input field
	ifFormat       :    "%d/%m/%Y",      // format of the input field
	button         :    "btnda",  // trigger for the calendar (button ID)
	align          :    "Tl",           // alignment (defaults to "Bl")
	singleClick    :    true,
	onUpdate       :    catcalc,
	position	   :    [assex,assey]
});
Calendar.setup({
	inputField     :    "datafine",     // id of the input field
	ifFormat       :    "%d/%m/%Y",      // format of the input field
	button         :    "btna",  // trigger for the calendar (button ID)
	align          :    "Tl",           // alignment (defaults to "Bl")
	singleClick    :    true,
	position	   :    [assex+120,assey]
});
