qh=Array;
qk=String;
Calendar._DN=new qh("Domenica","Lunedi","Martedi","Mercoledi","Giovedi","Venerdi","Sabato","Domenica");
Calendar._SDN=new qh("Dom","Lun","Mar","Mer","Gio","Ven","Sab","Dom");
Calendar._MN=new qh("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");
Calendar._SMN=new qh("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic");
Calendar._TT={};
Calendar._TT["INFO"]="a proposito del calendario";
Calendar._TT["ABOUT"]="DHTML Date/Time Selector\n"
	+"(c) dynarch.com 2002-2007\n"
	+"For latest version visit: http://dynarch.com/mishoo/calendar.epl\n"
	+"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details."
	+"\n\n"+"Date selection:\n"
	+"- Use the \xab, \xbb buttons to select year\n"
	+"- Use the "
	+qk.fromCharCode(0x2039)
	+", "
	+qk.fromCharCode(0x203a)
	+" buttons to select month\n"+"- Hold mouse button on any of the above buttons for faster selection.";
Calendar._TT["ABOUT_TIME"]="\n\n"+"Time selection:\n"+"- Click on any of the time parts to increase it\n"
	+"- or Shift-click to decrease it\n"+"- or click and drag for faster selection.";
Calendar._TT["PREV_YEAR"]="Anno prec. (tieni premuto per menu)";
Calendar._TT["PREV_MONTH"]="Mese prec. (tieni premuto per menu)";
Calendar._TT["GO_TODAY"]="Vai a oggi";
Calendar._TT["NEXT_MONTH"]="Mese succ. (tieni premuto per menu)";
Calendar._TT["NEXT_YEAR"]="Anno succ. (tieni premuto per menu)";
Calendar._TT["SEL_DATE"]="Seleziona data";
Calendar._TT["DRAG_TO_MOVE"]="Trascina per spostare";
Calendar._TT["PART_TODAY"]=" (oggi)";
Calendar._TT["DAY_FIRST"]="Vedi %s prima";
Calendar._TT["WEEKEND"]="0";
Calendar._TT["CLOSE"]="Chiudi";
Calendar._TT["TODAY"]="Oggi";
Calendar._TT["TIME_PART"]="(Shift-)Click o trascina per modificare";
Calendar._TT["DEF_DATE_FORMAT"]="%d-%m-%Y";
Calendar._TT["TT_DATE_FORMAT"]="%a, %e %b ";
Calendar._TT["WK"]="Set";
Calendar._TT["TIME"]="Ora:";

// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  if (cal.dateClicked)
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
	try{
		var el = document.getElementById(id);
		if (_dynarch_popupCalendar != null) {
		// we already have some calendar created
		_dynarch_popupCalendar.hide();                 // so we hide it first.
		} else {
		// first-time call, create the calendar.
		var cal = new Calendar(1, null, selected, closeHandler);
		// uncomment the following line to hide the week numbers
		// cal.weekNumbers = false;
		if (typeof showsTime == "string") {
		  cal.showsTime = true;
		  cal.time24 = (showsTime == "24");
		}
		if (showsOtherMonths) {
		  cal.showsOtherMonths = true;
		}
		_dynarch_popupCalendar = cal;                  // remember it in the global var
		cal.setRange(1900, 2070);        // min/max year allowed.
		cal.create();
		}
		_dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
		_dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
		_dynarch_popupCalendar.sel = el;                 // inform it what input field we use
		
		// the reference element that we pass to showAtElement is the button that
		// triggers the calendar.  In this example we align the calendar bottom-right
		// to the button.
		_dynarch_popupCalendar.showAtElement(el, "Br");        // show the calendar
		
		return false;
  }catch(e){
		alert("showCalendar:"+e);
		return false;
  }
}

function show_calendar(name, value){
	try{
		var obj = eval(name);
		showCalendar(obj.id, '%d/%m/%Y', false, false);
	}catch(e){
		alert("Name: "+name);
		alert("show_calendar: "+e);
		alert("Obj: "+obj);
	}
}