{"version":3,"names":[],"mappings":"","sources":["assets/plugins/datepicker.js"],"sourcesContent":["/*!\r\n * Accessible Datepicker v2.1.10\r\n * Copyright 2015-2017 Eureka2, Jacques Archimède.\r\n * Based on the example of the Open AJAX Alliance Accessibility Tools Task Force : http://www.oaa-accessibility.org/examplep/datepicker1/\r\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\r\n * Inspired by :\r\n * http://wet-boew.github.io/wet-boew/demos/datepicker/datepicker-fr.html\r\n * http://eternicode.github.io/bootstrap-datepicker\r\n */\r\n\r\n/**\r\n *\tDescription:\r\n *\t===========\r\n *\tThis DatePicker widget allows the user to select a date.\r\n *\tThe DatePicker shows one month at least.\r\n *\r\n *\tThe calendar portion of the date picker follows a table structure\r\n *\twhere days of the week and calendar day numbers are layed out in HTML table cells where WAI-ARIA semantics for a grid are applied.\r\n *\tThis provides context so an assistive technology can render the day of the week;\r\n *\tits corresponding numeric calendar day, and week number if necessary.\r\n *\r\n *\tThe calendar portion can be displayed in a numbers of ways, including as a popup associated with another widget,\r\n *\tor as a static region of a page.\r\n *\r\n * \tThis component complies with the recommendations of the guide http://www.w3.org/TR/wai-aria-practices/#datepicker of W3C, namely :\r\n *\r\n *\tKeyboard Interaction:\r\n *\t=====================\r\n *\r\n *\tKeyboard navigation on days that are not included the currently displayed month should move to the month automatically and lead to the day in the next or previous month.\r\n *\r\n *\t\t- Tab - Like other widgets, the date picker widget receives focus by tabbing into it. Once focus is received, focus is repositioned on today's date in a grid of days and weeks. A second tab will take the user out of the date picker widget. Focus initially is placed on today's date.\r\n *\t\t- Shift+Tab - reverses the direction of the tab order. Once in the widget, a Shift+Tab will take the user to the previous focusable element in the tab order.\r\n *\t\t- Up Arrow and Down Arrow - goes to the same day of the week in the previous or next week respectively. If the user advances past the end of the month they continue into the next or previous month as appropriate.\r\n *\t\t- Left Arrow and Right Arrow - advances one day to the next, also in a continuum. Visually focus is moved from day to day and wraps from row to row in a grid of days and weeks.\r\n *\t\t- Alt+Page Up - Moves to the same date in the previous year.\r\n *\t\t- Alt+Page Down - Moves to the same date in the next year.\r\n *\t\t- Space -\r\n *\t\t\tSingleton Mode: acts as a toggle either selecting or deselecting the date.\r\n *\t\t\tContiguous Mode: Similar to selecting a range of text. Space selects the first date. Shift+Arrows add to the selection. Pressing Space again deselects the previous selections and selects the current focused date.\r\n *\t\t- Home - Moves to the first day of the current month.\r\n *\t\t- End - Moves to the last day of the current month.\r\n *\t\t- Page Up - Moves to the same date in the previous month.\r\n *\t\t- Page Down - Moves to the same date in the next month.\r\n *\t\t- Enter -\r\n *\t\t\tIf the the calendar is a popup attached to some other widget (e.g., a text field), then Enter dismisses the popup, and the selected date(s) are shown in the associated widget.\r\n *\t\t\tIf the calendar is a static region on the page, then Enter confirms the selected date(s).\r\n *\t\t- Escape - in the case of a popup date picker, closes the widget without any action.\r\n *\r\n *\r\n *\tWAI-ARIA Roles, States, and Properties:\r\n *\t======================================\r\n *\r\n *\t\tThe current month has a label representing the month and year. It is advisable to use a role heading but is not essential. This \"label\" should have a unique ID.\r\n *\t\tIf the author would like to ensure that a label is announced by a screen reader, as the label changes, include live region properties with the label element: aria-live=\"assertive\" and aria-atomic=\"true\".\r\n *\t\tThe container for the day of week headers and numeric days of the week has a role of grid.\r\n *\t\tThe grid has an aria-labelledby property with a value equivalent to the id of the label for the grid.\r\n *\t\tEach name for the day of the week has a role columnheader and is not navigable via the keyboard.\r\n *\t\tEach numeric day of the week has the role gridcell.\r\n *\t\tWhen a day is selected its aria-selected is set to true, otherwise it is set to false or removed.\r\n *\t\tChanges in aria states, identified here, as well as focus, are clearly styled to show the user where their point of regard is and what days are selected.\r\n *\r\n *\tWhen the datepicker is active a calender day of the week always has focus.\r\n *\tThis can be achieved by setting the tabindex on that day as appropriate and then using script to give it focus.\r\n *\tThe grid container set aria-activedescendant to the id of the currently focused gridcell.\r\n *\r\n */\r\n\r\n(function () {\r\n\t\"use strict\";\r\n\tif (typeof Date.dp_locales === 'undefined') {\r\n\t\tDate.dp_locales = {\r\n\t\t\t\"texts\": {\r\n\t\t\t\t\"buttonTitle\": \"Select date ...\",\r\n\t\t\t\t\"buttonLabel\": \"Click or press the Enter key or the spacebar to open the calendar\",\r\n\t\t\t\t\"prevButtonLabel\": \"Go to previous month\",\r\n\t\t\t\t\"prevMonthButtonLabel\": \"Go to the previous year\",\r\n\t\t\t\t\"prevYearButtonLabel\": \"Go to the previous twenty years\",\r\n\t\t\t\t\"nextButtonLabel\": \"Go to next month\",\r\n\t\t\t\t\"nextMonthButtonLabel\": \"Go to the next year\",\r\n\t\t\t\t\"nextYearButtonLabel\": \"Go to the next twenty years\",\r\n\t\t\t\t\"changeMonthButtonLabel\": \"Click or press the Enter key or the spacebar to change the month\",\r\n\t\t\t\t\"changeYearButtonLabel\": \"Click or press the Enter key or the spacebar to change the year\",\r\n\t\t\t\t\"changeRangeButtonLabel\": \"Click or press the Enter key or the spacebar to go to the next twenty years\",\r\n\t\t\t\t\"closeButtonTitle\": \"Close\",\r\n\t\t\t\t\"closeButtonLabel\": \"Close the calendar\",\r\n\t\t\t\t\"calendarHelp\": \"- Up Arrow and Down Arrow - goes to the same day of the week in the previous or next week respectively. If the end of the month is reached, continues into the next or previous month as appropriate.\\r\\n- Left Arrow and Right Arrow - advances one day to the next, also in a continuum. Visually focus is moved from day to day and wraps from row to row in the grid of days.\\r\\n- Control+Page Up - Moves to the same date in the previous year.\\r\\n- Control+Page Down - Moves to the same date in the next year.\\r\\n- Home - Moves to the first day of the current month.\\r\\n- End - Moves to the last day of the current month.\\r\\n- Page Up - Moves to the same date in the previous month.\\r\\n- Page Down - Moves to the same date in the next month.\\r\\n- Enter or Espace - closes the calendar, and the selected date is shown in the associated text box.\\r\\n- Escape - closes the calendar without any action.\"\r\n\t\t\t},\r\n\t\t\t\"directionality\": \"LTR\",\r\n\t\t\t\"month_names\": [\r\n\t\t\t\t\"January\",\r\n\t\t\t\t\"February\",\r\n\t\t\t\t\"March\",\r\n\t\t\t\t\"April\",\r\n\t\t\t\t\"May\",\r\n\t\t\t\t\"June\",\r\n\t\t\t\t\"July\",\r\n\t\t\t\t\"August\",\r\n\t\t\t\t\"September\",\r\n\t\t\t\t\"October\",\r\n\t\t\t\t\"November\",\r\n\t\t\t\t\"December\"\r\n\t\t\t],\r\n\t\t\t\"month_names_abbreviated\": [\r\n\t\t\t\t\"Jan\",\r\n\t\t\t\t\"Feb\",\r\n\t\t\t\t\"Mar\",\r\n\t\t\t\t\"Apr\",\r\n\t\t\t\t\"May\",\r\n\t\t\t\t\"Jun\",\r\n\t\t\t\t\"Jul\",\r\n\t\t\t\t\"Aug\",\r\n\t\t\t\t\"Sep\",\r\n\t\t\t\t\"Oct\",\r\n\t\t\t\t\"Nov\",\r\n\t\t\t\t\"Dec\"\r\n\t\t\t],\r\n\t\t\t\"month_names_narrow\": [\r\n\t\t\t\t\"J\",\r\n\t\t\t\t\"F\",\r\n\t\t\t\t\"M\",\r\n\t\t\t\t\"A\",\r\n\t\t\t\t\"M\",\r\n\t\t\t\t\"J\",\r\n\t\t\t\t\"J\",\r\n\t\t\t\t\"A\",\r\n\t\t\t\t\"S\",\r\n\t\t\t\t\"O\",\r\n\t\t\t\t\"N\",\r\n\t\t\t\t\"D\"\r\n\t\t\t],\r\n\t\t\t\"day_names\": [\r\n\t\t\t\t\"Sunday\",\r\n\t\t\t\t\"Monday\",\r\n\t\t\t\t\"Tuesday\",\r\n\t\t\t\t\"Wednesday\",\r\n\t\t\t\t\"Thursday\",\r\n\t\t\t\t\"Friday\",\r\n\t\t\t\t\"Saturday\"\r\n\t\t\t],\r\n\t\t\t\"day_names_abbreviated\": [\r\n\t\t\t\t\"Sun\",\r\n\t\t\t\t\"Mon\",\r\n\t\t\t\t\"Tue\",\r\n\t\t\t\t\"Wed\",\r\n\t\t\t\t\"Thu\",\r\n\t\t\t\t\"Fri\",\r\n\t\t\t\t\"Sat\"\r\n\t\t\t],\r\n\t\t\t\"day_names_short\": [\r\n\t\t\t\t\"Su\",\r\n\t\t\t\t\"Mo\",\r\n\t\t\t\t\"Tu\",\r\n\t\t\t\t\"We\",\r\n\t\t\t\t\"Th\",\r\n\t\t\t\t\"Fr\",\r\n\t\t\t\t\"Sa\"\r\n\t\t\t],\r\n\t\t\t\"day_names_narrow\": [\r\n\t\t\t\t\"S\",\r\n\t\t\t\t\"M\",\r\n\t\t\t\t\"T\",\r\n\t\t\t\t\"W\",\r\n\t\t\t\t\"T\",\r\n\t\t\t\t\"F\",\r\n\t\t\t\t\"S\"\r\n\t\t\t],\r\n\t\t\t\"day_periods\": {\r\n\t\t\t\t\"am\": \"AM\",\r\n\t\t\t\t\"noon\": \"noon\",\r\n\t\t\t\t\"pm\": \"PM\"\r\n\t\t\t},\r\n\t\t\t\"day_periods_abbreviated\": {\r\n\t\t\t\t\"am\": \"AM\",\r\n\t\t\t\t\"noon\": \"noon\",\r\n\t\t\t\t\"pm\": \"PM\"\r\n\t\t\t},\r\n\t\t\t\"day_periods_narrow\": {\r\n\t\t\t\t\"am\": \"a\",\r\n\t\t\t\t\"noon\": \"n\",\r\n\t\t\t\t\"pm\": \"p\"\r\n\t\t\t},\r\n\t\t\t\"quarter_names\": [\r\n\t\t\t\t\"1st quarter\",\r\n\t\t\t\t\"2nd quarter\",\r\n\t\t\t\t\"3rd quarter\",\r\n\t\t\t\t\"4th quarter\"\r\n\t\t\t],\r\n\t\t\t\"quarter_names_abbreviated\": [\r\n\t\t\t\t\"Q1\",\r\n\t\t\t\t\"Q2\",\r\n\t\t\t\t\"Q3\",\r\n\t\t\t\t\"Q4\"\r\n\t\t\t],\r\n\t\t\t\"quarter_names_narrow\": [\r\n\t\t\t\t\"1\",\r\n\t\t\t\t\"2\",\r\n\t\t\t\t\"3\",\r\n\t\t\t\t\"4\"\r\n\t\t\t],\r\n\t\t\t\"era_names\": [\r\n\t\t\t\t\"Before Christ\",\r\n\t\t\t\t\"Anno Domini\"\r\n\t\t\t],\r\n\t\t\t\"era_names_abbreviated\": [\r\n\t\t\t\t\"BC\",\r\n\t\t\t\t\"AD\"\r\n\t\t\t],\r\n\t\t\t\"era_names_narrow\": [\r\n\t\t\t\t\"B\",\r\n\t\t\t\t\"A\"\r\n\t\t\t],\r\n\t\t\t\"full_format\": \"EEEE, MMMM d, y\",\r\n\t\t\t\"long_format\": \"MMMM d, y\",\r\n\t\t\t\"medium_format\": \"MMM d, y\",\r\n\t\t\t\"short_format\": \"M/d/yy\",\r\n\t\t\t\"firstday_of_week\": 0\r\n\t\t};\r\n\t}\r\n})();\r\n\r\n(function(factory){\r\n\tif (typeof define === \"function\" && define.amd) {\r\n\t\tdefine([\"jquery\"], factory);\r\n\t} else if (typeof exports === 'object') {\r\n\t\tfactory(require('jquery'));\r\n\t} else {\r\n\t\tif (typeof jQuery === 'undefined') {\r\n\t\t\tthrow new Error('Datepicker\\'s JavaScript requires jQuery')\r\n\t\t}\r\n\t\tfactory(jQuery);\r\n\t}\r\n}(function($, undefined){\r\n\t'use strict';\r\n\r\n\tvar datepickerButton = [\r\n\t\t'',\r\n\t\t'\t',\r\n\t\t''\r\n\t];\r\n\tvar datepickerCalendar = [\r\n\t\t'
',\r\n\t\t'\t
',\r\n\t\t'\t\t
',\r\n\t\t'\t\t
',\r\n\t\t'\t\t
',\r\n\t\t'\t\t
',\r\n\t\t'\t\t
July 2015
',\r\n\t\t'\t
',\r\n\t\t'\t',\r\n\t\t'\t\t',\r\n\t\t'\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t',\r\n\t\t'\t\t',\r\n\t\t'\t\t',\r\n\t\t'\t\t\t',\r\n\t\t'\t\t\t\t',\r\n\t\t'\t\t\t',\r\n\t\t'\t\t',\r\n\t\t'\t
SuMoTuWeThFrSa
Javascript must be enabled
',\r\n\t\t'\t
',\r\n\t\t'\t\t',\r\n\t\t'\t
',\r\n\t\t'\t
Click or press the Enter key or the spacebar to open the calendar
',\r\n\t\t'\t
Go to previous month
',\r\n\t\t'\t
Go to next month
',\r\n\t\t'\t
Go to previous year
',\r\n\t\t'\t
Go to next year
',\r\n\t\t'\t
Close the date picker
',\r\n\t\t'
'\r\n\t];\r\n\r\n\tvar Datepicker = function (target, options) {\r\n\t\tvar self = this;\r\n\t\tthis.$target = $(target); // textbox that will receive the selected date string and focus (if modal)\r\n\t\tthis.options = $.extend({}, Datepicker.DEFAULTS, options)\r\n\t\tthis.locales = Date.dp_locales;\r\n\t\tthis.startview(this.options.startView);\r\n\t\tif (typeof this.options.inputFormat === 'string') {\r\n\t\t\tthis.options.inputFormat = [this.options.inputFormat];\r\n\t\t}\r\n\t\tif (! $.isArray(this.options.datesDisabled)) {\r\n\t\t\tthis.options.datesDisabled = [this.options.datesDisabled];\r\n\t\t}\r\n\t\t$.each(this.options.datesDisabled, function(i, v) {\r\n\t\t\tif (typeof v === 'string') {\r\n\t\t\t\tvar date = self.parseDate(v);\r\n\t\t\t\tif (date === null ) {\r\n\t\t\t\t\tself.options.datesDisabled[i] = null;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tself.options.datesDisabled[i] = self.format(date);\r\n\t\t\t\t}\r\n\t\t\t} else if (v instanceof Date && !isNaN(v.valueOf())) {\r\n\t\t\t\tself.options.datesDisabled[i] = self.format(v);\r\n\t\t\t} else {\r\n\t\t\t\tself.options.datesDisabled[i] = null;\r\n\t\t\t}\r\n\t\t});\r\n\t\tif (this.options.min != null) {\r\n\t\t\tthis.options.min = this.parseDate(this.options.min);\r\n\t\t} else if (this.$target.attr('min')) {\r\n\t\t\tthis.options.min = this.parseDate(this.$target.attr('min'));\r\n\t\t}\r\n\t\tif (this.options.max != null) {\r\n\t\t\tthis.options.max = this.parseDate(this.options.max);\r\n\t\t} else if (this.$target.attr('max')) {\r\n\t\t\tthis.options.max = this.parseDate(this.$target.attr('max'));\r\n\t\t}\r\n\t\tif (typeof this.options.previous === 'string') {\r\n\t\t\tthis.options.previous = $(this.options.previous);\r\n\t\t} else if (! (this.options.previous instanceof jQuery)) {\r\n\t\t\tthis.options.previous = null;\r\n\t\t}\r\n\t\tif (typeof this.options.next === 'string') {\r\n\t\t\tthis.options.next = $(this.options.next);\r\n\t\t} else if (! (this.options.next instanceof jQuery)) {\r\n\t\t\tthis.options.next = null;\r\n\t\t}\r\n\t\tthis.id = this.$target.attr('id') || 'datepicker-' + Math.floor(Math.random() * 100000);\r\n\t\tvar calendar = datepickerCalendar.join(\"\");\r\n\t\tcalendar = calendar.replace(/CALENDARID/g, this.id + '');\r\n\r\n\t\t// complete the target textbox if any\r\n\t\tif (this.$target.parent('.wrapper').length == 0) {\r\n\t\t\tthis.$target.wrap( '
' );\r\n\t\t}\r\n\t\tthis.$label = this.$target.parents().find(\"label[for=\" + this.id + \"]\");\r\n\t\tthis.$group = this.$target.parent('.wrapper');\r\n\t\tthis.$target.attr('aria-autocomplete', 'none')\r\n\t\tthis.$target.css('min-width', '7em')\r\n\t\tthis.$target.addClass('form-control');\r\n\r\n\t\tif (! this.$target.attr('placeholder')) {\r\n\t\t\tthis.$target.attr('placeholder', this.options.inputFormat[0]);\r\n\t\t}\r\n\r\n\t\tvar button = datepickerButton.join(\"\");\r\n\t\tbutton = button.replace(/CALENDARID/g, this.id + '');\r\n\t\tthis.$button = $(button);\r\n\t\tthis.$button.addClass(this.options.theme);\r\n\t\tthis.$calendar = $(calendar);\r\n\t\tthis.$calendar.addClass(this.options.theme);\r\n\t\tthis.$target.after(this.$button);\r\n\r\n\t\t// be sure parent of the calendar is positionned to calculate the position of the calendar\r\n\t\tif (this.$calendar.parent().css('position') === 'static') {\r\n\t\t\tthis.$calendar.parent().css('position', 'relative');\r\n\t\t}\r\n\t\tthis.$calendar.find('.datepicker-bn-open-label').html(this.options.buttonLabel);\r\n\t\tif (this.$target.attr('id')) {\r\n\t\t\tthis.$calendar.attr('aria-controls', this.$target.attr('id'));\r\n\t\t}\r\n\t\tthis.$button.find('span').attr('title', this.options.buttonTitle);\r\n\t\tthis.$calendar.css('left', this.$target.parent().position().left + 'px');\r\n\t\tthis.$monthObj = this.$calendar.find('.datepicker-month');\r\n\t\tthis.$prev = this.$calendar.find('.datepicker-month-prev');\r\n\t\tthis.$next = this.$calendar.find('.datepicker-month-next');\r\n\t\tthis.$fastprev = this.$calendar.find('.datepicker-month-fast-prev');\r\n\t\tthis.$fastnext = this.$calendar.find('.datepicker-month-fast-next');\r\n\t\tthis.$grid = this.$calendar.find('.datepicker-grid');\r\n\t\tif (this.locales.directionality === 'RTL') {\r\n\t\t\tthis.$grid.addClass('rtl');\r\n\t\t}\r\n\t\tvar $days = this.$grid.find('th.datepicker-day abbr');\r\n\t\tthis.drawCalendarHeader();\r\n\t\tif (this.options.inline == false && this.options.modal == true) {\r\n\t\t\tthis.$close = this.$calendar.find('.datepicker-close');\r\n\t\t\tthis.$close.html(this.options.closeButtonTitle).attr('title', this.options.closeButtonLabel);\r\n\t\t\tthis.$calendar.find('.datepicker-bn-close-label').html(this.options.closeButtonLabel);\r\n\t\t} else {\r\n\t\t\tthis.hideObject(this.$calendar.find('.datepicker-close-wrap'));\r\n\t\t\tthis.hideObject(this.$calendar.find('.datepicker-bn-close-label'));\r\n\t\t}\r\n\r\n\t\tif (this.options.inline != false) {\r\n\t\t\tthis.hideObject(this.$button);\r\n\t\t\tvar $container = typeof this.options.inline === 'string' ? $('#' + this.options.inline) : this.options.inline;\r\n\t\t\t$container.append(this.$calendar);\r\n\t\t\tthis.$calendar.css({position: 'relative', left: '0px'});\r\n\t\t\tthis.initializeDate();\r\n\t\t} else {\r\n\t\t\tthis.$calendar.css({display: 'none'});\r\n\t\t\tthis.$target.parent().after(this.$calendar);\r\n\t\t\tthis.hide(!this.options.gainFocusOnConstruction);\r\n\t\t}\r\n\r\n\t\tthis.keys = {\r\n\t\t\ttab: 9,\r\n\t\t\tenter: 13,\r\n\t\t\tesc: 27,\r\n\t\t\tspace: 32,\r\n\t\t\tpageup: 33,\r\n\t\t\tpagedown: 34,\r\n\t\t\tend: 35,\r\n\t\t\thome: 36,\r\n\t\t\tleft: 37,\r\n\t\t\tup: 38,\r\n\t\t\tright: 39,\r\n\t\t\tdown: 40\r\n\t\t};\r\n\r\n\t\tthis.bindHandlers();\r\n\t\tthis.$button.click(function(e) {\r\n\t\t\tif (!$(this).hasClass('disabled')) {\r\n\t\t\t\tif (self.$calendar.attr('aria-hidden') === 'true') {\r\n\t\t\t\t\tself.initializeDate();\r\n\t\t\t\t\tself.show();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tself.hide();\r\n\t\t\t\t}\r\n\t\t\t\tself.selectGridCell(self.$grid.attr('aria-activedescendant'));\r\n\t\t\t}\r\n\t\t\te.stopPropagation();\r\n\t\t\treturn false;\r\n\t\t});\r\n\t\tthis.$button.keydown(function(e) {\r\n\t\t\tvar ev = e || event;\r\n\t\t\tif(ev.keyCode == self.keys.enter || ev.keyCode == self.keys.space) {\r\n\t\t\t\t$(this).trigger('click');\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\t\tthis.$calendar.on('blur', function(e) {\r\n\t\t\tif (self.$calendar.attr('aria-hidden') === 'false') {\r\n\t\t\t\tself.hide();\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t}\r\n\r\n\tDatepicker.VERSION = '2.1.10'\r\n\r\n\tDatepicker.DEFAULTS = {\r\n\t\tfirstDayOfWeek: Date.dp_locales.firstday_of_week, // Determines the first column of the calendar grid\r\n\t\tweekDayFormat: 'short', // Display format of the weekday names - values are 'short' or 'narrow'\r\n\t\tstartView: 0, // Initial calendar - values are 0 or 'days', 1 or 'months', 2 or 'years'\r\n\t\tdaysOfWeekDisabled: [],\r\n\t\tdatesDisabled: [],\r\n\t\tisDateDisabled: null,\r\n\t\tisMonthDisabled: null,\r\n\t\tisYearDisabled: null,\r\n\t\tinputFormat: [Date.dp_locales.short_format],\r\n\t\toutputFormat: Date.dp_locales.short_format,\r\n\t\ttitleFormat: Date.dp_locales.full_format,\r\n\t\tbuttonTitle: Date.dp_locales.texts.buttonTitle,\r\n\t\tbuttonLabel: Date.dp_locales.texts.buttonLabel,\r\n\t\tprevButtonLabel: Date.dp_locales.texts.prevButtonLabel,\r\n\t\tprevMonthButtonLabel: Date.dp_locales.texts.prevMonthButtonLabel,\r\n\t\tprevYearButtonLabel: Date.dp_locales.texts.prevYearButtonLabel,\r\n\t\tnextButtonLabel: Date.dp_locales.texts.nextButtonLabel,\r\n\t\tnextMonthButtonLabel: Date.dp_locales.texts.nextMonthButtonLabel,\r\n\t\tnextYearButtonLabel: Date.dp_locales.texts.nextYearButtonLabel,\r\n\t\tchangeMonthButtonLabel: Date.dp_locales.texts.changeMonthButtonLabel,\r\n\t\tchangeYearButtonLabel: Date.dp_locales.texts.changeYearButtonLabel,\r\n\t\tchangeRangeButtonLabel: Date.dp_locales.texts.changeRangeButtonLabel,\r\n\t\tcloseButtonTitle: Date.dp_locales.texts.closeButtonTitle,\r\n\t\tcloseButtonLabel: Date.dp_locales.texts.closeButtonLabel,\r\n\t\tonUpdate: function (value) {},\r\n\t\tprevious: null,\r\n\t\tnext: null,\r\n\t\ttheme: 'default',\r\n\t\tmodal: false,\r\n\t\tinline: false,\r\n\t\tgainFocusOnConstruction: true,\r\n\t\tmin: null,\r\n\t\tmax: null\r\n\t}\r\n\r\n\t/**\r\n\t *\tinitializeDate() is a member function to initialize the Datepicker date with the content of the target textbox\r\n\t *\r\n\t *\t@return N/A\r\n\t *\r\n\t */\r\n\tDatepicker.prototype.initializeDate = function() {\r\n\t\tvar val = this.$target.val();\r\n\t\tvar date = val === '' ? new Date() : this.parseDate(val);\r\n\t\tthis.setDate(date, true);\r\n\t} // end initializeDate()\r\n\r\n\t/**\r\n\t * getDate() is a member function to retrieve the current Datepicker date.\r\n\t * @return the Date object\r\n\t */\r\n\tDatepicker.prototype.getDate = function () {\r\n\t\tvar val = this.$target.val();\r\n\t\tvar date = val === '' ? new Date() : this.parseDate(val);\r\n\t\treturn date;\r\n\t} // end getDate()\r\n\r\n\t/**\r\n\t *\tsetDate() is a member function to set the Datepicker date with the content of newDate\r\n\t *\r\n\t *\t@param\t(newDate Date) the new value of the Datepicker date.\r\n\t *\t@return N/A\r\n\t *\r\n\t */\r\n\tDatepicker.prototype.setDate = function(newDate, init) {\r\n\t\tthis.dateObj = newDate;\r\n\t\tinit = (typeof init === 'undefined') ? false : init;\r\n\t\tif (this.dateObj == null) {\r\n\t\t\tthis.$target.attr('aria-invalid', true);\r\n\t\t\tthis.$target.parents('.form-group').addClass('has-error');\r\n\t\t\tthis.dateObj = new Date();\r\n\t\t\tthis.dateObj.setHours(0, 0, 0, 0);\r\n\t\t}\r\n\t\tif (this.options.min != null && this.dateObj < this.options.min) {\r\n\t\t\tthis.$target.attr('aria-invalid', true);\r\n\t\t\tthis.$target.parents('.form-group').addClass('has-error');\r\n\t\t\tthis.dateObj = this.options.min;\r\n\t\t} else if (this.options.max != null && this.dateObj > this.options.max) {\r\n\t\t\tthis.$target.attr('aria-invalid', true);\r\n\t\t\tthis.$target.parents('.form-group').addClass('has-error');\r\n\t\t\tthis.dateObj = this.options.max;\r\n\t\t}\r\n\t\tif (!init || this.$target.val() != '') {\r\n\t\t\tthis.$target.val(this.format(this.dateObj));\r\n\t\t}\r\n\t\tthis.curYear = this.dateObj.getFullYear();\r\n\t\tthis.year = this.curYear;\r\n\t\tthis.curMonth = this.dateObj.getMonth();\r\n\t\tthis.month = this.curMonth;\r\n\t\tthis.date = this.dateObj.getDate();\r\n\t\t// populate the calendar grid\r\n\t\tswitch (this.options.startView) {\r\n\t\t\tcase 1: // months\r\n\t\t\t\tthis.populateMonthsCalendar();\r\n\t\t\t\t// update the table's activedescdendant to point to the current month\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', this.$grid.find('.curMonth').attr('id'));\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2: // years\r\n\t\t\t\tthis.populateYearsCalendar();\r\n\t\t\t\t// update the table's activedescdendant to point to the current year\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', this.$grid.find('.curYear').attr('id'));\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthis.populateDaysCalendar();\r\n\t\t\t\t// update the table's activedescdendant to point to the current day\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', this.$grid.find('.curDay').attr('id'));\r\n\t\t}\r\n\t} // end setDate()\r\n\r\n\t/**\r\n\t *\tdrawCalendarHeader() is a member function to populate the calendar header with the days name.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.drawCalendarHeader = function() {\r\n\t\tvar $days = this.$grid.find('th.datepicker-day');\r\n\t\tvar weekday = this.options.firstDayOfWeek;\r\n\t\tfor (var i = 0; i < 7; i++) {\r\n\t\t\t$days.eq(i).attr('aria-label', this.locales.day_names[weekday])\r\n\t\t\t$days.children('abbr').eq(i).attr('title', this.locales.day_names[weekday]).text(\r\n\t\t\t\tthis.options.weekDayFormat === 'short' ?\r\n\t\t\t\t\tthis.locales.day_names_short[weekday] :\r\n\t\t\t\t\tthis.locales.day_names_narrow[weekday]\r\n\t\t\t);\r\n\t\t\tweekday = (weekday + 1) % 7;\r\n\t\t}\r\n\t} // end drawCalendarHeader()\r\n\r\n\t/**\r\n\t *\tpopulateDaysCalendar() is a member function to populate the datepicker grid with calendar days\r\n\t *\trepresenting the current month\r\n\t *\r\n\t *\t@return N/A\r\n\t *\r\n\t */\r\n\tDatepicker.prototype.populateDaysCalendar = function() {\r\n\t\tthis.$calendar.find('.datepicker-bn-prev-label').html(this.options.prevButtonLabel);\r\n\t\tthis.$calendar.find('.datepicker-bn-next-label').html(this.options.nextButtonLabel);\r\n\t\tthis.$calendar.find('.datepicker-bn-fast-prev-label').html(this.options.prevMonthButtonLabel);\r\n\t\tthis.$calendar.find('.datepicker-bn-fast-next-label').html(this.options.nextMonthButtonLabel);\r\n\t\tif (this.options.min != null &&\r\n\t\t\t(\tthis.year - 1 < this.options.min.getFullYear() ||\r\n\t\t\t\t(this.year - 1 == this.options.min.getFullYear() && this.month < this.options.min.getMonth()))) {\r\n\t\t\tthis.$fastprev.attr('title', '');\r\n\t\t\tthis.$fastprev.addClass('disabled');\r\n\t\t\tthis.$fastprev.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$fastprev.attr('title', this.options.prevMonthButtonLabel);\r\n\t\t\tthis.$fastprev.addClass('enabled');\r\n\t\t\tthis.$fastprev.removeClass('disabled');\r\n\t\t}\r\n\t\tvar previousMonth = this.previousMonth(this.year, this.month);\r\n\t\tif (this.options.min != null &&\r\n\t\t\t(\tpreviousMonth.year < this.options.min.getFullYear() ||\r\n\t\t\t\t(previousMonth.year == this.options.min.getFullYear() && previousMonth.month < this.options.min.getMonth()))) {\r\n\t\t\tthis.$prev.attr('title', '');\r\n\t\t\tthis.$prev.addClass('disabled');\r\n\t\t\tthis.$prev.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$prev.attr('title', this.options.prevButtonLabel);\r\n\t\t\tthis.$prev.addClass('enabled');\r\n\t\t\tthis.$prev.removeClass('disabled');\r\n\t\t}\r\n\t\tthis.$monthObj.attr('title', this.options.changeMonthButtonLabel);\r\n\t\tvar nextMonth = this.nextMonth(this.year, this.month);\r\n\t\tif (this.options.max != null &&\r\n\t\t\t(\tnextMonth.year > this.options.max.getFullYear() ||\r\n\t\t\t\t(nextMonth.year == this.options.max.getFullYear() && nextMonth.month > this.options.max.getMonth()))) {\r\n\t\t\tthis.$next.attr('title', '');\r\n\t\t\tthis.$next.addClass('disabled');\r\n\t\t\tthis.$next.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$next.attr('title', this.options.nextButtonLabel);\r\n\t\t\tthis.$next.addClass('enabled');\r\n\t\t\tthis.$next.removeClass('disabled');\r\n\t\t}\r\n\t\tif (this.options.max != null &&\r\n\t\t\t(\tthis.year + 1 > this.options.max.getFullYear() ||\r\n\t\t\t\t(this.year + 1 == this.options.max.getFullYear() && this.month > this.options.max.getMonth()))) {\r\n\t\t\tthis.$fastnext.attr('title', '');\r\n\t\t\tthis.$fastnext.addClass('disabled');\r\n\t\t\tthis.$fastnext.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$fastnext.attr('title', this.options.nextMonthButtonLabel);\r\n\t\t\tthis.$fastnext.addClass('enabled');\r\n\t\t\tthis.$fastnext.removeClass('disabled');\r\n\t\t}\r\n\t\tthis.showObject(this.$fastprev);\r\n\t\tthis.showObject(this.$fastnext);\r\n\t\tvar numDays = this.getDaysInMonth(this.year, this.month);\r\n\t\tvar numPrevDays = this.getDaysInMonth(previousMonth.year, previousMonth.month);\r\n\t\tvar startWeekday = new Date(this.year, this.month, 1).getDay();\r\n\t\tvar lastDayOfWeek = (this.options.firstDayOfWeek + 6) % 7;\r\n\t\tvar curDay = 1;\r\n\t\tvar rowCount = 1;\r\n\t\tthis.$monthObj.html(this.locales.month_names[this.month] + ' ' + this.year);\r\n\t\tthis.showObject(this.$grid.find('thead'));\r\n\t\t// clear the grid\r\n\t\tvar gridCells = '\\t\\n';\r\n\t\t// Insert the leading empty cells\r\n\t\tvar numEmpties = 0;\r\n\t\tvar weekday = this.options.firstDayOfWeek;\r\n\t\twhile (weekday != startWeekday) {\r\n\t\t\tnumEmpties++;\r\n\t\t\tweekday = (weekday + 1) % 7;\r\n\t\t}\r\n\t\tfor ( ; numEmpties > 0; numEmpties--) {\r\n\t\t\tgridCells += '\\t\\t' + (numPrevDays - numEmpties + 1) + '\\n';\r\n\t\t}\r\n\t\tvar isYearDisabled = this.options.isYearDisabled && this.options.isYearDisabled(this.year);\r\n\t\tvar isMonthDisabled = this.options.isMonthDisabled && this.options.isMonthDisabled(this.year, this.month + 1);\r\n\t\t// insert the days of the month.\r\n\t\tfor (curDay = 1; curDay <= numDays; curDay++) {\r\n\t\t\tvar date = new Date(this.year, this.month, curDay, 0, 0, 0, 0);\r\n\t\t\tvar longdate = this.formatDate(date, this.options.titleFormat);\r\n\t\t\tvar curDayClass = curDay == this.date && this.month == this.curMonth && this.year == this.curYear ? ' curDay' : '';\r\n\t\t\tif (isYearDisabled || isMonthDisabled) {\r\n\t\t\t\tgridCells += '\\t\\t -1) {\r\n\t\t\t\tgridCells += '\\t\\t this.options.max) {\r\n\t\t\t\tgridCells += '\\t\\t -1) {\r\n\t\t\t\tgridCells += '\\t\\t' + curDay;\r\n\t\t\tgridCells += '';\r\n\t\t\tif (weekday == lastDayOfWeek && curDay < numDays) {\r\n\t\t\t\t// This was the last day of the week, close it out\r\n\t\t\t\t// and begin a new one\r\n\t\t\t\tgridCells += '\\t\\n\\t\\n';\r\n\t\t\t\trowCount++;\r\n\t\t\t}\r\n\t\t\tif (curDay < numDays) {\r\n\t\t\t\tweekday = (weekday + 1) % 7;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Insert any trailing empty cells\r\n\t\twhile (weekday != lastDayOfWeek) {\r\n\t\t\tgridCells += '\\t\\t' + (++numEmpties) + '\\n';\r\n\t\t\tweekday = (weekday + 1) % 7;\r\n\t\t}\r\n\t\tgridCells += '\\t';\r\n\t\tvar $tbody = this.$grid.find('tbody');\r\n\t\t$tbody.empty();\r\n\t\t$tbody.append(gridCells);\r\n\t\tthis.gridType = 0; // 0 = days grid, 1 = months grid, 2 = years Grid\r\n\t} // end populateDaysCalendar()\r\n\r\n\t/**\r\n\t *\tpopulateMonthsCalendar() is a member function to populate the datepicker grid with calendar months\r\n\t *\trepresenting the current year\r\n\t *\r\n\t *\t@return N/A\r\n\t *\r\n\t */\r\n\tDatepicker.prototype.populateMonthsCalendar = function() {\r\n\t\tthis.$calendar.find('.datepicker-bn-prev-label').html(this.options.prevMonthButtonLabel);\r\n\t\tthis.$calendar.find('.datepicker-bn-next-label').html(this.options.nextMonthButtonLabel);\r\n\t\tthis.hideObject(this.$fastprev);\r\n\t\tthis.hideObject(this.$fastnext);\r\n\t\tif (this.options.min != null && this.year - 1 < this.options.min.getFullYear()) {\r\n\t\t\tthis.$prev.attr('title', '');\r\n\t\t\tthis.$prev.addClass('disabled');\r\n\t\t\tthis.$prev.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$prev.attr('title', this.options.prevMonthButtonLabel);\r\n\t\t\tthis.$prev.addClass('enabled');\r\n\t\t\tthis.$prev.removeClass('disabled');\r\n\t\t}\r\n\t\tthis.$monthObj.attr('title', this.options.changeYearButtonLabel);\r\n\t\tif (this.options.max != null && this.year + 1 > this.options.max.getFullYear()) {\r\n\t\t\tthis.$next.attr('title', '');\r\n\t\t\tthis.$next.addClass('disabled');\r\n\t\t\tthis.$next.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$next.attr('title', this.options.nextMonthButtonLabel);\r\n\t\t\tthis.$next.addClass('enabled');\r\n\t\t\tthis.$next.removeClass('disabled');\r\n\t\t}\r\n\t\tvar curMonth = 0;\r\n\t\tvar rowCount = 1;\r\n\t\tvar $tbody = this.$grid.find('tbody');\r\n\t\tthis.$monthObj.html(this.year);\r\n\t\t// clear the grid\r\n\t\tthis.hideObject(this.$grid.find('thead'));\r\n\t\t$tbody.empty();\r\n\t\t$('#datepicker-err-msg-' + this.id).empty();\r\n\t\tvar gridCells = '\\t\\n';\r\n\t\tvar isYearDisabled = this.options.isYearDisabled && this.options.isYearDisabled(this.year);\r\n\t\t// insert the months of the year.\r\n\t\tfor (curMonth = 0; curMonth < 12; curMonth++) {\r\n\t\t\tif (isYearDisabled) {\r\n\t\t\t\tgridCells += '\\t\\t this.options.max.getFullYear() || (this.year == this.options.max.getFullYear() && curMonth > this.options.max.getMonth()))) {\r\n\t\t\t\tgridCells += '\\t\\t\\n';\r\n\t\t\t\trowCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tgridCells += '\\t';\r\n\t\t$tbody.append(gridCells);\r\n\t\tthis.gridType = 1; // 0 = days grid, 1 = months grid, 2 = years Grid\r\n\t} // end populateMonthsCalendar()\r\n\r\n\t/**\r\n\t *\tpopulateYearsCalendar() is a member function to populate the datepicker grid with 20 calendar years\r\n\t *\taround the current year\r\n\t *\r\n\t *\t@return N/A\r\n\t *\r\n\t */\r\n\tDatepicker.prototype.populateYearsCalendar = function() {\r\n\t\tthis.$calendar.find('.datepicker-bn-prev-label').html(this.options.prevYearButtonLabel);\r\n\t\tthis.$calendar.find('.datepicker-bn-next-label').html(this.options.nextYearButtonLabel);\r\n\t\tthis.hideObject(this.$fastprev);\r\n\t\tthis.hideObject(this.$fastnext);\r\n\t\tif (this.options.min != null && this.year - 20 < this.options.min.getFullYear()) {\r\n\t\t\tthis.$prev.attr('title', '');\r\n\t\t\tthis.$prev.addClass('disabled');\r\n\t\t\tthis.$prev.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$prev.attr('title', this.options.prevYearButtonLabel);\r\n\t\t\tthis.$prev.addClass('enabled');\r\n\t\t\tthis.$prev.removeClass('disabled');\r\n\t\t}\r\n\t\tthis.$monthObj.attr('title', this.options.changeRangeButtonLabel);\r\n\t\tif (this.options.max != null && this.year + 20 > this.options.max.getFullYear()) {\r\n\t\t\tthis.$next.attr('title', '');\r\n\t\t\tthis.$next.addClass('disabled');\r\n\t\t\tthis.$next.removeClass('enabled');\r\n\t\t} else {\r\n\t\t\tthis.$next.attr('title', this.options.nextYearButtonLabel);\r\n\t\t\tthis.$next.addClass('enabled');\r\n\t\t\tthis.$next.removeClass('disabled');\r\n\t\t}\r\n\t\tvar startYear = Math.floor(this.year / 10) * 10;\r\n\t\tvar endYear = startYear + 19;\r\n\t\tvar rowCount = 1;\r\n\t\tvar $tbody = this.$grid.find('tbody');\r\n\t\tthis.$monthObj.html(startYear + '-' + endYear);\r\n\t\t// clear the grid\r\n\t\tthis.hideObject(this.$grid.find('thead'));\r\n\t\t$tbody.empty();\r\n\t\t$('#datepicker-err-msg-' + this.id).empty();\r\n\t\tvar gridCells = '\\t\\n';\r\n\t\t// insert the months of the year.\r\n\t\tfor (var curYear = startYear; curYear <= endYear; curYear++) {\r\n\t\t\tif (curYear == this.year) {\r\n\t\t\t\tgridCells += '\\t\\t this.options.max.getFullYear())) {\r\n\t\t\t\tgridCells += '\\t\\t\\n';\r\n\t\t\t\trowCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tgridCells += '\\t';\r\n\t\t$tbody.append(gridCells);\r\n\t\tthis.gridType = 2; // 0 = days grid, 1 = months grid, 2 = years Grid\r\n\t} // end populateYearsCalendar()\r\n\r\n\t/**\r\n\t *\tshowDaysOfPrevMonth() is a member function to show the days of the previous month\r\n\t *\r\n\t *\t@param\t(offset int) offset may be used to specify an offset for setting\r\n\t *\t\t\tfocus on a day the specified number of days from the end of the month.\r\n\t *\t@return true if the previous month is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showDaysOfPrevMonth = function(offset) {\r\n\t\t// show the previous month\r\n\t\tvar previousMonth = this.previousMonth(this.year, this.month);\r\n\t\tif (this.options.min != null &&\r\n\t\t\t(\tpreviousMonth.year < this.options.min.getFullYear() ||\r\n\t\t\t\t(previousMonth.year == this.options.min.getFullYear() && previousMonth.month < this.options.min.getMonth()))) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis.month = previousMonth.month;\r\n\t\tthis.year = previousMonth.year;\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateDaysCalendar();\r\n\r\n\t\t// if offset was specified, set focus on the last day - specified offset\r\n\t\tif (offset != null) {\r\n\t\t\tvar numDays = this.getDaysInMonth(this.year, this.month);\r\n\t\t\tvar day = 'cell' + (numDays - offset) + '-' + this.id;\r\n\t\t\tthis.$grid.attr('aria-activedescendant', day);\r\n\t\t\tthis.selectGridCell(day);\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end showDaysOfPrevMonth()\r\n\r\n\t/**\r\n\t *\tshowDaysOfMonth() is a member function to show the days of the specified month\r\n\t *\r\n\t *\t@param\t(month int) the month to show.\r\n\t *\t@return true if the month is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showDaysOfMonth = function(month) {\r\n\t\tif (this.options.min != null &&\r\n\t\t\t(\tthis.year < this.options.min.getFullYear() ||\r\n\t\t\t\t(this.year == this.options.min.getFullYear() && month < this.options.min.getMonth()))) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (this.options.max != null &&\r\n\t\t\t(\tthis.year > this.options.max.getFullYear() ||\r\n\t\t\t\t(this.year == this.options.max.getFullYear() && month > this.options.max.getMonth()))) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis.month = month;\r\n\t\tthis.date = Math.min(this.date, this.getDaysInMonth(this.year, this.month));\r\n\t\tthis.populateDaysCalendar();\r\n\t\t// update the table's activedescendant to point to the active day\r\n\t\tvar $active = this.$grid.find(\"tbody td[data-value='\" + this.date + \"']\");\r\n\t\tthis.selectGridCell($active.attr('id'));\r\n\t\treturn true;\r\n\t} // end showDaysOfMonth()\r\n\r\n\r\n\t/**\r\n\t *\tshowMonthsOfPrevYear() is a member function to show the months of the previous year\r\n\t *\r\n\t *\t@param\t(offset int) offset may be used to specify an offset for setting\r\n\t *\t\t\tfocus on a month the specified number of months from the end of the year.\r\n\t *\t@return true if the previous year is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showMonthsOfPrevYear = function(offset) {\r\n\t\tif (this.options.min != null && this.year - 1 < this.options.min.getFullYear()) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// show the previous year\r\n\t\tthis.year--;\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateMonthsCalendar();\r\n\r\n\t\t// if offset was specified, set focus on the last month - specified offset\r\n\t\tif (offset != null) {\r\n\t\t\tvar month = 'cell' + (12 - offset) + '-' + this.id;\r\n\t\t\tthis.$grid.attr('aria-activedescendant', month);\r\n\t\t\tthis.selectGridCell(month);\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end showMonthsOfPrevYear()\r\n\r\n\t/**\r\n\t *\tshowMonthsOfYear() is a member function to show the months of the specified year\r\n\t *\r\n\t *\t@param\t(year int) the year to show.\r\n\t *\t@return true if the year is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showMonthsOfYear = function(year) {\r\n\t\tif (this.options.min != null && year < this.options.min.getFullYear()) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (this.options.max != null && year > this.options.max.getFullYear()) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis.year = year;\r\n\t\tthis.populateMonthsCalendar();\r\n\t\t// update the table's activedescendant to point to the active month\r\n\t\tvar $active = this.$grid.find(\"tbody td[data-value='\" + this.month + \"']\");\r\n\t\tthis.$grid.attr('aria-activedescendant', $active.attr('id'));\r\n\t\tthis.selectGridCell($active.attr('id'));\r\n\t\treturn true;\r\n\t} // end showMonthsOfYear()\r\n\r\n\r\n\t/**\r\n\t *\tshowYearsOfPrevRange() is a member function to show the years of the previous range of twenty years\r\n\t *\r\n\t *\t@param\t(offset int) offset may be used to specify an offset for setting\r\n\t *\t\t\tfocus on a year the specified number of years from the end of the range.\r\n\t *\t@return true if the year - 20 is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showYearsOfPrevRange = function(offset) {\r\n\t\tif (this.options.min != null && this.year - 20 < this.options.min.getFullYear()) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// show the previous range\r\n\t\tthis.year -= 20;\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateYearsCalendar();\r\n\r\n\t\t// if offset was specified, set focus on the last month - specified offset\r\n\t\tif (offset != null) {\r\n\t\t\tvar year = 'cell' + (20 - offset) + '-' + this.id;\r\n\t\t\tthis.$grid.attr('aria-activedescendant', year);\r\n\t\t\tthis.selectGridCell(year);\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end showYearsOfPrevRange()\r\n\r\n\t/**\r\n\t * showDaysOfNextMonth() is a member function to show the next month\r\n\t *\r\n\t *\t@param\t(offset int) offset may be used to specify an offset for setting\r\n\t *\t\t\tfocus on a day the specified number of days from\r\n\t *\t\t\tthe beginning of the month.\r\n\t *\t@return true if the nextmMonth is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showDaysOfNextMonth = function(offset) {\r\n\t\t// show the next month\r\n\t\tvar nextMonth = this.nextMonth(this.year, this.month);\r\n\t\tif (this.options.max != null &&\r\n\t\t\t(\tnextMonth.year > this.options.max.getFullYear() ||\r\n\t\t\t\t(nextMonth.year == this.options.max.getFullYear() && nextMonth.month > this.options.max.getMonth()))) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis.month = nextMonth.month;\r\n\t\tthis.year = nextMonth.year;\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateDaysCalendar();\r\n\r\n\t\t// if offset was specified, set focus on the first day + specified offset\r\n\t\tif (offset != null) {\r\n\t\t\tvar day = 'cell' + offset + '-' + this.id;\r\n\t\t\tthis.$grid.attr('aria-activedescendant', day);\r\n\t\t\tthis.selectGridCell(day);\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end showDaysOfNextMonth()\r\n\r\n\t/**\r\n\t * showMonthsOfNextYear() is a member function to show the months of next year\r\n\t *\r\n\t *\t@param\t(offset int) offset may be used to specify an offset for setting\r\n\t *\t\t\tfocus on a month the specified number of month from\r\n\t *\t\t\tthe beginning of the year.\r\n\t *\t@return true if the next year is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showMonthsOfNextYear = function(offset) {\r\n\t\tif (this.options.max != null && this.year + 1 > this.options.max.getFullYear()) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// show the next year\r\n\t\tthis.year++;\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateMonthsCalendar();\r\n\r\n\t\t// if offset was specified, set focus on the first day + specified offset\r\n\t\tif (offset != null) {\r\n\t\t\tvar month = 'cell' + offset + '-' + this.id;\r\n\t\t\tthis.$grid.attr('aria-activedescendant', month);\r\n\t\t\tthis.selectGridCell(month);\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end showMonthsOfNextYear()\r\n\r\n\t/**\r\n\t * showYearsOfNextRange() is a member function to show the years of next range of years\r\n\t *\r\n\t *\t@param\t(offset int) offset may be used to specify an offset for setting\r\n\t *\t\t\tfocus on a year the specified number of years from\r\n\t *\t\t\tthe beginning of the range.\r\n\t *\t@return true if the year + 20 is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showYearsOfNextRange = function(offset) {\r\n\t\tif (this.options.max != null && this.year + 20 > this.options.max.getFullYear()) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// show the next year\r\n\t\tthis.year += 20;\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateYearsCalendar();\r\n\r\n\t\t// if offset was specified, set focus on the first day + specified offset\r\n\t\tif (offset != null) {\r\n\t\t\tvar year = 'cell' + offset + '-' + this.id;\r\n\t\t\tthis.$grid.attr('aria-activedescendant', year);\r\n\t\t\tthis.selectGridCell(year);\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end showYearsOfNextRange()\r\n\r\n\t/**\r\n\t *\tshowDaysOfPrevYear() is a member function to show the previous year\r\n\t *\r\n\t *\t@return true if the previous year is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showDaysOfPrevYear = function() {\r\n\t\tif (this.options.min != null &&\r\n\t\t\t(\tthis.year - 1 < this.options.min.getFullYear() ||\r\n\t\t\t\t(this.year - 1 == this.options.min.getFullYear() && this.month < this.options.min.getMonth()))) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// decrement the year\r\n\t\tthis.year--;\r\n\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateDaysCalendar();\r\n\t\treturn true;\r\n\t} // end showDaysOfPrevYear()\r\n\r\n\t/**\r\n\t *\tshowDaysOfNextYear() is a member function to show the next year\r\n\t *\r\n\t *\t@return true if the next year is between the minimum and the maximum date otherwise return false\r\n\t */\r\n\tDatepicker.prototype.showDaysOfNextYear = function() {\r\n\t\tif (this.options.max != null &&\r\n\t\t\t(\tthis.year + 1 > this.options.max.getFullYear() ||\r\n\t\t\t\t(this.year + 1 == this.options.max.getFullYear() && this.month > this.options.max.getMonth()))) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// increment the year\r\n\t\tthis.year++;\r\n\r\n\t\t// populate the calendar grid\r\n\t\tthis.populateDaysCalendar();\r\n\t\treturn true;\r\n\t} // end showDaysOfNextYear()\r\n\r\n\t/**\r\n\t *\tbindHandlers() is a member function to bind event handlers for the widget\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.bindHandlers = function() {\r\n\t\tvar self = this;\r\n\r\n\t\t// bind button handlers\r\n\t\tthis.$fastprev.click(function(e) {\r\n\t\t\treturn self.handleFastPrevClick(e);\r\n\t\t});\r\n\t\tthis.$prev.click(function(e) {\r\n\t\t\treturn self.handlePrevClick(e);\r\n\t\t});\r\n\t\tthis.$next.click(function(e) {\r\n\t\t\treturn self.handleNextClick(e);\r\n\t\t});\r\n\t\tthis.$fastnext.click(function(e) {\r\n\t\t\treturn self.handleFastNextClick(e);\r\n\t\t});\r\n\t\tthis.$monthObj.click(function(e) {\r\n\t\t\treturn self.handleMonthClick(e);\r\n\t\t});\r\n\t\tthis.$monthObj.keydown(function(e) {\r\n\t\t\treturn self.handleMonthKeyDown(e);\r\n\t\t});\r\n\t\tthis.$fastprev.keydown(function(e) {\r\n\t\t\treturn self.handleFastPrevKeyDown(e);\r\n\t\t});\r\n\t\tthis.$prev.keydown(function(e) {\r\n\t\t\treturn self.handlePrevKeyDown(e);\r\n\t\t});\r\n\t\tthis.$next.keydown(function(e) {\r\n\t\t\treturn self.handleNextKeyDown(e);\r\n\t\t});\r\n\t\tthis.$fastnext.keydown(function(e) {\r\n\t\t\treturn self.handleFastNextKeyDown(e);\r\n\t\t});\r\n\t\tif (this.options.modal == true) {\r\n\t\t\tthis.$close.click(function(e) {\r\n\t\t\t\treturn self.handleCloseClick(e);\r\n\t\t\t});\r\n\t\t\tthis.$close.keydown(function(e) {\r\n\t\t\t\treturn self.handleCloseKeyDown(e);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// bind grid handlers\r\n\t\tthis.$grid.keydown(function(e) {\r\n\t\t\treturn self.handleGridKeyDown(e);\r\n\t\t});\r\n\t\tthis.$grid.keypress(function(e) {\r\n\t\t\treturn self.handleGridKeyPress(e);\r\n\t\t});\r\n\t\tthis.$grid.focus(function(e) {\r\n\t\t\treturn self.handleGridFocus(e);\r\n\t\t});\r\n\t\tthis.$grid.blur(function(e) {\r\n\t\t\treturn self.handleGridBlur(e);\r\n\t\t});\r\n\t\tthis.$grid.delegate('td', 'click', function(e) {\r\n\t\t\treturn self.handleGridClick(this, e);\r\n\t\t});\r\n\r\n\t\t// bind target handlers\r\n\t\tthis.$target.change(function(e) {\r\n\t\t\tvar date = self.parseDate($(this).val());\r\n\t\t\tself.updateLinked(date);\r\n\t\t});\r\n\t} // end bindHandlers();\r\n\r\n\t/**\r\n\t *\thandleFastPrevClick() is a member function to process click events for the fast prev month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleFastPrevClick = function(e) {\r\n\t\tif (this.showDaysOfPrevYear()) {\r\n\t\t\tvar active = this.$grid.attr('aria-activedescendant');\r\n\t\t\tif (this.month != this.curMonth || this.year != this.curYear) {\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t} else {\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', active);\r\n\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t}\r\n\t\t}\r\n\t\te.stopPropagation();\r\n\t\treturn false;\r\n\t} // end handleFastPrevClick()\r\n\r\n\t/**\r\n\t *\thandlePrevClick() is a member function to process click events for the prev month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handlePrevClick = function(e) {\r\n\t\tvar active = this.$grid.attr('aria-activedescendant');\r\n\t\tswitch (this.gridType) {\r\n\t\t\tcase 0: // days grid\r\n\t\t\t\tvar ok;\r\n\t\t\t\tif (e.ctrlKey) {\r\n\t\t\t\t\tok = this.showDaysOfPrevYear();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tok = this.showDaysOfPrevMonth();\r\n\t\t\t\t}\r\n\t\t\t\tif (ok) {\r\n\t\t\t\t\tif (this.month != this.curMonth || this.year != this.curYear) {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', active);\r\n\t\t\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1: // months grid\r\n\t\t\t\tif (this.showMonthsOfPrevYear()) {\r\n\t\t\t\t\tif (this.year != this.curYear) {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', active);\r\n\t\t\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2: // years grid\r\n\t\t\t\tif (this.showYearsOfPrevRange()) {\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\te.stopPropagation();\r\n\t\treturn false;\r\n\t} // end handlePrevClick()\r\n\r\n\t/**\r\n\t *\thandleMonthClick() is a member function to process click events for the month header\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleMonthClick = function(e) {\r\n\t\tthis.changeGrid(e);\r\n\t\te.stopPropagation();\r\n\t\treturn false;\r\n\t} // end handleMonthClick()\r\n\r\n\t/**\r\n\t *\thandleNextClick() is a member function to process click events for the next month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleNextClick = function(e) {\r\n\t\tvar active = this.$grid.attr('aria-activedescendant');\r\n\t\tswitch (this.gridType) {\r\n\t\t\tcase 0: // days grid\r\n\t\t\t\tvar ok;\r\n\t\t\t\tif (e.ctrlKey) {\r\n\t\t\t\t\tok = this.showDaysOfNextYear();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tok = this.showDaysOfNextMonth();\r\n\t\t\t\t}\r\n\t\t\t\tif (ok) {\r\n\t\t\t\t\tif (this.month != this.curMonth || this.year != this.curYear) {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', active);\r\n\t\t\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1: // months grid\r\n\t\t\t\tif (this.showMonthsOfNextYear()) {\r\n\t\t\t\t\tif (this.year != this.curYear) {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', active);\r\n\t\t\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2: // years grid\r\n\t\t\t\tif (this.showYearsOfNextRange()) {\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\te.stopPropagation();\r\n\t\treturn false;\r\n\r\n\t} // end handleNextClick()\r\n\r\n\t/**\r\n\t *\thandleFastNextClick() is a member function to process click events for the fast next month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleFastNextClick = function(e) {\r\n\t\tif (this.showDaysOfNextYear()) {\r\n\t\t\tvar active = this.$grid.attr('aria-activedescendant');\r\n\t\t\tif (this.month != this.curMonth || this.year != this.curYear) {\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', 'cell1' + '-' + this.id);\r\n\t\t\t\tthis.selectGridCell('cell1' + '-' + this.id);\r\n\t\t\t} else {\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', active);\r\n\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t}\r\n\t\t}\r\n\t\te.stopPropagation();\r\n\t\treturn false;\r\n\r\n\t} // end handleFastNextClick()\r\n\r\n\t/**\r\n\t *\thandleCloseClick() is a member function to process click events for the close button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleCloseClick = function(e) {\r\n\t\t// dismiss the dialog box\r\n\t\tthis.hide();\r\n\t\te.stopPropagation();\r\n\t\treturn false;\r\n\t} // end handleCloseClick()\r\n\r\n\t/**\r\n\t *\thandleFastPrevKeyDown() is a member function to process keydown events for the fast prev month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleFastPrevKeyDown = function(e) {\r\n\t\tif (e.altKey) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this.options.modal == false || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\tthis.$close.focus();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$prev.focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.space:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.shiftKey || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.showDaysOfPrevYear();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.esc:\r\n\t\t\t\t{\r\n\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleFastPrevKeyDown()\r\n\r\n\t/**\r\n\t *\thandlePrevKeyDown() is a member function to process keydown events for the prev month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handlePrevKeyDown = function(e) {\r\n\t\tif (e.altKey) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this.options.modal == false || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\tif (this.gridType == 0) {\r\n\t\t\t\t\t\t\tthis.$fastprev.focus();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.$close.focus();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$monthObj.focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.space:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\tif (e.ctrlKey) {\r\n\t\t\t\t\t\t\t\tthis.showDaysOfPrevYear();\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tthis.showDaysOfPrevMonth();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\tthis.showMonthsOfPrevYear();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\tthis.showYearsOfPrevRange();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.esc:\r\n\t\t\t\t{\r\n\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handlePrevKeyDown()\r\n\r\n\t/**\r\n\t *\thandleMonthKeyDown() is a member function to process keydown events for the month title\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleMonthKeyDown = function(e) {\r\n\t\tif (e.altKey) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this.options.modal == false || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\tthis.$prev.focus();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$next.focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.space:\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.changeGrid(e);\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.esc:\r\n\t\t\t\t{\r\n\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleMonthKeyDown()\r\n\r\n\t/**\r\n\t *\thandleNextKeyDown() is a member function to process keydown events for the next month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleNextKeyDown = function(e) {\r\n\t\tif (e.altKey) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this.options.modal == false || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\tthis.$monthObj.focus();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (this.gridType == 0) {\r\n\t\t\t\t\t\t\tthis.$fastnext.focus();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.$grid.focus();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.space:\r\n\t\t\t\t{\r\n\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\tif (e.ctrlKey) {\r\n\t\t\t\t\t\t\t\tthis.showDaysOfNextYear();\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tthis.showDaysOfNextMonth();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\tthis.showMonthsOfNextYear();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\tthis.showYearsOfNextRange();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.esc:\r\n\t\t\t\t{\r\n\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleNextKeyDown()\r\n\r\n\t/**\r\n\t *\thandleFastNextKeyDown() is a member function to process keydown events for the fast next month button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleFastNextKeyDown = function(e) {\r\n\t\tif (e.altKey) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this.options.modal == false || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\tthis.$next.focus();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.$grid.focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.space:\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.showDaysOfNextYear();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.esc:\r\n\t\t\t\t{\r\n\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleFastNextKeyDown()\r\n\r\n\t/**\r\n\t *\thandleCloseKeyDown() is a member function to process keydown events for the close button\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleCloseKeyDown = function(e) {\r\n\t\tif (e.altKey) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\tthis.$grid.focus();\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (this.gridType == 0) {\r\n\t\t\t\t\t\t\tthis.$fastprev.focus();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.$prev.focus();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.esc:\r\n\t\t\tcase this.keys.space:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.shiftKey || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handlePrevKeyDown()\r\n\r\n\t/**\r\n\t *\thandleGridKeyDown() is a member function to process keydown events for the Datepicker grid\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleGridKeyDown = function(e) {\r\n\t\tvar $curCell = $('#' + this.$grid.attr('aria-activedescendant'));\r\n\t\tvar $cells = this.$grid.find('td.selectable');\r\n\t\tvar colCount = this.$grid.find('tbody tr').eq(0).find('td').length;\r\n\t\tif (e.altKey && e.keyCode != this.keys.pageup && e.keyCode != this.keys.pagedown) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this.options.modal == true) {\r\n\t\t\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t\t\tif (this.gridType == 0) {\r\n\t\t\t\t\t\t\t\tthis.$fastnext.focus();\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tthis.$next.focus();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.$close.focus();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\te.stopPropagation()\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\t\tthis.hide();\r\n\t\t\t\t\t\tthis.handleTabOut(e);\r\n\t\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.space:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\t// update the target box\r\n\t\t\t\t\t\t\tthis.update();\r\n\t\t\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\t\t\tthis.hide();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\tthis.showDaysOfMonth(parseInt($curCell.attr('data-value'), 10));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\tthis.showMonthsOfYear(parseInt($curCell.attr('data-value'), 10));\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.esc:\r\n\t\t\t\t{\r\n\t\t\t\t\t// dismiss the dialog box\r\n\t\t\t\t\tthis.hide();\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.left:\r\n\t\t\tcase this.keys.right:\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((e.keyCode == this.keys.left && this.locales.directionality === 'LTR') || (e.keyCode == this.keys.right && this.locales.directionality === 'RTL')) {\r\n\t\t\t\t\t\tif (e.ctrlKey || e.shiftKey) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar cellIndex = $cells.index($curCell) - 1;\r\n\t\t\t\t\t\tvar $prevCell = null;\r\n\t\t\t\t\t\tif (cellIndex >= 0) {\r\n\t\t\t\t\t\t\t$prevCell = $cells.eq(cellIndex);\r\n\t\t\t\t\t\t\tthis.unSelectGridCell($curCell.attr('id'));\r\n\t\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $prevCell.attr('id'));\r\n\t\t\t\t\t\t\tthis.selectGridCell($prevCell.attr('id'));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\t\t\tthis.showDaysOfPrevMonth(0);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\t\t\tthis.showMonthsOfPrevYear(0);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\t\t\tthis.showYearsOfPrevRange(0);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (e.ctrlKey || e.shiftKey) {\r\n\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar cellIndex = $cells.index($curCell) + 1;\r\n\t\t\t\t\t\tvar $nextCell = null;\r\n\t\t\t\t\t\tif (cellIndex < $cells.length) {\r\n\t\t\t\t\t\t\t$nextCell = $cells.eq(cellIndex);\r\n\t\t\t\t\t\t\tthis.unSelectGridCell($curCell.attr('id'));\r\n\t\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $nextCell.attr('id'));\r\n\t\t\t\t\t\t\tthis.selectGridCell($nextCell.attr('id'));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\t\t\t// move to the next month\r\n\t\t\t\t\t\t\t\t\tthis.showDaysOfNextMonth(1);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\t\t\tthis.showMonthsOfNextYear(1);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\t\t\tthis.showYearsOfNextRange(1);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.up:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.ctrlKey || e.shiftKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar cellIndex = $cells.index($curCell) - colCount;\r\n\t\t\t\t\tvar $prevCell = null;\r\n\t\t\t\t\tif (cellIndex >= 0) {\r\n\t\t\t\t\t\t$prevCell = $cells.eq(cellIndex);\r\n\t\t\t\t\t\tthis.unSelectGridCell($curCell.attr('id'));\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $prevCell.attr('id'));\r\n\t\t\t\t\t\tthis.selectGridCell($prevCell.attr('id'));\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// move to appropriate day in previous month\r\n\t\t\t\t\t\tcellIndex = colCount - 1 - $cells.index($curCell);\r\n\t\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\t\tthis.showDaysOfPrevMonth(cellIndex);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\t\tthis.showMonthsOfPrevYear(cellIndex);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\t\tthis.showYearsOfPrevRange(cellIndex);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.down:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.ctrlKey || e.shiftKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar cellIndex = $cells.index($curCell) + colCount;\r\n\t\t\t\t\tvar $nextCell = null;\r\n\t\t\t\t\tif (cellIndex < $cells.length) {\r\n\t\t\t\t\t\t$nextCell = $cells.eq(cellIndex);\r\n\t\t\t\t\t\tthis.unSelectGridCell($curCell.attr('id'));\r\n\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $nextCell.attr('id'));\r\n\t\t\t\t\t\tthis.selectGridCell($nextCell.attr('id'));\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// move to appropriate day in next month\r\n\t\t\t\t\t\tcellIndex = colCount + 1 - ($cells.length - $cells.index($curCell));\r\n\t\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\t\tthis.showDaysOfNextMonth(cellIndex);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\t\tthis.showMonthsOfNextYear(cellIndex);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\t\tthis.showYearsOfNextRange(cellIndex);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.pageup:\r\n\t\t\t\t{\r\n\t\t\t\t\tvar active = this.$grid.attr('aria-activedescendant');\r\n\t\t\t\t\tif (e.shiftKey || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\tvar ok = false;\r\n\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\tif (e.altKey) {\r\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\tok = this.showDaysOfPrevYear();\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tok = this.showDaysOfPrevMonth();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\tok = this.showMonthsOfPrevYear();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\tok = this.showYearsOfPrevRange();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (ok) {\r\n\t\t\t\t\t\tif ($('#' + active).attr('id') == undefined) {\r\n\t\t\t\t\t\t\t$cells = this.$grid.find('td.selectable');\r\n\t\t\t\t\t\t\tvar $lastCell = $cells.eq($cells.length - 1);\r\n\t\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $lastCell.attr('id'));\r\n\t\t\t\t\t\t\tthis.selectGridCell($lastCell.attr('id'));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.pagedown:\r\n\t\t\t\t{\r\n\t\t\t\t\tvar active = this.$grid.attr('aria-activedescendant');\r\n\t\t\t\t\tif (e.shiftKey || e.ctrlKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\tvar ok = false;\r\n\t\t\t\t\tswitch (this.gridType) {\r\n\t\t\t\t\t\tcase 0: // days grid\r\n\t\t\t\t\t\t\tif (e.altKey) {\r\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\tok = this.showDaysOfNextYear();\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tok = this.showDaysOfNextMonth();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 1: // months grid\r\n\t\t\t\t\t\t\tok = this.showMonthsOfNextYear();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 2: // years grid\r\n\t\t\t\t\t\t\tok = this.showYearsOfNextRange();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (ok) {\r\n\t\t\t\t\t\tif ($('#' + active).attr('id') == undefined) {\r\n\t\t\t\t\t\t\t$cells = this.$grid.find('td.selectable');\r\n\t\t\t\t\t\t\tvar $lastCell = $cells.eq($cells.length - 1);\r\n\t\t\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $lastCell.attr('id'));\r\n\t\t\t\t\t\t\tthis.selectGridCell($lastCell.attr('id'));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.selectGridCell(active);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.home:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.ctrlKey || e.shiftKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar $firstCell = $cells.eq(0);\r\n\t\t\t\t\tthis.unSelectGridCell($curCell.attr('id'));\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $firstCell.attr('id'));\r\n\t\t\t\t\tthis.selectGridCell($firstCell.attr('id'));\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\tcase this.keys.end:\r\n\t\t\t\t{\r\n\t\t\t\t\tif (e.ctrlKey || e.shiftKey) {\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar $lastCell = $cells.eq($cells.length - 1);\r\n\t\t\t\t\tthis.unSelectGridCell($curCell.attr('id'));\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $lastCell.attr('id'));\r\n\t\t\t\t\tthis.selectGridCell($lastCell.attr('id'));\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleGridKeyDown()\r\n\r\n\t/**\r\n\t *\thandleGridKeyPress() is a member function to consume keypress events for browsers that\r\n\t *\tuse keypress to scroll the screen and manipulate tabs\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t * \t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleGridKeyPress = function(e) {\r\n\t\tif (e.altKey) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tswitch (e.keyCode) {\r\n\t\t\tcase this.keys.tab:\r\n\t\t\tcase this.keys.enter:\r\n\t\t\tcase this.keys.space:\r\n\t\t\tcase this.keys.esc:\r\n\t\t\tcase this.keys.left:\r\n\t\t\tcase this.keys.right:\r\n\t\t\tcase this.keys.up:\r\n\t\t\tcase this.keys.down:\r\n\t\t\tcase this.keys.pageup:\r\n\t\t\tcase this.keys.pagedown:\r\n\t\t\tcase this.keys.home:\r\n\t\t\tcase this.keys.end:\r\n\t\t\t\t{\r\n\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleGridKeyPress()\r\n\r\n\t/**\r\n\t *\thandleGridClick() is a member function to process mouse click events for the Datepicker grid\r\n\t *\r\n\t *\t@param (id string) id is the id of the object triggering the event\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\tDatepicker.prototype.handleGridClick = function(id, e) {\r\n\t\tvar $cell = $(id);\r\n\t\tif ($cell.is('.empty') || $cell.is('.unselectable')) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tthis.$grid.find('.focus').removeClass('focus').attr('aria-selected', 'false').attr('tabindex', -1);\r\n\t\tswitch (this.gridType) {\r\n\t\t\tcase 0: // days grid\r\n\t\t\t\tthis.$grid.attr('aria-activedescendant', $cell.attr('id'));\r\n\t\t\t\tthis.selectGridCell($cell.attr('id'));\r\n\t\t\t\t// update the target box\r\n\t\t\t\tthis.update();\r\n\t\t\t\t// dismiss the dialog box\r\n\t\t\t\tthis.hide();\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1: // months grid\r\n\t\t\t\tthis.showDaysOfMonth(parseInt($cell.attr('data-value'), 10));\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2: // years grid\r\n\t\t\t\tthis.showMonthsOfYear(parseInt($cell.attr('data-value'), 10));\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\te.stopPropagation();\r\n\t\treturn false;\r\n\t} // end handleGridClick()\r\n\r\n\t/**\r\n\t *\thandleGridFocus() is a member function to process focus events for the Datepicker grid\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) true\r\n\t */\r\n\tDatepicker.prototype.handleGridFocus = function(e) {\r\n\t\tvar active = this.$grid.attr('aria-activedescendant');\r\n\t\tif ($('#' + active).attr('id') == undefined) {\r\n\t\t\tvar $cells = this.$grid.find('td.selectable');\r\n\t\t\tvar $lastCell = $cells.eq($cells.length - 1);\r\n\t\t\tthis.$grid.attr('aria-activedescendant', $lastCell.attr('id'));\r\n\t\t\tthis.selectGridCell($lastCell.attr('id'));\r\n\t\t} else {\r\n\t\t\tthis.selectGridCell(active);\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleGridFocus()\r\n\r\n\t/**\r\n\t *\thandleGridBlur() is a member function to process blur events for the Datepicker grid\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) true\r\n\t */\r\n\tDatepicker.prototype.handleGridBlur = function(e) {\r\n\t\tthis.unSelectGridCell(this.$grid.attr('aria-activedescendant'));\r\n\t\treturn true;\r\n\t} // end handleGridBlur()\r\n\r\n\t/**\r\n\t *\thandleTabOut() is a member function to process tab key in Datepicker grid\r\n\t *\r\n\t * @param (e obj) e is the event object associated with the event\r\n\t * @return (boolean) true\r\n\t */\r\n\tDatepicker.prototype.handleTabOut = function(e) {\r\n\t\tvar fields = $('body').find('input:visible,textarea:visible,select:visible');\r\n\t\tvar index = fields.index( this.$target );\r\n\t\tif ( index > -1 && index < fields.length ) {\r\n\t\t\tif (e.shiftKey) {\r\n\t\t\t\tif (index > 0) {\r\n\t\t\t\t\tindex--;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (index + 1 < fields.length) {\r\n\t\t\t\t\tindex++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfields.eq( index ).focus();\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end handleTabOut()\r\n\r\n\t/**\r\n\t *\tchangeGrid() is a member function to change the calendar after click or enter into the calendar title\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\t@return true\r\n\t */\r\n\tDatepicker.prototype.changeGrid = function(e) {\r\n\t\tswitch (this.gridType) {\r\n\t\t\tcase 0: // days grid\r\n\t\t\t\tthis.populateMonthsCalendar();\r\n\t\t\t\tif (this.year != this.curYear) {\r\n\t\t\t\t\tvar $cells = this.$grid.find('td.selectable');\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $cells.eq(0).attr('id'));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', this.$grid.find('.curMonth').attr('id'));\r\n\t\t\t\t}\r\n\t\t\t\tthis.selectGridCell(this.$grid.attr('aria-activedescendant'));\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2: // years grid\r\n\t\t\t\tif (e.shiftKey) {\r\n\t\t\t\t\t// goto previous twenty years\r\n\t\t\t\t\tthis.year -= 20;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// goto next twenty years\r\n\t\t\t\t\tthis.year += 20;\r\n\t\t\t\t}\r\n\t\t\tcase 1: // months grid\r\n\t\t\t\tthis.populateYearsCalendar();\r\n\t\t\t\tif (this.year != this.curYear) {\r\n\t\t\t\t\tvar $cells = this.$grid.find('td.selectable');\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', $cells.eq(0).attr('id'));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.$grid.attr('aria-activedescendant', this.$grid.find('.curYear').attr('id'));\r\n\t\t\t\t}\r\n\t\t\t\tthis.selectGridCell(this.$grid.attr('aria-activedescendant'));\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\treturn true;\r\n\t} // end changeGrid()\r\n\r\n\t/**\r\n\t *\tselectGridCell() is a member function to put focus on the current cell of the grid.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.selectGridCell = function(cellId) {\r\n\t\t$('#' + cellId).addClass('focus').attr('aria-selected', 'true').attr('tabindex', 0).focus();\r\n\t} // end selectGridCell()\r\n\r\n\t/**\r\n\t *\tunSelectGridCell() is a member function to put focus on the current cell of the grid.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.unSelectGridCell = function(cellId) {\r\n\t\t$('#' + cellId).removeClass('focus').attr('aria-selected', 'false').attr('tabindex', -1);\r\n\t} // end unSelectGridCell()\r\n\r\n\t/**\r\n\t *\tupdate() is a member function to update the target textbox.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.update = function() {\r\n\t\tvar $curDay = $('#' + this.$grid.attr('aria-activedescendant'));\r\n\t\tvar date = new Date(this.year, this.month, parseInt($curDay.attr('data-value'), 10));\r\n\t\tvar val = this.formatDate(date, this.options.outputFormat);\r\n\t\tthis.$target.val(val);\r\n\t\tthis.$target.removeAttr('aria-invalid');\r\n\t\tthis.$target.parents('.form-group').removeClass('has-error');\r\n\t\tthis.$target.trigger('change');\r\n\t\tif (this.options.onUpdate) {\r\n\t\t\tthis.options.onUpdate(val);\r\n\t\t}\r\n\t} // end update()\r\n\r\n\t/**\r\n\t *\tupdateLinked() is a member function to update the linked textbox.\r\n\t *\r\n\t *\t@param\t(date Date) the current value of this Datepicker date.\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.updateLinked = function(date) {\r\n\t\tif (this.options.previous !== null && this.options.previous.val() !== '') {\r\n\t\t\tvar previousDate = this.options.previous.datepicker('getDate');\r\n\t\t\tif (previousDate > date) {\r\n\t\t\t\tvar previousVal = this.formatDate(date, this.options.previous.datepicker('outputFormat'));\r\n\t\t\t\tthis.options.previous.val(previousVal);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (this.options.next !== null && this.options.next.val() !== '') {\r\n\t\t\tvar nextDate = this.options.next.datepicker('getDate');\r\n\t\t\tif (nextDate < date) {\r\n\t\t\t\tvar nextVal = this.formatDate(date, this.options.next.datepicker('outputFormat'));\r\n\t\t\t\tthis.options.next.val(nextVal);\r\n\t\t\t}\r\n\t\t}\r\n\t} // end updateLinked()\r\n\r\n\t/**\r\n\t *\thideObject() is a member function to hide an element of the datepicker.\r\n\t *\r\n\t *\t@param ($element jQuery object) the element to hide\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.hideObject = function($element) {\r\n\t\t$element.attr('aria-hidden', true);\r\n\t\t$element.hide();\r\n\t} // end hideObject()\r\n\r\n\t/**\r\n\t *\tshowObject() is a member function to show an element of the datepicker.\r\n\t *\r\n\t *\t@param ($element jQuery object) the element to show\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.showObject = function($element) {\r\n\t\t$element.attr('aria-hidden', false);\r\n\t\t$element.show();\r\n\t} // end showObject()\r\n\r\n\t/**\r\n\t *\tshow() is a member function to show the Datepicker and give it focus.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.show = function() {\r\n\t\tvar self = this;\r\n\t\t$('.datepicker-calendar').trigger('ab.datepicker.opening', [self.id]);\r\n\t\tif (this.options.modal == true) {\r\n\t\t\tif (!this.modalEventHandler) {\r\n\t\t\t\tthis.modalEventHandler = function(e) {\r\n\t\t\t\t\t//ensure focus remains on the dialog\r\n\t\t\t\t\tself.$grid.focus();\r\n\t\t\t\t\t// Consume all mouse events and do nothing\r\n\t\t\t\t\te.stopPropagation;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Bind an event listener to the document to capture all mouse events to make dialog modal\r\n\t\t\t$(document).on('click mousedown mouseup', this.modalEventHandler);\r\n\t\t\tthis.greyOut(true);\r\n\t\t\tvar zIndex = parseInt($('#datepicker-overlay').css('z-index'), 10) || 40;\r\n\t\t\tthis.$calendar.css('z-index', zIndex + 1);\r\n\t\t} else {\r\n\t\t\t// Bind an event listener to the document to capture only the mouse click event\r\n\t\t\t$(document).on('click', $.proxy(this.handleDocumentClick, this));\r\n\t\t\tthis.$calendar.on('ab.datepicker.opening', function(e, id) {\r\n\t\t\t\tif (id != self.id) {\r\n\t\t\t\t\tself.hide();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//ensure focus remains on the dialog\r\n\t\t\t\t\tself.$grid.focus();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t}\r\n\t\tthis.$calendar.on('ab.datepicker.opened', function(e, id) {\r\n\t\t\tif (id == self.id) {\r\n\t\t\t\tself.$grid.focus();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// adjust position of the calendar\r\n\t\tvar groupOffsetTop = Math.max(0, Math.floor(this.$group.offset().top - this.$label.offset().top));\r\n\t\tvar groupOffsetLeft = Math.max(0, Math.floor(this.$group.offset().left - this.$label.offset().left));\r\n\t\tvar parentPaddingLeft = parseInt(this.$calendar.parent().css('padding-left'), 10);\r\n\t\tvar calendarHeight = this.$calendar.outerHeight();\r\n\t\tvar groupTop = this.$group.offset().top;\r\n\t\tvar groupLeft = this.$group.offset().left;\r\n\t\tvar groupHeight = this.$group.outerHeight(true);\r\n\t\tvar roomBefore = Math.floor(groupTop - $(window).scrollTop());\r\n\t\tvar roomAfter = Math.floor($(window).height() - (groupTop + groupHeight - $(window).scrollTop()));\r\n\t\tif (roomAfter < calendarHeight && roomAfter < roomBefore) {\r\n\t\t\t// show calendar above group\r\n\t\t\tthis.$calendar.addClass('above');\r\n\t\t\tthis.$calendar.css({\r\n\t\t\t\ttop: (groupOffsetTop - calendarHeight) + 'px',\r\n\t\t\t\tleft: (groupOffsetLeft + parentPaddingLeft) + 'px'\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t // show calendar below group\r\n\t\t\tthis.$calendar.addClass('below');\r\n\t\t\tthis.$calendar.css({\r\n\t\t\t\ttop: (groupHeight + groupOffsetTop) + 'px',\r\n\t\t\t\tleft: (groupOffsetLeft + parentPaddingLeft) + 'px'\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// show the dialog\r\n\t\tthis.$calendar.attr('aria-hidden', 'false');\r\n\t\tthis.$calendar.show();\r\n\t\t$('.datepicker-calendar').trigger('ab.datepicker.opened', [self.id]);\r\n\t} // end show()\r\n\r\n\t/**\r\n\t *\trefresh() is a member function to refesh the datepicker content when an option change.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.refresh = function() {\r\n\t\tthis.drawCalendarHeader();\r\n\t\tswitch\t(this.gridType) {\r\n\t\t\tcase 0:\r\n\t\t\t\tthis.populateDaysCalendar();\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\tthis.populateMonthsCalendar();\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tthis.populateYearsCalendar();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t} // end refresh()\r\n\r\n\t/**\r\n\t *\thandleDocumentClick() is a member function to handle click on document.\r\n\t *\r\n\t *\t@param (e obj) e is the event object associated with the event\r\n\t *\r\n\t *\t@return (boolean) false if consuming event, true if propagating\r\n\t */\r\n\t Datepicker.prototype.handleDocumentClick = function(e) {\r\n\t\tif ($(e.target).parents('#datepicker-calendar-' + this.id).length == 0) {\r\n\t\t\tthis.hide();\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\t//ensure focus remains on the dialog\r\n\t\t\tthis.$grid.focus();\r\n\t\t\t// Consume all mouse events and do nothing\r\n\t\t\te.stopPropagation;\r\n\t\t\treturn false;\r\n\t\t}\r\n\t} // end handleDocumentClick()\r\n\r\n\t/**\r\n\t *\thide() is a member function to hide the Datepicker and remove focus.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\t Datepicker.prototype.hide = function(omitSettingFocus) {\r\n\t\tif (this.options.inline == false) {\r\n\t\t\tvar self = this;\r\n\t\t\t// unbind the modal event sinks\r\n\t\t\tif (this.options.modal == true) {\r\n\t\t\t\tif (this.modalEventHandler) {\r\n\t\t\t\t\t$(document).off('click mousedown mouseup', this.modalEventHandler);\r\n\t\t\t\t}\r\n\t\t\t\tthis.greyOut(false);\r\n\t\t\t} else {\r\n\t\t\t\t$(document).off('click', self.handleDocumentClick);\r\n\t\t\t\tthis.$calendar.off('ab.datepicker.opening');\r\n\t\t\t}\r\n\t\t\t// hide the dialog\r\n\t\t\tthis.$calendar.removeClass('above below');\r\n\t\t\tthis.$calendar.attr('aria-hidden', 'true');\r\n\t\t\tthis.$calendar.hide();\r\n\t\t\t$('.datepicker-calendar').trigger('ab.datepicker.closed', [self.id]);\r\n\t\t\t// set focus on the focus target\r\n\t\t\tif (!omitSettingFocus) {\r\n\t\t\t\t//this.$target.focus();\r\n\t\t\t}\r\n\t\t}\r\n\t} // end hide()\r\n\r\n\t/**\r\n\t *\tgreyOut() is a member function to grey out the document background.\r\n\t *\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.greyOut = function(on) {\r\n\t\tvar $overlay = $('#datepicker-overlay');\r\n\t\tif ($overlay.length == 0 && on) {\r\n\t\t\t$('body').append('
');\r\n\t\t\t$overlay = $('#datepicker-overlay');\r\n\t\t}\r\n\t\tif (on) {\r\n\t\t\t$overlay.fadeIn(500);\r\n\t\t} else {\r\n\t\t\t$overlay.fadeOut(500);\r\n\t\t}\r\n\t} // end greyOut()\r\n\r\n\t/**\r\n\t *\tabsolutePosition() is a member function that compute the absolute position\r\n\t *\tof some element within document.\r\n\t *\r\n\t *\t@param (element obj) the element of the document\r\n\t *\t@return an object containing the properties top and left.\r\n\t */\r\n\tDatepicker.prototype.absolutePosition = function (element) {\r\n\t\tvar top = 0, left = 0;\r\n\t\tif (element.getBoundingClientRect) {\r\n\t\t\tvar box = element.getBoundingClientRect();\r\n\t\t\tvar body = document.body;\r\n\t\t\tvar docElem = document.documentElement;\r\n\t\t\tvar scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;\r\n\t\t\tvar scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;\r\n\t\t\tvar clientTop = docElem.clientTop || body.clientTop || 0;\r\n\t\t\tvar clientLeft = docElem.clientLeft || body.clientLeft || 0;\r\n\t\t\ttop = Math.round(box.top + scrollTop - clientTop);\r\n\t\t\tleft = Math.round(box.left + scrollLeft - clientLeft);\r\n\t\t} else {\r\n\t\t\twhile(element) {\r\n\t\t\t\ttop = top + parseInt(element.offsetTop, 10);\r\n\t\t\t\tleft = left + parseInt(element.offsetLeft, 10);\r\n\t\t\t\telement = element.offsetParent;\t\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn {top: top, left: left};\r\n\t} // end absolutePosition()\r\n\r\n\t/**\r\n\t *\tgetDaysInMonth() is a member function to calculate the number of days in a given month\r\n\t *\r\n\t *\t@param (year int) the year\r\n\t *\t@param (month int) the given month\r\n\t *\r\n\t *\t@return (integer) number of days\r\n\t */\r\n\tDatepicker.prototype.getDaysInMonth = function(year, month) {\r\n\t\treturn 32 - new Date(year, month, 32).getDate();\r\n\t} // end getDaysInMonth()\r\n\r\n\t/**\r\n\t *\tpreviousMonth() is a member function that compute the month\r\n\t *\tpreceding a given month.\r\n\t *\r\n\t *\t@param (year int) the given year\r\n\t *\t@param (month int) the given month\r\n\t *\t@return an object containing the properties year and month.\r\n\t */\r\n\tDatepicker.prototype.previousMonth = function (year, month) {\r\n\t\tif (month == 0) {\r\n\t\t\tmonth = 11;\r\n\t\t\tyear--;\r\n\t\t} else {\r\n\t\t\tmonth--;\r\n\t\t}\r\n\t\treturn {year: year, month: month};\r\n\t} // end previousMonth()\r\n\r\n\t/**\r\n\t *\tnextMonth() is a member function that compute the month\r\n\t *\tfollowing a given month.\r\n\t *\r\n\t *\t@param (year int) the given year\r\n\t *\t@param (month int) the given month\r\n\t *\t@return an object containing the properties year and month.\r\n\t */\r\n\tDatepicker.prototype.nextMonth = function (year, month) {\r\n\t\tif (month == 11) {\r\n\t\t\tmonth = 0;\r\n\t\t\tyear++;\r\n\t\t} else {\r\n\t\t\tmonth++;\r\n\t\t}\r\n\t\treturn {year: year, month: month};\r\n\t} // end nextMonth()\r\n\r\n\t/**\r\n\t *\tformatDate (date_object, format)\r\n\t *\tThe format string uses the same abbreviations as in createDateFromFormat()\r\n\t *\r\n\t *\t@param (date date object) the given date\r\n\t *\t@param (format string) the given output format\r\n\t *\t@returns a date in the output format specified.\r\n\t */\r\n\tDatepicker.prototype.formatDate = function (date, format) {\r\n\t\tvar zeroPad = function (x) {\r\n\t\t\treturn(x < 0 || x > 9 ? \"\" : \"0\" ) + x;\r\n\t\t};\r\n\t\tvar getWeekOfMonth = function(date) {\r\n\t\t\treturn Math.ceil((date.getDate() - 1 - date.getDay()) / 7);\r\n\t\t};\r\n\t\tvar getWeekOfYear = function(date) {\r\n\t\t\tvar onejan = new Date(date.getFullYear(),0,1);\r\n\t\t\treturn Math.ceil((((date - onejan) / 86400000) + onejan.getDay()+1)/7);\r\n\t\t};\r\n\t\tvar getDayOfYear = function(date) {\r\n\t\t\tvar start = new Date(date.getFullYear(), 0, 0);\r\n\t\t\treturn Math.floor((date - start) / 86400000);\r\n\t\t};\r\n\t\tvar getMillisecondsInDay = function(date) {\r\n\t\t\tvar date1 = new Date(date.getTime());\r\n\t\t\tdate1.setHours( 0 );\r\n\t\t\treturn date - date1;\r\n\t\t};\r\n\t\tvar y = date.getFullYear() + \"\";\r\n\t\tvar M = date.getMonth() + 1;\r\n\t\tvar d = date.getDate();\r\n\t\tvar D = getDayOfYear(date);\r\n\t\tvar E = date.getDay();\r\n\t\tvar H = date.getHours();\r\n\t\tvar m = date.getMinutes();\r\n\t\tvar s = date.getSeconds();\r\n\t\tvar w = getWeekOfYear(date);\r\n\t\tvar W = getWeekOfMonth(date);\r\n\t\tvar F = Math.floor( date.getDate() / 7 ) + 1;\r\n\t\tvar Q = Math.ceil( ( date.getMonth() + 1 ) / 3 );\r\n\t\tvar era = date.getFullYear() < 1 ? 0 : 1;\r\n\t\tvar values = {\r\n\t\t\t\"y\": \"\" + y,\r\n\t\t\t\"yyyy\": y,\r\n\t\t\t\"yy\": y.substring(2,4),\r\n\t\t\t\"L\": M,\r\n\t\t\t\"LL\": zeroPad(M),\r\n\t\t\t\"LLL\": this.locales.month_names_abbreviated[M - 1],\r\n\t\t\t\"LLLL\": this.locales.month_names[M - 1],\r\n\t\t\t\"LLLLL\": this.locales.month_names_narrow[M - 1],\r\n\t\t\t\"M\": M,\r\n\t\t\t\"MM\": zeroPad(M),\r\n\t\t\t\"MMM\": this.locales.month_names_abbreviated[M - 1],\r\n\t\t\t\"MMMM\": this.locales.month_names[M - 1],\r\n\t\t\t\"MMMMM\": this.locales.month_names_narrow[M - 1],\r\n\t\t\t\"d\": d,\r\n\t\t\t\"dd\": zeroPad(d),\r\n\t\t\t\"D\": D,\r\n\t\t\t\"DD\": D,\r\n\t\t\t\"DDD\": D,\r\n\t\t\t\"A\": Math.round( getMillisecondsInDay(date) * Math.pow( 10, -2 ) ),\r\n\t\t\t\"AA\": Math.round( getMillisecondsInDay(date) * Math.pow( 10, -1 ) ),\r\n\t\t\t\"AAA\": Math.round( getMillisecondsInDay(date) * Math.pow( 10, 0 ) ),\r\n\t\t\t\"AAAA\": Math.round( getMillisecondsInDay(date) * Math.pow( 10, 1 ) ),\r\n\t\t\t\"AAAAA\": Math.round( getMillisecondsInDay(date) * Math.pow( 10, 2 ) ),\r\n\t\t\t\"AAAAAA\": Math.round( getMillisecondsInDay(date) * Math.pow( 10, 3 ) ),\r\n\t\t\t\"E\": this.locales.day_names_abbreviated[E],\r\n\t\t\t\"EE\": this.locales.day_names_abbreviated[E],\r\n\t\t\t\"EEE\": this.locales.day_names_abbreviated[E],\r\n\t\t\t\"EEEE\": this.locales.day_names[E],\r\n\t\t\t\"EEEEE\": this.locales.day_names_narrow[E],\r\n\t\t\t\"EEEEEE\": this.locales.day_names_short[E],\r\n\t\t\t\"e\": E,\r\n\t\t\t\"ee\": E,\r\n\t\t\t\"eee\": this.locales.day_names_abbreviated[E],\r\n\t\t\t\"eeee\": this.locales.day_names[E],\r\n\t\t\t\"eeeee\": this.locales.day_names_narrow[E],\r\n\t\t\t\"eeeeee\": this.locales.day_names_short[E],\r\n\t\t\t\"c\": E,\r\n\t\t\t\"cc\": E,\r\n\t\t\t\"ccc\": this.locales.day_names_abbreviated[E],\r\n\t\t\t\"cccc\": this.locales.day_names[E],\r\n\t\t\t\"ccccc\": this.locales.day_names_narrow[E],\r\n\t\t\t\"cccccc\": this.locales.day_names_short[E],\r\n\t\t\t\"F\": F,\r\n\t\t\t\"G\": this.locales.era_names_abbreviated[era],\r\n\t\t\t\"GG\": this.locales.era_names_abbreviated[era],\r\n\t\t\t\"GGG\": this.locales.era_names_abbreviated[era],\r\n\t\t\t\"GGGG\": this.locales.era_names[era],\r\n\t\t\t\"GGGGG\": this.locales.era_names_narrow[era],\r\n\t\t\t\"Q\": Q,\r\n\t\t\t\"QQ\": zeroPad(Q),\r\n\t\t\t\"QQQ\": this.locales.quarter_names_abbreviated[Q - 1],\r\n\t\t\t\"QQQQ\": this.locales.quarter_names[Q - 1],\r\n\t\t\t\"QQQQQ\": this.locales.quarter_names_narrow[Q - 1],\r\n\t\t\t\"q\": Q,\r\n\t\t\t\"qq\": zeroPad(Q),\r\n\t\t\t\"qqq\": this.locales.quarter_names_abbreviated[Q - 1],\r\n\t\t\t\"qqqq\": this.locales.quarter_names[Q - 1],\r\n\t\t\t\"qqqqq\": this.locales.quarter_names_narrow[Q - 1],\r\n\t\t\t\"H\": H,\r\n\t\t\t\"HH\": zeroPad(H),\r\n\t\t\t\"h\": H == 0 ? 12 : H > 12 ? H - 12 : H,\r\n\t\t\t\"hh\": zeroPad(H == 0 ? 12 : H > 12 ? H - 12 : H),\r\n\t\t\t\"K\": H > 11 ? H - 12 : H,\r\n\t\t\t\"k\": H + 1,\r\n\t\t\t\"KK\": zeroPad(H > 11 ? H - 12 : H),\r\n\t\t\t\"kk\": zeroPad(H + 1),\r\n\t\t\t\"a\": H > 11 ? this.locales.day_periods.pm : this.locales.day_periods.am,\r\n\t\t\t\"m\": m,\r\n\t\t\t\"mm\": zeroPad(m),\r\n\t\t\t\"s\": s,\r\n\t\t\t\"ss\": zeroPad(s),\r\n\t\t\t\"w\": w,\r\n\t\t\t\"ww\": zeroPad(w),\r\n\t\t\t\"W\": W,\r\n\t\t};\r\n\t\treturn format.replace(\r\n\t\t\t/('[^']+'|y{1,4}|L{1,5}|M{1,5}|c{1,6}|d{1,2}|D{1,3}|E{1,6}|e{1,6}|F{1,1}|G{1,5}|Q{1,5}|q{1,5}|H{1,2}|h{1,2}|K{1,2}|k{1,2}|m{1,2}|s{1,2}|w{1,2}|W{1,1}|A{1,6})/g,\r\n\t\t\tfunction (mask) {\r\n\t\t\t\treturn mask.charAt(0) === \"'\" ? mask.substr(1, mask.length - 2) : values[mask] || mask;\r\n\t\t\t}\r\n\t\t);\r\n\t} // end formatDate()\r\n\r\n\t/**\r\n\t *\tcreateDateFromFormat( format_string, date_string )\r\n\t *\r\n\t *\tThis function takes a date string and a format string. It matches\r\n\t *\tIf the date string matches the format string, it returns the\r\n\t *\tthe date object. If it does not match, it returns null.\r\n\t */\r\n\tDatepicker.prototype.createDateFromFormat = function(format, value) {\r\n\t\tvar extractInteger = function(str, pos, minlength, maxlength) {\r\n\t\t\tfor (var x = maxlength; x >= minlength; x--) {\r\n\t\t\t\tvar integer = str.substring(pos, pos + x);\r\n\t\t\t\tif (integer.length < minlength) {\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t\tif (/^\\d+$/.test(integer)) {\r\n\t\t\t\t\treturn integer;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t};\r\n\t\tvar skipName = function(names, pos) {\r\n\t\t\tfor (var i = 0; i < names.length; i++) {\r\n\t\t\t\tvar name = names[i];\r\n\t\t\t\tif (value.substring(pos, pos + name.length).toLowerCase() == name.toLowerCase()) {\r\n\t\t\t\t\treturn name.length;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t};\r\n\t\tvar pos = 0;\r\n\t\tvar now = new Date();\r\n\t\tvar year = now.getYear();\r\n\t\tvar month = now.getMonth() + 1;\r\n\t\tvar date = 1;\r\n\t\tvar hh = 0;\r\n\t\tvar mm = 0;\r\n\t\tvar ss = 0;\r\n\t\tvar ampm = \"\";\r\n\t\tvar self = this;\r\n\r\n\t\t$.each(format.match(/(.).*?\\1*/g), function(k, token) {\r\n\t\t\t// Extract contents of value based on format token\r\n\t\t\tswitch (token) {\r\n\t\t\t\tcase 'yyyy':\r\n\t\t\t\t\tyear = extractInteger(value, pos, 4, 4);\r\n\t\t\t\t\tif (year != null) {\r\n\t\t\t\t\t\tpos += year.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'yy':\r\n\t\t\t\t\tyear = extractInteger(value, pos, 2, 2);\r\n\t\t\t\t\tif (year != null) {\r\n\t\t\t\t\t\tpos += year.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'y':\r\n\t\t\t\t\tyear = extractInteger(value, pos, 2, 4);\r\n\t\t\t\t\tif (year != null) {\r\n\t\t\t\t\t\tpos += year.length;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'MMM':\r\n\t\t\t\tcase 'LLL':\r\n\t\t\t\t\tmonth = 0;\r\n\t\t\t\t\tfor (var i = 0; i < self.locales.month_names_abbreviated.length; i++) {\r\n\t\t\t\t\t\tvar month_name = self.locales.month_names_abbreviated[i];\r\n\t\t\t\t\t\tif (value.substring(pos, pos + month_name.length).toLowerCase() == month_name.toLowerCase()) {\r\n\t\t\t\t\t\t\tmonth = i + 1;\r\n\t\t\t\t\t\t\tpos += month_name.length;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'MMMM':\r\n\t\t\t\tcase 'LLLL':\r\n\t\t\t\t\tmonth = 0;\r\n\t\t\t\t\tfor (var i = 0; i < self.locales.month_names.length; i++) {\r\n\t\t\t\t\t\tvar month_name = self.locales.month_names[i];\r\n\t\t\t\t\t\tif (value.substring(pos, pos + month_name.length).toLowerCase() == month_name.toLowerCase()) {\r\n\t\t\t\t\t\t\tmonth = i + 1;\r\n\t\t\t\t\t\t\tpos += month_name.length;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'EEE':\r\n\t\t\t\tcase 'EE':\r\n\t\t\t\tcase 'E':\r\n\t\t\t\tcase 'eee':\r\n\t\t\t\t\tpos += skipName(self.locales.day_names_abbreviated, pos);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'EEEE':\r\n\t\t\t\tcase 'eeee':\r\n\t\t\t\tcase 'cccc':\r\n\t\t\t\t\tpos += skipName(self.locales.day_names, pos);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'EEEEEE':\r\n\t\t\t\tcase 'eeeeee':\r\n\t\t\t\tcase 'cccccc':\r\n\t\t\t\t\tpos += skipName(self.locales.day_names_short, pos);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'MM':\r\n\t\t\t\tcase 'M':\r\n\t\t\t\tcase 'LL':\r\n\t\t\t\tcase 'L':\r\n\t\t\t\t\tmonth = extractInteger(value, pos, token.length, 2);\r\n\t\t\t\t\tif (month == null || (month < 1) || (month > 12)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += month.length;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'dd':\r\n\t\t\t\tcase 'd':\r\n\t\t\t\t\tdate = extractInteger(value, pos, token.length, 2);\r\n\t\t\t\t\tif (date == null || (date < 1) || (date > 31)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += date.length;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'hh':\r\n\t\t\t\tcase 'h':\r\n\t\t\t\t\thh = extractInteger(value, pos, token.length, 2);\r\n\t\t\t\t\tif (hh == null || (hh < 1) || (hh > 12)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += hh.length;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'HH':\r\n\t\t\t\tcase 'H':\r\n\t\t\t\t\thh = extractInteger(value, pos, token.length, 2);\r\n\t\t\t\t\tif (hh == null || (hh < 0) || (hh > 23)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += hh.length;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'KK':\r\n\t\t\t\tcase 'K':\r\n\t\t\t\t\thh = extractInteger(value, pos, token.length, 2);\r\n\t\t\t\t\tif (hh == null || (hh < 0) || (hh > 11)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += hh.length;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'kk':\r\n\t\t\t\tcase 'k':\r\n\t\t\t\t\thh = extractInteger(value, pos, token.length, 2);\r\n\t\t\t\t\tif (hh == null || (hh < 1) || (hh > 24)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += hh.length;\r\n\t\t\t\t\thh--;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'mm':\r\n\t\t\t\tcase 'm':\r\n\t\t\t\t\tmm = extractInteger(value,pos,token.length,2);\r\n\t\t\t\t\tif (mm == null || (mm < 0) || (mm > 59)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += mm.length;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'ss':\r\n\t\t\t\tcase 's':\r\n\t\t\t\t\tss = extractInteger(value, pos, token.length, 2);\r\n\t\t\t\t\tif (ss == null || (ss < 0) || (ss > 59)){\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpos += ss.length;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'a':\r\n\t\t\t\t\tvar amlength = self.locales.day_periods.am.length;\r\n\t\t\t\t\tvar pmlength = self.locales.day_periods.pm.length;\r\n\t\t\t\t\tif (value.substring(pos, pos + amlength) == self.locales.day_periods.am) {\r\n\t\t\t\t\t\tampm = \"AM\";\r\n\t\t\t\t\t\tpos += amlength;\r\n\t\t\t\t\t} else if (value.substring(pos, pos + pmlength) == self.locales.day_periods.pm) {\r\n\t\t\t\t\t\tampm = \"PM\";\r\n\t\t\t\t\t\tpos += pmlength;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tif (value.substring(pos, pos + token.length) != token) {\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpos += token.length;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\t// If there are any trailing characters left in the value, it doesn't match\r\n\t\tif (pos != value.length) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tif (year == null) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tif (year.length == 2) {\r\n\t\t\tif (year > 50) {\r\n\t\t\t\tyear = 1900 + (year - 0);\r\n\t\t\t} else {\r\n\t\t\t\tyear = 2000 + (year - 0);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Is date valid for month?\r\n\t\tif ((month < 1) || (month > 12)) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tif (month == 2) {\r\n\t\t\t// Check for leap year\r\n\t\t\tif ( ( (year % 4 == 0) && (year % 100 != 0) ) || (year % 400 == 0) ) { // leap year\r\n\t\t\t\tif (date > 29) {\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (date > 28) {\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ((month == 4) || (month == 6) || (month == 9) || (month==11)) {\r\n\t\t\tif (date > 30) {\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Correct hours value\r\n\t\tif (hh < 12 && ampm == \"PM\") {\r\n\t\t\thh = hh - 0 + 12;\r\n\t\t} else if (hh > 11 && ampm == \"AM\") {\r\n\t\t\thh -= 12;\r\n\t\t}\r\n\t\treturn new Date(year, month - 1, date, hh, mm, ss);\r\n\t} // end createDateFromFormat()\r\n\r\n\t/**\r\n\t *\tparseDate() is a member function which parse a date string.\r\n\t *\r\n\t *\tThis function takes a date string and try to parse it with the input formats.\r\n\t *\tIf the date string matches one of the format string, it returns the\r\n\t *\tthe date object. Otherwise, it returns null.\r\n\t *\r\n\t *\t@param (value string) the date string\r\n\t *\t@return a date objet or null\r\n\t */\r\n\tDatepicker.prototype.parseDate = function(value) {\r\n\t\tvar date = null;\r\n\t\tvar self = this;\r\n\t\t$.each(this.options.inputFormat, function (i, format) {\r\n\t\t\tdate = self.createDateFromFormat(format, value);\r\n\t\t\tif (date != null) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\t\tif (date == null) { // last try with the output format\r\n\t\t\tdate = self.createDateFromFormat(this.options.outputFormat, value);\r\n\t\t}\r\n\t\treturn date;\r\n\t} // end parseDate()\r\n\r\n\t/**\r\n\t *\tmin() is a public member function which allow change the smallest selectable date.\r\n\t *\r\n\t *\t@param (value string) the new date\r\n\t *\t@return the smallest selectable date\r\n\t */\r\n\tDatepicker.prototype.min = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.options.min = value instanceof Date ? value : this.parseDate(value);\r\n\t\t\tif (this.options.min != null && this.dateObj < this.options.min) {\r\n\t\t\t\tthis.$target.attr('aria-invalid', true);\r\n\t\t\t\tthis.$target.parents('.form-group').addClass('has-error');\r\n\t\t\t\tthis.dateObj = this.options.min;\r\n\t\t\t}\r\n\t\t\tif (this.options.inline != false) {\r\n\t\t\t\tthis.refresh();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.options.min;\r\n\t} // end min()\r\n\r\n\t/**\r\n\t *\tmax() is a public member function which allow change the biggest selectable date.\r\n\t *\r\n\t *\t@param (value string) the new date\r\n\t *\t@return the biggest selectable date\r\n\t */\r\n\tDatepicker.prototype.max = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.options.max = value instanceof Date ? value : this.parseDate(value);\r\n\t\t\tif (this.options.max != null && this.dateObj > this.options.max) {\r\n\t\t\t\tthis.$target.attr('aria-invalid', true);\r\n\t\t\t\tthis.$target.parents('.form-group').addClass('has-error');\r\n\t\t\t\tthis.dateObj = this.options.max;\r\n\t\t\t}\r\n\t\t\tif (this.options.inline != false) {\r\n\t\t\t\tthis.refresh();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.options.max;\r\n\t} // end max()\r\n\r\n\t/**\r\n\t *\ttheme() is a public member function which allow change the datepicker theme.\r\n\t *\r\n\t *\t@param (value string) the new theme\r\n\t *\t@return the datepicker theme\r\n\t */\r\n\tDatepicker.prototype.theme = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.$button.removeClass(this.options.theme);\r\n\t\t\tthis.$calendar.removeClass(this.options.theme);\r\n\t\t\tthis.options.theme = value;\r\n\t\t\tthis.$button.addClass(this.options.theme);\r\n\t\t\tthis.$calendar.addClass(this.options.theme);\r\n\t\t}\r\n\t\treturn this.options.theme;\r\n\t} // end theme()\r\n\r\n\t/**\r\n\t *\tfirstDayOfWeek() is a public member function which allow change the first Day Of Week.\r\n\t *\r\n\t *\t@param (value integer) the new first Day Of Week\r\n\t *\t@return the first Day Of Week\r\n\t */\r\n\tDatepicker.prototype.firstDayOfWeek = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.options.firstDayOfWeek = parseInt(value, 10);\r\n\t\t\tif (this.options.inline == false) {\r\n\t\t\t\tthis.drawCalendarHeader();\r\n\t\t\t} else {\r\n\t\t\t\tthis.refresh();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.options.firstDayOfWeek;\r\n\t} // end firstDayOfWeek()\r\n\r\n\t/**\r\n\t *\tdaysOfWeekDisabled() is a public member function which allow disabling of some weekdays.\r\n\t *\r\n\t *\t@param (value string) the new disabled week days\r\n\t *\t@return the disabled week days\r\n\t */\r\n\tDatepicker.prototype.daysOfWeekDisabled = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.options.daysOfWeekDisabled = [];\r\n\t\t\tif (! $.isArray(value)) {\r\n\t\t\t\tvalue = [value];\r\n\t\t\t}\r\n\t\t\tvar self = this;\r\n\t\t\t$.each(value, function(i, val) {\r\n\t\t\t\tif (typeof val === 'number') {\r\n\t\t\t\t\tself.options.daysOfWeekDisabled.push(val);\r\n\t\t\t\t} else if (typeof val === 'string') {\r\n\t\t\t\t\tself.options.daysOfWeekDisabled.push(parseInt(val, 10));\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn this.options.daysOfWeekDisabled;\r\n\t} // end daysOfWeekDisabled()\r\n\r\n\t/**\r\n\t *\tweekDayFormat() is a public member function which allow change the format of weekdays name.\r\n\t *\r\n\t *\t@param (value string) the new format. Allowed : 'short' or 'narrow'\r\n\t *\t@return the format of weekdays name\r\n\t */\r\n\tDatepicker.prototype.weekDayFormat = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.options.weekDayFormat = value;\r\n\t\t\tthis.drawCalendarHeader();\r\n\t\t}\r\n\t\treturn this.options.weekDayFormat;\r\n\t} // end weekDayFormat()\r\n\r\n\t/**\r\n\t *\tinputFormat() is a public member function which allow change the input format.\r\n\t *\r\n\t *\t@param (value string) the new format\r\n\t *\t@return the input format\r\n\t */\r\n\tDatepicker.prototype.inputFormat = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tif (! $.isArray(value)) {\r\n\t\t\t\tvalue = [value];\r\n\t\t\t}\r\n\t\t\tif (this.$target.attr('placeholder') == this.options.inputFormat[0]) {\r\n\t\t\t\tthis.$target.attr('placeholder', value[0]);\r\n\t\t\t}\r\n\t\t\tthis.options.inputFormat = value;\r\n\t\t}\r\n\t\treturn this.options.inputFormat;\r\n\t} // end inputFormat()\r\n\r\n\t/**\r\n\t *\toutputFormat() is a public member function which allow change the output format.\r\n\t *\r\n\t *\t@param (value string) the new format\r\n\t *\t@return the output format\r\n\t */\r\n\tDatepicker.prototype.outputFormat = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.options.outputFormat = value;\r\n\t\t}\r\n\t\treturn this.options.outputFormat;\r\n\t} // end outputFormat()\r\n\r\n\t/**\r\n\t *\tmodal() is a public member function which allow to set or unset the modal mode.\r\n\t *\r\n\t *\t@param (value boolean) the new modal mode\r\n\t *\t@return the modal mode\r\n\t */\r\n\tDatepicker.prototype.modal = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tthis.options.modal = value;\r\n\t\t\tif (this.options.modal == true) {\r\n\t\t\t\tif (this.options.inline == false) {\r\n\t\t\t\t\tthis.showObject(this.$calendar.find('.datepicker-close-wrap'));\r\n\t\t\t\t\tthis.showObject(this.$calendar.find('.datepicker-bn-close-label'));\r\n\t\t\t\t}\r\n\t\t\t\tthis.$close = this.$calendar.find('.datepicker-close');\r\n\t\t\t\tthis.$close.html(this.options.closeButtonTitle).attr('title', this.options.closeButtonLabel);\r\n\t\t\t\tthis.$calendar.find('.datepicker-bn-close-label').html(this.options.closeButtonLabel);\r\n\t\t\t\tvar self = this;\r\n\t\t\t\tthis.$close.click(function(e) {\r\n\t\t\t\t\treturn self.handleCloseClick(e);\r\n\t\t\t\t});\r\n\t\t\t\tthis.$close.keydown(function(e) {\r\n\t\t\t\t\treturn self.handleCloseKeyDown(e);\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tthis.hideObject(this.$calendar.find('.datepicker-close-wrap'));\r\n\t\t\t\tthis.hideObject(this.$calendar.find('.datepicker-bn-close-label'));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.options.modal;\r\n\t} // end modal()\r\n\r\n\t/**\r\n\t *\tinline() is a public member function which allow to set or unset the inline mode.\r\n\t *\r\n\t *\t@param (value string or false) the id or jquery object of the datepicker container, false otherwise (not inline)\r\n\t *\t@return the given value\r\n\t */\r\n\tDatepicker.prototype.inline = function(value) {\r\n\t\tif (value != null) {\r\n\t\t\tif (value != false) {\r\n\t\t\t\tthis.hideObject(this.$button);\r\n\t\t\t\tthis.hideObject(this.$calendar.find('.datepicker-close-wrap'));\r\n\t\t\t\tthis.hideObject(this.$calendar.find('.datepicker-bn-close-label'));\r\n\t\t\t\tvar $container = typeof value === 'string' ? $('#' + value) : value;\r\n\t\t\t\t$container.append(this.$calendar);\r\n\t\t\t\tthis.$calendar.css({position: 'relative', left: '0px', top: '0px'});\r\n\t\t\t\tthis.options.inline = value;\r\n\t\t\t\tthis.initializeDate();\r\n\t\t\t\tthis.showObject(this.$calendar);\r\n\t\t\t} else {\r\n\t\t\t\tthis.$target.parent().after(this.$calendar);\r\n\t\t\t\tthis.showObject(this.$button);\r\n\t\t\t\tif (this.options.modal == true) {\r\n\t\t\t\t\tthis.showObject(this.$calendar.find('.datepicker-close-wrap'));\r\n\t\t\t\t\tthis.showObject(this.$calendar.find('.datepicker-bn-close-label'));\r\n\t\t\t\t}\r\n\t\t\t\tif (this.$calendar.parent().css('position') === 'static') {\r\n\t\t\t\t\tthis.$calendar.parent().css('position', 'relative');\r\n\t\t\t\t}\r\n\t\t\t\tthis.$calendar.css({position: 'absolute'});\r\n\t\t\t\tthis.options.inline = value;\r\n\t\t\t\tthis.hide();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this.options.inline;\r\n\t} // end inline()\r\n\r\n\t/**\r\n\t *\tformat() is a public member function to format a date according the output format.\r\n\t *\r\n\t *\t@param (value date object) the date\r\n\t *\t@return formatted date string\r\n\t */\r\n\tDatepicker.prototype.format = function(date) {\r\n\t\treturn this.formatDate(date, this.options.outputFormat);\r\n\t} // end format()\r\n\r\n\t/**\r\n\t *\tenable() is a public member function to enable this datepicker.\r\n\t */\r\n\tDatepicker.prototype.enable = function() {\r\n\t\tthis.$button.removeClass('disabled');\r\n\t\tthis.$button.attr('aria-disabled', false);\r\n\t\tthis.$button.attr('tabindex', 0);\r\n\t} // end enable()\r\n\r\n\t/**\r\n\t *\tdisable() is a public member function to disable this datepicker.\r\n\t */\r\n\tDatepicker.prototype.disable = function() {\r\n\t\tthis.hide();\r\n\t\tthis.$button.addClass('disabled');\r\n\t\tthis.$button.attr('aria-disabled', true);\r\n\t\tthis.$button.attr('tabindex', -1);\r\n\t} // end enable()\r\n\r\n\t/**\r\n\t *\tdatesDisabled() is a public member function to set dates to be disabled.\r\n\t */\r\n\tDatepicker.prototype.datesDisabled = function(dates) {\r\n\t\tthis.options.datesDisabled = [];\r\n\t\tif (! $.isArray(dates)) {\r\n\t\t\tdates = [dates];\r\n\t\t}\r\n\t\tvar self = this;\r\n\t\t$.each(dates, function(i, v) {\r\n\t\t\tif (typeof v === 'string') {\r\n\t\t\t\tvar date = self.parseDate(v);\r\n\t\t\t\tif (date !== null ) {\r\n\t\t\t\t\tself.options.datesDisabled.push(self.format(date));\r\n\t\t\t\t}\r\n\t\t\t} else if (v instanceof Date && !isNaN(v.valueOf())) {\r\n\t\t\t\tself.options.datesDisabled.push(self.format(v));\r\n\t\t\t}\r\n\t\t});\r\n\t} // end datesDisabled()\r\n\r\n\t/**\r\n\t *\tstartview() is a public member function to format a date according the output format.\r\n\t *\r\n\t *\t@param (value int|string) the new view\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.startview = function(view) {\r\n\t\tswitch (view) {\r\n\t\t\tcase 1:\r\n\t\t\tcase 'months':\r\n\t\t\t\tthis.options.startView = 1;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\tcase 'years':\r\n\t\t\t\tthis.options.startView = 2;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthis.options.startView = 0;\r\n\t\t}\r\n\t} // end startview()\r\n\r\n\t/**\r\n\t *\tsetLocales() is a public member function which allow change the locales.\r\n\t *\r\n\t *\t@param (value obj) the new locales\r\n\t *\t@return N/A\r\n\t */\r\n\tDatepicker.prototype.setLocales = function(value) {\r\n\t\tthis.locales = value;\r\n\t\tthis.options.inputFormat = [this.locales.short_format];\r\n\t\tthis.options.outputFormat = this.locales.short_format;\r\n\t\tthis.options.titleFormat = this.locales.full_format,\r\n\t\tthis.options.firstDayOfWeek = this.locales.firstday_of_week;\r\n\t\tthis.options.buttonTitle = this.locales.texts.buttonTitle;\r\n\t\tthis.$button.find('span').attr('title', this.options.buttonTitle);\r\n\t\tthis.options.buttonLabel = this.locales.texts.buttonLabel;\r\n\t\tthis.options.prevButtonLabel = this.locales.texts.prevButtonLabel;\r\n\t\tthis.options.prevMonthButtonLabel = this.locales.texts.prevMonthButtonLabel;\r\n\t\tthis.options.prevYearButtonLabel = this.locales.texts.prevYearButtonLabel;\r\n\t\tthis.options.nextButtonLabel = this.locales.texts.nextButtonLabel;\r\n\t\tthis.options.nextMonthButtonLabel = this.locales.texts.nextMonthButtonLabel;\r\n\t\tthis.options.nextYearButtonLabel = this.locales.texts.nextYearButtonLabel;\r\n\t\tthis.options.changeMonthButtonLabel = this.locales.texts.changeMonthButtonLabel;\r\n\t\tthis.options.changeYearButtonLabel = this.locales.texts.changeYearButtonLabel;\r\n\t\tthis.options.changeRangeButtonLabel = this.locales.texts.changeRangeButtonLabel;\r\n\t\tthis.options.closeButtonTitle = this.locales.texts.closeButtonTitle;\r\n\t\tthis.options.closeButtonLabel = this.locales.texts.closeButtonLabel;\r\n\t\tthis.options.calendarHelp = this.locales.texts.calendarHelp;\r\n\t\tthis.drawCalendarHeader();\r\n\t\tif (this.locales.directionality === 'RTL') {\r\n\t\t\tthis.$grid.addClass('rtl');\r\n\t\t} else {\r\n\t\t\tthis.$grid.removeClass('rtl');\r\n\t\t}\r\n\t} // end outputFormat()\r\n\r\n\t// DATEPICKER PLUGIN DEFINITION\r\n\t// ==========================\r\n\r\n\tvar old = $.fn.datepicker\r\n\r\n\t$.fn.datepicker = function (option, value) {\r\n\t\tif (typeof option == 'string' && $(this).length == 1) {\r\n\t\t\tvar data = $(this).eq(0).data('ab.datepicker');\r\n\t\t\tif (data) return data[option](value);\r\n\t\t} else {\r\n\t\t\treturn this.each(function () {\r\n\t\t\t\tvar $this = $(this);\r\n\t\t\t\tvar data = $this.data('ab.datepicker');\r\n\t\t\t\tvar options = $.extend({}, Datepicker.DEFAULTS, $this.data(), typeof option == 'object' && option);\r\n\t\t\t\tif (!data) $this.data('ab.datepicker', (data = new Datepicker(this, options)));\r\n\t\t\t\tif (typeof option == 'string') data[option](value);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\t$.fn.datepicker.Constructor = Datepicker\r\n\r\n\t// DATEPICKER NO CONFLICT\r\n\t// ====================\r\n\r\n\t$.fn.datepicker.noConflict = function () {\r\n\t\t$.fn.datepicker = old\r\n\t\treturn this\r\n\t}\r\n\r\n}));"],"file":"../../../assets/plugins/datepicker.js"}