diff --git a/dist/js/jquery.calendars.all.js b/dist/js/jquery.calendars.all.js
index 3c007e3..fceb620 100644
--- a/dist/js/jquery.calendars.all.js
+++ b/dist/js/jquery.calendars.all.js
@@ -1949,7 +1949,9 @@ $(selector).calendarsPicker({minDate: $.calendars.newDate(2001, 1, 1),
altFormat: null,
constrainInput: true,
commandsAsDateFormat: false,
- commands: {} // this.commands
+ commands: {}, // this.commands
+ ownerDocument: document,
+ contentWindow: window
},
/** Localisations for the plugin.
@@ -2076,6 +2078,9 @@ $(selector).calendarsPicker({minDate: $.calendars.newDate(2001, 1, 1),
this.disable(elem[0]);
}
}
+
+ $(inst.options.ownerDocument).on('mousedown.' + pluginName, plugin._checkExternalClick).
+ on('resize.' + pluginName, function() { plugin.hide(plugin.curInst); });
},
_optionsChanged: function(elem, inst, options) {
@@ -2383,7 +2388,7 @@ $(selector).calendarsPicker({minDate: $.calendars.newDate(2001, 1, 1),
inst.div = $('
').addClass(this._popupClass).
css({display: (hidden ? 'none' : 'static'), position: 'absolute',
left: elem.offset().left, top: elem.offset().top + elem.outerHeight()}).
- appendTo($(inst.options.popupContainer || 'body'));
+ appendTo($(inst.options.popupContainer || inst.options.ownerDocument.body));
if ($.fn.mousewheel) {
inst.div.mousewheel(this._doMouseWheel);
}
@@ -2450,8 +2455,8 @@ $(selector).calendarsPicker({minDate: $.calendars.newDate(2001, 1, 1),
_checkOffset: function(inst) {
var base = (inst.elem.is(':hidden') && inst.trigger ? inst.trigger : inst.elem);
var offset = base.offset();
- var browserWidth = $(window).width();
- var browserHeight = $(window).height();
+ var browserWidth = $(inst.options.contentWindow).width();
+ var browserHeight = $(inst.options.contentWindow).height();
if (browserWidth === 0) {
return offset;
}
@@ -2460,8 +2465,8 @@ $(selector).calendarsPicker({minDate: $.calendars.newDate(2001, 1, 1),
isFixed = isFixed || $(this).css('position') === 'fixed';
return !isFixed;
});
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+ var scrollX = inst.options.ownerDocument.documentElement.scrollLeft || inst.options.ownerDocument.body.scrollLeft;
+ var scrollY = inst.options.ownerDocument.documentElement.scrollTop || inst.options.ownerDocument.body.scrollTop;
var above = offset.top - (isFixed ? scrollY : 0) - inst.div.outerHeight();
var below = offset.top - (isFixed ? scrollY : 0) + base.outerHeight();
var alignL = offset.left - (isFixed ? scrollX : 0);
@@ -3118,7 +3123,7 @@ $(selector).datepick('setDate', [date1, date2, date3]) */
picker.addClass(inst.options.pickerClass);
}
// Resize
- $('body').append(picker);
+ $(inst.options.ownerDocument.body).append(picker);
var width = 0;
picker.find(inst.options.renderer.monthSelector).each(function() {
width += $(this).outerWidth();
@@ -3387,9 +3392,4 @@ $(selector).datepick('setDate', [date1, date2, date3]) */
var plugin = $.calendarsPicker; // Singleton instance
- $(function() {
- $(document).on('mousedown.' + pluginName, plugin._checkExternalClick).
- on('resize.' + pluginName, function() { plugin.hide(plugin.curInst); });
- });
-
})(jQuery);
diff --git a/dist/js/jquery.calendars.all.min.js b/dist/js/jquery.calendars.all.min.js
index b5bcddc..cf356dc 100644
--- a/dist/js/jquery.calendars.all.min.js
+++ b/dist/js/jquery.calendars.all.min.js
@@ -1,5 +1,4 @@
/*! http://keith-wood.name/calendars.html
Calendars localisations. */
-!function(a){"use strict";function b(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function c(b,c,d,e){if(this._calendar=b,this._year=c,this._month=d,this._day=e,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function d(a,b){return a=""+a,"000000".substring(0,b-a.length)+a}function e(){this.shortYearCutoff="+10"}function f(a){this.local=this.regionalOptions[a]||this.regionalOptions[""]}a.extend(b.prototype,{instance:function(a,b){a=(a||"gregorian").toLowerCase(),b=b||"";var c=this._localCals[a+"-"+b];if(!c&&this.calendars[a]&&(c=new this.calendars[a](b),this._localCals[a+"-"+b]=c),!c)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,a);return c},newDate:function(a,b,c,d,e){return d=("undefined"!=typeof a&&null!==a&&a.year?a.calendar():"string"==typeof d?this.instance(d,e):d)||this.instance(),d.newDate(a,b,c)},substituteDigits:function(a){return function(b){return(b+"").replace(/[0-9]/g,function(b){return a[b]})}},substituteChineseDigits:function(a,b){return function(c){for(var d="",e=0;c>0;){var f=c%10;d=(0===f?"":a[f]+b[e])+d,e++,c=Math.floor(c/10)}return 0===d.indexOf(a[1]+b[1])&&(d=d.substr(1)),d||a[0]}}}),a.extend(c.prototype,{newDate:function(a,b,c){return this._calendar.newDate("undefined"==typeof a||null===a?this:a,b,c)},year:function(a){return 0===arguments.length?this._year:this.set(a,"y")},month:function(a){return 0===arguments.length?this._month:this.set(a,"m")},day:function(a){return 0===arguments.length?this._day:this.set(a,"d")},date:function(b,c,d){if(!this._calendar.isValid(b,c,d))throw(a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=b,this._month=c,this._day=d,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(a,b){return this._calendar.add(this,a,b)},set:function(a,b){return this._calendar.set(this,a,b)},compareTo:function(b){if(this._calendar.name!==b._calendar.name)throw(a.calendars.local.differentCalendars||a.calendars.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,b._calendar.local.name);var c=this._year!==b._year?this._year-b._year:this._month!==b._month?this.monthOfYear()-b.monthOfYear():this._day-b._day;return 0===c?0:c<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(a){return this._calendar.fromJD(a)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(a){return this._calendar.fromJSDate(a)},toString:function(){return(this.year()<0?"-":"")+d(Math.abs(this.year()),4)+"-"+d(this.month(),2)+"-"+d(this.day(),2)}}),a.extend(e.prototype,{_validateLevel:0,newDate:function(b,d,e){return"undefined"==typeof b||null===b?this.today():(b.year&&(this._validate(b,d,e,a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate),e=b.day(),d=b.month(),b=b.year()),new c(this,b,d,e))},today:function(){return this.fromJSDate(new Date)},epoch:function(b){var c=this._validate(b,this.minMonth,this.minDay,a.calendars.local.invalidYear||a.calendars.regionalOptions[""].invalidYear);return c.year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(b){var c=this._validate(b,this.minMonth,this.minDay,a.calendars.local.invalidYear||a.calendars.regionalOptions[""].invalidYear);return(c.year()<0?"-":"")+d(Math.abs(c.year()),4)},monthsInYear:function(b){return this._validate(b,this.minMonth,this.minDay,a.calendars.local.invalidYear||a.calendars.regionalOptions[""].invalidYear),12},monthOfYear:function(b,c){var d=this._validate(b,c,this.minDay,a.calendars.local.invalidMonth||a.calendars.regionalOptions[""].invalidMonth);return(d.month()+this.monthsInYear(d)-this.firstMonth)%this.monthsInYear(d)+this.minMonth},fromMonthOfYear:function(b,c){var d=(c+this.firstMonth-2*this.minMonth)%this.monthsInYear(b)+this.minMonth;return this._validate(b,d,this.minDay,a.calendars.local.invalidMonth||a.calendars.regionalOptions[""].invalidMonth),d},daysInYear:function(b){var c=this._validate(b,this.minMonth,this.minDay,a.calendars.local.invalidYear||a.calendars.regionalOptions[""].invalidYear);return this.leapYear(c)?366:365},dayOfYear:function(b,c,d){var e=this._validate(b,c,d,a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate);return e.toJD()-this.newDate(e.year(),this.fromMonthOfYear(e.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(b,c,d){var e=this._validate(b,c,d,a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(e))+2)%this.daysInWeek()},extraInfo:function(b,c,d){return this._validate(b,c,d,a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate),{}},add:function(b,c,d){return this._validate(b,this.minMonth,this.minDay,a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate),this._correctAdd(b,this._add(b,c,d),c,d)},_add:function(a,b,c){this._validateLevel++;var d;if("d"===c||"w"===c){var e=a.toJD()+b*("w"===c?this.daysInWeek():1);return d=a.calendar().fromJD(e),this._validateLevel--,[d.year(),d.month(),d.day()]}try{var f=a.year()+("y"===c?b:0),g=a.monthOfYear()+("m"===c?b:0);d=a.day();var h=function(a){for(;gb-1+a.minMonth;)f++,g-=b,b=a.monthsInYear(f)};"y"===c?(a.month()!==this.fromMonthOfYear(f,g)&&(g=this.newDate(f,a.month(),this.minDay).monthOfYear()),g=Math.min(g,this.monthsInYear(f)),d=Math.min(d,this.daysInMonth(f,this.fromMonthOfYear(f,g)))):"m"===c&&(h(this),d=Math.min(d,this.daysInMonth(f,this.fromMonthOfYear(f,g))));var i=[f,this.fromMonthOfYear(f,g),d];return this._validateLevel--,i}catch(a){throw this._validateLevel--,a}},_correctAdd:function(a,b,c,d){if(!(this.hasYearZero||"y"!==d&&"m"!==d||0!==b[0]&&a.year()>0==b[0]>0)){var e={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[d],f=c<0?-1:1;b=this._add(a,c*e[0]+f*e[1],e[2])}return a.date(b[0],b[1],b[2])},set:function(b,c,d){this._validate(b,this.minMonth,this.minDay,a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate);var e="y"===d?c:b.year(),f="m"===d?c:b.month(),g="d"===d?c:b.day();return"y"!==d&&"m"!==d||(g=Math.min(g,this.daysInMonth(e,f))),b.date(e,f,g)},isValid:function(a,b,c){this._validateLevel++;var d=this.hasYearZero||0!==a;if(d){var e=this.newDate(a,b,this.minDay);d=b>=this.minMonth&&b-this.minMonth=this.minDay&&c-this.minDay13.5?13:1),j=e-(i>2.5?4716:4715);return j<=0&&j--,this.newDate(j,i,h)},toJSDate:function(b,c,d){var e=this._validate(b,c,d,a.calendars.local.invalidDate||a.calendars.regionalOptions[""].invalidDate),f=new Date(e.year(),e.month()-1,e.day());return f.setHours(0),f.setMinutes(0),f.setSeconds(0),f.setMilliseconds(0),f.setHours(f.getHours()>12?f.getHours()+2:0),f},fromJSDate:function(a){return this.newDate(a.getFullYear(),a.getMonth()+1,a.getDate())}}),a.calendars=new b,a.calendars.cdate=c,a.calendars.baseCalendar=e,a.calendars.calendars.gregorian=f}(jQuery),function(a){"use strict";a.extend(a.calendars.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),a.calendars.local=a.calendars.regionalOptions[""],a.extend(a.calendars.cdate.prototype,{formatDate:function(a,b){return"string"!=typeof a&&(b=a,a=""),this._calendar.formatDate(a||"",this,b)}}),a.extend(a.calendars.baseCalendar.prototype,{UNIX_EPOCH:a.calendars.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:a.calendars.instance().jdEpoch,TICKS_PER_DAY:864e9,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(b,c,d){if("string"!=typeof b&&(d=c,c=b,b=""),!c)return"";if(c.calendar()!==this)throw a.calendars.local.invalidFormat||a.calendars.regionalOptions[""].invalidFormat;b=b||this.local.dateFormat,d=d||{};for(var e=d.dayNamesShort||this.local.dayNamesShort,f=d.dayNames||this.local.dayNames,g=d.monthNamesShort||this.local.monthNamesShort,h=d.monthNames||this.local.monthNames,i=d.localNumbers||this.local.localNumbers,j=function(a,c){for(var d=1;p+d1},k=function(a,b,c,d){var e=""+b;if(j(a,d))for(;e.length1},r=function(b,d){var e=q(b,d),f=[2,3,e?4:2,e?4:2,10,11,20]["oyYJ@!".indexOf(b)+1],g=new RegExp("^-?\\d{1,"+f+"}"),h=c.substring(v).match(g);if(!h)throw(a.calendars.local.missingNumberAt||a.calendars.regionalOptions[""].missingNumberAt).replace(/\{0\}/,v);return v+=h[0].length,parseInt(h[0],10)},s=this,t=function(b,d,e,f){for(var g=q(b,f)?e:d,h=0;h-1){l=1,m=n;for(var y=this.daysInMonth(k,l);m>y;y=this.daysInMonth(k,l))l++,m-=y}return j>-1?this.fromJD(j):this.newDate(k,l,m)},determineDate:function(a,b,c,d,e){c&&"object"!=typeof c&&(e=d,d=c,c=null),"string"!=typeof d&&(e=d,d="");var f=this,g=function(a){try{return f.parseDate(d,a,e)}catch(a){}a=a.toLowerCase();for(var b=(a.match(/^c/)&&c?c.newDate():null)||f.today(),g=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,h=g.exec(a);h;)b.add(parseInt(h[1],10),h[2]||"d"),h=g.exec(a);return b};return b=b?b.newDate():null,a="undefined"==typeof a||null===a?b:"string"==typeof a?g(a):"number"==typeof a?isNaN(a)||a===1/0||a===-(1/0)?b:f.today().add(a,"d"):f.newDate(a)}})}(jQuery),function(a){"use strict";var b="calendarsPicker";a.JQPlugin.createPlugin({name:b,defaultRenderer:{picker:'{link:prev}{link:today}{link:next}
{months}{popup:start}
{link:clear}{link:close}
{popup:end}
',monthRow:'{months}
',month:'',weekHeader:"{days}
",dayHeader:"{day} | ",week:"{days}
",day:"{day} | ",monthSelector:".calendars-month",daySelector:"td",rtlClass:"calendars-rtl",multiClass:"calendars-multi",defaultClass:"",selectedClass:"calendars-selected",highlightedClass:"calendars-highlight",todayClass:"calendars-today",otherMonthClass:"calendars-other-month",weekendClass:"calendars-weekend",commandClass:"calendars-cmd",commandButtonClass:"",commandLinkClass:"",disabledClass:"calendars-disabled"},commands:{prev:{text:"prevText",status:"prevStatus",keystroke:{keyCode:33},enabled:function(a){var b=a.curMinDate();return!b||a.drawDate.newDate().add(1-a.options.monthsToStep-a.options.monthsOffset,"m").day(a.options.calendar.minDay).add(-1,"d").compareTo(b)!==-1},date:function(a){return a.drawDate.newDate().add(-a.options.monthsToStep-a.options.monthsOffset,"m").day(a.options.calendar.minDay)},action:function(a){c.changeMonth(this,-a.options.monthsToStep)}},prevJump:{text:"prevJumpText",status:"prevJumpStatus",keystroke:{keyCode:33,ctrlKey:!0},enabled:function(a){var b=a.curMinDate();return!b||a.drawDate.newDate().add(1-a.options.monthsToJump-a.options.monthsOffset,"m").day(a.options.calendar.minDay).add(-1,"d").compareTo(b)!==-1},date:function(a){return a.drawDate.newDate().add(-a.options.monthsToJump-a.options.monthsOffset,"m").day(a.options.calendar.minDay)},action:function(a){c.changeMonth(this,-a.options.monthsToJump)}},next:{text:"nextText",status:"nextStatus",keystroke:{keyCode:34},enabled:function(a){var b=a.get("maxDate");return!b||1!==a.drawDate.newDate().add(a.options.monthsToStep-a.options.monthsOffset,"m").day(a.options.calendar.minDay).compareTo(b)},date:function(a){return a.drawDate.newDate().add(a.options.monthsToStep-a.options.monthsOffset,"m").day(a.options.calendar.minDay)},action:function(a){c.changeMonth(this,a.options.monthsToStep)}},nextJump:{text:"nextJumpText",status:"nextJumpStatus",keystroke:{keyCode:34,ctrlKey:!0},enabled:function(a){var b=a.get("maxDate");return!b||1!==a.drawDate.newDate().add(a.options.monthsToJump-a.options.monthsOffset,"m").day(a.options.calendar.minDay).compareTo(b)},date:function(a){return a.drawDate.newDate().add(a.options.monthsToJump-a.options.monthsOffset,"m").day(a.options.calendar.minDay)},action:function(a){c.changeMonth(this,a.options.monthsToJump)}},current:{text:"currentText",status:"currentStatus",keystroke:{keyCode:36,ctrlKey:!0},enabled:function(a){var b=a.curMinDate(),c=a.get("maxDate"),d=a.selectedDates[0]||a.options.calendar.today();return!(b&&d.compareTo(b)===-1||c&&1===d.compareTo(c))},date:function(a){return a.selectedDates[0]||a.options.calendar.today()},action:function(a){var b=a.selectedDates[0]||a.options.calendar.today();c.showMonth(this,b.year(),b.month())}},today:{text:"todayText",status:"todayStatus",keystroke:{keyCode:36,ctrlKey:!0},enabled:function(a){var b=a.curMinDate(),c=a.get("maxDate");return!(b&&a.options.calendar.today().compareTo(b)===-1||c&&1===a.options.calendar.today().compareTo(c))},date:function(a){return a.options.calendar.today()},action:function(){c.showMonth(this)}},clear:{text:"clearText",status:"clearStatus",keystroke:{keyCode:35,ctrlKey:!0},enabled:function(){return!0},date:function(){return null},action:function(){c.clear(this)}},close:{text:"closeText",status:"closeStatus",keystroke:{keyCode:27},enabled:function(){return!0},date:function(){return null},action:function(){c.hide(this)}},prevWeek:{text:"prevWeekText",status:"prevWeekStatus",keystroke:{keyCode:38,ctrlKey:!0},enabled:function(a){var b=a.curMinDate();return!b||a.drawDate.newDate().add(-a.options.calendar.daysInWeek(),"d").compareTo(b)!==-1},date:function(a){return a.drawDate.newDate().add(-a.options.calendar.daysInWeek(),"d")},action:function(a){c.changeDay(this,-a.options.calendar.daysInWeek())}},prevDay:{text:"prevDayText",status:"prevDayStatus",keystroke:{keyCode:37,ctrlKey:!0},enabled:function(a){var b=a.curMinDate();return!b||a.drawDate.newDate().add(-1,"d").compareTo(b)!==-1},date:function(a){return a.drawDate.newDate().add(-1,"d")},action:function(){c.changeDay(this,-1)}},nextDay:{text:"nextDayText",status:"nextDayStatus",keystroke:{keyCode:39,ctrlKey:!0},enabled:function(a){var b=a.get("maxDate");return!b||1!==a.drawDate.newDate().add(1,"d").compareTo(b)},date:function(a){return a.drawDate.newDate().add(1,"d")},action:function(){c.changeDay(this,1)}},nextWeek:{text:"nextWeekText",status:"nextWeekStatus",keystroke:{keyCode:40,ctrlKey:!0},enabled:function(a){var b=a.get("maxDate");return!b||1!==a.drawDate.newDate().add(a.options.calendar.daysInWeek(),"d").compareTo(b)},date:function(a){return a.drawDate.newDate().add(a.options.calendar.daysInWeek(),"d")},action:function(a){c.changeDay(this,a.options.calendar.daysInWeek())}}},defaultOptions:{calendar:a.calendars.instance(),pickerClass:"",showOnFocus:!0,showTrigger:null,showAnim:"show",showOptions:{},showSpeed:"normal",popupContainer:null,alignment:"bottom",fixedWeeks:!1,firstDay:null,calculateWeek:null,localNumbers:!1,monthsToShow:1,monthsOffset:0,monthsToStep:1,monthsToJump:12,useMouseWheel:!0,changeMonth:!0,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,defaultDate:null,selectDefaultDate:!1,minDate:null,maxDate:null,dateFormat:null,autoSize:!1,rangeSelect:!1,rangeSeparator:" - ",multiSelect:0,multiSeparator:",",onDate:null,onShow:null,onChangeMonthYear:null,onSelect:null,onClose:null,altField:null,altFormat:null,constrainInput:!0,commandsAsDateFormat:!1,commands:{}},regionalOptions:{"":{renderer:{},prevText:"<Prev",prevStatus:"Show the previous month",prevJumpText:"<<",prevJumpStatus:"Show the previous year",nextText:"Next>",nextStatus:"Show the next month",nextJumpText:">>",nextJumpStatus:"Show the next year",currentText:"Current",currentStatus:"Show the current month",todayText:"Today",todayStatus:"Show today's month",clearText:"Clear",clearStatus:"Clear all the dates",closeText:"Close",closeStatus:"Close the datepicker",yearStatus:"Change the year",earlierText:" ▲",laterText:" ▼",monthStatus:"Change the month",weekText:"Wk",weekStatus:"Week of the year",dayStatus:"Select DD, M d, yyyy",defaultStatus:"Select a date",isRTL:!1}},_disabled:[],_popupClass:"calendars-popup",_triggerClass:"calendars-trigger",_disableClass:"calendars-disable",_monthYearClass:"calendars-month-year",_curMonthClass:"calendars-month-",_anyYearClass:"calendars-any-year",_curDoWClass:"calendars-dow-",_init:function(){this.defaultOptions.commands=this.commands,this.regionalOptions[""].renderer=this.defaultRenderer,this._super()},_instSettings:function(b,c){return{selectedDates:[],drawDate:null,pickingRange:!1,inline:a.inArray(b[0].nodeName.toLowerCase(),["div","span"])>-1,get:function(b){return a.inArray(b,["defaultDate","minDate","maxDate"])>-1?this.options.calendar.determineDate(this.options[b],null,this.selectedDates[0],this.get("dateFormat"),this.getConfig()):"dateFormat"===b?this.options.dateFormat||this.options.calendar.local.dateFormat:this.options[b]},curMinDate:function(){return this.pickingRange?this.selectedDates[0]:this.get("minDate")},getConfig:function(){return{dayNamesShort:this.options.dayNamesShort,dayNames:this.options.dayNames,monthNamesShort:this.options.monthNamesShort,monthNames:this.options.monthNames,calculateWeek:this.options.calculateWeek,shortYearCutoff:this.options.shortYearCutoff}}}},_postAttach:function(b,d){d.inline?(d.drawDate=c._checkMinMax((d.selectedDates[0]||d.get("defaultDate")||d.options.calendar.today()).newDate(),d),d.prevDate=d.drawDate.newDate(),this._update(b[0]),a.fn.mousewheel&&b.mousewheel(this._doMouseWheel)):(this._attachments(b,d),b.on("keydown."+d.name,this._keyDown).on("keypress."+d.name,this._keyPress).on("keyup."+d.name,this._keyUp),b.attr("disabled")&&this.disable(b[0]))},_optionsChanged:function(b,c,d){if(d.calendar&&d.calendar!==c.options.calendar){var e=function(a){return"object"==typeof c.options[a]?null:c.options[a]};d=a.extend({defaultDate:e("defaultDate"),minDate:e("minDate"),maxDate:e("maxDate")},d),c.selectedDates=[],c.drawDate=null}var f=c.selectedDates;a.extend(c.options,d),this.setDate(b[0],f,null,!1,!0),c.pickingRange=!1;var g=c.options.calendar,h=c.get("defaultDate");c.drawDate=this._checkMinMax((h?h:c.drawDate)||h||g.today(),c).newDate(),c.inline||this._attachments(b,c),(c.inline||c.div)&&this._update(b[0])},_attachments:function(b,d){b.off("focus."+d.name),d.options.showOnFocus&&b.on("focus."+d.name,this.show),d.trigger&&d.trigger.remove();var e=d.options.showTrigger;d.trigger=e?a(e).clone().removeAttr("id").addClass(this._triggerClass)[d.options.isRTL?"insertBefore":"insertAfter"](b).click(function(){c.isDisabled(b[0])||c[c.curInst===d?"hide":"show"](b[0])}):a([]),this._autoSize(b,d);var f=this._extractDates(d,b.val());f&&this.setDate(b[0],f,null,!0);var g=d.get("defaultDate");d.options.selectDefaultDate&&g&&0===d.selectedDates.length&&this.setDate(b[0],(g||d.options.calendar.today()).newDate())},_autoSize:function(a,b){if(b.options.autoSize&&!b.inline){var c=b.options.calendar,d=c.newDate(2009,10,20),e=b.get("dateFormat");if(e.match(/[DM]/)){var f=function(a){for(var b=0,c=0,d=0;db&&(b=a[d].length,c=d);return c};d.month(f(c.local[e.match(/MM/)?"monthNames":"monthNamesShort"])+1),d.day(f(c.local[e.match(/DD/)?"dayNames":"dayNamesShort"])+20-d.dayOfWeek())}b.elem.attr("size",d.formatDate(e,{localNumbers:b.options.localnumbers}).length)}},_preDestroy:function(b,c){c.trigger&&c.trigger.remove(),b.empty().off("."+c.name),c.inline&&a.fn.mousewheel&&b.unmousewheel(),!c.inline&&c.options.autoSize&&b.removeAttr("size")},multipleEvents:function(a){var b=arguments;return function(){for(var a=0;a').find("button,select").prop("disabled",!0).end().find("a").removeAttr("href")}else b.prop("disabled",!0),c.trigger.filter("button."+this._triggerClass).prop("disabled",!0).end().filter("img."+this._triggerClass).css({opacity:"0.5",cursor:"default"});this._disabled=a.map(this._disabled,function(a){return a===b[0]?null:a}),this._disabled.push(b[0])}},isDisabled:function(b){return b&&a.inArray(b,this._disabled)>-1},show:function(b){b=a(b.target||b);var d=c._getInst(b);if(c.curInst!==d&&(c.curInst&&c.hide(c.curInst,!0),!a.isEmptyObject(d))){d.lastVal=null,d.selectedDates=c._extractDates(d,b.val()),d.pickingRange=!1,d.drawDate=c._checkMinMax((d.selectedDates[0]||d.get("defaultDate")||d.options.calendar.today()).newDate(),d),d.prevDate=d.drawDate.newDate(),c.curInst=d,c._update(b[0],!0);var e=c._checkOffset(d);d.div.css({left:e.left,top:e.top});var f=d.options.showAnim,g=d.options.showSpeed;if(g="normal"===g&&a.ui&&parseInt(a.ui.version.substring(2))>=8?"_default":g,a.effects&&(a.effects[f]||a.effects.effect&&a.effects.effect[f])){var h=d.div.data();for(var i in h)i.match(/^ec\.storage\./)&&(h[i]=d._mainDiv.css(i.replace(/ec\.storage\./,"")));d.div.data(h).show(f,d.options.showOptions,g)}else d.div[f||"show"](f?g:0)}},_extractDates:function(a,b){if(b!==a.lastVal){a.lastVal=b,b=b.split(a.options.multiSelect?a.options.multiSeparator:a.options.rangeSelect?a.options.rangeSeparator:"\0");for(var c=[],d=0;d").addClass(this._popupClass).css({display:d?"none":"static",position:"absolute",left:b.offset().left,top:b.offset().top+b.outerHeight()}).appendTo(a(e.options.popupContainer||"body")),a.fn.mousewheel&&e.div.mousewheel(this._doMouseWheel)),e.div.html(this._generateContent(b[0],e)),b.focus())},_updateInput:function(b,c){var d=this._getInst(b);if(!a.isEmptyObject(d)){for(var e="",f="",g=d.options.multiSelect?d.options.multiSeparator:d.options.rangeSeparator,h=d.options.calendar,i=d.get("dateFormat"),j=d.options.altFormat||i,k={localNumbers:d.options.localNumbers},l=0;l0?g:"")+h.formatDate(i,d.selectedDates[l],k),f+=(l>0?g:"")+h.formatDate(j,d.selectedDates[l],k);d.inline||c||a(b).val(e),a(d.options.altField).val(f),!a.isFunction(d.options.onSelect)||c||d.inSelect||(d.inSelect=!0,d.options.onSelect.apply(b,[d.selectedDates]),d.inSelect=!1),a(b).change()}},_getBorders:function(a){var b=function(a){return{thin:1,medium:3,thick:5}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(b){var c=b.elem.is(":hidden")&&b.trigger?b.trigger:b.elem,d=c.offset(),e=a(window).width(),f=a(window).height();if(0===e)return d;var g=!1;a(b.elem).parents().each(function(){return g=g||"fixed"===a(this).css("position"),!g});var h=document.documentElement.scrollLeft||document.body.scrollLeft,i=document.documentElement.scrollTop||document.body.scrollTop,j=d.top-(g?i:0)-b.div.outerHeight(),k=d.top-(g?i:0)+c.outerHeight(),l=d.left-(g?h:0),m=d.left-(g?h:0)+c.outerWidth()-b.div.outerWidth(),n=d.left-h+b.div.outerWidth()>e,o=d.top-i+b.elem.outerHeight()+b.div.outerHeight()>f;b.div.css("position",g?"fixed":"absolute");var p=b.options.alignment;return d="topLeft"===p?{left:l,top:j}:"topRight"===p?{left:m,top:j}:"bottomLeft"===p?{left:l,top:k}:"bottomRight"===p?{left:m,top:k}:"top"===p?{left:b.options.isRTL||n?m:l,top:j}:{left:b.options.isRTL||n?m:l,top:o?j:k},d.left=Math.max(g?0:h,d.left),d.top=Math.max(g?0:i,d.top),d},_checkExternalClick:function(b){if(c.curInst){var d=a(b.target);0!==d.closest("."+c._popupClass+",."+c._triggerClass).length||d.hasClass(c._getMarker())||c.hide(c.curInst)}},hide:function(b,d){if(b){var e=this._getInst(b);if(a.isEmptyObject(e)&&(e=b),e&&e===c.curInst){var f=d?"":e.options.showAnim,g=e.options.showSpeed;g="normal"===g&&a.ui&&parseInt(a.ui.version.substring(2))>=8?"_default":g;
-var h=function(){e.div&&(e.div.remove(),e.div=null,c.curInst=null,a.isFunction(e.options.onClose)&&e.options.onClose.apply(b,[e.selectedDates]))};if(e.div.stop(),a.effects&&(a.effects[f]||a.effects.effect&&a.effects.effect[f]))e.div.hide(f,e.options.showOptions,g,h);else{var i="slideDown"===f?"slideUp":"fadeIn"===f?"fadeOut":"hide";e.div[i](f?g:"",h)}f||h()}}},_keyDown:function(b){var d,e=b.data&&b.data.elem||b.target,f=c._getInst(e),g=!1;if(f.inline||f.div)if(9===b.keyCode)c.hide(e);else if(13===b.keyCode)c.selectDate(e,a("a."+f.options.renderer.highlightedClass,f.div)[0]),g=!0;else{var h=f.options.commands;for(var i in h)if(f.options.commands.hasOwnProperty(i)&&(d=h[i],d.keystroke.keyCode===b.keyCode&&!!d.keystroke.ctrlKey==!(!b.ctrlKey&&!b.metaKey)&&!!d.keystroke.altKey===b.altKey&&!!d.keystroke.shiftKey===b.shiftKey)){c.performAction(e,i),g=!0;break}}else d=f.options.commands.current,d.keystroke.keyCode===b.keyCode&&!!d.keystroke.ctrlKey==!(!b.ctrlKey&&!b.metaKey)&&!!d.keystroke.altKey===b.altKey&&!!d.keystroke.shiftKey===b.shiftKey&&(c.show(e),g=!0);return f.ctrlKey=b.keyCode<48&&32!==b.keyCode||b.ctrlKey||b.metaKey,g&&(b.preventDefault(),b.stopPropagation()),!g},_keyPress:function(b){var d=c._getInst(b.data&&b.data.elem||b.target);if(!a.isEmptyObject(d)&&d.options.constrainInput){var e=String.fromCharCode(b.keyCode||b.charCode),f=c._allowedChars(d);return b.metaKey||d.ctrlKey||e<" "||!f||f.indexOf(e)>-1}return!0},_allowedChars:function(a){for(var b=a.options.multiSelect?a.options.multiSeparator:a.options.rangeSelect?a.options.rangeSeparator:"",c=!1,d=!1,e=a.get("dateFormat"),f=0;f0&&c.setDate(d,f,null,!0)}catch(a){}return!0},_doMouseWheel:function(b,d){var e=c.curInst&&c.curInst.elem[0]||a(b.target).closest("."+c._getMarker())[0];if(!c.isDisabled(e)){var f=c._getInst(e);f.options.useMouseWheel&&(d=d<0?-1:1,c.changeMonth(e,-f.options[b.ctrlKey?"monthsToJump":"monthsToStep"]*d)),b.preventDefault()}},clear:function(b){var c=this._getInst(b);if(!a.isEmptyObject(c)){c.selectedDates=[],this.hide(b);var d=c.get("defaultDate");c.options.selectDefaultDate&&d?this.setDate(b,(d||c.options.calendar.today()).newDate()):this._updateInput(b)}},getDate:function(b){var c=this._getInst(b);return a.isEmptyObject(c)?[]:c.selectedDates},setDate:function(b,c,d,e,f){var g=this._getInst(b);if(!a.isEmptyObject(g)){a.isArray(c)||(c=[c],d&&c.push(d));var h=g.get("minDate"),i=g.get("maxDate"),j=g.selectedDates[0];g.selectedDates=[];for(var k=0;k=e.toJD())&&(!f||c.toJD()<=f.toJD())},performAction:function(b,c){var d=this._getInst(b);if(!a.isEmptyObject(d)&&!this.isDisabled(b)){var e=d.options.commands;e[c]&&e[c].enabled.apply(b,[d])&&e[c].action.apply(b,[d])}},showMonth:function(b,c,d,e){var f=this._getInst(b);if(!a.isEmptyObject(f)&&("undefined"!=typeof e&&null!==e||f.drawDate.year()!==c||f.drawDate.month()!==d)){f.prevDate=f.drawDate.newDate();var g=f.options.calendar,h=this._checkMinMax("undefined"!=typeof c&&null!==c?g.newDate(c,d,1):g.today(),f);f.drawDate.date(h.year(),h.month(),"undefined"!=typeof e&&null!==e?e:Math.min(f.drawDate.day(),g.daysInMonth(h.year(),h.month()))),this._update(b)}},changeMonth:function(b,c){var d=this._getInst(b);if(!a.isEmptyObject(d)){var e=d.drawDate.newDate().add(c,"m");this.showMonth(b,e.year(),e.month())}},changeDay:function(b,c){var d=this._getInst(b);if(!a.isEmptyObject(d)){var e=d.drawDate.newDate().add(c,"d");this.showMonth(b,e.year(),e.month(),e.day())}},_checkMinMax:function(a,b){var c=b.get("minDate"),d=b.get("maxDate");return a=c&&a.compareTo(c)===-1?c.newDate():a,a=d&&1===a.compareTo(d)?d.newDate():a},retrieveDate:function(b,c){var d=this._getInst(b);return a.isEmptyObject(d)?null:d.options.calendar.fromJD(parseFloat(c.className.replace(/^.*jd(\d+\.5).*$/,"$1")))},selectDate:function(b,c){var d=this._getInst(b);if(!a.isEmptyObject(d)&&!this.isDisabled(b)){var e=this.retrieveDate(b,c);if(d.options.multiSelect){for(var f=!1,g=0;g'+(i?i.formatDate(d.options[h.text],{localNumbers:d.options.localNumbers}):d.options[h.text])+""+e+">")}};for(var n in d.options.commands)d.options.commands.hasOwnProperty(n)&&(m("button",'button type="button"',"button",n,d.options.renderer.commandButtonClass),m("link",'a href="javascript:void(0)"',"a",n,d.options.renderer.commandLinkClass));if(l=a(l),f[1]>1){var o=0;a(d.options.renderer.monthSelector,l).each(function(){var b=++o%f[1];a(this).addClass(1===b?"first":0===b?"last":"")})}var p=this;l.find(d.options.renderer.daySelector+" a").hover(function(){e(this),a(this).addClass(d.options.renderer.highlightedClass)},function(){e(this)}).click(function(){p.selectDate(b,this)}).end().find("select."+this._monthYearClass+":not(."+this._anyYearClass+")").change(function(){var c=a(this).val().split("/");p.showMonth(b,parseInt(c[1],10),parseInt(c[0],10))}).end().find("select."+this._anyYearClass).click(function(){a(this).css("visibility","hidden").next("input").css({left:this.offsetLeft,top:this.offsetTop,width:this.offsetWidth,height:this.offsetHeight}).show().focus()}).end().find("input."+p._monthYearClass).change(function(){try{var c=parseInt(a(this).val(),10);c=isNaN(c)?d.drawDate.year():c,p.showMonth(b,c,d.drawDate.month(),d.drawDate.day())}catch(a){}}).keydown(function(b){13===b.keyCode?a(b.elem).change():27===b.keyCode&&(a(b.elem).hide().prev("select").css("visibility","visible"),d.elem.focus())});var q={elem:d.elem[0]};l.keydown(q,this._keyDown).keypress(q,this._keyPress).keyup(q,this._keyUp),l.find("."+d.options.renderer.commandClass).click(function(){if(!a(this).hasClass(d.options.renderer.disabledClass)){var e=this.className.replace(new RegExp("^.*"+d.options.renderer.commandClass+"-([^ ]+).*$"),"$1");c.performAction(b,e)}}),d.options.isRTL&&l.addClass(d.options.renderer.rtlClass),f[0]*f[1]>1&&l.addClass(d.options.renderer.multiClass),d.options.pickerClass&&l.addClass(d.options.pickerClass),a("body").append(l);var r=0;return l.find(d.options.renderer.monthSelector).each(function(){r+=a(this).outerWidth()}),l.width(r/f[0]),a.isFunction(d.options.onShow)&&d.options.onShow.apply(b,[l,d.options.calendar,d]),l},_generateMonth:function(b,c,d,e,f,g,h){var i=f.daysInMonth(d,e),j=c.options.monthsToShow;j=a.isArray(j)?j:[1,j];var k=c.options.fixedWeeks||j[0]*j[1]>1,l=c.options.firstDay;l="undefined"==typeof l||null===l?f.local.firstDay:l;var m=(f.dayOfWeek(d,e,f.minDay)-l+f.daysInWeek())%f.daysInWeek(),n=k?6:Math.ceil((m+i)/f.daysInWeek()),o=c.options.selectOtherMonths&&c.options.showOtherMonths,p=c.pickingRange?c.selectedDates[0]:c.get("minDate"),q=c.get("maxDate"),r=g.week.indexOf("{weekOfYear}")>-1,s=f.today(),t=f.newDate(d,e,f.minDay);t.add(-m-(k&&(t.dayOfWeek()===l||t.daysInMonth()'+(a.isFunction(c.options.calculateWeek)?c.options.calculateWeek(t):t.weekOfYear())+"":"",z="",A=0;A0)B=t.compareTo(c.selectedDates[0])!==-1&&1!==t.compareTo(c.selectedDates[1]);else for(var C=0;C"+(c.options.showOtherMonths||t.month()===e?D.content||v(t.day()):" ")+(E?"":"")),t.add(1,"d"),u++}w+=this._prepare(g.week,c).replace(/\{days\}/g,z).replace(/\{weekOfYear\}/g,y)}var F=this._prepare(g.month,c).match(/\{monthHeader(:[^\}]+)?\}/);F=F[0].length<=13?"MM yyyy":F[0].substring(13,F[0].length-1),F=h?this._generateMonthSelection(c,d,e,p,q,F,f,g):f.formatDate(F,f.newDate(d,e,f.minDay),{localNumbers:c.options.localNumbers});var G=this._prepare(g.weekHeader,c).replace(/\{days\}/g,this._generateDayHeaders(c,f,g));return this._prepare(g.month,c).replace(/\{monthHeader(:[^\}]+)?\}/g,F).replace(/\{weekHeader\}/g,G).replace(/\{weeks\}/g,w)},_generateDayHeaders:function(a,b,c){var d=a.options.firstDay;d="undefined"==typeof d||null===d?b.local.firstDay:d;for(var e="",f=0;f'+b.local.dayNamesMin[g]+"")}return e},_generateMonthSelection:function(a,b,c,d,e,f,g){if(!a.options.changeMonth)return g.formatDate(f,g.newDate(b,c,1),{localNumbers:a.options.localNumbers});for(var h=g.local["monthNames"+(f.match(/mm/i)?"":"Short")],i=f.replace(/m+/i,"\\x2E").replace(/y+/i,"\\x2F"),j='",i=i.replace(/\\x2E/,j);var m=function(b){return a.options.localNumbers&&g.local.digits?g.local.digits(b):b},n=a.options.yearRange;if("any"===n)j='';else{n=n.split(":");var o=g.today().year(),p=n[0].match("c[+-].*")?b+parseInt(n[0].substring(1),10):(n[0].match("[+-].*")?o:0)+parseInt(n[0],10),q=n[1].match("c[+-].*")?b+parseInt(n[1].substring(1),10):(n[1].match("[+-].*")?o:0)+parseInt(n[1],10);j='