PageSourceSearch

https://supplybuild.ca/adna/legacy/vendor/xdan/jquery.datetimepicker.js

js supplybuild.ca collected 2026-10-09 21:50:28 UTC 61,454 bytes, 1,476 lines download raw bytes

1
2console.log("firing");
3/**
4 * @preserve jQuery DateTimePicker plugin v2.3.4
5 * @homepage http://xdsoft.net/jqplugins/datetimepicker/
6 * (c) 2014, Chupurnov Valeriy.
7 */
8(function( $ ) {
9	'use strict';
10	var default_options  = {
11		i18n:{
12			bg:{ // Bulgarian
13				months:[
14					"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
15				],
16				dayOfWeek:[
17					"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
18				]
19			},
20			fa:{ // Persian/Farsi
21				months:[
22					'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
23				],
24				dayOfWeek:[
25					'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
26				]
27			},
28			ru:{ // Russian
29				months:[
30					'Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'
31				],
32				dayOfWeek:[
33					"Вск", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
34				]
35			},
36			uk:{ // Ukrainian
37				months:[
38					'Січень','Лютий','Березень','Квітень','Травень','Червень','Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'
39				],
40				dayOfWeek:[
41					"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
42				]
43			},
44			en:{ // English
45				months: [
46					"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
46November", "December"
47				],
48				dayOfWeek: [
49					"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
50				]
51			},
52			el:{ // Ελληνικά
53				months: [
54					"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
55				],
56				dayOfWeek: [
57					"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
58				]
59			},
60			de:{ // German
61				months:[
62					'Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'
63				],
64				dayOfWeek:[
65					"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
66				]
67			},
68			nl:{ // Dutch
69				months:[
70					"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
71				],
72				dayOfWeek:[
73					"zo", "ma", "di", "wo", "do", "vr", "za"
74				]
75			},
76			tr:{ // Turkish
77				months:[
78					"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
79				],
80				dayOfWeek:[
81					"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
82				]
83			},
84			fr:{ //French
85				months:[
86			    "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
87				],
88				dayOfWeek:[
89					"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
90				]
91			},
92			es:{ // Spanish
93				months: [
94					"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
95				],
96				dayOfWeek: [
97					"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
98				]
99			},
100			th:{ // Thai
101				months:[
102					'มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'
103				],
104				dayOfWeek:[
105					'อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'
106				]
107			},
108			pl:{ // Polish
109				months: [
110					"styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
111				],
112				dayOfWeek: [
113					"nd", "pn", "wt", "śr", "cz", "pt", "sb"
114				]
115			},
116			pt:{ // Portuguese
117				months: [
118					"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
119				],
120				dayOfWeek: [
121					"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
122				]
123			},
124			ch:{ // Simplified Chinese
125				months: [
126					"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"
127				],
128				dayOfWeek: [
129					"日", "一","二","三","四","五","六"
130				]
131			},
132			se:{ // Swedish
133				months: [
134					"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September","Oktober", "November", "December"
135				],
136				dayOfWeek: [
137					"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
138				]
139			},
140			kr:{ // Korean
141				months: [
142					"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
143				],
144				dayOfWeek: [
145					"일", "월", "화", "수", "목", "금", "토"
146				]
147			},
148			it:{ // Italian
149				months: [
150					"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
151				],
152				dayOfWeek: [
153					"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
154				]
155			},
156			da:{ // Dansk
157				months: [
158					"January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
159				],
160				dayOfWeek: [
161					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
162				]
163			},
164			no:{ // Norwegian
165				months: [
166					"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
167				],
168				dayOfWeek: [
169					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
170				]
171			},
172			ja:{ // Japanese
173				months: [
174					"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
175				],
176				dayOfWeek: [
177					"日", "月", "火", "水", "木", "金", "土"
178				]
179			},
180			vi:{ // Vietnamese
181				months: [
182					"Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
183				],
184				dayOfWeek: [
185					"CN", "T2", "T3", "T4", "T5", "T6", "T7"
186				]
187			},
188			sl:{ // Slovenščina
189				months: [
190					"Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "
190November", "December"
191				],
192				dayOfWeek: [
193					"Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
194				]
195			},
196			cs:{ // Čeština
197				months: [
198					"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
199				],
200				dayOfWeek: [
201					"Ne", "Po", "Út", "St", "Čt", "Pá", "So"
202				]
203			},
204			hu:{ // Hungarian
205			    months: [
206					"Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
207			    ],
208			    dayOfWeek: [
209					"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
210			    ]
211			}
212		},
213		value:'',
214		lang:'en',
215		
216		format:	'Y/m/d H:i',
217		formatTime:	'H:i',
218		formatDate:	'Y/m/d',
219		
220		startDate:	false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', 
221		
222		step:60,
223		monthChangeSpinner:true,
224		closeOnDateSelect:false,
225		closeOnWithoutClick:true,
226		closeOnInputClick: true,
227		
228		timepicker:true,
229		datepicker:true,
230		weeks:false,
231		
232		defaultTime:false,		// use formatTime format (ex. '10:00' for formatTime:	'H:i')
233		defaultDate:false, 		// use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
234		
235		minDate:false,
236		maxDate:false,
237		minTime:false,
238		maxTime:false,
239		
240		allowTimes:[],
241		opened:false,
242		initTime:true,
243		inline:false,
244		
245		onSelectDate:function() {},
246		onSelectTime:function() {},
247		onChangeMonth:function() {},
248		onChangeDateTime:function() {},
249		onShow:function() {},
250		onClose:function() {},
251		onGenerate:function() {},
252		
253		withoutCopyright:true,
254		
255		inverseButton:false,
256		hours12:false,
257		next:	'xdsoft_next',
258		prev : 'xdsoft_prev',
259		dayOfWeekStart:0,
260		
261		timeHeightInTimePicker:25,
262		timepickerScrollbar:true,
263		
264		todayButton:true, // 2.1.0
265		defaultSelect:true, // 2.1.0
266		
267		scrollMonth:true,
268		scrollTime:true,
269		scrollInput:true,
270		
271		lazyInit:false,
272		
273		mask:false,
274		validateOnBlur:true,
275		allowBlank:true,
276		
277		yearStart:1950,
278		yearEnd:2050,
279		
280		style:'',
281		id:'',
282		
283		fixed: false,
284		
285		roundTime:'round', // ceil, floor
286		className:'',
287		
288		weekends	: 	[],
289		yearOffset:0,
290		beforeShowDay: null
291	};
292	
293	// fix for ie8
294	if ( !Array.prototype.indexOf ) {
295		Array.prototype.indexOf = function(obj, start) {
296			 for (var i = (start || 0), j = this.length; i < j; i++) {
297				 if (this[i] === obj) { return i; }
298			 }
299			 return -1;
300		}
301	}
302	
303	Date.prototype.countDaysInMonth = function(){
304		return new Date(this.getFullYear(), this.getMonth()+1, 0).getDate();
305	};
306	
307	$.fn.xdsoftScroller = function( _percent ) {
308		return this.each(function() {
309			var timeboxparent = $(this);
310			if( !$(this).hasClass('xdsoft_scroller_box') ) {
311				var pointerEventToXY = function( e ) {
312						var out = {x:0, y:0};
313						if( e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel' ) {
314							var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
315							out.x = touch.pageX;
316							out.y = touch.pageY;
317						}else if (e.type == 'mousedown' || e.type == 'mouseup' || e.type == 'mousemove' || e.type == 'mouseover'|| e.type=='mouseout' || e.type=='mouseenter' || e.type=='mouseleave') {
318							out.x = e.pageX;
319							out.y = e.pageY;
320						}
321						return out;
322					},
323					move = 0,
324					timebox = timeboxparent.children().eq(0),
325					parentHeight = timeboxparent[0].clientHeight,
326					height = timebox[0].offsetHeight,
327					scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
328					scroller = $('<div class="xdsoft_scroller"></div>'),
329					maximumOffset = 100,
330					start = false;
331
332				scrollbar.append(scroller);
333
334				timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
335				scroller.on('mousedown.xdsoft_scroller',function ( event ) {
336					if( !parentHeight )
337						timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]);
338					var pageY = event.pageY,
339						top = parseInt(scroller.css('margin-top')),
340						h1 = scrollbar[0].offsetHeight;
341					$(document.body).addClass('xdsoft_noselect');
342					$([document.body,window]).on('mouseup.xdsoft_scroller',function arguments_callee() {
343						$([document.body,window]).off('mouseup.xdsoft_scroller',arguments_callee)
344							.off('mousemove.xdsoft_scroller',move)
345							.removeClass('xdsoft_noselect');
346					});
347					$(document.body).on('mousemove.xdsoft_scroller',move = function(event) {
348						var offset = event.pageY-pageY+top;
349						if( offset<0 )
350							offset = 0;
351						if( offset+scroller[0].offsetHeight>h1 )
352							offset = h1-scroller[0].offsetHeight;
353						timeboxparent.trigger('scroll_element.xdsoft_scroller',[maximumOffset?offset/maximumOffset:0]);
354					});
355				});
356
357				timeboxparent
358					.on('scroll_element.xdsoft_scroller',function( event,percent ) {
359						if( !parentHeight )
360							timeboxparent.trigger('resize_scroll.xdsoft_scroller',[percent,true]);
361						percent = percent>1?1:(percent<0||isNaN(percent))?0:percent;
362						scroller.css('margin-top',maximumOffset*percent);
363						timebox.css('marginTop',-parseInt((height-parentHeight)*percent))
364					})
365					.on('resize_scroll.xdsoft_scroller',function( event,_percent,noTriggerScroll ) {
366						parentHeight = timeboxparent[0].clientHeight;
367						height = timebox[0].offsetHeight;
368						var percent = parentHeight/height,
369							sh = percent*scrollbar[0].offsetHeight;
370						if( percent>1 )
371							scroller.hide();
372						else{
373							scroller.show();
374							scroller.css('height',parseInt(sh>10?sh:10));
375							maximumOffset = scrollbar[0].offsetHeight-scroller[0].offsetHeight;
376							if( noTriggerScroll!==true )
377								timeboxparent.trigger('scroll_element.xdsoft_scroller',[_percent?_percent:Math.abs(parseInt(timebox.css('marginTop')))/(height-parentHeight)]);
378						}
379					});
380				timeboxparent.mousewheel&&timeboxparent.mousewheel(function(event, delta, deltaX, deltaY) {
381					var top = Math.abs(parseInt(timebox.css('marginTop')));
382					timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-delta*20)/(height-parentHeight)]);
383					event.stopPropagation();
384					return false;
385				});
386				timeboxparent.on('touchstart',function( event ) {
387					start = pointerEventToXY(event);
388				});
389				timeboxparent.on('touchmove',function( event ) {
390					if( start ) {
391						var coord = pointerEventToXY(event), top = Math.abs(parseInt(timebox.css('marginTop')));
392						timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-(coord.y-start.y))/(height-parentHeight)]);
393						event.stopPropagation();
394						event.preventDefault();
395						start = pointerEventToXY(event);
396					}
397				});
398				timeboxparent.on('touchend touchcancel',function( event ) {
399					start = false;
400				});
401			}
402			timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]);
403		});
404	};
405	$.fn.datetimepicker = function( opt ) {
406		var KEY0 = 48,
407			KEY9 = 57,
408			_KEY0 = 96,
409			_KEY9 = 105,
410			CTRLKEY = 17,
411			DEL = 46,
412			ENTER = 13,
413			ESC = 27,
414			BACKSPACE = 8,
415			ARROWLEFT = 37,
416			ARROWUP = 38,
417			ARROWRIGHT = 39,
418			ARROWDOWN = 40,
419			TAB = 9,
420			F5 = 116,
421			AKEY = 65,
422			CKEY = 67,
423			VKEY = 86,
424			ZKEY = 90,
425			YKEY = 89,
426			ctrlDown	=	false,
427			options = ($.isPlainObject(opt)||!opt)?$.extend(true,{},default_options,opt):$.extend({},default_options),
428
429			lazyInitTimer = 0,
430
431			lazyInit = function( input ){
432				input
433					.on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function initOnActionCallback(event) {
434						if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible')||input.data( 'xdsoft_datetimepicker') )
435							return;
436				
437						clearTimeout(lazyInitTimer);
438						
439						lazyInitTimer = setTimeout(function() {
440
441							if( !input.data( 'xdsoft_datetimepicker') )
442								createDateTimePicker(input);
443								
444							input
445								.off('open.xdsoft focusin.xdsoft mousedown.xdsoft',initOnActionCallback)
446								.trigger('open.xdsoft');
447						},100);
448						
449					});
450			},
451			
452			createDateTimePicker = function( input ) {
453				
454				var datetimepicker = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker xdsoft_noselect '+(options.weeks?' xdsoft_showweeks':'')+options.className+'"></div>'),
455					xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
456					datepicker = $('<div class="xdsoft_datepicker active"></div>'),
457					mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button><div class="xdsoft_label xdsoft_month"><span></span></div><div class="xdsoft_label xdsoft_year"><span></span></div><button type="button" class="xdsoft_next"></button></div>'),
458					calendar = $('<div class="xdsoft_calendar"></div>'),
459					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>'),
460					timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
461					timebox = $('<div class="xdsoft_time_variant"></div>'),
462					scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
463					scroller = $('<div class="xdsoft_scroller"></div>'),
464					monthselect =$('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
465					yearselect =$('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>');
466
467				//constructor lego
468				mounth_picker
469					.find('.xdsoft_month span')
470						.after(monthselect);
471				mounth_picker
472					.find('.xdsoft_year span')
473						.after(yearselect);
474
475				mounth_picker
476					.find('.xdsoft_month,.xdsoft_year')
477						.on('mousedown.xdsoft',function(event) {
478							mounth_picker
479								.find('.xdsoft_select')
480									.hide();
481									
482							var select = $(this).find('.xdsoft_select').eq(0),
483								val = 0,
484								top = 0;
485
486							if( _xdsoft_datetime.currentTime )
487								val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear']();
488
489							select.show();
490							
491							for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++) {
492								if( items.eq(i).data('value')==val ) {
493									break;
494								}else top+=items[0].offsetHeight;
495							}
496
497							select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].clientHeight)));
498							event.stopPropagation();
499							
500							return false;
501						});
502
503				mounth_picker
504					.find('.xdsoft_select')
505						.xdsoftScroller()
506						.on('mousedown.xdsoft',function( event ) {
507							event.stopPropagation();
508							event.preventDefault();
509						})
510						.on('mousedown.xdsoft','.xdsoft_option',function( event ) {
511							if( _xdsoft_datetime&&_xdsoft_datetime.currentTime )
512								_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value'));
513							
514							$(this).parent().parent().hide();
515							
516							datetimepicker.trigger('xchange.xdsoft');
517							options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
518						});
519
520
521				// set options
522				datetimepicker.setOptions = function( _options ) {
523					options = $.extend(true,{},options,_options);
524					
525					if( _options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length ){
526						options['allowTimes'] = $.extend(true,[],_options.allowTimes);
527					}
528					
529					if( _options.weekends && $.isArray(_options.weekends) && _options.weekends.length ){
530						options['weekends'] = $.extend(true,[],_options.weekends);
531					}
532					
533					if( (options.open||options.opened)&&(!options.inline) ) {
534						input.trigger('open.xdsoft');
535					}
536
537					if( options.inline ) {
538						triggerAfterOpen = true;
539						datetimepicker.addClass('xdsoft_inline');
540						input.after(datetimepicker).hide();
541					}
542
543					if( options.inverseButton ) {
544						options.next = 'xdsoft_prev';
545						options.prev = 'xdsoft_next';
546					}
547
548					if( options.datepicker )
549						datepicker.addClass('active');
550					else
551						datepicker.removeClass('active');
552
553					if( options.timepicker )
554						timepicker.addClass('active');
555					else
556						timepicker.removeClass('active');
557
558					if( options.value ){
559						input&&input.val&&input.val(options.value);
560						_xdsoft_datetime.setCurrentTime(options.value);
561					}
562
563					if( isNaN(options.dayOfWeekStart) )
564						options.dayOfWeekStart = 0;
565					else
566						options.dayOfWeekStart = parseInt(options.dayOfWeekStart)%7;
567
568					if( !options.timepickerScrollbar )
569						scrollbar.hide();
570					
571					if( options.minDate && /^-(.*)$/.test(options.minDate) ){
572						options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat( options.formatDate );
573					}
574					
575					if( options.maxDate &&  /^\+(.*)$/.test(options.maxDate) ) {
576						options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat( options.formatDate );
577					}
578					
579					mounth_picker
580						.find('.xdsoft_today_button')
581							.css('visibility',!options.todayButton?'hidden':'visible');
582
583					if( options.mask ) {
584						var e,
585							getCaretPos = function ( input ) {
586								try{
587									if ( document.selection && document.selection.createRange ) {
588										var range = document.selection.createRange();
589										return range.getBookmark().charCodeAt(2) - 2;
590									}else
591										if ( input.setSelectionRange )
592											return input.selectionStart;
593								}catch(e) {
594									return 0;
595								}
596							},
597							setCaretPos = function ( node,pos ) {
598								node = (typeof node == "string" || node instanceof String) ? document.getElementById(node) : node;
599								if(!node) {
600									return false;
601								}else if(node.createTextRange) {
602									var textRange = node.createTextRange();
603									textRange.collapse(true);
604									textRange.moveEnd(pos);
605									textRange.moveStart(pos);
606									textRange.select();
607									return true;
608								}else if(node.setSelectionRange) {
609									node.setSelectionRange(pos,pos);
610									return true;
611								}
612								return false;
613							},
614							isValidValue = function ( mask,value ) {
615								var reg = mask
616									.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,'\\$1')
617									.replace(/_/g,'{digit+}')
618									.replace(/([0-9]{1})/g,'{digit$1}')
619									.replace(/\{digit([0-9]{1})\}/g,'[0-$1_]{1}')
620									.replace(/\{digit[\+]\}/g,'[0-9_]{1}');
621								return RegExp(reg).test(value);
622							};
623						input.off('keydown.xdsoft');
624						switch(true) {
625							case ( options.mask===true ):
626							
627								options.mask = options.format
628									.replace(/Y/g,'9999')
629									.replace(/F/g,'9999')
630									.replace(/m/g,'19')
631									.replace(/d/g,'39')
632									.replace(/H/g,'29')
633									.replace(/i/g,'59')
634									.replace(/s/g,'59');
635									
636							case ( $.type(options.mask) == 'string' ):
637							
638								if( !isValidValue( options.mask,input.val() ) )
639									input.val(options.mask.replace(/[0-9]/g,'_'));
640
641								input.on('keydown.xdsoft',function( event ) {
642									var val = this.value,
643										key = event.which;
644										
645									switch(true) {
646										case (( key>=KEY0&&key<=KEY9 )||( key>=_KEY0&&key<=_KEY9 ))||(key==BACKSPACE||key==DEL):
647											var pos = getCaretPos(this),
648												digit = ( key!=BACKSPACE&&key!=DEL )?String.fromCharCode((_KEY0 <= key && key <= _KEY9)? key-KEY0 : key):'_';
649											
650											if( (key==BACKSPACE||key==DEL)&&pos ) {
651												pos--;
652												digit='_';
653											}
654											
655											while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
656												pos+=( key==BACKSPACE||key==DEL )?-1:1;
657
658											val = val.substr(0,pos)+digit+val.substr(pos+1);
659											if( $.trim(val)=='' ){
660												val = options.mask.replace(/[0-9]/g,'_');
661											}else{
662												if( pos==options.mask.length )
663													break;
664											}
665											
666											pos+=(key==BACKSPACE||key==DEL)?0:1;
667											while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
668												pos+=(key==BACKSPACE||key==DEL)?-1:1;
669												
670											if( isValidValue( options.mask,val ) ) {
671												this.value = val;
672												setCaretPos(this,pos);
673											}else if( $.trim(val)=='' )
674												this.value = options.mask.replace(/[0-9]/g,'_');
675											else{
676												input.trigger('error_input.xdsoft');
677											}
678										break;
679										case ( !!~([AKEY,CKEY,VKEY,ZKEY,YKEY].indexOf(key))&&ctrlDown ):
680										 case !!~([ESC,ARROWUP,ARROWDOWN,ARROWLEFT,ARROWRIGHT,F5,
680CTRLKEY,TAB,ENTER].indexOf(key)):
681										return true;
682									}
683									event.preventDefault();
684									return false;
685								});
686							break;
687						}
688					}
689					if( options.validateOnBlur ) {
690						input
691							.off('blur.xdsoft')
692							.on('blur.xdsoft', function() {
693								if( options.allowBlank && !$.trim($(this).val()).length ) {
694									$(this).val(null);
695									datetimepicker.data('xdsoft_datetime').empty();
696								}else if( !Date.parseDate( $(this).val(), options.format ) ) {
697									$(this).val((_xdsoft_datetime.now()).dateFormat( options.format ));
698									datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
699								}
700								else{
701									datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
702 								}
703								datetimepicker.trigger('changedatetime.xdsoft');
704							});
705					}
706					options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
707					
708					datetimepicker
709						.trigger('xchange.xdsoft')
710						.trigger('afterOpen.xdsoft')
711				};
712
713				datetimepicker
714					.data('options',options)
715					.on('mousedown.xdsoft',function( event ) {
716						event.stopPropagation();
717						event.preventDefault();
718						yearselect.hide();
719						monthselect.hide();
720						return false;
721					});
722
723				var scroll_element = timepicker.find('.xdsoft_time_box');
724				scroll_element.append(timebox);
725				scroll_element.xdsoftScroller();
726				
727				datetimepicker.on('afterOpen.xdsoft',function() {
728					scroll_element.xdsoftScroller();
729				});
730
731				datetimepicker
732					.append(datepicker)
733					.append(timepicker);
734
735				if( options.withoutCopyright!==true )
736					datetimepicker
737						.append(xdsoft_copyright);
738
739				datepicker
740					.append(mounth_picker)
741					.append(calendar);
742
743				$('body').append(datetimepicker);
744
745				var _xdsoft_datetime = new function() {
746					var _this = this;
747					_this.now = function( norecursion ) {
748						var d = new Date();
749						
750						if( !norecursion && options.defaultDate  ){
751							var date = _this.strToDate(options.defaultDate);
752							d.setFullYear( date.getFullYear() );
753							d.setMonth( date.getMonth() );
754							d.setDate( date.getDate() );
755						}
756						
757						if( options.yearOffset  ){
758							d.setFullYear(d.getFullYear()+options.yearOffset);
759						}
760						
761						if( !norecursion && options.defaultTime ){
762							var time = _this.strtotime(options.defaultTime);
763							d.setHours( time.getHours() );
764							d.setMinutes( time.getMinutes() );
765						}
766							
767						return d;
768					};
769
770					
771					_this.isValidDate = function (d) {
772						if ( Object.prototype.toString.call(d) !== "[object Date]" )
773							return false;
774						return !isNaN(d.getTime());
775					};
776
777					_this.setCurrentTime = function( dTime ) {
778						_this.currentTime = (typeof dTime == 'string')? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
779						datetimepicker.trigger('xchange.xdsoft');
780					};
781
782					_this.empty = function() {
783						_this.currentTime = null;
784					};
785
786					_this.getCurrentTime = function( dTime) {
787						return _this.currentTime;
788					};
789
790					_this.nextMonth = function() {
791						var month = _this.currentTime.getMonth()+1;
792						if( month==12 ) {
793							_this.currentTime.setFullYear(_this.currentTime.getFullYear()+1);
794							month = 0;
795						}
796						_this.currentTime.setDate(
797							Math.min(
798								Date.daysInMonth[month],
799								_this.currentTime.getDate()
800							)
801						);
802						_this.currentTime.setMonth(month);
803						options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
804						datetimepicker.trigger('xchange.xdsoft');
805						return month;
806					};
807
808					_this.prevMonth = function() {
809						var month = _this.currentTime.getMonth()-1;
810						if( month==-1 ) {
811							_this.currentTime.setFullYear(_this.currentTime.getFullYear()-1);
812							month = 11;
813						}
814						_this.currentTime.setDate(
815							Math.min(
816								Date.daysInMonth[month],
817								_this.currentTime.getDate()
818							)
819						);
820						_this.currentTime.setMonth(month);
821						options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
822						datetimepicker.trigger('xchange.xdsoft');
823						return month;
824					};
825
826					_this.strToDateTime = function( sDateTime ) {
827						if( sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime) )
828							return sDateTime;
829						
830						var tmpDate = [],timeOffset,currentTime;
831					
832						if( ( tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime) )  && ( tmpDate[2]=Date.parseDate(tmpDate[2], options.formatDate) ) ) {
833							timeOffset = tmpDate[2].getTime()-(tmpDate[2].getTimezoneOffset())*60000;
834							currentTime = new Date((_xdsoft_datetime.now()).getTime()+parseInt(tmpDate[1]+'1')*timeOffset);
835						}else
836							currentTime = sDateTime?Date.parseDate(sDateTime, options.format):_this.now();
837							
838						if( !_this.isValidDate(currentTime) )
839							currentTime = _this.now();
840							
841						return currentTime;
842					};
843
844					_this.strToDate = function( sDate ) {
845						if( sDate && sDate instanceof Date && _this.isValidDate(sDate) )
846							return sDate;
847						
848						var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now(true);
849						if( !_this.isValidDate(currentTime) )
850							currentTime = _this.now(true);
851							
852						return currentTime;
853					};
854
855					_this.strtotime = function( sTime ) {
856						if( sTime && sTime instanceof Date && _this.isValidDate(sTime) )
857							return sTime;
858							
859						var currentTime = sTime?Date.parseDate(sTime, options.formatTime):_this.now();
860						if( !_this.isValidDate(currentTime) )
861							currentTime = _this.now(true);
862							
863						return currentTime;
864					};
865
866					_this.str = function() {
867						return _this.currentTime.dateFormat(options.format);
868					};
869					
870					_this.currentTime = this.now();
871				};
872				mounth_picker
873					.find('.xdsoft_today_button')
874						.on('mousedown.xdsoft',function() {
875							datetimepicker.data('changed',true);
876							_xdsoft_datetime.setCurrentTime(0);
877							datetimepicker.trigger('afterOpen.xdsoft');
878						}).on('dblclick.xdsoft',function(){
879							input.val( _xdsoft_datetime.str() );
880							datetimepicker.trigger('close.xdsoft');
881						});
882				mounth_picker
883					.find('.xdsoft_prev,.xdsoft_next')
884						.on('mousedown.xdsoft',function() {
885							var $this = $(this),
886								timer = 0,
887								stop = false;
888
889							(function arguments_callee1(v) {
890								var month =  _xdsoft_datetime.currentTime.getMonth();
891								if( $this.hasClass( options.next ) ) {
892									_xdsoft_datetime.nextMonth();
893								}else if( $this.hasClass( options.prev ) ) {
894									_xdsoft_datetime.prevMonth();
895								}
896								if (options.monthChangeSpinner) {
897									!stop&&(timer = setTimeout(arguments_callee1,v?v:100));
898								}
899							})(500);
900
901							$([document.body,window]).on('mouseup.xdsoft',function arguments_callee2() {
902								clearTimeout(timer);
903								stop = true;
904								$([document.body,window]).off('mouseup.xdsoft',arguments_callee2);
905							});
906						});
907
908				timepicker
909					.find('.xdsoft_prev,.xdsoft_next')
910						.on('mousedown.xdsoft',function() {
911							var $this = $(this),
912								timer = 0,
913								stop = false,
914								period = 110;
915							(function arguments_callee4(v) {
916								var pheight = timeboxparent[0].clientHeight,
917									height = timebox[0].offsetHeight,
918									top = Math.abs(parseInt(timebox.css('marginTop')));
919								if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ) {
920									timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px')
921								}else if( $this.hasClass(options.prev) && top-options.timeHeightInTimePicker>=0  ) {
922									timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px')
923								}
924								timeboxparent.trigger('scroll_element.xdsoft_scroller',[Math.abs(parseInt(timebox.css('marginTop'))/(height-pheight))]);
925								period= ( period>10 )?10:period-10;
926								!stop&&(timer = setTimeout(arguments_callee4,v?v:period));
927							})(500);
928							$([document.body,window]).on('mouseup.xdsoft',function arguments_callee5() {
929								clearTimeout(timer);
930								stop = true;
931								$([document.body,window])
932									.off('mouseup.xdsoft',arguments_callee5);
933							});
934						});
935
936				var xchangeTimer = 0;
937				// base handler - generating a calendar and timepicker
938				datetimepicker
939					.on('xchange.xdsoft',function( event ) {
940						clearTimeout(xchangeTimer);
941						xchangeTimer = setTimeout(function(){
942							var table 	=	'',
943									start	= new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1, 12, 0, 0),
944									i = 0,
945									today = _xdsoft_datetime.now();
946								
947								while( start.getDay()!=options.dayOfWeekStart )
948									start.setDate(start.getDate()-1);
949
950								//generate calendar
951								table+='<table><thead><tr>';
952
953								if(options.weeks) {
954									table+='<th></th>';
955								}
956
957								// days
958								for(var j = 0; j<7; j++) {
959									table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)%7]+'</th>';
960								}
961
962								table+='</tr></thead>';
963								table+='<tbody>';
964								var maxDate = false, minDate = false;
965								
966								if( options.maxDate!==false ) {
967									maxDate = _xdsoft_datetime.strToDate(options.maxDate);
968									maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999);
969								}
970								
971								if( options.minDate!==false ) {
972									minDate = _xdsoft_datetime.strToDate(options.minDate);
973									minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
974								}
975								
976								var d,y,m,w,classes = [],customDateSettings,newRow=true;
977								
978								while( i<_xdsoft_datetime.currentTime.countDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
979									classes = [];
980									i++;
981
982									d = start.getDate(); y = start.getFullYear(); m = start.getMonth(); w = start.getWeekOfYear();
983
984									classes.push('xdsoft_date');
985
986									if ( options.beforeShowDay && options.beforeShowDay.call ) {
987										customDateSettings = options.beforeShowDay.call(datetimepicker, start);
988									} else {
989										customDateSettings = null;
990									}
991
992									if( ( maxDate!==false && start > maxDate )||(  minDate!==false && start < minDate )||(customDateSettings && customDateSettings[0] === false) ){
993										classes.push('xdsoft_disabled');
994									}
995
996									if ( customDateSettings && customDateSettings[1] != "" ) {
997										classes.push(customDateSettings[1]);
998									}
999
1000									if( _xdsoft_datetime.currentTime.getMonth()!=m ) classes.push('xdsoft_other_month');
1001
1002									if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat( options.formatDate )==start.dateFormat( options.formatDate ) ) {
1003										classes.push('xdsoft_current');
1004									}
1005
1006									if( today.dateFormat( options.formatDate )==start.dateFormat( options.formatDate ) ) {
1007										classes.push('xdsoft_today');
1008									}
1009
1010									if( start.getDay()==0||start.getDay()==6||~options.weekends.indexOf(start.dateFormat( options.formatDate )) ) {
1011										classes.push('xdsoft_weekend');
1012									}
1013
1014									if(options.beforeShowDay && typeof options.beforeShowDay == 'function') {
1015										classes.push(options.beforeShowDay(start))
1016									}
1017
1018									if(newRow) {
1019										table+='<tr>';
1020										newRow = false;
1021										
1022										if(options.weeks) {
1023											table+='<th>'+w+'</th>';
1024										}
1025									}
1026
1027									table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+' class="xdsoft_date xdsoft_day_of_week'+start.getDay()+' '+ classes.join(' ')+'">'+
1028												'<div>'+d+'</div>'+
1029											'</td>';
1030
1031									if( start.getDay()==options.dayOfWeekStartPrev ) {
1032										table+='</tr>';
1033										newRow = true;
1034									}
1035
1036									start.setDate(d+1);
1037								}
1038								table+='</tbody></table>';
1039
1040								calendar.html(table);
1041
1042								mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
1043								mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
1044
1045								// generate timebox
1046								var time = '',
1047									h = '',
1048									m ='',
1049									line_time = function line_time( h,m ) {
1050										var now = _xdsoft_datetime.now();
1051										now.setHours(h);
1052										h = parseInt(now.getHours());
1053										now.setMinutes(m);
1054										m = parseInt(now.getMinutes());
1055
1056										classes = [];
1057										if( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||(options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime()))
1058											classes.push('xdsoft_disabled');
1059										if( (options.initTime||options.defaultSelect||datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)&&(options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m))) {
1060											if( options.defaultSelect||datetimepicker.data('changed')) {
1061												classes.push('xdsoft_current');
1062											} else if( options.initTime ) {
1063												classes.push('xdsoft_init_time');
1064											}
1065										}
1066										if( parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))
1067											classes.push('xdsoft_today');
1068										time+= '<div class="xdsoft_time '+classes.join(' ')+'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
1069									};
1070
1071								if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ) {
1072									for( var i=0,j=0;i<(options.hours12?12:24);i++ ) {
1073										for( j=0;j<60;j+=options.step ) {
1074											h = (i<10?'0':'')+i;
1075											m = (j<10?'0':'')+j;
1076											line_time( h,m );
1077										}
1078									}
1079								}else{
1080									for( var i=0;i<options.allowTimes.length;i++ ) {
1081										h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
1082										m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
1083										line_time( h,m );
1084									}
1085								}
1086
1087								timebox.html(time);
1088
1089								var opt = '',
1090									i = 0;
1091
1092								for( i = parseInt(options.yearStart,10)+options.yearOffset;i<= parseInt(options.yearEnd,10)+options.yearOffset;i++ ) {
1093									opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
1094								}
1095								yearselect.children().eq(0)
1096														.html(opt);
1097
1098								for( i = 0,opt = '';i<= 11;i++ ) {
1099									opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>';
1100								}
1101								monthselect.children().eq(0).html(opt);
1102								$(datetimepicker)
1103									.trigger('generate.xdsoft');
1104						},10);
1105						event.stopPropagation();
1106					})
1107					.on('afterOpen.xdsoft',function() {
1108						if( options.timepicker ) {
1109							var classType;
1110							if( timebox.find('.xdsoft_current').length ) {
1111								classType = '.xdsoft_current';
1112							} else if( timebox.find('.xdsoft_init_time').length ) {
1113								classType = '.xdsoft_init_time';
1114							}
1115							
1116							if( classType ) {
1117								var pheight = timeboxparent[0].clientHeight,
1118									height = timebox[0].offsetHeight,
1119									top = timebox.find(classType).index()*options.timeHeightInTimePicker+1;
1120								if( (height-pheight)<top )
1121									top = height-pheight;
1122								timeboxparent.trigger('scroll_element.xdsoft_scroller',[parseInt(top)/(height-pheight)]);
1123							}else{
1124								timeboxparent.trigger('scroll_element.xdsoft_scroller',[0]);
1125							}
1126						}
1127					});
1128				
1129				var timerclick = 0;
1130				
1131				calendar
1132					.on('click.xdsoft', 'td', function (xdevent) {
1133					  xdevent.stopPropagation();  // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1134						timerclick++;
1135						var $this = $(this),
1136							currentTime = _xdsoft_datetime.currentTime;
1137						
1138						if( currentTime===undefined||currentTime===null ){
1139                            _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1140                            currentTime = _xdsoft_datetime.currentTime;
1141                        }
1142						
1143						if( $this.hasClass('xdsoft_disabled') )
1144							return false;
1145
1146						currentTime.setDate( 1 );
1147						currentTime.setFullYear( $this.data('year') );
1148						currentTime.setMonth( $this.data('month') );
1149						currentTime.setDate( $this.data('date') );
1150						
1151						datetimepicker.trigger('select.xdsoft',[currentTime]);
1152
1153						input.val( _xdsoft_datetime.str() );
1154						if( (timerclick>1||(options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker )))&&!options.inline ) {
1155							datetimepicker.trigger('close.xdsoft');
1156						}
1157
1158						if( options.onSelectDate &&	options.onSelectDate.call ) {
1159							options.onSelectDate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1160						}
1161
1162						datetimepicker.data('changed',true);
1163						datetimepicker.trigger('xchange.xdsoft');
1164						datetimepicker.trigger('changedatetime.xdsoft');
1165						setTimeout(function(){
1166							timerclick = 0;
1167						},200);
1168					});
1169
1170				timebox
1171					.on('click.xdsoft', 'div', function (xdevent) {
1172					    xdevent.stopPropagation(); // NAJ: Prevents closing of Pop-ups, Modals and Flyouts
1173						var $this = $(this),
1174							currentTime = _xdsoft_datetime.currentTime;
1175						
1176						if( currentTime===undefined||currentTime===null ){
1177                            _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1178                            currentTime = _xdsoft_datetime.currentTime;
1179                        }
1180						
1181						if( $this.hasClass('xdsoft_disabled') )
1182							return false;
1183						currentTime.setHours($this.data('hour'));
1184						currentTime.setMinutes($this.data('minute'));
1185						datetimepicker.trigger('select.xdsoft',[currentTime]);
1186
1187						datetimepicker.data('input').val( _xdsoft_datetime.str() );
1188
1189						!options.inline&&datetimepicker.trigger('close.xdsoft');
1190
1191						if( options.onSelectTime&&options.onSelectTime.call ) {
1192							options.onSelectTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1193						}
1194						datetimepicker.data('changed',true);
1195						datetimepicker.trigger('xchange.xdsoft');
1196						datetimepicker.trigger('changedatetime.xdsoft');
1197					});
1198
1199				datetimepicker.mousewheel&&datepicker.mousewheel(function(event, delta, deltaX, deltaY) {
1200					if( !options.scrollMonth )
1201						return true;
1202					if( delta<0 )
1203						_xdsoft_datetime.nextMonth();
1204					else
1205						_xdsoft_datetime.prevMonth();
1206					return false;
1207				});
1208
1209				datetimepicker.mousewheel&&timeboxparent.unmousewheel().mousewheel(function(event, delta, deltaX, deltaY) {
1210					if( !options.scrollTime )
1211						return true;
1212					var pheight = timeboxparent[0].clientHeight,
1213						height = timebox[0].offsetHeight,
1214						top = Math.abs(parseInt(timebox.css('marginTop'))),
1215						fl = true;
1216					if( delta<0 && (height-pheight)-options.timeHeightInTimePicker>=top ) {
1217						timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px');
1218						fl = false;
1219					}else if( delta>0&&top-options.timeHeightInTimePicker>=0 ) {
1220						timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px');
1221						fl = false;
1222					}
1223					timeboxparent.trigger('scroll_element.xdsoft_scroller',[Math.abs(parseInt(timebox.css('marginTop'))/(height-pheight))]);
1224					event.stopPropagation();
1225					return fl;
1226				});
1227				
1228				var triggerAfterOpen = false;
1229				datetimepicker
1230					.on('changedatetime.xdsoft',function() {
1231						if( options.onChangeDateTime&&options.onChangeDateTime.call ) {
1232							var $input = datetimepicker.data('input');
1233							options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input);
1234							delete options.value;
1235							$input.trigger('change');
1236						}
1237					})
1238					.on('generate.xdsoft',function() {
1239						if( options.onGenerate&&options.onGenerate.call )
1240							options.onGenerate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1241						if( triggerAfterOpen ){
1242							datetimepicker.trigger('afterOpen.xdsoft');
1243							triggerAfterOpen = false;
1244						}
1245					})
1246					.on( 'click.xdsoft', function( xdevent )
1247					{
1248						xdevent.stopPropagation();  // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1249					});
1250
1251				var current_time_index = 0;
1252				input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ) {
1253					if( !options.scrollInput )
1254						return true;
1255					if( !options.datepicker && options.timepicker ) {
1256						current_time_index = timebox.find('.xdsoft_current').length?timebox.find('.xdsoft_current').eq(0).index():0;
1257						if( current_time_index+delta>=0&&current_time_index+delta<timebox.children().length )
1258							current_time_index+=delta;
1259						timebox.children().eq(current_time_index).length&&timebox.children().eq(current_time_index).trigger('mousedown');
1260						return false;
1261					}else if( options.datepicker && !options.timepicker ) {
1262						datepicker.trigger( event, [delta, deltaX, deltaY]);
1263						input.val&&input.val( _xdsoft_datetime.str() );
1264						datetimepicker.trigger('changedatetime.xdsoft');
1265						return false;
1266					}
1267				});
1268				var setPos = function() {
1269					var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1, left = offset.left, position = "absolute";
1270					if (options.fixed) {
1271						top -= $(window).scrollTop();
1272						left -= $(window).scrollLeft();
1273						position = "fixed";
1274					}else {
1275						if( top+datetimepicker[0].offsetHeight>$(window).height()+$(window).scrollTop() )
1276							top = offset.top-datetimepicker[0].offsetHeight+1;
1277							if (top < 0)
1278								top = 0;
1279						if( left+datetimepicker[0].offsetWidth>$(window).width() )
1280							left = offset.left-datetimepicker[0].offsetWidth+datetimepicker.data('input')[0].offsetWidth;
1281					}
1282					datetimepicker.css({
1283						left:left,
1284						top:top,
1285						position: position
1286					});
1287				};
1288				datetimepicker
1289					.on('open.xdsoft', function() {
1290						var onShow = true;
1291						if( options.onShow&&options.onShow.call) {
1292							onShow = options.onShow.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1293						}
1294						if( onShow!==false ) {
1295							datetimepicker.show();
1296							setPos();
1297							$(window)
1298								.off('resize.xdsoft',setPos)
1299								.on('resize.xdsoft',setPos);
1300
1301							if( options.closeOnWithoutClick ) {
1302								$([document.body,window]).on('mousedown.xdsoft',function arguments_callee6() {
1303									datetimepicker.trigger('close.xdsoft');
1304									$([document.body,window]).off('mousedown.xdsoft',arguments_callee6);
1305								});
1306							}
1307						}
1308					})
1309					.on('close.xdsoft', function( event ) {
1310						var onClose = true;
1311						if( options.onClose&&options.onClose.call ) {
1312							onClose=options.onClose.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1313						}
1314						if( onClose!==false&&!options.opened&&!options.inline ) {
1315							datetimepicker.hide();
1316						}
1317						event.stopPropagation();
1318					})
1319					.data('input',input);
1320
1321				var timer = 0,
1322					timer1 = 0;
1323
1324				datetimepicker.data('xdsoft_datetime',_xdsoft_datetime);
1325				datetimepicker.setOptions(options);
1326				
1327				function getCurrentValue(){
1328
1329					var ct = false;
1330
1331                    if ( options.startDate ) {
1332                        ct = _xdsoft_datetime.strToDate(options.startDate);
1333                    } else {
1334                        ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
1335						if( ct ) {
1336							ct = _xdsoft_datetime.strToDateTime(ct);
1337						} else if ( options.defaultDate ) {
1338							ct = _xdsoft_datetime.strToDate(options.defaultDate);
1339						}
1340                    }
1341
1342					if ( ct && _xdsoft_datetime.isValidDate(ct) ) {
1343						datetimepicker.data('changed',true);
1344					} else {
1345                        ct = '';
1346                    }
1347					
1348					return ct?ct:0;
1349				}
1350				//debugger
1351				_xdsoft_datetime.setCurrentTime( getCurrentValue() );
1352
1353				input
1354					.data( 'xdsoft_datetimepicker',datetimepicker )
1355					.on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function(event) {
1356						if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible')||(input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick) )
1357							return;
1358						clearTimeout(timer);
1359						timer = setTimeout(function() {
1360							if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
1361								return;
1362								
1363							triggerAfterOpen = true;
1364							_xdsoft_datetime.setCurrentTime(getCurrentValue());
1365							
1366							datetimepicker.trigger('open.xdsoft');
1367						},100);
1368					})
1369					.on('keydown.xdsoft',function( event ) {
1370						var val = this.value,
1371							key = event.which;
1372						switch(true) {
1373							case !!~([ENTER].indexOf(key)):
1374								var elementSelector = $("input:visible,textarea:visible");
1375								datetimepicker.trigger('close.xdsoft');
1376								elementSelector.eq(elementSelector.index(this) + 1).focus();
1377							return false;
1378							case !!~[TAB].indexOf(key):
1379								datetimepicker.trigger('close.xdsoft');
1380							return true;
1381						}
1382					});
1383			},
1384			destroyDateTimePicker = function( input ) {
1385				var datetimepicker = input.data('xdsoft_datetimepicker');
1386				if( datetimepicker ) {
1387					datetimepicker.data('xdsoft_datetime',null);
1388					datetimepicker.remove();
1389					input
1390						.data( 'xdsoft_datetimepicker',null )
1391						.off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft' );
1392					$(window).off('resize.xdsoft');
1393					$([window,document.body]).off('mousedown.xdsoft');
1394					input.unmousewheel&&input.unmousewheel();
1395				}
1396			};
1397		$(document)
1398			.off('keydown.xdsoftctrl keyup.xdsoftctrl')
1399			.on('keydown.xdsoftctrl',function(e) {
1400				if ( e.keyCode == CTRLKEY )
1401					ctrlDown = true;
1402			})
1403			.on('keyup.xdsoftctrl',function(e) {
1404				if ( e.keyCode == CTRLKEY )
1405					ctrlDown = false;
1406			});
1407		return this.each(function() {
1408			var datetimepicker;
1409			if( datetimepicker = $(this).data('xdsoft_datetimepicker') ) {
1410				if( $.type(opt) === 'string' ) {
1411					switch(opt) {
1412						case 'show':
1413							$(this).select().focus();
1414							datetimepicker.trigger( 'open.xdsoft' );
1415						break;
1416						case 'hide':
1417							datetimepicker.trigger('close.xdsoft');
1418						break;
1419						case 'destroy':
1420							destroyDateTimePicker($(this));
1421						break;
1422						case 'reset':
1423							this.value = this.defaultValue;
1424							if(!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format)))
1425								datetimepicker.data('changed',false);
1426							datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
1427						break;
1428					}
1429				}else{
1430					datetimepicker
1431						.setOptions(opt);
1432				}
1433				return 0;
1434			}else
1435				if( ($.type(opt) !== 'string') ){
1436					if( !options.lazyInit||options.open||options.inline ){
1437						createDateTimePicker($(this));
1438					}else
1439						lazyInit($(this));
1440				}
1441		});
1442	};
1443	$.fn.datetimepicker.defaults = default_options;
1444})( jQuery );
1445
1446/*
1447 * Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
1448 *
1449 * Licensed under the MIT License (LICENSE.txt).
1450 *
1451 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
1452 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
1453 * Thanks to: Seamus Leahy for adding deltaX and deltaY
1454 *
1455 * Version: 3.1.3
1456 *
1457 * Requires: 1.2.2+
1458 */
1459(function(factory) {if(typeof define==='function'&&define.amd) {define(['jquery'],factory)}else if(typeof exports==='object') {module.exports=factory}else{factory(jQuery)}}(function($) {var toFix=['wheel','mousewheel','DOMMouseScroll','MozMousePixelScroll'];var toBind='onwheel'in document||document.documentMode>=9?['wheel']:['mousewheel','DomMouseScroll','MozMousePixelScroll'];var lowestDelta,lowestDeltaXY;if($.event.fixHooks) {for(var i=toFix.length;i;) {$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}$.event.special.mousewheel={setup:function() {if(this.addEventListener) {for(var i=toBind.length;i;) {this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}},teardown:function() {if(this.removeEventListener) {for(var i=toBind.length;i;) {this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}}};$.fn.extend({mousewheel:function(fn) {return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn) {return this.unbind("mousewheel",fn)}});function handler(event) {var orgEvent=event||window.event,args=[].slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,absDeltaXY=0,fn;event=$.event.fix(orgEvent);event.type="mousewheel";if(orgEvent.wheelDelta) {delta=orgEvent.wheelDelta}if(orgEvent.detail) {delta=orgEvent.detail*-1}if(orgEvent.deltaY) {deltaY=orgEvent.deltaY*-1;delta=deltaY}if(orgEvent.deltaX) {deltaX=orgEvent.deltaX;delta=deltaX*-1}if(orgEvent.wheelDeltaY!==undefined) {deltaY=orgEvent.wheelDeltaY}if(orgEvent.wheelDeltaX!==undefined) {deltaX=orgEvent.wheelDeltaX*-1}absDelta=Math.abs(delta);if(!lowestDelta||absDelta<lowestDelta) {lowestDelta=absDelta}absDeltaXY=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDeltaXY||absDeltaXY<lowestDeltaXY) {lowestDeltaXY=absDeltaXY}fn=delta>
14590?'floor':'ceil';delta=Math[fn](delta/lowestDelta);deltaX=Math[fn](deltaX/lowestDeltaXY);deltaY=Math[fn](deltaY/lowestDeltaXY);args.unshift(event,delta,deltaX,deltaY);return($.event.dispatch||$.event.handle).apply(this,args)}}));
1460
1461
1462// Parse and Format Library
1463//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
1464/*
1465 * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
1466 *
1467 * This program is free software; you can redistribute it and/or modify it
1468 * under the terms of the GNU Lesser General Public License as published by the
1469 * Free Software Foundation, version 2.1.
1470 *
1471 * This program is distributed in the hope that it will be useful, but WITHOUT
1472 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1473 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
1474 * details.
1475 */
1476Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}eval(code.substring(0,code.length-3)+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,
1476s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};

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.