| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237 | 
							- ;(function (window, jQuery, undefined) { ;(function () {
 
-     var VERSION = '2.2.3',
 
-         pluginName = 'datepicker',
 
-         autoInitSelector = '.datepicker-here',
 
-         jQuerybody, jQuerydatepickersContainer,
 
-         containerBuilt = false,
 
-         baseTemplate = '' +
 
-             '<div class="datepicker">' +
 
-             '<i class="datepicker--pointer"></i>' +
 
-             '<nav class="datepicker--nav"></nav>' +
 
-             '<div class="datepicker--content"></div>' +
 
-             '</div>',
 
-         defaults = {
 
-             classes: '',
 
-             inline: false,
 
-             language: 'ru',
 
-             startDate: new Date(),
 
-             firstDay: '',
 
-             weekends: [6, 0],
 
-             dateFormat: '',
 
-             altField: '',
 
-             altFieldDateFormat: '@',
 
-             toggleSelected: true,
 
-             keyboardNav: true,
 
-             position: 'bottom left',
 
-             offset: 12,
 
-             view: 'days',
 
-             minView: 'days',
 
-             showOtherMonths: true,
 
-             selectOtherMonths: true,
 
-             moveToOtherMonthsOnSelect: true,
 
-             showOtherYears: true,
 
-             selectOtherYears: true,
 
-             moveToOtherYearsOnSelect: true,
 
-             minDate: '',
 
-             maxDate: '',
 
-             disableNavWhenOutOfRange: true,
 
-             multipleDates: false, // Boolean or Number
 
-             multipleDatesSeparator: ',',
 
-             range: false,
 
-             todayButton: false,
 
-             clearButton: false,
 
-             showEvent: 'focus',
 
-             autoClose: false,
 
-             // navigation
 
-             monthsField: 'monthsShort',
 
-             prevHtml: '<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>',
 
-             nextHtml: '<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>',
 
-             navTitles: {
 
-                 days: 'MM, <i>yyyy</i>',
 
-                 // days: '<i>yyyy</i>, MM',
 
-                 months: 'yyyy',
 
-                 years: 'yyyy1 - yyyy2'
 
-             },
 
-             // timepicker
 
-             timepicker: false,
 
-             onlyTimepicker: false,
 
-             dateTimeSeparator: ' ',
 
-             timeFormat: '',
 
-             minHours: 0,
 
-             maxHours: 24,
 
-             minMinutes: 0,
 
-             maxMinutes: 59,
 
-             hoursStep: 1,
 
-             minutesStep: 1,
 
-             // events
 
-             onSelect: '',
 
-             onShow: '',
 
-             onHide: '',
 
-             onChangeMonth: '',
 
-             onChangeYear: '',
 
-             onChangeDecade: '',
 
-             onChangeView: '',
 
-             onRenderCell: ''
 
-         },
 
-         hotKeys = {
 
-             'ctrlRight': [17, 39],
 
-             'ctrlUp': [17, 38],
 
-             'ctrlLeft': [17, 37],
 
-             'ctrlDown': [17, 40],
 
-             'shiftRight': [16, 39],
 
-             'shiftUp': [16, 38],
 
-             'shiftLeft': [16, 37],
 
-             'shiftDown': [16, 40],
 
-             'altUp': [18, 38],
 
-             'altRight': [18, 39],
 
-             'altLeft': [18, 37],
 
-             'altDown': [18, 40],
 
-             'ctrlShiftUp': [16, 17, 38]
 
-         },
 
-         datepicker;
 
-     var Datepicker  = function (el, options) {
 
-         this.el = el;
 
-         this.jQueryel = jQuery(el);
 
-         this.opts = jQuery.extend(true, {}, defaults, options, this.jQueryel.data());
 
-         if (jQuerybody == undefined) {
 
-             jQuerybody = jQuery('body');
 
-         }
 
-         if (!this.opts.startDate) {
 
-             this.opts.startDate = new Date();
 
-         }
 
-         if (this.el.nodeName == 'INPUT') {
 
-             this.elIsInput = true;
 
-         }
 
-         if (this.opts.altField) {
 
-             this.jQueryaltField = typeof this.opts.altField == 'string' ? jQuery(this.opts.altField) : this.opts.altField;
 
-         }
 
-         this.inited = false;
 
-         this.visible = false;
 
-         this.silent = false; // Need to prevent unnecessary rendering
 
-         this.currentDate = this.opts.startDate;
 
-         this.currentView = this.opts.view;
 
-         this._createShortCuts();
 
-         this.selectedDates = [];
 
-         this.views = {};
 
-         this.keys = [];
 
-         this.minRange = '';
 
-         this.maxRange = '';
 
-         this._prevOnSelectValue = '';
 
-         this.init()
 
-     };
 
-     datepicker = Datepicker;
 
-     datepicker.prototype = {
 
-         VERSION: VERSION,
 
-         viewIndexes: ['days','months', 'years' ],
 
-         init: function () {
 
-             if (!containerBuilt && !this.opts.inline && this.elIsInput) {
 
-                 this._buildDatepickersContainer();
 
-             }
 
-             this._buildBaseHtml();
 
-             this._defineLocale(this.opts.language);
 
-             this._syncWithMinMaxDates();
 
-             if (this.elIsInput) {
 
-                 if (!this.opts.inline) {
 
-                     // Set extra classes for proper transitions
 
-                     this._setPositionClasses(this.opts.position);
 
-                     this._bindEvents()
 
-                 }
 
-                 if (this.opts.keyboardNav && !this.opts.onlyTimepicker) {
 
-                     this._bindKeyboardEvents();
 
-                 }
 
-                 this.jQuerydatepicker.on('mousedown', this._onMouseDownDatepicker.bind(this));
 
-                 this.jQuerydatepicker.on('mouseup', this._onMouseUpDatepicker.bind(this));
 
-             }
 
-             if (this.opts.classes) {
 
-                 this.jQuerydatepicker.addClass(this.opts.classes)
 
-             }
 
-             if (this.opts.timepicker) {
 
-                 this.timepicker = new jQuery.fn.datepicker.Timepicker(this, this.opts);
 
-                 this._bindTimepickerEvents();
 
-             }
 
-             if (this.opts.onlyTimepicker) {
 
-                 this.jQuerydatepicker.addClass('-only-timepicker-');
 
-             }
 
-             this.views[this.currentView] = new jQuery.fn.datepicker.Body(this, this.currentView, this.opts);
 
-             this.views[this.currentView].show();
 
-             this.nav = new jQuery.fn.datepicker.Navigation(this, this.opts);
 
-             this.view = this.currentView;
 
-             this.jQueryel.on('clickCell.adp', this._onClickCell.bind(this));
 
-             this.jQuerydatepicker.on('mouseenter', '.datepicker--cell', this._onMouseEnterCell.bind(this));
 
-             this.jQuerydatepicker.on('mouseleave', '.datepicker--cell', this._onMouseLeaveCell.bind(this));
 
-             this.inited = true;
 
-         },
 
-         _createShortCuts: function () {
 
-             this.minDate = this.opts.minDate ? this.opts.minDate : new Date(-8639999913600000);
 
-             this.maxDate = this.opts.maxDate ? this.opts.maxDate : new Date(8639999913600000);
 
-         },
 
-         _bindEvents : function () {
 
-             this.jQueryel.on(this.opts.showEvent + '.adp', this._onShowEvent.bind(this));
 
-             this.jQueryel.on('mouseup.adp', this._onMouseUpEl.bind(this));
 
-             this.jQueryel.on('blur.adp', this._onBlur.bind(this));
 
-             this.jQueryel.on('keyup.adp', this._onKeyUpGeneral.bind(this));
 
-             jQuery(window).on('resize.adp', this._onResize.bind(this));
 
-             jQuery('body').on('mouseup.adp', this._onMouseUpBody.bind(this));
 
-         },
 
-         _bindKeyboardEvents: function () {
 
-             this.jQueryel.on('keydown.adp', this._onKeyDown.bind(this));
 
-             this.jQueryel.on('keyup.adp', this._onKeyUp.bind(this));
 
-             this.jQueryel.on('hotKey.adp', this._onHotKey.bind(this));
 
-         },
 
-         _bindTimepickerEvents: function () {
 
-             this.jQueryel.on('timeChange.adp', this._onTimeChange.bind(this));
 
-         },
 
-         isWeekend: function (day) {
 
-             return this.opts.weekends.indexOf(day) !== -1;
 
-         },
 
-         _defineLocale: function (lang) {
 
-             if (typeof lang == 'string') {
 
-                 this.loc = jQuery.fn.datepicker.language[lang];
 
-                 if (!this.loc) {
 
-                     console.warn('Can\'t find language "' + lang + '" in Datepicker.language, will use "ru" instead');
 
-                     this.loc = jQuery.extend(true, {}, jQuery.fn.datepicker.language.ru)
 
-                 }
 
-                 this.loc = jQuery.extend(true, {}, jQuery.fn.datepicker.language.ru, jQuery.fn.datepicker.language[lang])
 
-             } else {
 
-                 this.loc = jQuery.extend(true, {}, jQuery.fn.datepicker.language.ru, lang)
 
-             }
 
-             if (this.opts.dateFormat) {
 
-                 this.loc.dateFormat = this.opts.dateFormat
 
-             }
 
-             if (this.opts.timeFormat) {
 
-                 this.loc.timeFormat = this.opts.timeFormat
 
-             }
 
-             if (this.opts.firstDay !== '') {
 
-                 this.loc.firstDay = this.opts.firstDay
 
-             }
 
-             if (this.opts.timepicker) {
 
-                 this.loc.dateFormat = [this.loc.dateFormat, this.loc.timeFormat].join(this.opts.dateTimeSeparator);
 
-             }
 
-             if (this.opts.onlyTimepicker) {
 
-                 this.loc.dateFormat = this.loc.timeFormat;
 
-             }
 
-             var boundary = this._getWordBoundaryRegExp;
 
-             if (this.loc.timeFormat.match(boundary('aa')) ||
 
-                 this.loc.timeFormat.match(boundary('AA'))
 
-             ) {
 
-                this.ampm = true;
 
-             }
 
-         },
 
-         _buildDatepickersContainer: function () {
 
-             containerBuilt = true;
 
-             jQuerybody.append('<div class="datepickers-container" id="datepickers-container"></div>');
 
-             jQuerydatepickersContainer = jQuery('#datepickers-container');
 
-         },
 
-         _buildBaseHtml: function () {
 
-             var jQueryappendTarget,
 
-                 jQueryinline = jQuery('<div class="datepicker-inline">');
 
-             if(this.el.nodeName == 'INPUT') {
 
-                 if (!this.opts.inline) {
 
-                     jQueryappendTarget = jQuerydatepickersContainer;
 
-                 } else {
 
-                     jQueryappendTarget = jQueryinline.insertAfter(this.jQueryel)
 
-                 }
 
-             } else {
 
-                 jQueryappendTarget = jQueryinline.appendTo(this.jQueryel)
 
-             }
 
-             this.jQuerydatepicker = jQuery(baseTemplate).appendTo(jQueryappendTarget);
 
-             this.jQuerycontent = jQuery('.datepicker--content', this.jQuerydatepicker);
 
-             this.jQuerynav = jQuery('.datepicker--nav', this.jQuerydatepicker);
 
-         },
 
-         _triggerOnChange: function () {
 
-             if (!this.selectedDates.length) {
 
-                 // Prevent from triggering multiple onSelect callback with same argument (empty string) in IE10-11
 
-                 if (this._prevOnSelectValue === '') return;
 
-                 this._prevOnSelectValue = '';
 
-                 return this.opts.onSelect('', '', this);
 
-             }
 
-             var selectedDates = this.selectedDates,
 
-                 parsedSelected = datepicker.getParsedDate(selectedDates[0]),
 
-                 formattedDates,
 
-                 _this = this,
 
-                 dates = new Date(
 
-                     parsedSelected.year,
 
-                     parsedSelected.month,
 
-                     parsedSelected.date,
 
-                     parsedSelected.hours,
 
-                     parsedSelected.minutes
 
-                 );
 
-                 formattedDates = selectedDates.map(function (date) {
 
-                     return _this.formatDate(_this.loc.dateFormat, date)
 
-                 }).join(this.opts.multipleDatesSeparator);
 
-             // Create new dates array, to separate it from original selectedDates
 
-             if (this.opts.multipleDates || this.opts.range) {
 
-                 dates = selectedDates.map(function(date) {
 
-                     var parsedDate = datepicker.getParsedDate(date);
 
-                     return new Date(
 
-                         parsedDate.year,
 
-                         parsedDate.month,
 
-                         parsedDate.date,
 
-                         parsedDate.hours,
 
-                         parsedDate.minutes
 
-                     );
 
-                 })
 
-             }
 
-             this._prevOnSelectValue = formattedDates;
 
-             this.opts.onSelect(formattedDates, dates, this);
 
-         },
 
-         next: function () {
 
-             var d = this.parsedDate,
 
-                 o = this.opts;
 
-             switch (this.view) {
 
-                 case 'days':
 
-                     this.date = new Date(d.year, d.month + 1, 1);
 
-                     if (o.onChangeMonth) o.onChangeMonth(this.parsedDate.month, this.parsedDate.year);
 
-                     break;
 
-                 case 'months':
 
-                     this.date = new Date(d.year + 1, d.month, 1);
 
-                     if (o.onChangeYear) o.onChangeYear(this.parsedDate.year);
 
-                     break;
 
-                 case 'years':
 
-                     this.date = new Date(d.year + 10, 0, 1);
 
-                     if (o.onChangeDecade) o.onChangeDecade(this.curDecade);
 
-                     break;
 
-             }
 
-         },
 
-         prev: function () {
 
-             var d = this.parsedDate,
 
-                 o = this.opts;
 
-             switch (this.view) {
 
-                 case 'days':
 
-                     this.date = new Date(d.year, d.month - 1, 1);
 
-                     if (o.onChangeMonth) o.onChangeMonth(this.parsedDate.month, this.parsedDate.year);
 
-                     break;
 
-                 case 'months':
 
-                     this.date = new Date(d.year - 1, d.month, 1);
 
-                     if (o.onChangeYear) o.onChangeYear(this.parsedDate.year);
 
-                     break;
 
-                 case 'years':
 
-                     this.date = new Date(d.year - 10, 0, 1);
 
-                     if (o.onChangeDecade) o.onChangeDecade(this.curDecade);
 
-                     break;
 
-             }
 
-         },
 
-         formatDate: function (string, date) {
 
-             date = date || this.date;
 
-             var result = string,
 
-                 boundary = this._getWordBoundaryRegExp,
 
-                 locale = this.loc,
 
-                 leadingZero = datepicker.getLeadingZeroNum,
 
-                 decade = datepicker.getDecade(date),
 
-                 d = datepicker.getParsedDate(date),
 
-                 fullHours = d.fullHours,
 
-                 hours = d.hours,
 
-                 ampm = string.match(boundary('aa')) || string.match(boundary('AA')),
 
-                 dayPeriod = 'am',
 
-                 replacer = this._replacer,
 
-                 validHours;
 
-             if (this.opts.timepicker && this.timepicker && ampm) {
 
-                 validHours = this.timepicker._getValidHoursFromDate(date, ampm);
 
-                 fullHours = leadingZero(validHours.hours);
 
-                 hours = validHours.hours;
 
-                 dayPeriod = validHours.dayPeriod;
 
-             }
 
-             switch (true) {
 
-                 case /@/.test(result):
 
-                     result = result.replace(/@/, date.getTime());
 
-                 case /aa/.test(result):
 
-                     result = replacer(result, boundary('aa'), dayPeriod);
 
-                 case /AA/.test(result):
 
-                     result = replacer(result, boundary('AA'), dayPeriod.toUpperCase());
 
-                 case /dd/.test(result):
 
-                     result = replacer(result, boundary('dd'), d.fullDate);
 
-                 case /d/.test(result):
 
-                     result = replacer(result, boundary('d'), d.date);
 
-                 case /DD/.test(result):
 
-                     result = replacer(result, boundary('DD'), locale.days[d.day]);
 
-                 case /D/.test(result):
 
-                     result = replacer(result, boundary('D'), locale.daysShort[d.day]);
 
-                 case /mm/.test(result):
 
-                     result = replacer(result, boundary('mm'), d.fullMonth);
 
-                 case /m/.test(result):
 
-                     result = replacer(result, boundary('m'), d.month + 1);
 
-                 case /MM/.test(result):
 
-                     result = replacer(result, boundary('MM'), this.loc.months[d.month]);
 
-                 case /M/.test(result):
 
-                     result = replacer(result, boundary('M'), locale.monthsShort[d.month]);
 
-                 case /ii/.test(result):
 
-                     result = replacer(result, boundary('ii'), d.fullMinutes);
 
-                 case /i/.test(result):
 
-                     result = replacer(result, boundary('i'), d.minutes);
 
-                 case /hh/.test(result):
 
-                     result = replacer(result, boundary('hh'), fullHours);
 
-                 case /h/.test(result):
 
-                     result = replacer(result, boundary('h'), hours);
 
-                 case /yyyy/.test(result):
 
-                     result = replacer(result, boundary('yyyy'), d.year);
 
-                 case /yyyy1/.test(result):
 
-                     result = replacer(result, boundary('yyyy1'), decade[0]);
 
-                 case /yyyy2/.test(result):
 
-                     result = replacer(result, boundary('yyyy2'), decade[1]);
 
-                 case /yy/.test(result):
 
-                     result = replacer(result, boundary('yy'), d.year.toString().slice(-2));
 
-             }
 
-             return result;
 
-         },
 
-         _replacer: function (str, reg, data) {
 
-             return str.replace(reg, function (match, p1,p2,p3) {
 
-                 return p1 + data + p3;
 
-             })
 
-         },
 
-         _getWordBoundaryRegExp: function (sign) {
 
-             var symbols = '\\s|\\.|-|/|\\\\|,|\\jQuery|\\!|\\?|:|;';
 
-             return new RegExp('(^|>|' + symbols + ')(' + sign + ')(jQuery|<|' + symbols + ')', 'g');
 
-         },
 
-         selectDate: function (date) {
 
-             var _this = this,
 
-                 opts = _this.opts,
 
-                 d = _this.parsedDate,
 
-                 selectedDates = _this.selectedDates,
 
-                 len = selectedDates.length,
 
-                 newDate = '';
 
-             if (Array.isArray(date)) {
 
-                 date.forEach(function (d) {
 
-                     _this.selectDate(d)
 
-                 });
 
-                 return;
 
-             }
 
-             if (!(date instanceof Date)) return;
 
-             this.lastSelectedDate = date;
 
-             // Set new time values from Date
 
-             if (this.timepicker) {
 
-                 this.timepicker._setTime(date);
 
-             }
 
-             // On this step timepicker will set valid values in it's instance
 
-             _this._trigger('selectDate', date);
 
-             // Set correct time values after timepicker's validation
 
-             // Prevent from setting hours or minutes which values are lesser then `min` value or
 
-             // greater then `max` value
 
-             if (this.timepicker) {
 
-                 date.setHours(this.timepicker.hours);
 
-                 date.setMinutes(this.timepicker.minutes)
 
-             }
 
-             if (_this.view == 'days') {
 
-                 if (date.getMonth() != d.month && opts.moveToOtherMonthsOnSelect) {
 
-                     newDate = new Date(date.getFullYear(), date.getMonth(), 1);
 
-                 }
 
-             }
 
-             if (_this.view == 'years') {
 
-                 if (date.getFullYear() != d.year && opts.moveToOtherYearsOnSelect) {
 
-                     newDate = new Date(date.getFullYear(), 0, 1);
 
-                 }
 
-             }
 
-             if (newDate) {
 
-                 _this.silent = true;
 
-                 _this.date = newDate;
 
-                 _this.silent = false;
 
-                 _this.nav._render()
 
-             }
 
-             if (opts.multipleDates && !opts.range) { // Set priority to range functionality
 
-                 if (len === opts.multipleDates) return;
 
-                 if (!_this._isSelected(date)) {
 
-                     _this.selectedDates.push(date);
 
-                 }
 
-             } else if (opts.range) {
 
-                 if (len == 2) {
 
-                     _this.selectedDates = [date];
 
-                     _this.minRange = date;
 
-                     _this.maxRange = '';
 
-                 } else if (len == 1) {
 
-                     _this.selectedDates.push(date);
 
-                     if (!_this.maxRange){
 
-                         _this.maxRange = date;
 
-                     } else {
 
-                         _this.minRange = date;
 
-                     }
 
-                     // Swap dates if they were selected via dp.selectDate() and second date was smaller then first
 
-                     if (datepicker.bigger(_this.maxRange, _this.minRange)) {
 
-                         _this.maxRange = _this.minRange;
 
-                         _this.minRange = date;
 
-                     }
 
-                     _this.selectedDates = [_this.minRange, _this.maxRange]
 
-                 } else {
 
-                     _this.selectedDates = [date];
 
-                     _this.minRange = date;
 
-                 }
 
-             } else {
 
-                 _this.selectedDates = [date];
 
-             }
 
-             _this._setInputValue();
 
-             if (opts.onSelect) {
 
-                 _this._triggerOnChange();
 
-             }
 
-             if (opts.autoClose && !this.timepickerIsActive) {
 
-                 if (!opts.multipleDates && !opts.range) {
 
-                     _this.hide();
 
-                 } else if (opts.range && _this.selectedDates.length == 2) {
 
-                     _this.hide();
 
-                 }
 
-             }
 
-             _this.views[this.currentView]._render()
 
-         },
 
-         removeDate: function (date) {
 
-             var selected = this.selectedDates,
 
-                 _this = this;
 
-             if (!(date instanceof Date)) return;
 
-             return selected.some(function (curDate, i) {
 
-                 if (datepicker.isSame(curDate, date)) {
 
-                     selected.splice(i, 1);
 
-                     if (!_this.selectedDates.length) {
 
-                         _this.minRange = '';
 
-                         _this.maxRange = '';
 
-                         _this.lastSelectedDate = '';
 
-                     } else {
 
-                         _this.lastSelectedDate = _this.selectedDates[_this.selectedDates.length - 1];
 
-                     }
 
-                     _this.views[_this.currentView]._render();
 
-                     _this._setInputValue();
 
-                     if (_this.opts.onSelect) {
 
-                         _this._triggerOnChange();
 
-                     }
 
-                     return true
 
-                 }
 
-             })
 
-         },
 
-         today: function () {
 
-             this.silent = true;
 
-             this.view = this.opts.minView;
 
-             this.silent = false;
 
-             this.date = new Date();
 
-             if (this.opts.todayButton instanceof Date) {
 
-                 this.selectDate(this.opts.todayButton)
 
-             }
 
-         },
 
-         clear: function () {
 
-             this.selectedDates = [];
 
-             this.minRange = '';
 
-             this.maxRange = '';
 
-             this.views[this.currentView]._render();
 
-             this._setInputValue();
 
-             if (this.opts.onSelect) {
 
-                 this._triggerOnChange()
 
-             }
 
-         },
 
-         /**
 
-          * Updates datepicker options
 
-          * @param {String|Object} param - parameter's name to update. If object then it will extend current options
 
-          * @param {String|Number|Object} [value] - new param value
 
-          */
 
-         update: function (param, value) {
 
-             var len = arguments.length,
 
-                 lastSelectedDate = this.lastSelectedDate;
 
-             if (len == 2) {
 
-                 this.opts[param] = value;
 
-             } else if (len == 1 && typeof param == 'object') {
 
-                 this.opts = jQuery.extend(true, this.opts, param)
 
-             }
 
-             this._createShortCuts();
 
-             this._syncWithMinMaxDates();
 
-             this._defineLocale(this.opts.language);
 
-             this.nav._addButtonsIfNeed();
 
-             if (!this.opts.onlyTimepicker) this.nav._render();
 
-             this.views[this.currentView]._render();
 
-             if (this.elIsInput && !this.opts.inline) {
 
-                 this._setPositionClasses(this.opts.position);
 
-                 if (this.visible) {
 
-                     this.setPosition(this.opts.position)
 
-                 }
 
-             }
 
-             if (this.opts.classes) {
 
-                 this.jQuerydatepicker.addClass(this.opts.classes)
 
-             }
 
-             if (this.opts.onlyTimepicker) {
 
-                 this.jQuerydatepicker.addClass('-only-timepicker-');
 
-             }
 
-             if (this.opts.timepicker) {
 
-                 if (lastSelectedDate) this.timepicker._handleDate(lastSelectedDate);
 
-                 this.timepicker._updateRanges();
 
-                 this.timepicker._updateCurrentTime();
 
-                 // Change hours and minutes if it's values have been changed through min/max hours/minutes
 
-                 if (lastSelectedDate) {
 
-                     lastSelectedDate.setHours(this.timepicker.hours);
 
-                     lastSelectedDate.setMinutes(this.timepicker.minutes);
 
-                 }
 
-             }
 
-             this._setInputValue();
 
-             return this;
 
-         },
 
-         _syncWithMinMaxDates: function () {
 
-             var curTime = this.date.getTime();
 
-             this.silent = true;
 
-             if (this.minTime > curTime) {
 
-                 this.date = this.minDate;
 
-             }
 
-             if (this.maxTime < curTime) {
 
-                 this.date = this.maxDate;
 
-             }
 
-             this.silent = false;
 
-         },
 
-         _isSelected: function (checkDate, cellType) {
 
-             var res = false;
 
-             this.selectedDates.some(function (date) {
 
-                 if (datepicker.isSame(date, checkDate, cellType)) {
 
-                     res = date;
 
-                     return true;
 
-                 }
 
-             });
 
-             return res;
 
-         },
 
-         _setInputValue: function () {
 
-             var _this = this,
 
-                 opts = _this.opts,
 
-                 format = _this.loc.dateFormat,
 
-                 altFormat = opts.altFieldDateFormat,
 
-                 value = _this.selectedDates.map(function (date) {
 
-                     return _this.formatDate(format, date)
 
-                 }),
 
-                 altValues;
 
-             if (opts.altField && _this.jQueryaltField.length) {
 
-                 altValues = this.selectedDates.map(function (date) {
 
-                     return _this.formatDate(altFormat, date)
 
-                 });
 
-                 altValues = altValues.join(this.opts.multipleDatesSeparator);
 
-                 this.jQueryaltField.val(altValues);
 
-             }
 
-             value = value.join(this.opts.multipleDatesSeparator);
 
-             this.jQueryel.val(value)
 
-         },
 
-         /**
 
-          * Check if date is between minDate and maxDate
 
-          * @param date {object} - date object
 
-          * @param type {string} - cell type
 
-          * @returns {boolean}
 
-          * @private
 
-          */
 
-         _isInRange: function (date, type) {
 
-             var time = date.getTime(),
 
-                 d = datepicker.getParsedDate(date),
 
-                 min = datepicker.getParsedDate(this.minDate),
 
-                 max = datepicker.getParsedDate(this.maxDate),
 
-                 dMinTime = new Date(d.year, d.month, min.date).getTime(),
 
-                 dMaxTime = new Date(d.year, d.month, max.date).getTime(),
 
-                 types = {
 
-                     day: time >= this.minTime && time <= this.maxTime,
 
-                     month: dMinTime >= this.minTime && dMaxTime <= this.maxTime,
 
-                     year: d.year >= min.year && d.year <= max.year
 
-                 };
 
-             return type ? types[type] : types.day
 
-         },
 
-         _getDimensions: function (jQueryel) {
 
-             var offset = jQueryel.offset();
 
-             return {
 
-                 width: jQueryel.outerWidth(),
 
-                 height: jQueryel.outerHeight(),
 
-                 left: offset.left,
 
-                 top: offset.top
 
-             }
 
-         },
 
-         _getDateFromCell: function (cell) {
 
-             var curDate = this.parsedDate,
 
-                 year = cell.data('year') || curDate.year,
 
-                 month = cell.data('month') == undefined ? curDate.month : cell.data('month'),
 
-                 date = cell.data('date') || 1;
 
-             return new Date(year, month, date);
 
-         },
 
-         _setPositionClasses: function (pos) {
 
-             pos = pos.split(' ');
 
-             var main = pos[0],
 
-                 sec = pos[1],
 
-                 classes = 'datepicker -' + main + '-' + sec + '- -from-' + main + '-';
 
-             if (this.visible) classes += ' active';
 
-             this.jQuerydatepicker
 
-                 .removeAttr('class')
 
-                 .addClass(classes);
 
-         },
 
-         setPosition: function (position) {
 
-             position = position || this.opts.position;
 
-             var dims = this._getDimensions(this.jQueryel),
 
-                 selfDims = this._getDimensions(this.jQuerydatepicker),
 
-                 pos = position.split(' '),
 
-                 top, left,
 
-                 offset = this.opts.offset,
 
-                 main = pos[0],
 
-                 secondary = pos[1];
 
-             switch (main) {
 
-                 case 'top':
 
-                     top = dims.top - selfDims.height - offset;
 
-                     break;
 
-                 case 'right':
 
-                     left = dims.left + dims.width + offset;
 
-                     break;
 
-                 case 'bottom':
 
-                     top = dims.top + dims.height + offset;
 
-                     break;
 
-                 case 'left':
 
-                     left = dims.left - selfDims.width - offset;
 
-                     break;
 
-             }
 
-             switch(secondary) {
 
-                 case 'top':
 
-                     top = dims.top;
 
-                     break;
 
-                 case 'right':
 
-                     left = dims.left + dims.width - selfDims.width;
 
-                     break;
 
-                 case 'bottom':
 
-                     top = dims.top + dims.height - selfDims.height;
 
-                     break;
 
-                 case 'left':
 
-                     left = dims.left;
 
-                     break;
 
-                 case 'center':
 
-                     if (/left|right/.test(main)) {
 
-                         top = dims.top + dims.height/2 - selfDims.height/2;
 
-                     } else {
 
-                         left = dims.left + dims.width/2 - selfDims.width/2;
 
-                     }
 
-             }
 
-             this.jQuerydatepicker
 
-                 .css({
 
-                     left: left,
 
-                     top: top
 
-                 })
 
-         },
 
-         show: function () {
 
-             var onShow = this.opts.onShow;
 
-             this.setPosition(this.opts.position);
 
-             this.jQuerydatepicker.addClass('active');
 
-             this.visible = true;
 
-             if (onShow) {
 
-                 this._bindVisionEvents(onShow)
 
-             }
 
-         },
 
-         hide: function () {
 
-             var onHide = this.opts.onHide;
 
-             this.jQuerydatepicker
 
-                 .removeClass('active')
 
-                 .css({
 
-                     left: '-100000px'
 
-                 });
 
-             this.focused = '';
 
-             this.keys = [];
 
-             this.inFocus = false;
 
-             this.visible = false;
 
-             this.jQueryel.blur();
 
-             if (onHide) {
 
-                 this._bindVisionEvents(onHide)
 
-             }
 
-         },
 
-         down: function (date) {
 
-             this._changeView(date, 'down');
 
-         },
 
-         up: function (date) {
 
-             this._changeView(date, 'up');
 
-         },
 
-         _bindVisionEvents: function (event) {
 
-             this.jQuerydatepicker.off('transitionend.dp');
 
-             event(this, false);
 
-             this.jQuerydatepicker.one('transitionend.dp', event.bind(this, this, true))
 
-         },
 
-         _changeView: function (date, dir) {
 
-             date = date || this.focused || this.date;
 
-             var nextView = dir == 'up' ? this.viewIndex + 1 : this.viewIndex - 1;
 
-             if (nextView > 2) nextView = 2;
 
-             if (nextView < 0) nextView = 0;
 
-             this.silent = true;
 
-             this.date = new Date(date.getFullYear(), date.getMonth(), 1);
 
-             this.silent = false;
 
-             this.view = this.viewIndexes[nextView];
 
-         },
 
-         _handleHotKey: function (key) {
 
-             var date = datepicker.getParsedDate(this._getFocusedDate()),
 
-                 focusedParsed,
 
-                 o = this.opts,
 
-                 newDate,
 
-                 totalDaysInNextMonth,
 
-                 monthChanged = false,
 
-                 yearChanged = false,
 
-                 decadeChanged = false,
 
-                 y = date.year,
 
-                 m = date.month,
 
-                 d = date.date;
 
-             switch (key) {
 
-                 case 'ctrlRight':
 
-                 case 'ctrlUp':
 
-                     m += 1;
 
-                     monthChanged = true;
 
-                     break;
 
-                 case 'ctrlLeft':
 
-                 case 'ctrlDown':
 
-                     m -= 1;
 
-                     monthChanged = true;
 
-                     break;
 
-                 case 'shiftRight':
 
-                 case 'shiftUp':
 
-                     yearChanged = true;
 
-                     y += 1;
 
-                     break;
 
-                 case 'shiftLeft':
 
-                 case 'shiftDown':
 
-                     yearChanged = true;
 
-                     y -= 1;
 
-                     break;
 
-                 case 'altRight':
 
-                 case 'altUp':
 
-                     decadeChanged = true;
 
-                     y += 10;
 
-                     break;
 
-                 case 'altLeft':
 
-                 case 'altDown':
 
-                     decadeChanged = true;
 
-                     y -= 10;
 
-                     break;
 
-                 case 'ctrlShiftUp':
 
-                     this.up();
 
-                     break;
 
-             }
 
-             totalDaysInNextMonth = datepicker.getDaysCount(new Date(y,m));
 
-             newDate = new Date(y,m,d);
 
-             // If next month has less days than current, set date to total days in that month
 
-             if (totalDaysInNextMonth < d) d = totalDaysInNextMonth;
 
-             // Check if newDate is in valid range
 
-             if (newDate.getTime() < this.minTime) {
 
-                 newDate = this.minDate;
 
-             } else if (newDate.getTime() > this.maxTime) {
 
-                 newDate = this.maxDate;
 
-             }
 
-             this.focused = newDate;
 
-             focusedParsed = datepicker.getParsedDate(newDate);
 
-             if (monthChanged && o.onChangeMonth) {
 
-                 o.onChangeMonth(focusedParsed.month, focusedParsed.year)
 
-             }
 
-             if (yearChanged && o.onChangeYear) {
 
-                 o.onChangeYear(focusedParsed.year)
 
-             }
 
-             if (decadeChanged && o.onChangeDecade) {
 
-                 o.onChangeDecade(this.curDecade)
 
-             }
 
-         },
 
-         _registerKey: function (key) {
 
-             var exists = this.keys.some(function (curKey) {
 
-                 return curKey == key;
 
-             });
 
-             if (!exists) {
 
-                 this.keys.push(key)
 
-             }
 
-         },
 
-         _unRegisterKey: function (key) {
 
-             var index = this.keys.indexOf(key);
 
-             this.keys.splice(index, 1);
 
-         },
 
-         _isHotKeyPressed: function () {
 
-             var currentHotKey,
 
-                 found = false,
 
-                 _this = this,
 
-                 pressedKeys = this.keys.sort();
 
-             for (var hotKey in hotKeys) {
 
-                 currentHotKey = hotKeys[hotKey];
 
-                 if (pressedKeys.length != currentHotKey.length) continue;
 
-                 if (currentHotKey.every(function (key, i) { return key == pressedKeys[i]})) {
 
-                     _this._trigger('hotKey', hotKey);
 
-                     found = true;
 
-                 }
 
-             }
 
-             return found;
 
-         },
 
-         _trigger: function (event, args) {
 
-             this.jQueryel.trigger(event, args)
 
-         },
 
-         _focusNextCell: function (keyCode, type) {
 
-             type = type || this.cellType;
 
-             var date = datepicker.getParsedDate(this._getFocusedDate()),
 
-                 y = date.year,
 
-                 m = date.month,
 
-                 d = date.date;
 
-             if (this._isHotKeyPressed()){
 
-                 return;
 
-             }
 
-             switch(keyCode) {
 
-                 case 37: // left
 
-                     type == 'day' ? (d -= 1) : '';
 
-                     type == 'month' ? (m -= 1) : '';
 
-                     type == 'year' ? (y -= 1) : '';
 
-                     break;
 
-                 case 38: // up
 
-                     type == 'day' ? (d -= 7) : '';
 
-                     type == 'month' ? (m -= 3) : '';
 
-                     type == 'year' ? (y -= 4) : '';
 
-                     break;
 
-                 case 39: // right
 
-                     type == 'day' ? (d += 1) : '';
 
-                     type == 'month' ? (m += 1) : '';
 
-                     type == 'year' ? (y += 1) : '';
 
-                     break;
 
-                 case 40: // down
 
-                     type == 'day' ? (d += 7) : '';
 
-                     type == 'month' ? (m += 3) : '';
 
-                     type == 'year' ? (y += 4) : '';
 
-                     break;
 
-             }
 
-             var nd = new Date(y,m,d);
 
-             if (nd.getTime() < this.minTime) {
 
-                 nd = this.minDate;
 
-             } else if (nd.getTime() > this.maxTime) {
 
-                 nd = this.maxDate;
 
-             }
 
-             this.focused = nd;
 
-         },
 
-         _getFocusedDate: function () {
 
-             var focused  = this.focused || this.selectedDates[this.selectedDates.length - 1],
 
-                 d = this.parsedDate;
 
-             if (!focused) {
 
-                 switch (this.view) {
 
-                     case 'days':
 
-                         focused = new Date(d.year, d.month, new Date().getDate());
 
-                         break;
 
-                     case 'months':
 
-                         focused = new Date(d.year, d.month, 1);
 
-                         break;
 
-                     case 'years':
 
-                         focused = new Date(d.year, 0, 1);
 
-                         break;
 
-                 }
 
-             }
 
-             return focused;
 
-         },
 
-         _getCell: function (date, type) {
 
-             type = type || this.cellType;
 
-             var d = datepicker.getParsedDate(date),
 
-                 selector = '.datepicker--cell[data-year="' + d.year + '"]',
 
-                 jQuerycell;
 
-             switch (type) {
 
-                 case 'month':
 
-                     selector = '[data-month="' + d.month + '"]';
 
-                     break;
 
-                 case 'day':
 
-                     selector += '[data-month="' + d.month + '"][data-date="' + d.date + '"]';
 
-                     break;
 
-             }
 
-             jQuerycell = this.views[this.currentView].jQueryel.find(selector);
 
-             return jQuerycell.length ? jQuerycell : jQuery('');
 
-         },
 
-         destroy: function () {
 
-             var _this = this;
 
-             _this.jQueryel
 
-                 .off('.adp')
 
-                 .data('datepicker', '');
 
-             _this.selectedDates = [];
 
-             _this.focused = '';
 
-             _this.views = {};
 
-             _this.keys = [];
 
-             _this.minRange = '';
 
-             _this.maxRange = '';
 
-             if (_this.opts.inline || !_this.elIsInput) {
 
-                 _this.jQuerydatepicker.closest('.datepicker-inline').remove();
 
-             } else {
 
-                 _this.jQuerydatepicker.remove();
 
-             }
 
-         },
 
-         _handleAlreadySelectedDates: function (alreadySelected, selectedDate) {
 
-             if (this.opts.range) {
 
-                 if (!this.opts.toggleSelected) {
 
-                     // Add possibility to select same date when range is true
 
-                     if (this.selectedDates.length != 2) {
 
-                         this._trigger('clickCell', selectedDate);
 
-                     }
 
-                 } else {
 
-                     this.removeDate(selectedDate);
 
-                 }
 
-             } else if (this.opts.toggleSelected){
 
-                 this.removeDate(selectedDate);
 
-             }
 
-             // Change last selected date to be able to change time when clicking on this cell
 
-             if (!this.opts.toggleSelected) {
 
-                 this.lastSelectedDate = alreadySelected;
 
-                 if (this.opts.timepicker) {
 
-                     this.timepicker._setTime(alreadySelected);
 
-                     this.timepicker.update();
 
-                 }
 
-             }
 
-         },
 
-         _onShowEvent: function (e) {
 
-             if (!this.visible) {
 
-                 this.show();
 
-             }
 
-         },
 
-         _onBlur: function () {
 
-             if (!this.inFocus && this.visible) {
 
-                 this.hide();
 
-             }
 
-         },
 
-         _onMouseDownDatepicker: function (e) {
 
-             this.inFocus = true;
 
-         },
 
-         _onMouseUpDatepicker: function (e) {
 
-             this.inFocus = false;
 
-             e.originalEvent.inFocus = true;
 
-             if (!e.originalEvent.timepickerFocus) this.jQueryel.focus();
 
-         },
 
-         _onKeyUpGeneral: function (e) {
 
-             var val = this.jQueryel.val();
 
-             if (!val) {
 
-                 this.clear();
 
-             }
 
-         },
 
-         _onResize: function () {
 
-             if (this.visible) {
 
-                 this.setPosition();
 
-             }
 
-         },
 
-         _onMouseUpBody: function (e) {
 
-             if (e.originalEvent.inFocus) return;
 
-             if (this.visible && !this.inFocus) {
 
-                 this.hide();
 
-             }
 
-         },
 
-         _onMouseUpEl: function (e) {
 
-             e.originalEvent.inFocus = true;
 
-             setTimeout(this._onKeyUpGeneral.bind(this),4);
 
-         },
 
-         _onKeyDown: function (e) {
 
-             var code = e.which;
 
-             this._registerKey(code);
 
-             // Arrows
 
-             if (code >= 37 && code <= 40) {
 
-                 e.preventDefault();
 
-                 this._focusNextCell(code);
 
-             }
 
-             // Enter
 
-             if (code == 13) {
 
-                 if (this.focused) {
 
-                     if (this._getCell(this.focused).hasClass('-disabled-')) return;
 
-                     if (this.view != this.opts.minView) {
 
-                         this.down()
 
-                     } else {
 
-                         var alreadySelected = this._isSelected(this.focused, this.cellType);
 
-                         if (!alreadySelected) {
 
-                             if (this.timepicker) {
 
-                                 this.focused.setHours(this.timepicker.hours);
 
-                                 this.focused.setMinutes(this.timepicker.minutes);
 
-                             }
 
-                             this.selectDate(this.focused);
 
-                             return;
 
-                         }
 
-                         this._handleAlreadySelectedDates(alreadySelected, this.focused)
 
-                     }
 
-                 }
 
-             }
 
-             // Esc
 
-             if (code == 27) {
 
-                 this.hide();
 
-             }
 
-         },
 
-         _onKeyUp: function (e) {
 
-             var code = e.which;
 
-             this._unRegisterKey(code);
 
-         },
 
-         _onHotKey: function (e, hotKey) {
 
-             this._handleHotKey(hotKey);
 
-         },
 
-         _onMouseEnterCell: function (e) {
 
-             var jQuerycell = jQuery(e.target).closest('.datepicker--cell'),
 
-                 date = this._getDateFromCell(jQuerycell);
 
-             // Prevent from unnecessary rendering and setting new currentDate
 
-             this.silent = true;
 
-             if (this.focused) {
 
-                 this.focused = ''
 
-             }
 
-             jQuerycell.addClass('-focus-');
 
-             this.focused = date;
 
-             this.silent = false;
 
-             if (this.opts.range && this.selectedDates.length == 1) {
 
-                 this.minRange = this.selectedDates[0];
 
-                 this.maxRange = '';
 
-                 if (datepicker.less(this.minRange, this.focused)) {
 
-                     this.maxRange = this.minRange;
 
-                     this.minRange = '';
 
-                 }
 
-                 this.views[this.currentView]._update();
 
-             }
 
-         },
 
-         _onMouseLeaveCell: function (e) {
 
-             var jQuerycell = jQuery(e.target).closest('.datepicker--cell');
 
-             jQuerycell.removeClass('-focus-');
 
-             this.silent = true;
 
-             this.focused = '';
 
-             this.silent = false;
 
-         },
 
-         _onTimeChange: function (e, h, m) {
 
-             var date = new Date(),
 
-                 selectedDates = this.selectedDates,
 
-                 selected = false;
 
-             if (selectedDates.length) {
 
-                 selected = true;
 
-                 date = this.lastSelectedDate;
 
-             }
 
-             date.setHours(h);
 
-             date.setMinutes(m);
 
-             if (!selected && !this._getCell(date).hasClass('-disabled-')) {
 
-                 this.selectDate(date);
 
-             } else {
 
-                 this._setInputValue();
 
-                 if (this.opts.onSelect) {
 
-                     this._triggerOnChange();
 
-                 }
 
-             }
 
-         },
 
-         _onClickCell: function (e, date) {
 
-             if (this.timepicker) {
 
-                 date.setHours(this.timepicker.hours);
 
-                 date.setMinutes(this.timepicker.minutes);
 
-             }
 
-             this.selectDate(date);
 
-         },
 
-         set focused(val) {
 
-             if (!val && this.focused) {
 
-                 var jQuerycell = this._getCell(this.focused);
 
-                 if (jQuerycell.length) {
 
-                     jQuerycell.removeClass('-focus-')
 
-                 }
 
-             }
 
-             this._focused = val;
 
-             if (this.opts.range && this.selectedDates.length == 1) {
 
-                 this.minRange = this.selectedDates[0];
 
-                 this.maxRange = '';
 
-                 if (datepicker.less(this.minRange, this._focused)) {
 
-                     this.maxRange = this.minRange;
 
-                     this.minRange = '';
 
-                 }
 
-             }
 
-             if (this.silent) return;
 
-             this.date = val;
 
-         },
 
-         get focused() {
 
-             return this._focused;
 
-         },
 
-         get parsedDate() {
 
-             return datepicker.getParsedDate(this.date);
 
-         },
 
-         set date (val) {
 
-             if (!(val instanceof Date)) return;
 
-             this.currentDate = val;
 
-             if (this.inited && !this.silent) {
 
-                 this.views[this.view]._render();
 
-                 this.nav._render();
 
-                 if (this.visible && this.elIsInput) {
 
-                     this.setPosition();
 
-                 }
 
-             }
 
-             return val;
 
-         },
 
-         get date () {
 
-             return this.currentDate
 
-         },
 
-         set view (val) {
 
-             this.viewIndex = this.viewIndexes.indexOf(val);
 
-             if (this.viewIndex < 0) {
 
-                 return;
 
-             }
 
-             this.prevView = this.currentView;
 
-             this.currentView = val;
 
-             if (this.inited) {
 
-                 if (!this.views[val]) {
 
-                     this.views[val] = new  jQuery.fn.datepicker.Body(this, val, this.opts)
 
-                 } else {
 
-                     this.views[val]._render();
 
-                 }
 
-                 this.views[this.prevView].hide();
 
-                 this.views[val].show();
 
-                 this.nav._render();
 
-                 if (this.opts.onChangeView) {
 
-                     this.opts.onChangeView(val)
 
-                 }
 
-                 if (this.elIsInput && this.visible) this.setPosition();
 
-             }
 
-             return val
 
-         },
 
-         get view() {
 
-             return this.currentView;
 
-         },
 
-         get cellType() {
 
-             return this.view.substring(0, this.view.length - 1)
 
-         },
 
-         get minTime() {
 
-             var min = datepicker.getParsedDate(this.minDate);
 
-             return new Date(min.year, min.month, min.date).getTime()
 
-         },
 
-         get maxTime() {
 
-             var max = datepicker.getParsedDate(this.maxDate);
 
-             return new Date(max.year, max.month, max.date).getTime()
 
-         },
 
-         get curDecade() {
 
-             return datepicker.getDecade(this.date)
 
-         }
 
-     };
 
-     //  Utils
 
-     // -------------------------------------------------
 
-     datepicker.getDaysCount = function (date) {
 
-         return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
 
-     };
 
-     datepicker.getParsedDate = function (date) {
 
-         return {
 
-             year: date.getFullYear(),
 
-             month: date.getMonth(),
 
-             fullMonth: (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1, // One based
 
-             date: date.getDate(),
 
-             fullDate: date.getDate() < 10 ? '0' + date.getDate() : date.getDate(),
 
-             day: date.getDay(),
 
-             hours: date.getHours(),
 
-             fullHours:  date.getHours() < 10 ? '0' + date.getHours() :  date.getHours() ,
 
-             minutes: date.getMinutes(),
 
-             fullMinutes:  date.getMinutes() < 10 ? '0' + date.getMinutes() :  date.getMinutes()
 
-         }
 
-     };
 
-     datepicker.getDecade = function (date) {
 
-         var firstYear = Math.floor(date.getFullYear() / 10) * 10;
 
-         return [firstYear, firstYear + 9];
 
-     };
 
-     datepicker.template = function (str, data) {
 
-         return str.replace(/#\{([\w]+)\}/g, function (source, match) {
 
-             if (data[match] || data[match] === 0) {
 
-                 return data[match]
 
-             }
 
-         });
 
-     };
 
-     datepicker.isSame = function (date1, date2, type) {
 
-         if (!date1 || !date2) return false;
 
-         var d1 = datepicker.getParsedDate(date1),
 
-             d2 = datepicker.getParsedDate(date2),
 
-             _type = type ? type : 'day',
 
-             conditions = {
 
-                 day: d1.date == d2.date && d1.month == d2.month && d1.year == d2.year,
 
-                 month: d1.month == d2.month && d1.year == d2.year,
 
-                 year: d1.year == d2.year
 
-             };
 
-         return conditions[_type];
 
-     };
 
-     datepicker.less = function (dateCompareTo, date, type) {
 
-         if (!dateCompareTo || !date) return false;
 
-         return date.getTime() < dateCompareTo.getTime();
 
-     };
 
-     datepicker.bigger = function (dateCompareTo, date, type) {
 
-         if (!dateCompareTo || !date) return false;
 
-         return date.getTime() > dateCompareTo.getTime();
 
-     };
 
-     datepicker.getLeadingZeroNum = function (num) {
 
-         return parseInt(num) < 10 ? '0' + num : num;
 
-     };
 
-     /**
 
-      * Returns copy of date with hours and minutes equals to 0
 
-      * @param date {Date}
 
-      */
 
-     datepicker.resetTime = function (date) {
 
-         if (typeof date != 'object') return;
 
-         date = datepicker.getParsedDate(date);
 
-         return new Date(date.year, date.month, date.date)
 
-     };
 
-     jQuery.fn.datepicker = function ( options ) {
 
-         return this.each(function () {
 
-             if (!jQuery.data(this, pluginName)) {
 
-                 jQuery.data(this,  pluginName,
 
-                     new Datepicker( this, options ));
 
-             } else {
 
-                 var _this = jQuery.data(this, pluginName);
 
-                 _this.opts = jQuery.extend(true, _this.opts, options);
 
-                 _this.update();
 
-             }
 
-         });
 
-     };
 
-     jQuery.fn.datepicker.Constructor = Datepicker;
 
-     jQuery.fn.datepicker.language = {
 
-         ru: {
 
-             days: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
 
-             daysShort: ['Вос','Пон','Вто','Сре','Чет','Пят','Суб'],
 
-             daysMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
 
-             months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
 
-             monthsShort: ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'],
 
-             today: 'Сегодня',
 
-             clear: 'Очистить',
 
-             dateFormat: 'dd.mm.yyyy',
 
-             timeFormat: 'hh:ii',
 
-             firstDay: 1
 
-         }
 
-     };
 
-     jQuery(function () {
 
-         jQuery(autoInitSelector).datepicker();
 
-     })
 
- })();
 
- ;(function () {
 
-     var templates = {
 
-         days:'' +
 
-         '<div class="datepicker--days datepicker--body">' +
 
-         '<div class="datepicker--days-names"></div>' +
 
-         '<div class="datepicker--cells datepicker--cells-days"></div>' +
 
-         '</div>',
 
-         months: '' +
 
-         '<div class="datepicker--months datepicker--body">' +
 
-         '<div class="datepicker--cells datepicker--cells-months"></div>' +
 
-         '</div>',
 
-         years: '' +
 
-         '<div class="datepicker--years datepicker--body">' +
 
-         '<div class="datepicker--cells datepicker--cells-years"></div>' +
 
-         '</div>'
 
-         },
 
-         datepicker = jQuery.fn.datepicker,
 
-         dp = datepicker.Constructor;
 
-     datepicker.Body = function (d, type, opts) {
 
-         this.d = d;
 
-         this.type = type;
 
-         this.opts = opts;
 
-         this.jQueryel = jQuery('');
 
-         if (this.opts.onlyTimepicker) return;
 
-         this.init();
 
-     };
 
-     datepicker.Body.prototype = {
 
-         init: function () {
 
-             this._buildBaseHtml();
 
-             this._render();
 
-             this._bindEvents();
 
-         },
 
-         _bindEvents: function () {
 
-             this.jQueryel.on('click', '.datepicker--cell', jQuery.proxy(this._onClickCell, this));
 
-         },
 
-         _buildBaseHtml: function () {
 
-             this.jQueryel = jQuery(templates[this.type]).appendTo(this.d.jQuerycontent);
 
-             this.jQuerynames = jQuery('.datepicker--days-names', this.jQueryel);
 
-             this.jQuerycells = jQuery('.datepicker--cells', this.jQueryel);
 
-         },
 
-         _getDayNamesHtml: function (firstDay, curDay, html, i) {
 
-             curDay = curDay != undefined ? curDay : firstDay;
 
-             html = html ? html : '';
 
-             i = i != undefined ? i : 0;
 
-             if (i > 7) return html;
 
-             if (curDay == 7) return this._getDayNamesHtml(firstDay, 0, html, ++i);
 
-             html += '<div class="datepicker--day-name' + (this.d.isWeekend(curDay) ? " -weekend-" : "") + '">' + this.d.loc.daysMin[curDay] + '</div>';
 
-             return this._getDayNamesHtml(firstDay, ++curDay, html, ++i);
 
-         },
 
-         _getCellContents: function (date, type) {
 
-             var classes = "datepicker--cell datepicker--cell-" + type,
 
-                 currentDate = new Date(),
 
-                 parent = this.d,
 
-                 minRange = dp.resetTime(parent.minRange),
 
-                 maxRange = dp.resetTime(parent.maxRange),
 
-                 opts = parent.opts,
 
-                 d = dp.getParsedDate(date),
 
-                 render = {},
 
-                 html = d.date;
 
-             switch (type) {
 
-                 case 'day':
 
-                     if (parent.isWeekend(d.day)) classes += " -weekend-";
 
-                     if (d.month != this.d.parsedDate.month) {
 
-                         classes += " -other-month-";
 
-                         if (!opts.selectOtherMonths) {
 
-                             classes += " -disabled-";
 
-                         }
 
-                         if (!opts.showOtherMonths) html = '';
 
-                     }
 
-                     break;
 
-                 case 'month':
 
-                     html = parent.loc[parent.opts.monthsField][d.month];
 
-                     break;
 
-                 case 'year':
 
-                     var decade = parent.curDecade;
 
-                     html = d.year;
 
-                     if (d.year < decade[0] || d.year > decade[1]) {
 
-                         classes += ' -other-decade-';
 
-                         if (!opts.selectOtherYears) {
 
-                             classes += " -disabled-";
 
-                         }
 
-                         if (!opts.showOtherYears) html = '';
 
-                     }
 
-                     break;
 
-             }
 
-             if (opts.onRenderCell) {
 
-                 render = opts.onRenderCell(date, type) || {};
 
-                 html = render.html ? render.html : html;
 
-                 classes += render.classes ? ' ' + render.classes : '';
 
-             }
 
-             if (opts.range) {
 
-                 if (dp.isSame(minRange, date, type)) classes += ' -range-from-';
 
-                 if (dp.isSame(maxRange, date, type)) classes += ' -range-to-';
 
-                 if (parent.selectedDates.length == 1 && parent.focused) {
 
-                     if (
 
-                         (dp.bigger(minRange, date) && dp.less(parent.focused, date)) ||
 
-                         (dp.less(maxRange, date) && dp.bigger(parent.focused, date)))
 
-                     {
 
-                         classes += ' -in-range-'
 
-                     }
 
-                     if (dp.less(maxRange, date) && dp.isSame(parent.focused, date)) {
 
-                         classes += ' -range-from-'
 
-                     }
 
-                     if (dp.bigger(minRange, date) && dp.isSame(parent.focused, date)) {
 
-                         classes += ' -range-to-'
 
-                     }
 
-                 } else if (parent.selectedDates.length == 2) {
 
-                     if (dp.bigger(minRange, date) && dp.less(maxRange, date)) {
 
-                         classes += ' -in-range-'
 
-                     }
 
-                 }
 
-             }
 
-             if (dp.isSame(currentDate, date, type)) classes += ' -current-';
 
-             if (parent.focused && dp.isSame(date, parent.focused, type)) classes += ' -focus-';
 
-             if (parent._isSelected(date, type)) classes += ' -selected-';
 
-             if (!parent._isInRange(date, type) || render.disabled) classes += ' -disabled-';
 
-             return {
 
-                 html: html,
 
-                 classes: classes
 
-             }
 
-         },
 
-         /**
 
-          * Calculates days number to render. Generates days html and returns it.
 
-          * @param {object} date - Date object
 
-          * @returns {string}
 
-          * @private
 
-          */
 
-         _getDaysHtml: function (date) {
 
-             var totalMonthDays = dp.getDaysCount(date),
 
-                 firstMonthDay = new Date(date.getFullYear(), date.getMonth(), 1).getDay(),
 
-                 lastMonthDay = new Date(date.getFullYear(), date.getMonth(), totalMonthDays).getDay(),
 
-                 daysFromPevMonth = firstMonthDay - this.d.loc.firstDay,
 
-                 daysFromNextMonth = 6 - lastMonthDay + this.d.loc.firstDay;
 
-             daysFromPevMonth = daysFromPevMonth < 0 ? daysFromPevMonth + 7 : daysFromPevMonth;
 
-             daysFromNextMonth = daysFromNextMonth > 6 ? daysFromNextMonth - 7 : daysFromNextMonth;
 
-             var startDayIndex = -daysFromPevMonth + 1,
 
-                 m, y,
 
-                 html = '';
 
-             for (var i = startDayIndex, max = totalMonthDays + daysFromNextMonth; i <= max; i++) {
 
-                 y = date.getFullYear();
 
-                 m = date.getMonth();
 
-                 html += this._getDayHtml(new Date(y, m, i))
 
-             }
 
-             return html;
 
-         },
 
-         _getDayHtml: function (date) {
 
-            var content = this._getCellContents(date, 'day');
 
-             return '<div class="' + content.classes + '" ' +
 
-                 'data-date="' + date.getDate() + '" ' +
 
-                 'data-month="' + date.getMonth() + '" ' +
 
-                 'data-year="' + date.getFullYear() + '">' + content.html + '</div>';
 
-         },
 
-         /**
 
-          * Generates months html
 
-          * @param {object} date - date instance
 
-          * @returns {string}
 
-          * @private
 
-          */
 
-         _getMonthsHtml: function (date) {
 
-             var html = '',
 
-                 d = dp.getParsedDate(date),
 
-                 i = 0;
 
-             while(i < 12) {
 
-                 html += this._getMonthHtml(new Date(d.year, i));
 
-                 i++
 
-             }
 
-             return html;
 
-         },
 
-         _getMonthHtml: function (date) {
 
-             var content = this._getCellContents(date, 'month');
 
-             return '<div class="' + content.classes + '" data-month="' + date.getMonth() + '">' + content.html + '</div>'
 
-         },
 
-         _getYearsHtml: function (date) {
 
-             var d = dp.getParsedDate(date),
 
-                 decade = dp.getDecade(date),
 
-                 firstYear = decade[0] - 1,
 
-                 html = '',
 
-                 i = firstYear;
 
-             for (i; i <= decade[1] + 1; i++) {
 
-                 html += this._getYearHtml(new Date(i , 0));
 
-             }
 
-             return html;
 
-         },
 
-         _getYearHtml: function (date) {
 
-             var content = this._getCellContents(date, 'year');
 
-             return '<div class="' + content.classes + '" data-year="' + date.getFullYear() + '">' + content.html + '</div>'
 
-         },
 
-         _renderTypes: {
 
-             days: function () {
 
-                 var dayNames = this._getDayNamesHtml(this.d.loc.firstDay),
 
-                     days = this._getDaysHtml(this.d.currentDate);
 
-                 this.jQuerycells.html(days);
 
-                 this.jQuerynames.html(dayNames)
 
-             },
 
-             months: function () {
 
-                 var html = this._getMonthsHtml(this.d.currentDate);
 
-                 this.jQuerycells.html(html)
 
-             },
 
-             years: function () {
 
-                 var html = this._getYearsHtml(this.d.currentDate);
 
-                 this.jQuerycells.html(html)
 
-             }
 
-         },
 
-         _render: function () {
 
-             if (this.opts.onlyTimepicker) return;
 
-             this._renderTypes[this.type].bind(this)();
 
-         },
 
-         _update: function () {
 
-             var jQuerycells = jQuery('.datepicker--cell', this.jQuerycells),
 
-                 _this = this,
 
-                 classes,
 
-                 jQuerycell,
 
-                 date;
 
-             jQuerycells.each(function (cell, i) {
 
-                 jQuerycell = jQuery(this);
 
-                 date = _this.d._getDateFromCell(jQuery(this));
 
-                 classes = _this._getCellContents(date, _this.d.cellType);
 
-                 jQuerycell.attr('class',classes.classes)
 
-             });
 
-         },
 
-         show: function () {
 
-             if (this.opts.onlyTimepicker) return;
 
-             this.jQueryel.addClass('active');
 
-             this.acitve = true;
 
-         },
 
-         hide: function () {
 
-             this.jQueryel.removeClass('active');
 
-             this.active = false;
 
-         },
 
-         //  Events
 
-         // -------------------------------------------------
 
-         _handleClick: function (el) {
 
-             var date = el.data('date') || 1,
 
-                 month = el.data('month') || 0,
 
-                 year = el.data('year') || this.d.parsedDate.year,
 
-                 dp = this.d;
 
-             // Change view if min view does not reach yet
 
-             if (dp.view != this.opts.minView) {
 
-                 dp.down(new Date(year, month, date));
 
-                 return;
 
-             }
 
-             // Select date if min view is reached
 
-             var selectedDate = new Date(year, month, date),
 
-                 alreadySelected = this.d._isSelected(selectedDate, this.d.cellType);
 
-             if (!alreadySelected) {
 
-                 dp._trigger('clickCell', selectedDate);
 
-                 return;
 
-             }
 
-             dp._handleAlreadySelectedDates.bind(dp, alreadySelected, selectedDate)();
 
-         },
 
-         _onClickCell: function (e) {
 
-             var jQueryel = jQuery(e.target).closest('.datepicker--cell');
 
-             if (jQueryel.hasClass('-disabled-')) return;
 
-             this._handleClick.bind(this)(jQueryel);
 
-         }
 
-     };
 
- })();
 
- ;(function () {
 
-     var template = '' +
 
-         '<div class="datepicker--nav-action" data-action="prev">#{prevHtml}</div>' +
 
-         '<div class="datepicker--nav-title">#{title}</div>' +
 
-         '<div class="datepicker--nav-action" data-action="next">#{nextHtml}</div>',
 
-         buttonsContainerTemplate = '<div class="datepicker--buttons"></div>',
 
-         button = '<span class="datepicker--button" data-action="#{action}">#{label}</span>',
 
-         datepicker = jQuery.fn.datepicker,
 
-         dp = datepicker.Constructor;
 
-     datepicker.Navigation = function (d, opts) {
 
-         this.d = d;
 
-         this.opts = opts;
 
-         this.jQuerybuttonsContainer = '';
 
-         this.init();
 
-     };
 
-     datepicker.Navigation.prototype = {
 
-         init: function () {
 
-             this._buildBaseHtml();
 
-             this._bindEvents();
 
-         },
 
-         _bindEvents: function () {
 
-             this.d.jQuerynav.on('click', '.datepicker--nav-action', jQuery.proxy(this._onClickNavButton, this));
 
-             this.d.jQuerynav.on('click', '.datepicker--nav-title', jQuery.proxy(this._onClickNavTitle, this));
 
-             this.d.jQuerydatepicker.on('click', '.datepicker--button', jQuery.proxy(this._onClickNavButton, this));
 
-         },
 
-         _buildBaseHtml: function () {
 
-             if (!this.opts.onlyTimepicker) {
 
-                 this._render();
 
-             }
 
-             this._addButtonsIfNeed();
 
-         },
 
-         _addButtonsIfNeed: function () {
 
-             if (this.opts.todayButton) {
 
-                 this._addButton('today')
 
-             }
 
-             if (this.opts.clearButton) {
 
-                 this._addButton('clear')
 
-             }
 
-         },
 
-         _render: function () {
 
-             var title = this._getTitle(this.d.currentDate),
 
-                 html = dp.template(template, jQuery.extend({title: title}, this.opts));
 
-             this.d.jQuerynav.html(html);
 
-             if (this.d.view == 'years') {
 
-                 jQuery('.datepicker--nav-title', this.d.jQuerynav).addClass('-disabled-');
 
-             }
 
-             this.setNavStatus();
 
-         },
 
-         _getTitle: function (date) {
 
-             return this.d.formatDate(this.opts.navTitles[this.d.view], date)
 
-         },
 
-         _addButton: function (type) {
 
-             if (!this.jQuerybuttonsContainer.length) {
 
-                 this._addButtonsContainer();
 
-             }
 
-             var data = {
 
-                     action: type,
 
-                     label: this.d.loc[type]
 
-                 },
 
-                 html = dp.template(button, data);
 
-             if (jQuery('[data-action=' + type + ']', this.jQuerybuttonsContainer).length) return;
 
-             this.jQuerybuttonsContainer.append(html);
 
-         },
 
-         _addButtonsContainer: function () {
 
-             this.d.jQuerydatepicker.append(buttonsContainerTemplate);
 
-             this.jQuerybuttonsContainer = jQuery('.datepicker--buttons', this.d.jQuerydatepicker);
 
-         },
 
-         setNavStatus: function () {
 
-             if (!(this.opts.minDate || this.opts.maxDate) || !this.opts.disableNavWhenOutOfRange) return;
 
-             var date = this.d.parsedDate,
 
-                 m = date.month,
 
-                 y = date.year,
 
-                 d = date.date;
 
-             switch (this.d.view) {
 
-                 case 'days':
 
-                     if (!this.d._isInRange(new Date(y, m-1, 1), 'month')) {
 
-                         this._disableNav('prev')
 
-                     }
 
-                     if (!this.d._isInRange(new Date(y, m+1, 1), 'month')) {
 
-                         this._disableNav('next')
 
-                     }
 
-                     break;
 
-                 case 'months':
 
-                     if (!this.d._isInRange(new Date(y-1, m, d), 'year')) {
 
-                         this._disableNav('prev')
 
-                     }
 
-                     if (!this.d._isInRange(new Date(y+1, m, d), 'year')) {
 
-                         this._disableNav('next')
 
-                     }
 
-                     break;
 
-                 case 'years':
 
-                     var decade = dp.getDecade(this.d.date);
 
-                     if (!this.d._isInRange(new Date(decade[0] - 1, 0, 1), 'year')) {
 
-                         this._disableNav('prev')
 
-                     }
 
-                     if (!this.d._isInRange(new Date(decade[1] + 1, 0, 1), 'year')) {
 
-                         this._disableNav('next')
 
-                     }
 
-                     break;
 
-             }
 
-         },
 
-         _disableNav: function (nav) {
 
-             jQuery('[data-action="' + nav + '"]', this.d.jQuerynav).addClass('-disabled-')
 
-         },
 
-         _activateNav: function (nav) {
 
-             jQuery('[data-action="' + nav + '"]', this.d.jQuerynav).removeClass('-disabled-')
 
-         },
 
-         _onClickNavButton: function (e) {
 
-             var jQueryel = jQuery(e.target).closest('[data-action]'),
 
-                 action = jQueryel.data('action');
 
-             this.d[action]();
 
-         },
 
-         _onClickNavTitle: function (e) {
 
-             if (jQuery(e.target).hasClass('-disabled-')) return;
 
-             if (this.d.view == 'days') {
 
-                 return this.d.view = 'months'
 
-             }
 
-             this.d.view = 'years';
 
-         }
 
-     }
 
- })();
 
- ;(function () {
 
-     var template = '<div class="datepicker--time">' +
 
-         '<div class="datepicker--time-current">' +
 
-         '   <span class="datepicker--time-current-hours">#{hourVisible}</span>' +
 
-         '   <span class="datepicker--time-current-colon">:</span>' +
 
-         '   <span class="datepicker--time-current-minutes">#{minValue}</span>' +
 
-         '</div>' +
 
-         '<div class="datepicker--time-sliders">' +
 
-         '   <div class="datepicker--time-row">' +
 
-         '      <input type="range" name="hours" value="#{hourValue}" min="#{hourMin}" max="#{hourMax}" step="#{hourStep}"/>' +
 
-         '   </div>' +
 
-         '   <div class="datepicker--time-row">' +
 
-         '      <input type="range" name="minutes" value="#{minValue}" min="#{minMin}" max="#{minMax}" step="#{minStep}"/>' +
 
-         '   </div>' +
 
-         '</div>' +
 
-         '</div>',
 
-         datepicker = jQuery.fn.datepicker,
 
-         dp = datepicker.Constructor;
 
-     datepicker.Timepicker = function (inst, opts) {
 
-         this.d = inst;
 
-         this.opts = opts;
 
-         this.init();
 
-     };
 
-     datepicker.Timepicker.prototype = {
 
-         init: function () {
 
-             var input = 'input';
 
-             this._setTime(this.d.date);
 
-             this._buildHTML();
 
-             if (navigator.userAgent.match(/trident/gi)) {
 
-                 input = 'change';
 
-             }
 
-             this.d.jQueryel.on('selectDate', this._onSelectDate.bind(this));
 
-             this.jQueryranges.on(input, this._onChangeRange.bind(this));
 
-             this.jQueryranges.on('mouseup', this._onMouseUpRange.bind(this));
 
-             this.jQueryranges.on('mousemove focus ', this._onMouseEnterRange.bind(this));
 
-             this.jQueryranges.on('mouseout blur', this._onMouseOutRange.bind(this));
 
-         },
 
-         _setTime: function (date) {
 
-             var _date = dp.getParsedDate(date);
 
-             this._handleDate(date);
 
-             this.hours = _date.hours < this.minHours ? this.minHours : _date.hours;
 
-             this.minutes = _date.minutes < this.minMinutes ? this.minMinutes : _date.minutes;
 
-         },
 
-         /**
 
-          * Sets minHours and minMinutes from date (usually it's a minDate)
 
-          * Also changes minMinutes if current hours are bigger then @date hours
 
-          * @param date {Date}
 
-          * @private
 
-          */
 
-         _setMinTimeFromDate: function (date) {
 
-             this.minHours = date.getHours();
 
-             this.minMinutes = date.getMinutes();
 
-             // If, for example, min hours are 10, and current hours are 12,
 
-             // update minMinutes to default value, to be able to choose whole range of values
 
-             if (this.d.lastSelectedDate) {
 
-                 if (this.d.lastSelectedDate.getHours() > date.getHours()) {
 
-                     this.minMinutes = this.opts.minMinutes;
 
-                 }
 
-             }
 
-         },
 
-         _setMaxTimeFromDate: function (date) {
 
-             this.maxHours = date.getHours();
 
-             this.maxMinutes = date.getMinutes();
 
-             if (this.d.lastSelectedDate) {
 
-                 if (this.d.lastSelectedDate.getHours() < date.getHours()) {
 
-                     this.maxMinutes = this.opts.maxMinutes;
 
-                 }
 
-             }
 
-         },
 
-         _setDefaultMinMaxTime: function () {
 
-             var maxHours = 23,
 
-                 maxMinutes = 59,
 
-                 opts = this.opts;
 
-             this.minHours = opts.minHours < 0 || opts.minHours > maxHours ? 0 : opts.minHours;
 
-             this.minMinutes = opts.minMinutes < 0 || opts.minMinutes > maxMinutes ? 0 : opts.minMinutes;
 
-             this.maxHours = opts.maxHours < 0 || opts.maxHours > maxHours ? maxHours : opts.maxHours;
 
-             this.maxMinutes = opts.maxMinutes < 0 || opts.maxMinutes > maxMinutes ? maxMinutes : opts.maxMinutes;
 
-         },
 
-         /**
 
-          * Looks for min/max hours/minutes and if current values
 
-          * are out of range sets valid values.
 
-          * @private
 
-          */
 
-         _validateHoursMinutes: function (date) {
 
-             if (this.hours < this.minHours) {
 
-                 this.hours = this.minHours;
 
-             } else if (this.hours > this.maxHours) {
 
-                 this.hours = this.maxHours;
 
-             }
 
-             if (this.minutes < this.minMinutes) {
 
-                 this.minutes = this.minMinutes;
 
-             } else if (this.minutes > this.maxMinutes) {
 
-                 this.minutes = this.maxMinutes;
 
-             }
 
-         },
 
-         _buildHTML: function () {
 
-             var lz = dp.getLeadingZeroNum,
 
-                 data = {
 
-                     hourMin: this.minHours,
 
-                     hourMax: lz(this.maxHours),
 
-                     hourStep: this.opts.hoursStep,
 
-                     hourValue: this.hours,
 
-                     hourVisible: lz(this.displayHours),
 
-                     minMin: this.minMinutes,
 
-                     minMax: lz(this.maxMinutes),
 
-                     minStep: this.opts.minutesStep,
 
-                     minValue: lz(this.minutes)
 
-                 },
 
-                 _template = dp.template(template, data);
 
-             this.jQuerytimepicker = jQuery(_template).appendTo(this.d.jQuerydatepicker);
 
-             this.jQueryranges = jQuery('[type="range"]', this.jQuerytimepicker);
 
-             this.jQueryhours = jQuery('[name="hours"]', this.jQuerytimepicker);
 
-             this.jQueryminutes = jQuery('[name="minutes"]', this.jQuerytimepicker);
 
-             this.jQueryhoursText = jQuery('.datepicker--time-current-hours', this.jQuerytimepicker);
 
-             this.jQueryminutesText = jQuery('.datepicker--time-current-minutes', this.jQuerytimepicker);
 
-             if (this.d.ampm) {
 
-                 this.jQueryampm = jQuery('<span class="datepicker--time-current-ampm">')
 
-                     .appendTo(jQuery('.datepicker--time-current', this.jQuerytimepicker))
 
-                     .html(this.dayPeriod);
 
-                 this.jQuerytimepicker.addClass('-am-pm-');
 
-             }
 
-         },
 
-         _updateCurrentTime: function () {
 
-             var h =  dp.getLeadingZeroNum(this.displayHours),
 
-                 m = dp.getLeadingZeroNum(this.minutes);
 
-             this.jQueryhoursText.html(h);
 
-             this.jQueryminutesText.html(m);
 
-             if (this.d.ampm) {
 
-                 this.jQueryampm.html(this.dayPeriod);
 
-             }
 
-         },
 
-         _updateRanges: function () {
 
-             this.jQueryhours.attr({
 
-                 min: this.minHours,
 
-                 max: this.maxHours
 
-             }).val(this.hours);
 
-             this.jQueryminutes.attr({
 
-                 min: this.minMinutes,
 
-                 max: this.maxMinutes
 
-             }).val(this.minutes)
 
-         },
 
-         /**
 
-          * Sets minHours, minMinutes etc. from date. If date is not passed, than sets
 
-          * values from options
 
-          * @param [date] {object} - Date object, to get values from
 
-          * @private
 
-          */
 
-         _handleDate: function (date) {
 
-             this._setDefaultMinMaxTime();
 
-             if (date) {
 
-                 if (dp.isSame(date, this.d.opts.minDate)) {
 
-                     this._setMinTimeFromDate(this.d.opts.minDate);
 
-                 } else if (dp.isSame(date, this.d.opts.maxDate)) {
 
-                     this._setMaxTimeFromDate(this.d.opts.maxDate);
 
-                 }
 
-             }
 
-             this._validateHoursMinutes(date);
 
-         },
 
-         update: function () {
 
-             this._updateRanges();
 
-             this._updateCurrentTime();
 
-         },
 
-         /**
 
-          * Calculates valid hour value to display in text input and datepicker's body.
 
-          * @param date {Date|Number} - date or hours
 
-          * @param [ampm] {Boolean} - 12 hours mode
 
-          * @returns {{hours: *, dayPeriod: string}}
 
-          * @private
 
-          */
 
-         _getValidHoursFromDate: function (date, ampm) {
 
-             var d = date,
 
-                 hours = date;
 
-             if (date instanceof Date) {
 
-                 d = dp.getParsedDate(date);
 
-                 hours = d.hours;
 
-             }
 
-             var _ampm = ampm || this.d.ampm,
 
-                 dayPeriod = 'am';
 
-             if (_ampm) {
 
-                 switch(true) {
 
-                     case hours == 0:
 
-                         hours = 12;
 
-                         break;
 
-                     case hours == 12:
 
-                         dayPeriod = 'pm';
 
-                         break;
 
-                     case hours > 11:
 
-                         hours = hours - 12;
 
-                         dayPeriod = 'pm';
 
-                         break;
 
-                     default:
 
-                         break;
 
-                 }
 
-             }
 
-             return {
 
-                 hours: hours,
 
-                 dayPeriod: dayPeriod
 
-             }
 
-         },
 
-         set hours (val) {
 
-             this._hours = val;
 
-             var displayHours = this._getValidHoursFromDate(val);
 
-             this.displayHours = displayHours.hours;
 
-             this.dayPeriod = displayHours.dayPeriod;
 
-         },
 
-         get hours() {
 
-             return this._hours;
 
-         },
 
-         //  Events
 
-         // -------------------------------------------------
 
-         _onChangeRange: function (e) {
 
-             var jQuerytarget = jQuery(e.target),
 
-                 name = jQuerytarget.attr('name');
 
-             
 
-             this.d.timepickerIsActive = true;
 
-             this[name] = jQuerytarget.val();
 
-             this._updateCurrentTime();
 
-             this.d._trigger('timeChange', [this.hours, this.minutes]);
 
-             this._handleDate(this.d.lastSelectedDate);
 
-             this.update()
 
-         },
 
-         _onSelectDate: function (e, data) {
 
-             this._handleDate(data);
 
-             this.update();
 
-         },
 
-         _onMouseEnterRange: function (e) {
 
-             var name = jQuery(e.target).attr('name');
 
-             jQuery('.datepicker--time-current-' + name, this.jQuerytimepicker).addClass('-focus-');
 
-         },
 
-         _onMouseOutRange: function (e) {
 
-             var name = jQuery(e.target).attr('name');
 
-             if (this.d.inFocus) return; // Prevent removing focus when mouse out of range slider
 
-             jQuery('.datepicker--time-current-' + name, this.jQuerytimepicker).removeClass('-focus-');
 
-         },
 
-         _onMouseUpRange: function (e) {
 
-             this.d.timepickerIsActive = false;
 
-         }
 
-     };
 
- })();
 
-  })(window,jQuery);
 
 
  |