/*
Documentation $_DOCUMENT_ROOT/js/jscalendar/doc/html/reference.html
*/

// formattazione calendario x i CLIENT
function calendar_client(strTypeName, boolDisableDays,dateFormat) {
	if(!dateFormat)			dateFormat			= "%B %e, %Y";

	document.write('<script type = "text/javascript">');

	document.write('Calendar.setup(');
	document.write('					{');
	// id of the input field
	document.write('						inputField: "' + strTypeName + '",');
	// format of the input field
	document.write('						ifFormat: "%Y-%m-%d",   ');
	// trigger for the calendar (button ID)
	document.write('						button: "' + strTypeName + '_trigger' + '",  ');
	// alignment (defaults to "Bl")
	document.write('						align: "Tl",            ');
	//Format of the date displayed in the displayArea (if specified).
	document.write('						daFormat: "'+ dateFormat +'",  ');
	// This is the ID of a <span>, <div>, or any other element that you would like to use to display the current date. This is generally useful only if the input field is hidden, as an area to display the date.
	document.write('						displayArea: "' + strTypeName + '_area' + '",');
	// Specifies which day is to be displayed as the first day of week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, ..., 6 means Saturday. The end user can easily change this too, by clicking on the day name in the calendar header.
	document.write('						firstDay: 1,');

	if (boolDisableDays) {
		// disable weekend days before today
		document.write('						dateStatusFunc: function(date) { ');
		document.write('							return ((now.getTime()-86400000) > date.getTime()) ? true : false;');
		document.write('						},');
		
		// An array having exactly 2 elements, integers. (!) The first [0] element is the minimum year that is available, and the second [1] element is the maximum year that the calendar will allow. 
		document.write('						range:');
		document.write('						[');
		document.write('							' + (now.getFullYear()     ) + ',');
		document.write('							' + (now.getFullYear() +  1) + '');
		document.write('						],');
	}else{
		// An array having exactly 2 elements, integers. (!) The first [0] element is the minimum year that is available, and the second [1] element is the maximum year that the calendar will allow. 
		document.write('						range:');
		document.write('						[');
		document.write('							' + (now.getFullYear() -  2) + ',');
		document.write('							' + (now.getFullYear() +  1) + '');
		document.write('						],');
		
	}

	// If ''true'' then the calendar will display week numbers. 
	document.write('						weekNumbers: false,');
	document.write('						showOthers : true,');
	document.write('						singleClick: true');
	document.write('					});');

	document.write('</script>');
}