function js360calendar(_text_control_id)
{
	this.cal_obj = null;
	this.format = '%j-%M-%Y';
	this.text_control_id=_text_control_id;
	this.show_calendar=show_calendar;
}

function show_calendar()
{
	if (this.cal_obj) this.cal_obj=null;
	var text_field = document.getElementById(this.text_control_id);
	this.cal_obj = new RichCalendar(this.text_control_id, false);
	this.cal_obj.user_onchange_handler = cal2_on_change;
	this.cal_obj.user_onclose_handler = cal2_on_close;
	this.cal_obj.format=this.format;
	this.cal_obj.user_onautoclose_handler = cal2_on_autoclose;
	this.cal_obj.parse_date(text_field.value, this.format);
	this.cal_obj.show_at_element(text_field, "adj_left-bottom");
}

// user defined onchange handler
function cal2_on_change(cal, object_code) {
	if (object_code == 'day') {
		document.getElementById(this.target_obj).value = cal.get_formatted_date(this.format);
		cal.hide();
	}
}

// user defined onclose handler (used in pop-up mode - when auto_close is true)
function cal2_on_close(cal) {
	if (window.confirm('Are you sure to close the calendar?')) {
		cal.hide();
	}
}

// user defined onautoclose handler
function cal2_on_autoclose(cal) {
}

