	//<![CDATA[
	// the default multiple dates selected,
	// first time the calendar is displayed
	var MA = [];
	function closed(calendar) {
		// here we’ll write the output; this is only for example. You
		// will normally fill an input field or something with the dates.
		var el = document.getElementById("output");
		//variabile per numerare i campi
		var j=1;
		// reset initial content.
		el.innerHTML = "";

		// Reset the "MA", in case one triggers the calendar again.
		// CAREFUL! You don’t want to do "MA = [];". We need to modify
		// the value of the current array, instead of creating a new one.
		// Calendar.setup is called only once! :-) So be careful.
	
		MA.length = 0;
		// walk the calendar’s multiple dates selection hash
		for (var i in calendar.multiple) {
			var d = calendar.multiple[i];
			// sometimes the date is not actually selected,
			// so let’s check
			if (d) {
			// OK, selected. Fill an input field or something.
			//per funzionare Date
			var date2 = new Date(d);
			
				//Eliminare il record inutile
				
				if( date2.print("%A, %Y %B %d")!= "%A, %Y %B %d"){
				el.innerHTML +='<input type="hidden" name="dataj' + j + '" id="dataj' + j + '" value="'+ date2.print("%d-%m-%Y")+'" />' + date2.print("%d %B %Y, %A") +"<br />";
				// and push it in the "MA", in case one triggers the calendar again.
				MA[MA.length] = d;
				//incremento
				j++;
				}

			}
			
		}
		
		j = j - 1;
		//totale giorni scelti
		el.innerHTML +='<input type="hidden" name="num_day" id="num_day" value="'+j+'" />';
		
		calendar.hide();
		return true;
	};
	//]]>
