function showCalendar(id, format, showsTime, showsOtherMonths, bottomLimitStr, upLimitStr, idDefaultInit) {
	  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(2000, 2070);        // min/max year allowed.

		var bottomLimit;
		var isBottomLimit = false;
		var isUpLimit = false;
		if (bottomLimitStr == null || bottomLimitStr == 'null' || bottomLimitStr.indexOf('/') == -1) {
			isBottomLimit = true;
			bottomLimit = new Date();
		}
		else {
			isBottomLimit = true;
			bottomLimit = getDateFromStr(bottomLimitStr);
		}
		
		var upLimit;
		if (upLimitStr != null && upLimitStr != 'null' && upLimitStr.indexOf('/') > -1) {
			isUpLimit = true;
			upLimit = getDateFromStr(upLimitStr);
		}
		var currentDate = new Date(); 
		
		cal.setDisabledHandler(function(date, year, month, day) {
			
			if ((!isBottomLimit || isBeforeOrEqual(bottomLimit, date)) && (!isUpLimit || isBeforeOrEqual(date, upLimit))) {
				return false;
			}
			else {
				return true;
			}
		});

	    cal.create();

	  }

	  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format

	  if (el.value && el.value != 'null' && el.value.indexOf('/') > -1) {
	  	_dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
	  } else if (idDefaultInit && document.getElementById(idDefaultInit) && document.getElementById(idDefaultInit).value) {
	  	_dynarch_popupCalendar.parseDate(document.getElementById(idDefaultInit).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 cal.dateClicked;

	}

 



	// This function gets called when the end-user clicks on some date.

	function selected(cal, date) {
		



	  if (cal.dateClicked){

	  cal.sel.value = date; // just update the date in the input field.
	  cal.callCloseHandler();
	cal.sel.onchange();
	  }

	}

	

	// 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

	  _dynarch_popupCalendar = null;

	}
	
	
	// Returns true if date1 <= date2
	function isBeforeOrEqual(date1, date2) {
		if (date1.getFullYear() < date2.getFullYear()) {return true; }
	  	if (date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()) {return true; }
	  	if (date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() <= date2.getDate()) {return true; }
	  	return false;	
	}
	
	function getDateFromStr(dateStr) {
		var tableau = dateStr.split('/');
		return new Date(tableau[1] + '/' + tableau[0] + '/' + tableau[2]);
	}