PageSourceSearch

https://planneroffice.com.ua/assets/ddb6a84e/jquery.datetimepicker.full.js

js planneroffice.com.ua collected 2026-10-07 07:03:04 UTC 104,664 bytes, 2,788 lines download raw bytes

vendor: 24,257 bytes, lines 1-404
1/*!
2 * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016
3 * @version 1.3.4
4 *
5 * Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
6 * @see http://php.net/manual/en/function.date.php
7 *
8 * For more JQuery plugins visit http://plugins.krajee.com
9 * For more Yii related demos visit http://demos.krajee.com
10*/
11
12var DateFormatter;
13/*
14!function(){"use strict";var t,e,r,n,a,u,i;u=864e5,i=3600,t=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.toLowerCase()===e.toLowerCase()},e=function(t,r,n){var a=n||"0",u=t.toString();return u.length<r?e(a+u,r):u},r=function(t){var e,n;for(t=t||{},e=1;e<arguments.length;e++)if(n=arguments[e])for(var a in n)n.hasOwnProperty(a)&&("object"==typeof n[a]?r(t[a],n[a]):t[a]=n[a]);return t},n=function(t,e){for(var r=0;r<e.length;r++)if(e[r].toLowerCase()===t.toLowerCase())return r;return-1},a={dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(t){var e=t%10,r={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(t%100/10)&&r[e]?r[e]:"th"}},separators:/[ \-+\/\.T:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},DateFormatter=function(t){var e=this,n=r(a,t);e.dateSettings=n.dateSettings,e.separators=n.separators,e.validParts=n.validParts,e.intParts=n.intParts,e.tzParts=n.tzParts,e.tzClip=n.tzClip},DateFormatter.prototype={constructor:DateFormatter,getMonth:function(t){var e,r=this;return e=n(t,r.dateSettings.monthsShort)+1,0===e&&(e=n(t,r.dateSettings.months)+1),e},parseDate:function(e,r){var n,a,u,i,s,o,c,f,l,h,d=this,g=!1,m=!1,p=d.dateSettings,y={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)return null;if(e instanceof Date)return e;if("U"===r)return u=parseInt(e),u?new Date(1e3*u):e;switch(typeof e){case"number":return new Date(e);case"string":break;default:return null}if(n=r.match(d.validParts),!n||0===n.length)throw new Error("Invalid date format definition.");for(a=e.replace(d.separators,"\x00").split("\x00"),u=0;u<a.length;u++)switch(i=a[u],s=parseInt(i),n[u]){case"y":case"Y":if(!s)return null;l=i.length,y.year=2===l?parseInt((70>s?"20":"19")+i):s,g=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(o=d.getMonth(i),!(o>0))return null;y.month=o}else{if(!(s>=1&&12>=s))return null;y.month=s}g=!0;break;case"d":case"j":if(!(s>=1&&31>=s))return null;y.day=s,g=!0;break;case"g":case"h":if(c=n.indexOf("a")>-1?n.indexOf("a"):n.indexOf("A")>-1?n.indexOf("A"):-1,h=a[c],c>-1)f=t(h,p.meridiem[0])?0:t(h,p.meridiem[1])?12:-1,s>=1&&12>=s&&f>-1?y.hour=s+f-1:s>=0&&23>=s&&(y.hour=s);else{if(!(s>=0&&23>=s))return null;y.hour=s}m=!0;break;case"G":case"H":if(!(s>=0&&23>=s))return null;y.hour=s,m=!0;break;case"i":if(!(s>=0&&59>=s))return null;y.min=s,m=!0;break;case"s":if(!(s>=0&&59>=s))return null;y.sec=s,m=!0}if(g===!0&&y.year&&y.month&&y.day)y.date=new Date(y.year,y.month-1,y.day,y.hour,y.min,y.sec,0);else{if(m!==!0)return null;y.date=new Date(0,0,0,y.hour,y.min,y.sec,0)}return y.date},guessDate:function(t,e){if("string"!=typeof t)return t;var r,n,a,u,i,s,o=this,c=t.replace(o.separators,"\x00").split("\x00"),f=/^[djmn]/g,l=e.match(o.validParts),h=new Date,d=0;if(!f.test(l[0]))return t;for(a=0;a<c.length;a++){if(d=2,i=c[a],s=parseInt(i.substr(0,2)),isNaN(s))return null;switch(a){case 0:"m"===l[0]||"n"===l[0]?h.setMonth(s-1):h.setDate(s);break;case 1:"m"===l[0]||"n"===l[0]?h.setDate(s):h.setMonth(s-1);break;case 2:if(n=h.getFullYear(),r=i.length,d=4>r?r:4,n=parseInt(4>r?n.toString().substr(0,4-r)+i:i.substr(0,4)),!n)return null;h.setFullYear(n);break;case 3:h.setHours(s);break;case 4:h.setMinutes(s);break;case 5:h.setSeconds(s)}u=i.substr(d),u.length>0&&c.splice(a+1,0,u)}return h},parseFormat:function(t,r){var n,a=this,s=a.dateSettings,o=/\\?(.?)/gi,c=function(t,e){return n[t]?n[t]():e};return n={d:function(){return e(n.j(),2)},D:function(){return s.daysShort[n.w()]},j:function(){return r.getDate()},l:function(){return s.days[n.w()]},N:function(){return n.w()||7},w:function(){return r.getDay()},z:function(){var t=new Date(n.Y(),n.n()-1,n.j()),e=new Date(n.Y(),0,1);return Math.round((t-e)/u)},W:function(){var t=new Date(n.Y(),n.n()-1,n.j()-n.N()+3),r=new Date(t.getFullYear(),0,4);return e(1+Math.round((t-r)/u/7),2)},F:function(){return s.months[r.getMonth()]},m:function(){return e(n.n(),2)},M:function(){return s.monthsShort[r.getMonth()]},n:function(){return r.getMonth()+1},t:function(){return new Date(n.Y(),n.n(),0).getDate()},L:function(){var t=n.Y();return t%4===0&&t%100!==0||t%400===0?1:0},o:function(){var t=n.n(),e=n.W(),r=n.Y();return r+(12===t&&9>e?1:1===t&&e>9?-1:0)},Y:function(){return r.getFullYear()},y:function(){return n.Y().toString().slice(-2)},a:function(){return n.A().toLowerCase()},A:function(){var t=n.G()<12?0:1;return s.meridiem[t]},B:function(){var t=r.getUTCHours()*i,n=60*r.getUTCMinutes(),a=r.getUTCSeconds();return e(Math.floor((t+n+a+i)/86.4)%1e3,3)},g:function(){return n.G()%12||12},G:function(){return r.getHours()},h:function(){return e(n.g(),2)},H:function(){return e(n.G(),2)},i:function(){return e(r.getMinutes(),2)},s:function(){return e(r.getSeconds(),2)},u:function(){return e(1e3*r.getMilliseconds(),6)},e:function(){var t=/\((.*)\)/.exec(String(r))[1];return t||"Coordinated Universal Time"},I:function(){var t=new Date(n.Y(),0),e=Date.UTC(n.Y(),0),r=new Date(n.Y(),6),a=Date.UTC(n.Y(),6);return t-e!==r-a?1:0},O:function(){var t=r.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+e(100*Math.floor(n/60)+n%60,4)},P:function(){var t=n.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){var t=(String(r).match(a.tzParts)||[""]).pop().replace(a.tzClip,"");return t||"UTC"},Z:function(){return 60*-r.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(o,c)},r:function(){return"D, d M Y H:i:s O".replace(o,c)},U:function(){return r.getTime()/1e3||0}},c(t,t)},formatDate:function(t,e){var r,n,a,u,i,s=this,o="",c="\\";if("string"==typeof t&&(t=s.parseDate(t,e),!t))return null;if(t instanceof Date){for(a=e.length,r=0;a>r;r++)i=e.charAt(r),"S"!==i&&i!==c&&(r>0&&e.charAt(r-1)===c?o+=i:(u=s.parseFormat(i,t),r!==a-1&&s.intParts.test(i)&&"S"===e.charAt(r+1)&&(n=parseInt(u)||0,u+=s.dateSettings.ordinal(n)),o+=u));return o}return""}}}();
15*/
16
17!
18function () {
19        "use strict";
20        var t, e, r, n, a, u, i;
21        u = 864e5,
22        i = 3600,
23        t = function (t, e) {
24                return "string" == typeof t && "string" == typeof e && t.toLowerCase() === e.toLowerCase()
25        },
26        e = function (t, r, n) {
27                var a = n || "0",
28                        u = t.toString();
29                return u.length < r ? e(a + u, r) : u
30        },
31        r = function (t) {
32                var e, n;
33                for (t = t || {}, e = 1; e < arguments.length; e++) if (n = arguments[e]) for (var a in n) n.hasOwnProperty(a) && ("object" == typeof n[a] ? r(t[a], n[a]) : t[a] = n[a]);
34                return t
35        },
36        n = function (t, e) {
37                for (var r = 0; r < e.length; r++) if (e[r].toLowerCase() === t.toLowerCase()) return r;
38                return -1
39        },
40        a = {
41                dateSettings: {
42                        days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
43                        daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
44                        months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
45                        monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
46                        meridiem: ["AM", "PM"],
47                        ordinal: function (t) {
48                                var e = t % 10,
49                                        r = {
50                                                1: "st",
51                                                2: "nd",
52                                                3: "rd"
53                                        };
54                                return 1 !== Math.floor(t % 100 / 10) && r[e] ? r[e] : "th"
55                        }
56                },
57                separators: /[ \-+\/\.T:@]/g,
58                validParts: /[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,
59                intParts: /[djwNzmnyYhHgGis]/g,
60                tzParts: /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
61                tzClip: /[^-+\dA-Z]/g
62        },
63        DateFormatter = function (t) {
64                var e = this,
65                        n = r(a, t);
66                e.dateSettings = n.dateSettings,
67                e.separators = n.separators,
68                e.validParts = n.validParts,
69                e.intParts = n.intParts,
70                e.tzParts = n.tzParts,
71                e.tzClip = n.tzClip
72        },
73        DateFormatter.prototype = {
74                constructor: DateFormatter,
75                getMonth: function (t) {
76					var e, r = this;
77					return e = n(t, r.dateSettings.monthsShort) + 1,
78					0 === e && (e = n(t, r.dateSettings.months) + 1),
79					e
80                },
81                parseDate: function (e, r) {
82					var n, a, u, i, s, o, c, f, l, h, d = this,
83					g = !1,
84					m = !1,
85					p = d.dateSettings,
86					y = {
87						date: null,
88						year: null,
89						month: null,
90						day: null,
91						hour: 0,
92						min: 0,
93						sec: 0
94					};
95					if (!e) return null;
96					if (e instanceof Date) return e;
97					if ("U" === r) return u = parseInt(e),
98					u ? new Date(1e3 * u) : e;
99					switch (typeof e) {
100					case "number":
101							return new Date(e);
102					case "string":
103							break;
104					default:
105							return null
106					}
107					if (n = r.match(d.validParts), !n || 0 === n.length) throw new Error("Invalid date format definition.");
108					for (a = e.replace(d.separators, "\x00").split("\x00"), u = 0; u < a.length; u++) switch (i = a[u], s = parseInt(i), n[u]) {
109					case "y":
110					case "Y":
111							if (!s) return null;
112							l = i.length,
113							y.year = 2 === l ? parseInt((70 > s ? "20" : "19") + i) : s,
114							g = !0;
115							break;
116					case "m":
117					case "n":
118					case "M":
119					case "F":
120							if (isNaN(s)) {
121									if (o = d.getMonth(i), !(o > 0)) return null;
122									y.month = o
123							} else {
124									if (!(s >= 1 && 12 >= s)) return null;
125									y.month = s
126							}
127							g = !0;
128							break;
129					case "d":
130					case "j":
131							if (!(s >= 1 && 31 >= s)) return null;
132							y.day = s,
133							g = !0;
134							break;
135					case "g":
136					case "h":
137							if (c = n.indexOf("a") > -1 ? n.indexOf("a") : n.indexOf("A") > -1 ? n.indexOf("A") : -1, h = a[c], c > -1) f = t(h, p.meridiem[0]) ? 0 : t(h, p.meridiem[1]) ? 12 : -1,
138							s >= 1 && 12 >= s && f > -1 ? y.hour = s + f - 1 : s >= 0 && 23 >= s && (y.hour = s);
139							else {
140									if (!(s >= 0 && 23 >= s)) return null;
141									y.hour = s
142							}
143							m = !0;
144							break;
145					case "G":
146					case "H":
147							if (!(s >= 0 && 23 >= s)) return null;
148							y.hour = s,
149							m = !0;
150							break;
151					case "i":
152							if (!(s >= 0 && 59 >= s)) return null;
153							y.min = s,
154							m = !0;
155							break;
156					case "s":
157							if (!(s >= 0 && 59 >= s)) return null;
158							y.sec = s,
159							m = !0
160					}
161					if (g === !0 && y.year && y.month && y.day) y.date = new Date(y.year, y.month - 1, y.day, y.hour, y.min, y.sec, 0);
162					else {
163							if (m !== !0) return null;
164							y.date = new Date(0, 0, 0, y.hour, y.min, y.sec, 0)
165					}
166					return y.date
167                },
168                guessDate: function (t, e) {
169                        if ("string" != typeof t) return t;
170                        var r, n, a, u, i, s, o = this,
171                                c = t.replace(o.separators, "\x00").split("\x00"),
172                                f = /^[djmn]/g,
173                                l = e.match(o.validParts),
174                                h = new Date,
175                                d = 0;
176                        if (!f.test(l[0])) return t;
177                        for (a = 0; a < c.length; a++) {
178                                if (d = 2, i = c[a], s = parseInt(i.substr(0, 2)), isNaN(s)) return null;
179                                switch (a) {
180                                case 0:
181                                        "m" === l[0] || "n" === l[0] ? h.setMonth(s - 1) : h.setDate(s);
182                                        break;
183                                case 1:
184                                        "m" === l[0] || "n" === l[0] ? h.setDate(s) : h.setMonth(s - 1);
185                                        break;
186                                case 2:
187                                        if (n = h.getFullYear(), r = i.length, d = 4 > r ? r : 4, n = parseInt(4 > r ? n.toString().substr(0, 4 - r) + i : i.substr(0, 4)), !n) return null;
188                                        h.setFullYear(n);
189                                        break;
190                                case 3:
191                                        h.setHours(s);
192                                        break;
193                                case 4:
194                                        h.setMinutes(s);
195                                        break;
196                                case 5:
197                                        h.setSeconds(s)
198                                }
199                                u = i.substr(d),
200                                u.length > 0 && c.splice(a + 1, 0, u)
201                        }
202                        return h
203                },
204                parseFormat: function (t, r) {
205                        var n, a = this,
206                                s = a.dateSettings,
207                                o = /\\?(.?)/gi,
208                                c = function (t, e) {
209                                        return n[t] ? n[t]() : e
210                                };
211                        return n = {
212                                d: function () {
213                                        return e(n.j(), 2)
214                                },
215                                D: function () {
216                                        return s.daysShort[n.w()]
217                                },
218                                j: function () {
219                                        return r.getDate()
220                                },
221                                l: function () {
222                                        return s.days[n.w()]
223                                },
224                                N: function () {
225                                        return n.w() || 7
226                                },
227                                w: function () {
228                                        return r.getDay()
229                                },
230                                z: function () {
231                                        var t = new Date(n.Y(), n.n() - 1, n.j()),
232                                                e = new Date(n.Y(), 0, 1);
233                                        return Math.round((t - e) / u)
234                                },
235                                W: function () {
236                                        var t = new Date(n.Y(), n.n() - 1, n.j() - n.N() + 3),
237                                                r = new Date(t.getFullYear(), 0, 4);
238                                        return e(1 + Math.round((t - r) / u / 7), 2)
239                                },
240                                F: function () {
241                                        return s.months[r.getMonth()]
242                                },
243                                m: function () {
244                                        return e(n.n(), 2)
245                                },
246                                M: function () {
247                                        return s.monthsShort[r.getMonth()]
248                                },
249                                n: function () {
250                                        return r.getMonth() + 1
251                                },
252                                t: function () {
253                                        return new Date(n.Y(), n.n(), 0).getDate()
254                                },
255                                L: function () {
256                                        var t = n.Y();
257                                        return t % 4 === 0 && t % 100 !== 0 || t % 400 === 0 ? 1 : 0
258                                },
259                                o: function () {
260                                        var t = n.n(),
261                                                e = n.W(),
262                                                r = n.Y();
263                                        return r + (12 === t && 9 > e ? 1 : 1 === t && e > 9 ? -1 : 0)
264                                },
265                                Y: function () {
266                                        return r.getFullYear()
267                                },
268                                y: function () {
269                                        return n.Y().toString().slice(-2)
270                                },
271                                a: function () {
272                                        return n.A().toLowerCase()
273                                },
274                                A: function () {
275                                        var t = n.G() < 12 ? 0 : 1;
276                                        return s.meridiem[t]
277                                },
278                                B: function () {
279                                        var t = r.getUTCHours() * i,
280                                                n = 60 * r.getUTCMinutes(),
281                                                a = r.getUTCSeconds();
282                                        return e(Math.floor((t + n + a + i) / 86.4) % 1e3, 3)
283                                },
284                                g: function () {
285                                        return n.G() % 12 || 12
286                                },
287                                G: function () {
288                                        return r.getHours()
289                                },
290                                h: function () {
291                                        return e(n.g(), 2)
292                                },
293                                H: function () {
294                                        return e(n.G(), 2)
295                                },
296                                i: function () {
297                                        return e(r.getMinutes(), 2)
298                                },
299                                s: function () {
300                                        return e(r.getSeconds(), 2)
301                                },
302                                u: function () {
303                                        return e(1e3 * r.getMilliseconds(), 6)
304                                },
305                                e: function () {
306                                        var t = /\((.*)\)/.exec(String(r))[1];
307                                        return t || "Coordinated Universal Time"
308                                },
309                                I: function () {
310                                        var t = new Date(n.Y(), 0),
311                                                e = Date.UTC(n.Y(), 0),
312                                                r = new Date(n.Y(), 6),
313                                                a = Date.UTC(n.Y(), 6);
314                                        return t - e !== r - a ? 1 : 0
315                                },
316                                O: function () {
317                                        var t = r.getTimezoneOffset(),
318                                                n = Math.abs(t);
319                                        return (t > 0 ? "-" : "+") + e(100 * Math.floor(n / 60) + n % 60, 4)
320                                },
321                                P: function () {
322                                        var t = n.O();
323                                        return t.substr(0, 3) + ":" + t.substr(3, 2)
324                                },
325                                T: function () {
326                                        var t = (String(r).match(a.tzParts) || [""]).pop().replace(a.tzClip, "");
327                                        return t || "UTC"
328                                },
329                                Z: function () {
330                                        return 60 * -r.getTimezoneOffset()
331                                },
332                                c: function () {
333                                        return "Y-m-d\\TH:i:sP".replace(o, c)
334                                },
335                                r: function () {
336                                        return "D, d M Y H:i:s O".replace(o, c)
337                                },
338                                U: function () {
339                                        return r.getTime() / 1e3 || 0
340                                }
341                        },
342                        c(t, t)
343                },
344                formatDate: function (t, e) {
345					var r, n, a, u, i, s = this,
346							o = "",
347							c = "\\";
348					if ("string" == typeof t && (t = s.parseDate(t, e), !t)) return null;
349					if (t instanceof Date) {
350							for (a = e.length, r = 0; a > r; r++) i = e.charAt(r),
351							"S" !== i && i !== c && (r > 0 && e.charAt(r - 1) === c ? o += i : (u = s.parseFormat(i, t), r !== a - 1 && s.intParts.test(i) && "S" === e.charAt(r + 1) && (n = parseInt(u) || 0, u += s.dateSettings.ordinal(n)), o += u));
352							return o
353					}
354					return ""
355                }
356        }
357}();
358
359/**
360 * @preserve jQuery DateTimePicker
361 * @homepage http://xdsoft.net/jqplugins/datetimepicker/
362 * @author Chupurnov Valeriy (<[email protected]>)
363 */
364
365/**
366 * @param {jQuery} $
367 */
368
369var datetimepickerFactory = function ($) {
370	'use strict';
371
372	var default_options  = {
373		btn_close : true,
374		i18n: {
375			ru: { // Russian
376				months: [
377					'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
378				],
379				dayOfWeekShort: [
380					"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
381				],
382				dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
383			},
384			uk: { // Ukrainian
385				months: [
386					'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
387				],
388				dayOfWeekShort: [
389					"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
390				],
391				dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
392			},
393			ua: { // Ukrainian
394				months: [
395					'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
396				],
397				dayOfWeekShort: [
398					"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
399				],
400				dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
401			},
402			en: { // English
403				months: [
404					"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
404November", "December"
405				],
406				dayOfWeekShort: [
407					"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
408				],
409				dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
410			},
411			de: { // German
412				months: [
413					'Januar', 'Februar', 'Marz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
414				],
415				dayOfWeekShort: [
416					"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
417				],
418				dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
419			},
420			nl: { // Dutch
421				months: [
422					"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
423				],
424				dayOfWeekShort: [
425					"zo", "ma", "di", "wo", "do", "vr", "za"
426				],
427				dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
428			},
429			tr: { // Turkish
430				months: [
431					"Ocak", "Subat", "Mart", "Nisan", "May?s", "Haziran", "Temmuz", "Agustos", "Eylul", "Ekim", "Kas?m", "Aral?k"
432				],
433				dayOfWeekShort: [
434					"Paz", "Pts", "Sal", "Car", "Per", "Cum", "Cts"
435				],
436				dayOfWeek: ["Pazar", "Pazartesi", "Sal?", "Carsamba", "Persembe", "Cuma", "Cumartesi"]
437			},
438			fr: { //French
439				months: [
440					"Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Decembre"
441				],
442				dayOfWeekShort: [
443					"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
444				],
445				dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
446			},
447			pl: { // Polish
448				months: [
449					"styczen", "luty", "marzec", "kwiecien", "maj", "czerwiec", "lipiec", "sierpien", "wrzesien", "pazdziernik", "listopad", "grudzien"
450				],
451				dayOfWeekShort: [
452					"nd", "pn", "wt", "sr", "cz", "pt", "sb"
453				],
454				dayOfWeek: ["niedziela", "poniedzialek", "wtorek", "sroda", "czwartek", "piatek", "sobota"]
455			},
456			pt: { // Portuguese (European)
457				months: [
458					"Janeiro", "Fevereiro", "Marco", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
459				],
460				dayOfWeekShort: [
461					"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
462				],
463				dayOfWeek: ["Domingo", "Segunda", "Terca", "Quarta", "Quinta", "Sexta", "Sabado"]
464			},
465			it: { // Italian (Standard)
466				months: [
467					"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
468				],
469				dayOfWeekShort: [
470					"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
471				],
472				dayOfWeek: ["Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato"]
473			}, // Espana: Spanish
474			es: {
475				months: [
476					"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
477				],
478				dayOfWeekShort: [
479					"Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab"
480				],
481				dayOfWeek: ["Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"]
482			}, // Slovakia:
483			sk: {
484				months: [
485					"Januar", "Februar", "Marec", "April", "Maj", "Jun", "Jul", "August", "September", "Oktober", "November", "December"
486				],
487				dayOfWeekShort: [
488					"Ned", "Pon", "Uto", "Str", "Stv", "Pia", "Sob"
489				],
490				dayOfWeek: ["Nedela", "Pondelok", "Utorok", "Streda", "Stvrtok", "Piatok", "Sobota"]
491			}, // Chech:
492			cs: {
493				months: [
494					"Leden", "Unor", "Brezen", "Duben", "Kveten", "Cerven", "Cervenec", "Srpen", "Zari", "Rijen", "Listopad", "Prosinec"
495				],
496				dayOfWeekShort: [
497					"Ne", "Po", "Ut", "St", "Ct", "Pa", "So"
498				],
499				dayOfWeek: ["Nedele", "Pondeli", "Utery", "Streda", "Ctvrtek", "Patek", "Sobota"]
500			}
501		},
502
503		ownerDocument: document,
504		contentWindow: window,
505
506		value: '',
507		rtl: false,
508
509		format:	'Y/m/d H:i',
510		formatTime:	'H:i',
511		formatDate:	'Y/m/d',
512
513		startDate:	false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
514		step: 60,
515		monthChangeSpinner: true,
516
517		closeOnDateSelect: false,
518		closeOnTimeSelect: true,
519		closeOnWithoutClick: true,
520		closeOnInputClick: true,
521		openOnFocus: true,
522
523		timepicker: true,
524		datepicker: true,
525		weeks: false,
526
527		defaultTime: false,	// use formatTime format (ex. '10:00' for formatTime:	'H:i')
528		defaultDate: false,	// use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
529
530		minDate: false,
531		maxDate: false,
532		minTime: false,
533		maxTime: false,
534        minDateTime: false,
535
536		disabledMinTime: false,
537		disabledMaxTime: false,
538
539		allowTimes: [],
540		opened: false,
541		initTime: true,
542		inline: false,
543		theme: '',
544		touchMovedThreshold: 5,
545
546		onSelectDate: function () {},
547		onSelectTime: function () {},
548		onChangeMonth: function () {},
549		onGetWeekOfYear: function () {},
550		onChangeYear: function () {},
551		onChangeDateTime: function () {},
552		onShow: function () {},
553		onClose: function () {},
554		onGenerate: function () {},
555
556		withoutCopyright: true,
vendor: 2,537 bytes, lines 557-672
557		inverseButton: false,
558		hours12: false,
559		next: 'xdsoft_next',
560		prev : 'xdsoft_prev',
561		dayOfWeekStart: 0,
562		parentID: 'body',
563		timeHeightInTimePicker: 25,
564		timepickerScrollbar: true,
565		todayButton: true,
566		prevButton: true,
567		nextButton: true,
568		defaultSelect: true,
569
570		scrollMonth: true,
571		scrollTime: true,
572		scrollInput: true,
573
574		lazyInit: false,
575		mask: false,
576		validateOnBlur: true,
577		allowBlank: true,
578		yearStart: 1950,
579		yearEnd: 2050,
580		monthStart: 0,
581		monthEnd: 11,
582		style: '',
583		id: '',
584		fixed: false,
585		roundTime: 'round', // ceil, floor
586		className: '',
587		weekends: [],
588		highlightedDates: [],
589		highlightedPeriods: [],
590		allowDates : [],
591		allowDateRe : null,
592		disabledDates : [],
593		disabledWeekDays: [],
594		yearOffset: 0,
595		beforeShowDay: null,
596
597		enterLikeTab: true,
598		showApplyButton: false
599	};
600
601	var dateHelper = null,
602		globalLocaleDefault = 'en',
603		globalLocale = 'en';
604
605	var dateFormatterOptionsDefault = {
606		meridiem: ['AM', 'PM']
607	};
608
609	var initDateFormatter = function(){
610		var locale = default_options.i18n[globalLocale],
611			opts = {
612				days: locale.dayOfWeek,
613				daysShort: locale.dayOfWeekShort,
614				months: locale.months,
615				monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) })
616			};
617
618		if (typeof DateFormatter === 'function') {
619			dateHelper = new DateFormatter({
620				dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
621			});
622		}
623	};
624
625	// for locale settings
626	$.datetimepicker = {
627		setLocale: function(locale){
628			var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault;
629			if (globalLocale !== newLocale) {
630				globalLocale = newLocale;
631				// reinit date formatter
632				initDateFormatter();
633			}
634		},
635
636		setDateFormatter: function(dateFormatter) {
637			dateHelper = dateFormatter;
638		},
639
640		RFC_2822: 'D, d M Y H:i:s O',
641		ATOM: 'Y-m-d\TH:i:sP',
642		ISO_8601: 'Y-m-d\TH:i:sO',
643		RFC_822: 'D, d M y H:i:s O',
644		RFC_850: 'l, d-M-y H:i:s T',
645		RFC_1036: 'D, d M y H:i:s O',
646		RFC_1123: 'D, d M Y H:i:s O',
647		RSS: 'D, d M Y H:i:s O',
648		W3C: 'Y-m-d\TH:i:sP'
649	};
650
651	// first init date formatter
652	initDateFormatter();
653
654	// fix for ie8
655	if (!window.getComputedStyle) {
656		window.getComputedStyle = function (el) {
657			this.el = el;
658			this.getPropertyValue = function (prop) {
659				var re = /(-([a-z]))/g;
660				if (prop === 'float') {
661					prop = 'styleFloat';
662				}
663				if (re.test(prop)) {
664					prop = prop.replace(re, function (a, b, c) {
665						return c.toUpperCase();
666					});
667				}
668				return el.currentStyle[prop] || null;
669			};
670			return this;
671		};
672	}
vendor: 6,346 bytes, lines 673-869
673
674	if (!Array.prototype.indexOf) {
675		Array.prototype.indexOf = function (obj, start) {
676			var i, j;
677			for (i = (start || 0), j = this.length; i < j; i += 1) {
678				if (this[i] === obj) { return i; }
679			}
680			return -1;
681		};
682	}
683
684	Date.prototype.countDaysInMonth = function () {
685		return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
686	};
687
688	$.fn.xdsoftScroller = function (options, percent) {
689		return this.each(function () {
690			var timeboxparent = $(this),
691				pointerEventToXY = function (e) {
692					var out = {x: 0, y: 0},
693						touch;
694					if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
695						touch  = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
696						out.x = touch.clientX;
697						out.y = touch.clientY;
698					} else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
699						out.x = e.clientX;
700						out.y = e.clientY;
701					}
702					return out;
703				},
704				timebox,
705				parentHeight,
706				height,
707				scrollbar,
708				scroller,
709				maximumOffset = 100,
710				start = false,
711				startY = 0,
712				startTop = 0,
713				h1 = 0,
714				touchStart = false,
715				startTopScroll = 0,
716				calcOffset = function () {};
717
718			if (percent === 'hide') {
719				timeboxparent.find('.xdsoft_scrollbar').hide();
720				return;
721			}
722
723			if (!$(this).hasClass('xdsoft_scroller_box')) {
724				timebox = timeboxparent.children().eq(0);
725				parentHeight = timeboxparent[0].clientHeight;
726				height = timebox[0].offsetHeight;
727				scrollbar = $('<div class="xdsoft_scrollbar"></div>');
728				scroller = $('<div class="xdsoft_scroller"></div>');
729				scrollbar.append(scroller);
730
731				timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
732				calcOffset = function calcOffset(event) {
733					var offset = pointerEventToXY(event).y - startY + startTopScroll;
734					if (offset < 0) {
735						offset = 0;
736					}
737					if (offset + scroller[0].offsetHeight > h1) {
738						offset = h1 - scroller[0].offsetHeight;
739					}
740					timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
741				};
742
743				scroller
744					.on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
745						if (!parentHeight) {
746							timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
747						}
748
749						startY = pointerEventToXY(event).y;
750						startTopScroll = parseInt(scroller.css('margin-top'), 10);
751						h1 = scrollbar[0].offsetHeight;
752
753						if (event.type === 'mousedown' || event.type === 'touchstart') {
754							if (options.ownerDocument) {
755								$(options.ownerDocument.body).addClass('xdsoft_noselect');
756							}
757							$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
758								$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
759									.off('mousemove.xdsoft_scroller', calcOffset)
760									.removeClass('xdsoft_noselect');
761							});
762							$(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
763						} else {
764							touchStart = true;
765							event.stopPropagation();
766							event.preventDefault();
767						}
768					})
769					.on('touchmove', function (event) {
770						if (touchStart) {
771							event.preventDefault();
772							calcOffset(event);
773						}
774					})
775					.on('touchend touchcancel', function () {
776						touchStart =  false;
777						startTopScroll = 0;
778					});
779
780				timeboxparent
781					.on('scroll_element.xdsoft_scroller', function (event, percentage) {
782						if (!parentHeight) {
783							timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
784						}
785						percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
786
787						scroller.css('margin-top', maximumOffset * percentage);
788
789						setTimeout(function () {
790							timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
791						}, 10);
792					})
793					.on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
794						var percent, sh;
795						parentHeight = timeboxparent[0].clientHeight;
796						height = timebox[0].offsetHeight;
797						percent = parentHeight / height;
798						sh = percent * scrollbar[0].offsetHeight;
799						if (percent > 1) {
800							scroller.hide();
801						} else {
802							scroller.show();
803							scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
804							maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
805							if (noTriggerScroll !== true) {
806								timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
807							}
808						}
809					});
810
811				timeboxparent.on('mousewheel', function (event) {
812					var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
813
814					top = top - (event.deltaY * 20);
815					if (top < 0) {
816						top = 0;
817					}
818
819					timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
820					event.stopPropagation();
821					return false;
822				});
823
824				timeboxparent.on('touchstart', function (event) {
825					start = pointerEventToXY(event);
826					startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
827				});
828
829				timeboxparent.on('touchmove', function (event) {
830					if (start) {
831						event.preventDefault();
832						var coord = pointerEventToXY(event);
833						timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
834					}
835				});
836
837				timeboxparent.on('touchend touchcancel', function () {
838					start = false;
839					startTop = 0;
840				});
841			}
842			timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
843		});
844	};
845
846	$.fn.datetimepicker = function (opt, opt2) {
847		var result = this,
848			KEY0 = 48,
849			KEY9 = 57,
850			_KEY0 = 96,
851			_KEY9 = 105,
852			CTRLKEY = 17,
853			DEL = 46,
854			ENTER = 13,
855			ESC = 27,
856			BACKSPACE = 8,
857			ARROWLEFT = 37,
858			ARROWUP = 38,
859			ARROWRIGHT = 39,
860			ARROWDOWN = 40,
861			TAB = 9,
862			F5 = 116,
863			AKEY = 65,
864			CKEY = 67,
865			VKEY = 86,
866			ZKEY = 90,
867			YKEY = 89,
868			ctrlDown	=	false,
869			options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
vendor: 10,864 bytes, lines 870-1174
870			lazyInitTimer = 0,
871			createDateTimePicker,
872			destroyDateTimePicker,
873
874			lazyInit = function (input) {
875				input
876					.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() {
877						if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
878							return;
879						}
880						clearTimeout(lazyInitTimer);
881						lazyInitTimer = setTimeout(function () {
882
883							if (!input.data('xdsoft_datetimepicker')) {
884								createDateTimePicker(input);
885							}
886							input
887								.off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
888								.trigger('open.xdsoft');
889						}, 100);
890					});
891			};
892
893		createDateTimePicker = function (input) {
894
895			var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>');
896
897				if ( options.btn_close )
898					var btn_clear = $('<div class="" style="position: absolute; display:inline-block; min-width: 50px; bottom: 5px; left: 10px; color: orangered; cursor: pointer;">' + locales[user_locale].Clean + '</div>');
899				else
900					var btn_clear = $('');
901
902				var datepicker = $('<div class="xdsoft_datepicker active"></div>'),
903					month_picker = $('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
904					'<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
905					'<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
906					'<button type="button" class="xdsoft_next"></button></div>'),
907					calendar = $('<div class="xdsoft_calendar"></div>'),
908					timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
909					timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
910					timebox = $('<div class="xdsoft_time_variant"></div>'),
911					applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save selected</button>'),
912					monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
913					yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
914					triggerAfterOpen = false,
915					XDSoft_datetime,
916					xchangeTimer,
917					timerclick,
918					current_time_index,
919					setPos,
920					timer = 0,
921					_xdsoft_datetime,
922					forEachAncestorOf;
923
924			if (options.id) {
925				datetimepicker.attr('id', options.id);
926			}
927			if (options.style) {
928				datetimepicker.attr('style', options.style);
929			}
930			if (options.weeks) {
931				datetimepicker.addClass('xdsoft_showweeks');
932			}
933			if (options.rtl) {
934				datetimepicker.addClass('xdsoft_rtl');
935			}
936
937			datetimepicker.addClass('xdsoft_' + options.theme);
938			datetimepicker.addClass(options.className);
939			
940			
941				btn_clear.on ( "click", function (event) {
942					input.val("");
943					input.trigger('change');
944					datetimepicker.trigger("close.xdsoft");
945				} );
946
947			month_picker
948				.find('.xdsoft_month span')
949				.after(monthselect);
950			month_picker
951				.find('.xdsoft_year span')
952				.after(yearselect);
953
954			
955			month_picker
956				.find('.xdsoft_month,.xdsoft_year')
957				.on('touchstart mousedown.xdsoft', function (event) {
958					var select = $(this).find('.xdsoft_select').eq(0),
959						val = 0,
960						top = 0,
961						visible = select.is(':visible'),
962						items,
963						i;
964
965					month_picker
966						.find('.xdsoft_select')
967						.hide();
968					if (_xdsoft_datetime.currentTime) {
969						val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
970					}
971
972					select[visible ? 'hide' : 'show']();
973					for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
974						if (items.eq(i).data('value') === val) {
975							break;
976						} else {
977							top += items[0].offsetHeight;
978						}
979					}
980
981					select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
982					event.stopPropagation();
983					return false;
984				});
985
986			var handleTouchMoved = function (event) {
987				this.touchStartPosition = this.touchStartPosition || event.originalEvent.touches[0];
988				var touchPosition = event.originalEvent.touches[0];
989				var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX);
990				var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY);
991				var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement);
992				if(distance > options.touchMovedThreshold) {
993					this.touchMoved = true;
994				}
995			}
996
997			month_picker
998				.find('.xdsoft_select')
999				.xdsoftScroller(options)
1000				.on('touchstart mousedown.xdsoft', function (event) {
1001					if ( event.originalEvent.touches != undefined ) {
1002						this.touchMoved = false;
1003						this.touchStartPosition = event.originalEvent.touches[0];
1004					}
1005					event.stopPropagation();
1006					event.preventDefault();
1007				})
1008				.on('touchmove', '.xdsoft_option', handleTouchMoved)
1009				.on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
1010					if (!this.touchMoved) {
1011						if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
1012							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1013						}
1014
1015						var year = _xdsoft_datetime.currentTime.getFullYear();
1016						if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
1017							_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
1018						}
1019
1020						$(this).parent().parent().hide();
1021
1022						datetimepicker.trigger('xchange.xdsoft');
1023						if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1024							options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1025						}
1026
1027						if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
1028							options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1029						}
1030					}
1031				});
1032
1033			datetimepicker.getValue = function () {
1034				return _xdsoft_datetime.getCurrentTime();
1035			};
1036
1037			datetimepicker.setOptions = function (_options) {
1038				var highlightedDates = {};
1039
1040				options = $.extend(true, {}, options, _options);
1041
1042				// console.log ( " NEW options:" );
1043				// console.log ( options.mask );
1044
1045				if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
1046					options.allowTimes = $.extend(true, [], _options.allowTimes);
1047				}
1048
1049				if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
1050					options.weekends = $.extend(true, [], _options.weekends);
1051				}
1052
1053				if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
1054					options.allowDates = $.extend(true, [], _options.allowDates);
1055				}
1056
1057				if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
1058					options.allowDateRe = new RegExp(_options.allowDateRe);
1059				}
1060
1061				if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
1062					$.each(_options.highlightedDates, function (index, value) {
1063						var splitData = $.map(value.split(','), $.trim),
1064							exDesc,
1065							hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
1066							keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
1067						if (highlightedDates[keyDate] !== undefined) {
1068							exDesc = highlightedDates[keyDate].desc;
1069							if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1070								highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1071							}
1072						} else {
1073							highlightedDates[keyDate] = hDate;
1074						}
1075					});
1076
1077					options.highlightedDates = $.extend(true, [], highlightedDates);
1078				}
1079
1080				if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
1081					highlightedDates = $.extend(true, [], options.highlightedDates);
1082					$.each(_options.highlightedPeriods, function (index, value) {
1083						var dateTest, // start date
1084							dateEnd,
1085							desc,
1086							hDate,
1087							keyDate,
1088							exDesc,
1089							style;
1090						if ($.isArray(value)) {
1091							dateTest = value[0];
1092							dateEnd = value[1];
1093							desc = value[2];
1094							style = value[3];
1095						}
1096						else {
1097							var splitData = $.map(value.split(','), $.trim);
1098							dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
1099							dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
1100							desc = splitData[2];
1101							style = splitData[3];
1102						}
1103
1104						while (dateTest <= dateEnd) {
1105							hDate = new HighlightedDate(dateTest, desc, style);
1106							keyDate = dateHelper.formatDate(dateTest, options.formatDate);
1107							dateTest.setDate(dateTest.getDate() + 1);
1108							if (highlightedDates[keyDate] !== undefined) {
1109								exDesc = highlightedDates[keyDate].desc;
1110								if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1111									highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1112								}
1113							} else {
1114								highlightedDates[keyDate] = hDate;
1115							}
1116						}
1117					});
1118
1119					options.highlightedDates = $.extend(true, [], highlightedDates);
1120				}
1121
1122				if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
1123					options.disabledDates = $.extend(true, [], _options.disabledDates);
1124				}
1125
1126				if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
1127					options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
1128				}
1129
1130				if ((options.open || options.opened) && (!options.inline)) {
1131					input.trigger('open.xdsoft');
1132				}
1133
1134				if (options.inline) {
1135					triggerAfterOpen = true;
1136					datetimepicker.addClass('xdsoft_inline');
1137					input.after(datetimepicker).hide();
1138				}
1139
1140				if (options.inverseButton) {
1141					options.next = 'xdsoft_prev';
1142					options.prev = 'xdsoft_next';
1143				}
1144
1145				if (options.datepicker) {
1146					datepicker.addClass('active');
1147				} else {
1148					datepicker.removeClass('active');
1149				}
1150
1151				if (options.timepicker) {
1152					timepicker.addClass('active');
1153				} else {
1154					timepicker.removeClass('active');
1155				}
1156
1157				if (options.value) {
1158																			// console.log ( "options.value", options.value );
1159																			// console.log ( _xdsoft_datetime.str );
1160																			// console.log ( input.val() );
1161
1162					_xdsoft_datetime.setCurrentTime(options.value);
1163					if (input && input.val) {
1164						input.val(_xdsoft_datetime.str);
1165					}
1166				}
1167
1168				if (isNaN(options.dayOfWeekStart)) {
1169					options.dayOfWeekStart = 0;
1170				} else {
1171					options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
1172				}
1173
1174				if (!options.timepickerScrollbar) {
vendor: 22,415 bytes, lines 1175-1791
1175					timeboxparent.xdsoftScroller(options, 'hide');
1176				}
1177
1178				if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
1179					options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
1180				}
1181
1182				if (options.maxDate &&  /^[\+\-](.*)$/.test(options.maxDate)) {
1183					options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
1184				}
1185
1186                if (options.minDateTime &&  /^\+(.*)$/.test(options.minDateTime)) {
1187                	options.minDateTime = _xdsoft_datetime.strToDateTime(options.minDateTime).dateFormat(options.formatDate);
1188                }
1189
1190				applyButton.toggle(options.showApplyButton);
1191
1192				month_picker
1193					.find('.xdsoft_today_button')
1194					.css('visibility', !options.todayButton ? 'hidden' : 'visible');
1195
1196				month_picker
1197					.find('.' + options.prev)
1198					.css('visibility', !options.prevButton ? 'hidden' : 'visible');
1199
1200				month_picker
1201					.find('.' + options.next)
1202					.css('visibility', !options.nextButton ? 'hidden' : 'visible');
1203
1204				// console.log ( "options.mask" );
1205				// console.log ( options.mask );
1206
1207				setMask(options);
1208
1209				if (options.validateOnBlur) {
1210					input
1211						.off('blur.xdsoft')
1212						.on('blur.xdsoft', function () {
1213							if (options.allowBlank && (!$.trim($(this).val()).length ||
1214									(typeof options.mask === "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
1215								$(this).val(null);
1216								datetimepicker.data('xdsoft_datetime').empty();
1217							} else {
1218								var d = dateHelper.parseDate($(this).val(), options.format);
1219								if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
1220									$(this).val(dateHelper.formatDate(d, options.format));
1221								} else {
1222									var splittedHours   = +([$(this).val()[0], $(this).val()[1]].join('')),
1223										splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
1224
1225									// parse the numbers as 0312 => 03:12
1226									if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1227										$(this).val([splittedHours, splittedMinutes].map(function (item) {
1228											return item > 9 ? item : '0' + item;
1229										}).join(':'));
1230									} else {
1231										$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
1232									}
1233								}
1234								datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1235							}
1236
1237							datetimepicker.trigger('changedatetime.xdsoft');
1238							datetimepicker.trigger('close.xdsoft');
1239						});
1240				}
1241				options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
1242
1243				datetimepicker
1244					.trigger('xchange.xdsoft')
1245					.trigger('afterOpen.xdsoft');
1246			};
1247
1248			datetimepicker
1249				.data('options', options)
1250				.on('touchstart mousedown.xdsoft', function (event) {
1251					event.stopPropagation();
1252					event.preventDefault();
1253					yearselect.hide();
1254					monthselect.hide();
1255					return false;
1256				});
1257
1258			//scroll_element = timepicker.find('.xdsoft_time_box');
1259			timeboxparent.append(timebox);
1260			timeboxparent.xdsoftScroller(options);
1261
1262			datetimepicker.on('afterOpen.xdsoft', function () {
1263				timeboxparent.xdsoftScroller(options);
1264			});
1265
1266			datetimepicker
1267				.append(datepicker)
1268				.append(timepicker).append(btn_clear);
1269
1270			datepicker
1271				.append(month_picker)
1272				.append(calendar)
1273				.append(applyButton);
1274
1275			$(options.parentID)
1276				.append(datetimepicker);
1277
1278			XDSoft_datetime = function () {
1279				var _this = this;
1280				_this.now = function (norecursion) {
1281					var d = new Date(),
1282						date,
1283						time;
1284
1285					if (!norecursion && options.defaultDate) {
1286						date = _this.strToDateTime(options.defaultDate);
1287						d.setFullYear(date.getFullYear());
1288						d.setMonth(date.getMonth());
1289						d.setDate(date.getDate());
1290					}
1291
1292					if (options.yearOffset) {
1293						d.setFullYear(d.getFullYear() + options.yearOffset);
1294					}
1295
1296					if (!norecursion && options.defaultTime) {
1297						time = _this.strtotime(options.defaultTime);
1298						d.setHours(time.getHours());
1299						d.setMinutes(time.getMinutes());
1300						d.setSeconds(time.getSeconds());
1301						d.setMilliseconds(time.getMilliseconds());
1302					}
1303					return d;
1304				};
1305
1306				_this.isValidDate = function (d) {
1307					if (Object.prototype.toString.call(d) !== "[object Date]") {
1308						return false;
1309					}
1310					return !isNaN(d.getTime());
1311				};
1312
1313				_this.setCurrentTime = function (dTime, requireValidDate) {
1314					if (typeof dTime === 'string') {
1315						_this.currentTime = _this.strToDateTime(dTime);
1316					}
1317					else if (_this.isValidDate(dTime)) {
1318						_this.currentTime = dTime;
1319					}
1320					else if (!dTime && !requireValidDate && options.allowBlank && !options.inline) {
1321						_this.currentTime = null;
1322					}
1323					else {
1324						_this.currentTime = _this.now();
1325					}
1326
1327					datetimepicker.trigger('xchange.xdsoft');
1328				};
1329
1330				_this.empty = function () {
1331					_this.currentTime = null;
1332				};
1333
1334				_this.getCurrentTime = function () {
1335					return _this.currentTime;
1336				};
1337
1338				_this.nextMonth = function () {
1339
1340					if (_this.currentTime === undefined || _this.currentTime === null) {
1341						_this.currentTime = _this.now();
1342					}
1343
1344					var month = _this.currentTime.getMonth() + 1,
1345						year;
1346					if (month === 12) {
1347						_this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
1348						month = 0;
1349					}
1350
1351					year = _this.currentTime.getFullYear();
1352
1353					_this.currentTime.setDate(
1354						Math.min(
1355							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
1356							_this.currentTime.getDate()
1357						)
1358					);
1359					_this.currentTime.setMonth(month);
1360
1361					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1362						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1363					}
1364
1365					if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
1366						options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1367					}
1368
1369					datetimepicker.trigger('xchange.xdsoft');
1370					return month;
1371				};
1372
1373				_this.prevMonth = function () {
1374
1375					if (_this.currentTime === undefined || _this.currentTime === null) {
1376						_this.currentTime = _this.now();
1377					}
1378
1379					var month = _this.currentTime.getMonth() - 1;
1380					if (month === -1) {
1381						_this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
1382						month = 11;
1383					}
1384					_this.currentTime.setDate(
1385						Math.min(
1386							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
1387							_this.currentTime.getDate()
1388						)
1389					);
1390					_this.currentTime.setMonth(month);
1391					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1392						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1393					}
1394					datetimepicker.trigger('xchange.xdsoft');
1395					return month;
1396				};
1397
1398				_this.getWeekOfYear = function (datetime) {
1399					if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
1400						var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
1401						if (typeof week !== 'undefined') {
1402							return week;
1403						}
1404					}
1405					var onejan = new Date(datetime.getFullYear(), 0, 1);
1406
1407					//First week of the year is th one with the first Thursday according to ISO8601
1408					if (onejan.getDay() !== 4) {
1409						onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
1410					}
1411
1412					return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
1413				};
1414
1415				_this.strToDateTime = function (sDateTime) {
1416					var tmpDate = [], timeOffset, currentTime;
1417
1418					if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
1419						return sDateTime;
1420					}
1421
1422					tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime);
1423
1424					if (tmpDate) {
1425						tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
1426					}
1427
1428					if (tmpDate  && tmpDate[2]) {
1429						timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
1430						currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
1431					} else {
1432						currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
1433					}
1434
1435					if (!_this.isValidDate(currentTime)) {
1436						currentTime = _this.now();
1437					}
1438
1439					return currentTime;
1440				};
1441
1442				_this.strToDate = function (sDate) {
1443					if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
1444						return sDate;
1445					}
1446
1447					var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
1448					if (!_this.isValidDate(currentTime)) {
1449						currentTime = _this.now(true);
1450					}
1451					return currentTime;
1452				};
1453
1454				_this.strtotime = function (sTime) {
1455					if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
1456						return sTime;
1457					}
1458					var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
1459					if (!_this.isValidDate(currentTime)) {
1460						currentTime = _this.now(true);
1461					}
1462					return currentTime;
1463				};
1464
1465				_this.str = function () {
1466					return dateHelper.formatDate(_this.currentTime, options.format);
1467				};
1468				_this.currentTime = this.now();
1469			};
1470
1471			_xdsoft_datetime = new XDSoft_datetime();
1472
1473			applyButton.on('touchend click', function (e) {//pathbrite
1474				e.preventDefault();
1475				datetimepicker.data('changed', true);
1476				_xdsoft_datetime.setCurrentTime(getCurrentValue());
1477				input.val(_xdsoft_datetime.str());
1478				datetimepicker.trigger('close.xdsoft');
1479			});
1480
1481			month_picker
1482				.find('.xdsoft_today_button')
1483				.on('touchend mousedown.xdsoft', function () {
1484					datetimepicker.data('changed', true);
1485					_xdsoft_datetime.setCurrentTime(0, true);
1486					datetimepicker.trigger('afterOpen.xdsoft');
1487				}).on('dblclick.xdsoft', function () {
1488				var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
1489				currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
1490				minDate = _xdsoft_datetime.strToDate(options.minDate);
1491				minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
1492				if (currentDate < minDate) {
1493					return;
1494				}
1495				maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1496				maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
1497				if (currentDate > maxDate) {
1498					return;
1499				}
1500				input.val(_xdsoft_datetime.str());
1501				input.trigger('change');
1502				datetimepicker.trigger('close.xdsoft');
1503			});
1504
1505			month_picker
1506				.find('.xdsoft_prev,.xdsoft_next')
1507				.on('touchend mousedown.xdsoft', function () {
1508					var $this = $(this),
1509						timer = 0,
1510						stop = false;
1511
1512					(function arguments_callee1(v) {
1513						if ($this.hasClass(options.next)) {
1514							_xdsoft_datetime.nextMonth();
1515						} else if ($this.hasClass(options.prev)) {
1516							_xdsoft_datetime.prevMonth();
1517						}
1518						if (options.monthChangeSpinner) {
1519							if (!stop) {
1520								timer = setTimeout(arguments_callee1, v || 100);
1521							}
1522						}
1523					}(500));
1524
1525					$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
1526						clearTimeout(timer);
1527						stop = true;
1528						$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
1529					});
1530				});
1531
1532			timepicker
1533				.find('.xdsoft_prev,.xdsoft_next')
1534				.on('touchend mousedown.xdsoft', function () {
1535					var $this = $(this),
1536						timer = 0,
1537						stop = false,
1538						period = 110;
1539					(function arguments_callee4(v) {
1540						var pheight = timeboxparent[0].clientHeight,
1541							height = timebox[0].offsetHeight,
1542							top = Math.abs(parseInt(timebox.css('marginTop'), 10));
1543						if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
1544							timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
1545						} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
1546							timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
1547						}
1548						
1549						// Fixed bug:
1550						// When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
1551						// The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
1552						// would cause a bug when you use jquery.css method.
1553						// Let's say: * { transition: all .5s ease; }
1554						// jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
1555						// meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
1556						// next/prev button.
1557						// 
1558						// What we should do:
1559						// Replace timebox.css('marginTop') with timebox[0].style.marginTop.
1560						// 
1561						timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
1562						period = (period > 10) ? 10 : period - 10;
1563						if (!stop) {
1564							timer = setTimeout(arguments_callee4, v || period);
1565						}
1566					}(500));
1567					$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
1568						clearTimeout(timer);
1569						stop = true;
1570						$([options.ownerDocument.body, options.contentWindow])
1571							.off('touchend mouseup.xdsoft', arguments_callee5);
1572					});
1573				});
1574
1575			xchangeTimer = 0;
1576			// base handler - generating a calendar and timepicker
1577			datetimepicker
1578				.on('xchange.xdsoft', function (event) {
1579					clearTimeout(xchangeTimer);
1580					xchangeTimer = setTimeout(function () {
1581
1582						if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
1583							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1584						}
1585
1586						var table =	'',
1587							start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
1588							i = 0,
1589							j,
1590							today = _xdsoft_datetime.now(),
1591							maxDate = false,
1592							minDate = false,
1593                            minDateTime = false,
1594							hDate,
1595							day,
1596							d,
1597							y,
1598							m,
1599							w,
1600							classes = [],
1601							customDateSettings,
1602							newRow = true,
1603							time = '',
1604							h,
1605							line_time,
1606							description;
1607
1608						while (start.getDay() !== options.dayOfWeekStart) {
1609							start.setDate(start.getDate() - 1);
1610						}
1611
1612						table += '<table><thead><tr>';
1613
1614						if (options.weeks) {
1615							table += '<th></th>';
1616						}
1617
1618						for (j = 0; j < 7; j += 1) {
1619							table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
1620						}
1621
1622						table += '</tr></thead>';
1623						table += '<tbody>';
1624
1625						if (options.maxDate !== false) {
1626							maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1627							maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
1628						}
1629
1630						if (options.minDate !== false) {
1631							minDate = _xdsoft_datetime.strToDate(options.minDate);
1632							minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
1633						}
1634
1635                        if (options.minDateTime !== false) {
1636							minDateTime = _xdsoft_datetime.strToDate(options.minDateTime);
1637							minDateTime = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), minDateTime.getHours(), minDateTime.getMinutes(), minDateTime.getSeconds());
1638						}
1639
1640						while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
1641							classes = [];
1642							i += 1;
1643
1644							day = start.getDay();
1645							d = start.getDate();
1646							y = start.getFullYear();
1647							m = start.getMonth();
1648							w = _xdsoft_datetime.getWeekOfYear(start);
1649							description = '';
1650
1651							classes.push('xdsoft_date');
1652
1653							if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
1654								customDateSettings = options.beforeShowDay.call(datetimepicker, start);
1655							} else {
1656								customDateSettings = null;
1657							}
1658
1659							if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
1660								if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){
1661									classes.push('xdsoft_disabled');
1662								}
1663							}
1664							
1665							if(options.allowDates && options.allowDates.length>0){
1666								if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
1667									classes.push('xdsoft_disabled');
1668								}
1669							}
1670							
1671							if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime)  || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
1672								classes.push('xdsoft_disabled');
1673							}
1674							
1675							if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
1676								classes.push('xdsoft_disabled');
1677							}
1678							
1679							if (options.disabledWeekDays.indexOf(day) !== -1) {
1680								classes.push('xdsoft_disabled');
1681							}
1682							
1683							if (input.is('[disabled]')) {
1684								classes.push('xdsoft_disabled');
1685							}
1686
1687							if (customDateSettings && customDateSettings[1] !== "") {
1688								classes.push(customDateSettings[1]);
1689							}
1690
1691							if (_xdsoft_datetime.currentTime.getMonth() !== m) {
1692								classes.push('xdsoft_other_month');
1693							}
1694
1695							if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
1696								classes.push('xdsoft_current');
1697							}
1698
1699							if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
1700								classes.push('xdsoft_today');
1701							}
1702
1703							if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
1704								classes.push('xdsoft_weekend');
1705							}
1706
1707							if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
1708								hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
1709								classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
1710								description = hDate.desc === undefined ? '' : hDate.desc;
1711							}
1712
1713							if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
1714								classes.push(options.beforeShowDay(start));
1715							}
1716
1717							if (newRow) {
1718								table += '<tr>';
1719								newRow = false;
1720								if (options.weeks) {
1721									table += '<th>' + w + '</th>';
1722								}
1723							}
1724
1725							table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
1726								'<div>' + d + '</div>' +
1727								'</td>';
1728
1729							if (start.getDay() === options.dayOfWeekStartPrev) {
1730								table += '</tr>';
1731								newRow = true;
1732							}
1733
1734							start.setDate(d + 1);
1735						}
1736						table += '</tbody></table>';
1737
1738						calendar.html(table);
1739
1740						month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
1741						month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
1742
1743						// generate timebox
1744						time = '';
1745						h = '';
1746						m = '';
1747
1748						line_time = function line_time(h, m) {
1749							var now = _xdsoft_datetime.now(), optionDateTime, current_time,
1750								isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
1751							now.setHours(h);
1752							h = parseInt(now.getHours(), 10);
1753							now.setMinutes(m);
1754							m = parseInt(now.getMinutes(), 10);
1755							optionDateTime = new Date(_xdsoft_datetime.currentTime);
1756							optionDateTime.setHours(h);
1757							optionDateTime.setMinutes(m);
1758							classes = [];
1759							if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) {
1760								classes.push('xdsoft_disabled');
1761							} else if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
1762								classes.push('xdsoft_disabled');
1763							} else if (input.is('[disabled]')) {
1764								classes.push('xdsoft_disabled');
1765							}
1766
1767							current_time = new Date(_xdsoft_datetime.currentTime);
1768							current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
1769
1770							if (!isALlowTimesInit) {
1771								current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
1772							}
1773
1774							if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
1775								if (options.defaultSelect || datetimepicker.data('changed')) {
1776									classes.push('xdsoft_current');
1777								} else if (options.initTime) {
1778									classes.push('xdsoft_init_time');
1779								}
1780							}
1781							if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
1782								classes.push('xdsoft_today');
1783							}
1784							time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
1785						};
1786
1787						if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
1788							for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
1789								for (j = 0; j < 60; j += options.step) {
1790									h = (i < 10 ? '0' : '') + i;
1791									m = (j < 10 ? '0'
vendor: 3,470 bytes, lines 1791-1886
1791 : '') + j;
1792									line_time(h, m);
1793								}
1794							}
1795						} else {
1796							for (i = 0; i < options.allowTimes.length; i += 1) {
1797								h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
1798								m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
1799								line_time(h, m);
1800							}
1801						}
1802
1803						timebox.html(time);
1804
1805						opt = '';
1806
1807						for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
1808							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>';
1809						}
1810						yearselect.children().eq(0)
1811							.html(opt);
1812
1813						for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
1814							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
1815						}
1816						monthselect.children().eq(0).html(opt);
1817						$(datetimepicker)
1818							.trigger('generate.xdsoft');
1819					}, 10);
1820					event.stopPropagation();
1821				})
1822				.on('afterOpen.xdsoft', function () {
1823					if (options.timepicker) {
1824						var classType, pheight, height, top;
1825						if (timebox.find('.xdsoft_current').length) {
1826							classType = '.xdsoft_current';
1827						} else if (timebox.find('.xdsoft_init_time').length) {
1828							classType = '.xdsoft_init_time';
1829						}
1830						if (classType) {
1831							pheight = timeboxparent[0].clientHeight;
1832							height = timebox[0].offsetHeight;
1833							top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
1834							if ((height - pheight) < top) {
1835								top = height - pheight;
1836							}
1837							timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
1838						} else {
1839							timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
1840						}
1841					}
1842				});
1843
1844			timerclick = 0;
1845			calendar
1846				.on('touchend click.xdsoft', 'td', function (xdevent) {
1847					xdevent.stopPropagation();  // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1848					timerclick += 1;
1849					var $this = $(this),
1850						currentTime = _xdsoft_datetime.currentTime;
1851
1852					if (currentTime === undefined || currentTime === null) {
1853						_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1854						currentTime = _xdsoft_datetime.currentTime;
1855					}
1856
1857					if ($this.hasClass('xdsoft_disabled')) {
1858						return false;
1859					}
1860
1861					currentTime.setDate(1);
1862					currentTime.setFullYear($this.data('year'));
1863					currentTime.setMonth($this.data('month'));
1864					currentTime.setDate($this.data('date'));
1865
1866					datetimepicker.trigger('select.xdsoft', [currentTime]);
1867
1868					input.val(_xdsoft_datetime.str());
1869
1870					if (options.onSelectDate &&	$.isFunction(options.onSelectDate)) {
1871						options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1872					}
1873
1874					datetimepicker.data('changed', true);
1875					datetimepicker.trigger('xchange.xdsoft');
1876					datetimepicker.trigger('changedatetime.xdsoft');
1877					if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
1878						datetimepicker.trigger('close.xdsoft');
1879					}
1880					setTimeout(function () {
1881						timerclick = 0;
1882					}, 200);
1883				});
1884
1885			timebox
1886				.on('touch
vendor: 3,854 bytes, lines 1886-2006
1886start', 'div', function (xdevent) {
1887					this.touchMoved = false;
1888				})
1889				.on('touchmove', 'div', handleTouchMoved)
1890				.on('touchend click.xdsoft', 'div', function (xdevent) {
1891					if (!this.touchMoved) {
1892						xdevent.stopPropagation();
1893						var $this = $(this),
1894							currentTime = _xdsoft_datetime.currentTime;
1895
1896						if (currentTime === undefined || currentTime === null) {
1897							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1898							currentTime = _xdsoft_datetime.currentTime;
1899						}
1900
1901						if ($this.hasClass('xdsoft_disabled')) {
1902							return false;
1903						}
1904						currentTime.setHours($this.data('hour'));
1905						currentTime.setMinutes($this.data('minute'));
1906						datetimepicker.trigger('select.xdsoft', [currentTime]);
1907
1908						datetimepicker.data('input').val(_xdsoft_datetime.str());
1909
1910						if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
1911							options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1912						}
1913						datetimepicker.data('changed', true);
1914						datetimepicker.trigger('xchange.xdsoft');
1915						datetimepicker.trigger('changedatetime.xdsoft');
1916						if (options.inline !== true && options.closeOnTimeSelect === true) {
1917							datetimepicker.trigger('close.xdsoft');
1918						}
1919					}
1920				});
1921
1922			datepicker
1923				.on('mousewheel.xdsoft', function (event) {
1924					if (!options.scrollMonth) {
1925						return true;
1926					}
1927					if (event.deltaY < 0) {
1928						_xdsoft_datetime.nextMonth();
1929					} else {
1930						_xdsoft_datetime.prevMonth();
1931					}
1932					return false;
1933				});
1934
1935			input
1936				.on('mousewheel.xdsoft', function (event) {
1937					if (!options.scrollInput) {
1938						return true;
1939					}
1940					if (!options.datepicker && options.timepicker) {
1941						current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
1942						if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
1943							current_time_index += event.deltaY;
1944						}
1945						if (timebox.children().eq(current_time_index).length) {
1946							timebox.children().eq(current_time_index).trigger('mousedown');
1947						}
1948						return false;
1949					}
1950					if (options.datepicker && !options.timepicker) {
1951						datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
1952						if (input.val) {
1953							input.val(_xdsoft_datetime.str());
1954						}
1955						datetimepicker.trigger('changedatetime.xdsoft');
1956						return false;
1957					}
1958				});
1959
1960			datetimepicker
1961				.on('changedatetime.xdsoft', function (event) {
1962					if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
1963						var $input = datetimepicker.data('input');
1964						options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
1965						delete options.value;
1966						$input.trigger('change');
1967					}
1968				})
1969				.on('generate.xdsoft', function () {
1970					if (options.onGenerate && $.isFunction(options.onGenerate)) {
1971						options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1972					}
1973					if (triggerAfterOpen) {
1974						datetimepicker.trigger('afterOpen.xdsoft');
1975						triggerAfterOpen = false;
1976					}
1977				})
1978				.on('click.xdsoft', function (xdevent) {
1979					xdevent.stopPropagation();
1980				});
1981
1982			current_time_index = 0;
1983
1984			
1985			// Runs the callback for each of the specified node's ancestors.
1986			// 
1987			//  Return FALSE from the callback to stop ascending.
1988			// 
1989			//  @param {DOMNode} node
1990			//  @param {Function} callback
1991			//  @returns {undefined}
1992			// 
1993			forEachAncestorOf = function (node, callback) {
1994				do {
1995					node = node.parentNode;
1996					if (!node || callback(node) === false) {
1997						break;
1998					}
1999				} while (node.nodeName !== 'HTML');
2000			};
2001
2002			// 
2003			// Sets the position of the picker.
2004			// 
2005			//  @returns {undefined}
2006			// 
vendor: 4,880 bytes, lines 2006-2158
2006
2007			setPos = function () {
2008				var dateInputOffset,
2009					dateInputElem,
2010					verticalPosition,
2011					left,
2012					position,
2013					datetimepickerElem,
2014					dateInputHasFixedAncestor,
2015					$dateInput,
2016					windowWidth,
2017					verticalAnchorEdge,
2018					datetimepickerCss,
2019					windowHeight,
2020					windowScrollTop;
2021
2022				$dateInput = datetimepicker.data('input');
2023				dateInputOffset = $dateInput.offset();
2024				dateInputElem = $dateInput[0];
2025
2026				verticalAnchorEdge = 'top';
2027				verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1;
2028				left = dateInputOffset.left;
2029				position = "absolute";
2030
2031				windowWidth = $(options.contentWindow).width();
2032				windowHeight = $(options.contentWindow).height();
2033				windowScrollTop = $(options.contentWindow).scrollTop();
2034
2035				if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
2036					var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
2037					left = left - diff;
2038				}
2039
2040				if ($dateInput.parent().css('direction') === 'rtl') {
2041					left -= (datetimepicker.outerWidth() - $dateInput.outerWidth());
2042				}
2043
2044				if (options.fixed) {
2045					verticalPosition -= windowScrollTop;
2046					left -= $(options.contentWindow).scrollLeft();
2047					position = "fixed";
2048				} else {
2049					dateInputHasFixedAncestor = false;
2050
2051					forEachAncestorOf(dateInputElem, function (ancestorNode) {
2052						if (ancestorNode === null) {
2053							return false;
2054						}
2055
2056						if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
2057							dateInputHasFixedAncestor = true;
2058							return false;
2059						}
2060					});
2061
2062					if (dateInputHasFixedAncestor) {
2063						position = 'fixed';
2064
2065						//If the picker won't fit entirely within the viewport then display it above the date input.
2066						if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) {
2067							verticalAnchorEdge = 'bottom';
2068							verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top;
2069						} else {
2070							verticalPosition -= windowScrollTop;
2071						}
2072					} else {
2073						if (verticalPosition + datetimepicker[0].offsetHeight > windowHeight + windowScrollTop) {
2074							verticalPosition = dateInputOffset.top - datetimepicker[0].offsetHeight + 1;
2075						}
2076					}
2077
2078					if (verticalPosition < 0) {
2079						verticalPosition = 0;
2080					}
2081
2082					if (left + dateInputElem.offsetWidth > windowWidth) {
2083						left = windowWidth - dateInputElem.offsetWidth;
2084					}
2085				}
2086
2087				datetimepickerElem = datetimepicker[0];
2088
2089				forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
2090					var ancestorNodePosition;
2091
2092					ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
2093
2094					if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
2095						left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
2096						return false;
2097					}
2098				});
2099
2100				datetimepickerCss = {
2101					position: position,
2102					left: left,
2103					top: '',  //Initialize to prevent previous values interfering with new ones.
2104					bottom: ''  //Initialize to prevent previous values interfering with new ones.
2105				};
2106
2107				datetimepickerCss[verticalAnchorEdge] = verticalPosition;
2108
2109				datetimepicker.css(datetimepickerCss);
2110			};
2111
2112			datetimepicker
2113				.on('open.xdsoft', function (event) {
2114					var onShow = true;
2115					if (options.onShow && $.isFunction(options.onShow)) {
2116						onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
2117					}
2118					if (onShow !== false) {
2119						datetimepicker.show();
2120						setPos();
2121						$(options.contentWindow)
2122							.off('resize.xdsoft', setPos)
2123							.on('resize.xdsoft', setPos);
2124
2125						if (options.closeOnWithoutClick) {
2126							$([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
2127								datetimepicker.trigger('close.xdsoft');
2128								$([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
2129							});
2130						}
2131					}
2132				})
2133				.on('close.xdsoft', function (event) {
2134					var onClose = true;
2135					month_picker
2136						.find('.xdsoft_month,.xdsoft_year')
2137						.find('.xdsoft_select')
2138						.hide();
2139					if (options.onClose && $.isFunction(options.onClose)) {
2140						onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
2141					}
2142					if (onClose !== false && !options.opened && !options.inline) {
2143						datetimepicker.hide();
2144					}
2145					event.stopPropagation();
2146				})
2147				.on('toggle.xdsoft', function () {
2148					if (datetimepicker.is(':visible')) {
2149						datetimepicker.trigger('close.xdsoft');
2150					} else {
2151						datetimepicker.trigger('open.xdsoft');
2152					}
2153				})
2154				.data('input', input);
2155
2156			timer = 0;
2157
2158			
vendor: 20,136 bytes, lines 2158-2766
2158// console.log ( _xdsoft_datetime );
2159			// console.log ( options.defaultDate );
2160
2161			datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
2162			datetimepicker.setOptions(options);
2163
2164			function getCurrentValue() {
2165				var ct = false, time;
2166
2167				if (options.startDate) {
2168					ct = _xdsoft_datetime.strToDate(options.startDate);
2169				} else {
2170					ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
2171					if (ct) {
2172						ct = _xdsoft_datetime.strToDateTime(ct);
2173					} else if (options.defaultDate) {
2174						ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
2175						if (options.defaultTime) {
2176							time = _xdsoft_datetime.strtotime(options.defaultTime);
2177							ct.setHours(time.getHours());
2178							ct.setMinutes(time.getMinutes());
2179						}
2180					}
2181				}
2182
2183				if (ct && _xdsoft_datetime.isValidDate(ct)) {
2184					datetimepicker.data('changed', true);
2185				} else {
2186					ct = '';
2187				}
2188				return ct || 0;
2189			}
2190
2191			function setMask(options) {
2192
2193				var isValidValue = function (mask, value) {
2194
2195					// console.log ( " Valid mask: " , mask );
2196
2197					var reg = mask
2198						.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
2199						.replace(/_/g, '{digit+}')
2200						.replace(/([0-9]{1})/g, '{digit$1}')
2201						.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
2202						.replace(/\{digit[\+]\}/g, '[0-9_]{1}');
2203						
2204						
2205						// console.log ( (new RegExp(reg)).test(value) );
2206						
2207					return (new RegExp(reg)).test(value);
2208				},
2209					getCaretPos = function (input) {
2210						try {
2211							if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
2212								var range = options.ownerDocument.selection.createRange();
2213								return range.getBookmark().charCodeAt(2) - 2;
2214							}
2215							if (input.setSelectionRange) {
2216								return input.selectionStart;
2217							}
2218						} catch (e) {
2219							return 0;
2220						}
2221					},
2222					setCaretPos = function (node, pos) {
2223						node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
2224						if (!node) {
2225							return false;
2226						}
2227						if (node.createTextRange) {
2228							var textRange = node.createTextRange();
2229							textRange.collapse(true);
2230							textRange.moveEnd('character', pos);
2231							textRange.moveStart('character', pos);
2232							textRange.select();
2233							return true;
2234						}
2235						if (node.setSelectionRange) {
2236							node.setSelectionRange(pos, pos);
2237							return true;
2238						}
2239						return false;
2240					};
2241
2242				if(options.mask) {
2243					input.off('keydown.xdsoft');
2244				}
2245
2246				if (options.mask === true) {
2247					if (typeof moment != 'undefined') {
2248						// options.mask = options.format
2249						// 	.replace(/Y{4}/g, '9999')
2250						// 	.replace(/Y{2}/g, '99')
2251						// 	.replace(/M{2}/g, '19')
2252						// 	.replace(/D{2}/g, '39')
2253						// 	.replace(/H{2}/g, '29')
2254						// 	.replace(/m{2}/g, '59')
2255						// 	.replace(/s{2}/g, '59');
2256
2257						options.mask = options.format
2258							.replace(/Y/g, '9999')
2259							.replace(/F/g, '9999')
2260							.replace(/m/g, '19')
2261							.replace(/d/g, '39')
2262							.replace(/H/g, '29')
2263							.replace(/i/g, '59')
2264							.replace(/s/g, '59');
2265					} else {
2266						options.mask = options.format
2267							.replace(/Y/g, '9999')
2268							.replace(/F/g, '9999')
2269							.replace(/m/g, '19')
2270							.replace(/d/g, '39')
2271							.replace(/H/g, '29')
2272							.replace(/i/g, '59')
2273							.replace(/s/g, '59');
2274					}
2275				}
2276
2277				if ($.type(options.mask) === 'string') {
2278					if (!isValidValue(options.mask, input.val())) {
2279						// input.val(options.mask.replace(/[0-9]/g, '_'));
2280						setCaretPos(input[0], 0);
2281					}
2282
2283					input.on('paste.xdsoft', function (event) {
2284					    // couple options here
2285					    // 1. return false - tell them they can't paste
2286					    // 2. insert over current characters - minimal validation
2287					    // 3. full fledged parsing and validation
2288					    // let's go option 2 for now
2289
2290					    // fires multiple times for some reason
2291
2292					    // https://stackoverflow.com/a/30496488/1366033
2293					    var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData,
2294						pastedData = clipboardData.getData('text'),
2295						val = this.value,
2296						pos = this.selectionStart
2297
2298					    var valueBeforeCursor = val.substr(0, pos);
2299					    var valueAfterPaste = val.substr(pos + pastedData.length);
2300
2301					    val = valueBeforeCursor + pastedData + valueAfterPaste;           
2302					    pos += pastedData.length;
2303
2304						if (isValidValue(options.mask, val)) {
2305							this.value = val;
2306							setCaretPos(this, pos);
2307					    } else if ($.trim(val) === '') {
2308							this.value = options.mask.replace(/[0-9]/g, '_');
2309					    } else {
2310							input.trigger('error_input.xdsoft');
2311					    }
2312
2313					    event.preventDefault();
2314					    return false;
2315					  });
2316
2317					  input.on('keydown.xdsoft', function (event) {
2318					    var val = this.value,
2319						key = event.which,
2320						pos = this.selectionStart,
2321						selEnd = this.selectionEnd,
2322						hasSel = pos !== selEnd,
2323						digit;
2324
2325					    // only alow these characters
2326					    if (((key >=  KEY0 && key <=  KEY9)  ||
2327						 (key >= _KEY0 && key <= _KEY9)) || 
2328						 (key === BACKSPACE || key === DEL)) {
2329
2330					      // get char to insert which is new character or placeholder ('_')
2331					      digit = (key === BACKSPACE || key === DEL) ? '_' :
2332							  String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key);
2333
2334						// we're deleting something, we're not at the start, and have normal cursor, move back one
2335						// if we have a selection length, cursor actually sits behind deletable char, not in front
2336						if (key === BACKSPACE && pos && !hasSel) {
2337						    pos -= 1;
2338						}
2339
2340						// don't stop on a separator, continue whatever direction you were going
2341						//   value char - keep incrementing position while on separator char and we still have room
2342						//   del char   - keep decrementing position while on separator char and we still have room
2343						while (true) {
2344						  var maskValueAtCurPos = options.mask.substr(pos, 1);
2345						  var posShorterThanMaskLength = pos < options.mask.length;
2346						  var posGreaterThanZero = pos > 0;
2347						  var notNumberOrPlaceholder = /[^0-9_]/;
2348						  var curPosOnSep = notNumberOrPlaceholder.test(maskValueAtCurPos);
2349						  var continueMovingPosition = curPosOnSep && posShorterThanMaskLength && posGreaterThanZero
2350
2351						  // if we hit a real char, stay where we are
2352						  if (!continueMovingPosition) break;
2353
2354						  // hitting backspace in a selection, you can possibly go back any further - go forward
2355						  pos += (key === BACKSPACE && !hasSel) ? -1 : 1;
2356
2357						}
2358
2359
2360						if (hasSel) {
2361						  // pos might have moved so re-calc length
2362						  var selLength = selEnd - pos
2363
2364						  // if we have a selection length we will wipe out entire selection and replace with default template for that range
2365						  var defaultBlank = options.mask.replace(/[0-9]/g, '_');
2366						  var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength); 
2367						  var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty
2368
2369						  var valueBeforeSel = val.substr(0, pos);
2370						  var insertChars = digit + selReplacementRemainder;
2371						  var charsAfterSelection = val.substr(pos + selLength);
2372
2373						  val = valueBeforeSel + insertChars + charsAfterSelection
2374
2375						} else {
2376						  var valueBeforeCursor = val.substr(0, pos);
2377						  var insertChar = digit;
2378						  var valueAfterNextChar = val.substr(pos + 1);
2379
2380						  val = valueBeforeCursor + insertChar + valueAfterNextChar
2381						}
2382
2383						if ($.trim(val) === '') {
2384						  // if empty, set to default
2385						    val = defaultBlank
2386						} else {
2387						  // if at the last character don't need to do anything
2388						    if (pos === options.mask.length) {
2389							event.preventDefault();
2390							return false;
2391						    }
2392						}
2393
2394						// resume cursor location
2395						pos += (key === BACKSPACE) ? 0 : 1;
2396						// don't stop on a separator, continue whatever direction you were going
2397						while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
2398						    pos += (key === BACKSPACE) ? 0 : 1;
2399						}
2400
2401						if (isValidValue(options.mask, val)) {
2402						    this.value = val;
2403						    setCaretPos(this, pos);
2404						} else if ($.trim(val) === '') {
2405						    this.value = options.mask.replace(/[0-9]/g, '_');
2406						} else {
2407						    input.trigger('error_input.xdsoft');
2408						}
2409					    } else {
2410						if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
2411						    return true;
2412						}
2413					    }
2414
2415					    event.preventDefault();
2416					    return false;
2417					  });
2418				}
2419			}
2420
2421			_xdsoft_datetime.setCurrentTime(getCurrentValue());
2422
2423			input
2424				.data('xdsoft_datetimepicker', datetimepicker)
2425				.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () {
2426					if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
2427						return;
2428					}
2429					if (!options.openOnFocus) {
2430						return;
2431					}
2432					clearTimeout(timer);
2433					timer = setTimeout(function () {
2434						if (input.is(':disabled')) {
2435							return;
2436						}
2437
2438						triggerAfterOpen = true;
2439						_xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
2440						if(options.mask) {
2441							setMask(options);
2442						}
2443						datetimepicker.trigger('open.xdsoft');
2444					}, 100);
2445				})
2446				.on('keydown.xdsoft', function (event) {
2447					var elementSelector,
2448						key = event.which;
2449					if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
2450						elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
2451						datetimepicker.trigger('close.xdsoft');
2452						elementSelector.eq(elementSelector.index(this) + 1).focus();
2453						return false;
2454					}
2455					if ([TAB].indexOf(key) !== -1) {
2456						datetimepicker.trigger('close.xdsoft');
2457						return true;
2458					}
2459				})
2460				.on('blur.xdsoft', function () {
2461					datetimepicker.trigger('close.xdsoft');
2462				});
2463		};
2464		destroyDateTimePicker = function (input) {
2465			var datetimepicker = input.data('xdsoft_datetimepicker');
2466			if (datetimepicker) {
2467				datetimepicker.data('xdsoft_datetime', null);
2468				datetimepicker.remove();
2469				input
2470					.data('xdsoft_datetimepicker', null)
2471					.off('.xdsoft');
2472				$(options.contentWindow).off('resize.xdsoft');
2473				$([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
2474				if (input.unmousewheel) {
2475					input.unmousewheel();
2476				}
2477			}
2478		};
2479		$(options.ownerDocument)
2480			.off('keydown.xdsoftctrl keyup.xdsoftctrl')
2481			.on('keydown.xdsoftctrl', function (e) {
2482				if (e.keyCode === CTRLKEY) {
2483					ctrlDown = true;
2484				}
2485			})
2486			.on('keyup.xdsoftctrl', function (e) {
2487				if (e.keyCode === CTRLKEY) {
2488					ctrlDown = false;
2489				}
2490			});
2491
2492		this.each(function () {
2493			var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
2494			if (datetimepicker) {
2495				if ($.type(opt) === 'string') {
2496					switch (opt) {
2497						case 'show':
2498							$(this).select().focus();
2499							datetimepicker.trigger('open.xdsoft');
2500							break;
2501						case 'hide':
2502							datetimepicker.trigger('close.xdsoft');
2503							break;
2504						case 'toggle':
2505							datetimepicker.trigger('toggle.xdsoft');
2506							break;
2507						case 'destroy':
2508							destroyDateTimePicker($(this));
2509							break;
2510						case 'reset':
2511							this.value = this.defaultValue;
2512							if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
2513								datetimepicker.data('changed', false);
2514							}
2515							datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
2516							break;
2517						case 'validate':
2518							$input = datetimepicker.data('input');
2519							$input.trigger('blur.xdsoft');
2520							break;
2521						default:
2522							if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
2523								result = datetimepicker[opt](opt2);
2524							}
2525					}
2526				} else {
2527					datetimepicker
2528						.setOptions(opt);
2529				}
2530				return 0;
2531			}
2532			if ($.type(opt) !== 'string') {
2533				if (!options.lazyInit || options.open || options.inline) {
2534					createDateTimePicker($(this));
2535				} else {
2536					lazyInit($(this));
2537				}
2538			}
2539		});
2540
2541		return result;
2542	};
2543
2544	$.fn.datetimepicker.defaults = default_options;
2545
2546	function HighlightedDate(date, desc, style) {
2547		"use strict";
2548		this.date = date;
2549		this.desc = desc;
2550		this.style = style;
2551	}
2552};
2553(function (factory) {
2554	if ( typeof define === 'function' && define.amd ) {
2555		// AMD. Register as an anonymous module.
2556		define(['jquery', 'jquery-mousewheel'], factory);
2557	} else if (typeof exports === 'object') {
2558		// Node/CommonJS style for Browserify
2559		module.exports = factory(require('jquery'));
2560	} else {
2561		// Browser globals
2562		factory(jQuery);
2563	}
2564}(datetimepickerFactory));
2565
2566
2567
2568/*!
2569 * jQuery Mousewheel 3.1.13
2570 *
2571 * Copyright jQuery Foundation and other contributors
2572 * Released under the MIT license
2573 * http://jquery.org/license
2574 */
2575
2576(function (factory) {
2577    if ( typeof define === 'function' && define.amd ) {
2578        // AMD. Register as an anonymous module.
2579        define(['jquery'], factory);
2580    } else if (typeof exports === 'object') {
2581        // Node/CommonJS style for Browserify
2582        module.exports = factory;
2583    } else {
2584        // Browser globals
2585        factory(jQuery);
2586    }
2587}(function ($) {
2588
2589    var toFix  = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
2590        toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
2591                    ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
2592        slice  = Array.prototype.slice,
2593        nullLowestDeltaTimeout, lowestDelta;
2594
2595    if ( $.event.fixHooks ) {
2596        for ( var i = toFix.length; i; ) {
2597            $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
2598        }
2599    }
2600
2601    var special = $.event.special.mousewheel = {
2602        version: '3.1.12',
2603
2604        setup: function() {
2605            if ( this.addEventListener ) {
2606                for ( var i = toBind.length; i; ) {
2607                    this.addEventListener( toBind[--i], handler, false );
2608                }
2609            } else {
2610                this.onmousewheel = handler;
2611            }
2612            // Store the line height and page height for this particular element
2613            $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
2614            $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
2615        },
2616
2617        teardown: function() {
2618            if ( this.removeEventListener ) {
2619                for ( var i = toBind.length; i; ) {
2620                    this.removeEventListener( toBind[--i], handler, false );
2621                }
2622            } else {
2623                this.onmousewheel = null;
2624            }
2625            // Clean up the data we added to the element
2626            $.removeData(this, 'mousewheel-line-height');
2627            $.removeData(this, 'mousewheel-page-height');
2628        },
2629
2630        getLineHeight: function(elem) {
2631            var $elem = $(elem),
2632                $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
2633            if (!$parent.length) {
2634                $parent = $('body');
2635            }
2636            return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
2637        },
2638
2639        getPageHeight: function(elem) {
2640            return $(elem).height();
2641        },
2642
2643        settings: {
2644            adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
2645            normalizeOffset: true  // calls getBoundingClientRect for each event
2646        }
2647    };
2648
2649    $.fn.extend({
2650        mousewheel: function(fn) {
2651            return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
2652        },
2653
2654        unmousewheel: function(fn) {
2655            return this.unbind('mousewheel', fn);
2656        }
2657    });
2658
2659
2660    function handler(event) {
2661        var orgEvent   = event || window.event,
2662            args       = slice.call(arguments, 1),
2663            delta      = 0,
2664            deltaX     = 0,
2665            deltaY     = 0,
2666            absDelta   = 0,
2667            offsetX    = 0,
2668            offsetY    = 0;
2669        event = $.event.fix(orgEvent);
2670        event.type = 'mousewheel';
2671
2672        // Old school scrollwheel delta
2673        if ( 'detail'      in orgEvent ) { deltaY = orgEvent.detail * -1;      }
2674        if ( 'wheelDelta'  in orgEvent ) { deltaY = orgEvent.wheelDelta;       }
2675        if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY;      }
2676        if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
2677
2678        // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
2679        if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
2680            deltaX = deltaY * -1;
2681            deltaY = 0;
2682        }
2683
2684        // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
2685        delta = deltaY === 0 ? deltaX : deltaY;
2686
2687        // New school wheel delta (wheel event)
2688        if ( 'deltaY' in orgEvent ) {
2689            deltaY = orgEvent.deltaY * -1;
2690            delta  = deltaY;
2691        }
2692        if ( 'deltaX' in orgEvent ) {
2693            deltaX = orgEvent.deltaX;
2694            if ( deltaY === 0 ) { delta  = deltaX * -1; }
2695        }
2696
2697        // No change actually happened, no reason to go any further
2698        if ( deltaY === 0 && deltaX === 0 ) { return; }
2699
2700        // Need to convert lines and pages to pixels if we aren't already in pixels
2701        // There are three delta modes:
2702        //   * deltaMode 0 is by pixels, nothing to do
2703        //   * deltaMode 1 is by lines
2704        //   * deltaMode 2 is by pages
2705        if ( orgEvent.deltaMode === 1 ) {
2706            var lineHeight = $.data(this, 'mousewheel-line-height');
2707            delta  *= lineHeight;
2708            deltaY *= lineHeight;
2709            deltaX *= lineHeight;
2710        } else if ( orgEvent.deltaMode === 2 ) {
2711            var pageHeight = $.data(this, 'mousewheel-page-height');
2712            delta  *= pageHeight;
2713            deltaY *= pageHeight;
2714            deltaX *= pageHeight;
2715        }
2716
2717        // Store lowest absolute delta to normalize the delta values
2718        absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
2719
2720        if ( !lowestDelta || absDelta < lowestDelta ) {
2721            lowestDelta = absDelta;
2722
2723            // Adjust older deltas if necessary
2724            if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
2725                lowestDelta /= 40;
2726            }
2727        }
2728
2729        // Adjust older deltas if necessary
2730        if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
2731            // Divide all the things by 40!
2732            delta  /= 40;
2733            deltaX /= 40;
2734            deltaY /= 40;
2735        }
2736
2737        // Get a whole, normalized value for the deltas
2738        delta  = Math[ delta  >= 1 ? 'floor' : 'ceil' ](delta  / lowestDelta);
2739        deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
2740        deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
2741
2742        // Normalise offsetX and offsetY properties
2743        if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
2744            var boundingRect = this.getBoundingClientRect();
2745            offsetX = event.clientX - boundingRect.left;
2746            offsetY = event.clientY - boundingRect.top;
2747        }
2748
2749        // Add information to the event object
2750        event.deltaX = deltaX;
2751        event.deltaY = deltaY;
2752        event.deltaFactor = lowestDelta;
2753        event.offsetX = offsetX;
2754        event.offsetY = offsetY;
2755        // Go ahead and set deltaMode to 0 since we converted to pixels
2756        // Although this is a little odd since we overwrite the deltaX/Y
2757        // properties with normalized deltas.
2758        event.deltaMode = 0;
2759
2760        // Add event and delta to the front of the arguments
2761        args.unshift(event, delta, deltaX, deltaY);
2762
2763        // Clearout lowestDelta after sometime to better
2764        // handle multiple device types that give different
2765        // a different lowestDelta
2766        // Ex: trackpad = 3 and mouse wheel = 120
2767        if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
2768        nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
2769
2770        return ($.event.dispatch || $.event.handle).apply(this, args);
2771    }
2772
2773    function nullLowestDelta() {
2774        lowestDelta = null;
2775    }
2776
2777    function shouldAdjustOldDeltas(orgEvent, absDelta) {
2778        // If this is an older event and the delta is divisable by 120,
2779        // then we are assuming that the browser is treating this as an
2780        // older mouse wheel event and that we should divide the deltas
2781        // by 40 to try and get a more usable deltaFactor.
2782        // Side note, this actually impacts the reported scroll distance
2783        // in older browsers and can cause scrolling to be slower than native.
2784        // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
2785        return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
2786    }
2787
2788}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.