code: function(elem, immediate) {
  			if (!elem) {
  				return;
  			}
  			var inst = this._getInst(elem);
  			if ($.isEmptyObject(inst)) {
  				inst = elem;
  			}
  			if (inst && inst === plugin.curInst) {
  				var showAnim = (immediate ? '' : inst.options.showAnim);
  				var showSpeed = inst.options.showSpeed;
  				showSpeed = (showSpeed === 'normal' && $.ui &&
  					parseInt($.ui.version.substring(2)) >= 8 ? '_default' : showSpeed);
  				var postProcess = function() {
  					if (!inst.div) {
  						return;
  					}
  					inst.div.remove();
  					inst.div = null;
  					plugin.curInst = null;
  					if ($.isFunction(inst.options.onClose)) {
  						inst.options.onClose.apply(elem, [inst.selectedDates]);
  					}
  				};
  				inst.div.stop();
  				if ($.effects && ($.effects[showAnim] || ($.effects.effect && $.effects.effect[showAnim]))) {
  					inst.div.hide(showAnim, inst.options.showOptions, showSpeed, postProcess);
  				}
  				else {
  					var hideAnim = (showAnim === 'slideDown' ? 'slideUp' :
  						(showAnim === 'fadeIn' ? 'fadeOut' : 'hide'));
  					inst.div[hideAnim]((showAnim ? showSpeed : ''), postProcess);
  				}
  				if (!showAnim) {
  					postProcess();
  				}
  			}
  		}
docs: Hide a popup datepicker.
  @memberof CalendarsPicker
  @param elem {Element|object} The control to use or the current instance settings.
  @param immediate {boolean} <code>true</code> to close immediately without animation (internal).
  @example $(selector).datepick('hide')