function selected(cal, date) {
	if(cal.dateClicked) {
  		cal.sel.value = date; 
  		cal.callCloseHandler();
	}
}

function closeHandler(cal) {
  cal.hide();
  _dynarch_popupCalendar = null;
}

function showCalendar(el, format, showsTime, showsOtherMonths) {
  //var el = document.getElementById("sel1");

  if (_dynarch_popupCalendar != null) {
    _dynarch_popupCalendar.hide();
  } else {
    var cal = new Calendar(1, null, selected, closeHandler);
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal; 
    cal.setRange(1900, 2070); 
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);
  _dynarch_popupCalendar.parseDate(el.value); 
  _dynarch_popupCalendar.sel = el;           
  if(typeof(el.nextSibling.tagName) == "undefined")
  	var obj = el.nextSibling.nextSibling;	
  else 
  	var obj = el.nextSibling;
  _dynarch_popupCalendar.showAtElement(obj, "Br"); 

  return false;
}
