PageSourceSearch

https://crocis10.es/wp-content/plugins/booking/js/wpbc_times.js?ver=10.14.15

js crocis10.es collected 2026-10-06 13:05:50 UTC 25,610 bytes, 671 lines download raw bytes

1var start_time_checking_index;
2
3/**
4 * Get dots for partially  booked dates.
5 *    For parent booking resources with  specific capacity,
6 *    System do not show partially booked dates,  if at least one child booking resource fully  available
7 *    Otherwise it show maximum number of time-slot in one specific child booking resource
8 *
9 * @param param_calendar_id				ID of booking resource
10 * @param my_thisDateTime				timestamp of date
11 * @returns {string}
12 */
13function wpbc_show_date_info_top( param_calendar_id, my_thisDateTime ) {
14
15	var resource_id = parseInt(param_calendar_id.replace("calendar_booking", ''));
16
17	if (isNaN(resource_id)) {
18		return '';  // FixIn: 10.9.5.2.
19	}
20
21	// console.log( _wpbc.bookings_in_calendar__get( resource_id ) );		// for debug
22
23	// 1. Get child booking resources  or single booking resource  that  exist  in dates :	[1] | [1,14,15,17]
24	var child_resources_arr = wpbc_clone_obj(_wpbc.booking__get_param_value(resource_id, 'resources_id_arr__in_dates'));
25
26	// '2023-08-21'
27	var sql_date = wpbc__get__sql_class_date(new Date(my_thisDateTime));
28
29	var child_resource_id;
30	var merged_seconds;
31	var dots_count = 0;
32
33	var dots_in__resources = [];
34
35	// Loop all resources ID.
36	if (child_resources_arr !== null) {
37		for (child_resource_id of child_resources_arr) {                                                                    // FixIn: 10.9.5.1.
38
39			// _wpbc.bookings_in_calendar__get_for_date(2,'2023-08-21')[12].booked_time_slots.merged_seconds		= [ "07:00:11 - 07:30:02", "10:00:11 - 00:00:00" ]
40			// _wpbc.bookings_in_calendar__get_for_date(2,'2023-08-21')[2].booked_time_slots.merged_seconds			= [  [ 25211, 27002 ], [ 36011, 86400 ]  ]
41
42			if (false !== _wpbc.bookings_in_calendar__get_for_date(resource_id, sql_date)) {
43				merged_seconds = _wpbc.bookings_in_calendar__get_for_date(resource_id, sql_date)[child_resource_id].booked_time_slots.merged_seconds;		// [  [ 25211, 27002 ], [ 36011, 86400 ]  ]
44			} else {
45				merged_seconds = [];
46			}
47
48			if (0 === merged_seconds.length) {
49				return ''; 																		// Day available
50			}
51
52			for (var i = 0; i < merged_seconds.length; i++) {
53				if (!wpbc_is_this_timeslot__full_day_booked(merged_seconds[i])) {			// Check  if this fully  booked date. If yes,  then  do not count it
54					dots_count++;
55				}
56			}
57
58			dots_in__resources.push(dots_count);
59			dots_count = 0;
60		}
61	}
62	var dots_count_max = Math.max.apply( Math, dots_in__resources );						// Get maximum value in array [ 1, 5, 3]  ->  5
63
64	var dot_content = '';
65	for ( var d = 0; d < dots_count_max; d++ ){
66		dot_content += '&centerdot;';
67	}
68
69	dot_content = ( '' !== dot_content ) ? '<div class="wpbc_time_dots">' + dot_content + '</div>' : '';
70
71	return dot_content;
72}
73
74/**
75 * Show Date Info at  bottom  of the  Day Cell
76 *
77 * @param param_calendar_id		'calendar_booking1'
78 * @param my_thisDateTime		56567557757
79 * @returns {string}
80 */
81function wpbc_show_date_info_bottom( param_calendar_id, my_thisDateTime ) {
82
83	var bottom_hint_arr = [];
84
85	// Cost Hint
86	if ( typeof (wpbc_show_day_cost_in_date_bottom) == 'function' ) {
87		var cost_hint = wpbc_show_day_cost_in_date_bottom( param_calendar_id, my_thisDateTime );
88		if ( '' !== cost_hint ) {
89			bottom_hint_arr.push( wpbc_show_day_cost_in_date_bottom( param_calendar_id, my_thisDateTime ) );
90		}
91	}
92
93	// Availability Hint		// FixIn: 10.6.4.1.
94	var availability = wpbc_get_in_date_availability_hint( param_calendar_id, my_thisDateTime )
95	if ( '' !== availability ) {
96		bottom_hint_arr.push( availability );
97	}
98
99	var bottom_hint = bottom_hint_arr.join( '' );
100	return bottom_hint;
101}
102
103/**
104 * Get Availability Hint for in Day Cell
105 *
106 * @param param_calendar_id
107 * @param my_thisDateTime
108 * @returns {string}
109 */
110function wpbc_get_in_date_availability_hint( param_calendar_id, my_thisDateTime ) {								        // FixIn: 10.6.4.1.
111
112	/*
113	var sql_date 	= wpbc__get__sql_class_date( new Date( my_thisDateTime ) );						// '2023-08-21'
114	var resource_id = parseInt( param_calendar_id.replace( "calendar_booking", '' ) );				// 1
115	var day_availability_obj = _wpbc.bookings_in_calendar__get_for_date( resource_id, sql_date );	// obj
116
117	if ( 'undefined' !== typeof (day_availability_obj.day_availability) ) {
118		return '<strong>' + day_availability_obj.day_availability + '</strong> ' + 'available';
119	} else {
120		return '';
121	}
122	*/
123
124	var resource_id = parseInt( param_calendar_id.replace( "calendar_booking", '' ) );
125
126	// console.log( _wpbc.bookings_in_calendar__get( resource_id ) );		// for debug
127
128	// 1. Get child booking resources  or single booking resource  that  exist  in dates :	[1] | [1,14,15,17]
129	// var child_resources_arr = wpbc_clone_obj( _wpbc.booking__get_param_value( resource_id, 'resources_id_arr__in_dates' ) );
130
131	// '2023-08-21'
132	var sql_date = wpbc__get__sql_class_date( new Date( my_thisDateTime ) );
133
134    var hint__in_day__availability = '';
135
136    var get_for_date_obj = _wpbc.bookings_in_calendar__get_for_date( resource_id, sql_date );
137
138    if ( false !== get_for_date_obj ){
139
140        if (
141               (undefined != get_for_date_obj[ 'summary' ])
142            && (undefined != get_for_date_obj[ 'summary' ].hint__in_day__availability)
143        ){
144            hint__in_day__availability = get_for_date_obj[ 'summary' ].hint__in_day__availability;		// "5 available"
145        }
146
147    }
148
149    return hint__in_day__availability;
150}
151
152
153/**
154 * Hide Tippy tooltip on scroll, to prevent issue on mobile touch devices of showing tooltip at top left corner!
155 * @param evt
156 */
157jQuery( window ).on( 'scroll', function ( event ){													//FixIn: 9.2.1.5	// FixIn: 9.4.3.3.
158	if ( 'function' === typeof( wpbc_tippy ) ){
159		wpbc_tippy.hideAll();
160	}
161} );
162
163
164/**
165 * Check if in booking form  exist  times fields for booking for specific time-slot
166 * @param resource_id
167 * @param form_elements
168 * @returns {boolean}
169 */
170function wpbc_is_time_field_in_booking_form( resource_id, form_elements ){											// FixIn: 8.2.1.28.
171
172	var count = form_elements.length;
173	var start_time = false;
174	var end_time = false;
175	var duration = false;
176	var element;
177
178	/**
179	 *  Get from booking form  'rangetime', 'durationtime', 'starttime', 'endtime',  if exists.
180	 */
181	for ( var i = 0; i < count; i++ ){
182
183		element = form_elements[ i ];
184
185		// Skip elements from garbage
186		if ( jQuery( element ).closest( '.booking_form_garbage' ).length ){											// FixIn: 7.1.2.14.
187			continue;
188		}
189
190		if (
191			   ( element.name != undefined )
192			&& ( element.name.indexOf( 'hint' ) !== -1 )				// FixIn: 9.5.5.2.
193		){
194			var my_element = element.name; //.toString();
195			if ( my_element.indexOf( 'rangetime' ) !== -1 ){                       	// Range Time
196
197				return true;
198			}
199			if ( (my_element.indexOf( 'durationtime' ) !== -1) ){                	// Duration
200				duration = element.value;
201			}
202			if ( my_element.indexOf( 'starttime' ) !== -1 ){                     	// Start Time
203				start_time = element.value;
204			}
205			if ( my_element.indexOf( 'endtime' ) !== -1 ){                        	// End Time
206				end_time = element.value;
207			}
208		}
209	}
210
211	// Duration get Values
212	if ( ( duration !== false ) && ( start_time !== false ) ){  // we have Duration and Start time
213		return true;
214	}
215
216	if ( ( start_time !== false ) && ( end_time !== false ) ){  // we have End time and Start time
217		return true;
218	}
219
220	return false;
221}
222
223
224/**
225 * Check if the selected date/time is already in the past compared to "today_arr".
226 *
227 * Behavior notes:
228 * - If "is_enabled_change_over" is enabled, always returns false (no restriction).
229 * - `sort_date_array[0]` is expected to be the earliest selected date (sorted ascending).
230 * - `today_arr` is expected to be: [YYYY, MM, DD, HH, mm] (strings or numbers).
231 * - `myTime` is expected to be "HH:MM" (24h).
232 *
233 * @param {string} myTime Time string in "HH:MM" format.
234 * @param {Array<Array<string|number>>} sort_date_array Array of date arrays; first element is used as date to check.
235 * @returns {boolean} True if selected date/time is in the past, otherwise false.
236 */
237function wpbc_is_time_in_the_past_for_today(myTime, sort_date_array) {
238
239	// FixIn: 10.14.10.2.
240	if ( true === _wpbc.get_other_param( 'is_enabled_change_over' ) ) {
241		return false;
242	}
243	var date_to_check = sort_date_array[0];
244	if ( parseInt( date_to_check[0] ) < parseInt( _wpbc.get_other_param( 'today_arr' )[0] ) ) {
245		return true;
246	}
247	if (
248		(parseInt( date_to_check[0] ) == parseInt( _wpbc.get_other_param( 'today_arr' )[0] )) &&
249		(parseInt( date_to_check[1] ) < parseInt( _wpbc.get_other_param( 'today_arr' )[1] ))
250	) {
251		return true;
252	}
253	if (
254		(parseInt( date_to_check[0] ) == parseInt( _wpbc.get_other_param( 'today_arr' )[0] )) &&
255		(parseInt( date_to_check[1] ) == parseInt( _wpbc.get_other_param( 'today_arr' )[1] )) &&
256		(parseInt( date_to_check[2] ) < parseInt( _wpbc.get_other_param( 'today_arr' )[2] ))
257	) {
258		return true;
259	}
260	if (
261		(parseInt( date_to_check[0] ) == parseInt( _wpbc.get_other_param( 'today_arr' )[0] )) &&
262		(parseInt( date_to_check[1] ) == parseInt( _wpbc.get_other_param( 'today_arr' )[1] )) &&
263		(parseInt( date_to_check[2] ) == parseInt( _wpbc.get_other_param( 'today_arr' )[2] ))
264	) {
265		var mytime_value = myTime.split( ":" );
266		mytime_value     = parseInt( mytime_value[0] ) * 60 + parseInt( mytime_value[1] );
267
268		var current_time_value = parseInt( _wpbc.get_other_param( 'today_arr' )[3] ) * 60 + parseInt( _wpbc.get_other_param( 'today_arr' )[4] );
269
270		if ( current_time_value > mytime_value ) {
271			return true;
272		}
273	}
274	return false;
275}
276
277/**
278 * Validate a time string.
279 *
280 * Supported formats:
281 *  - 24-hour time: "H:MM" or "HH:MM"
282 *      Examples: "0:00", "09:30", "23:59", "24:00"
283 *      Notes: "24:00" is allowed, but "24:01" is not.
284 *
285 *  - 12-hour time: "H:MM AM/PM" (AM/PM is case-insensitive; spaces are optional)
286 *      Examples: "9:30 AM", "09:30pm", "12:05 PM"
287 *
288 * @param {string} time_str Raw time string entered by the user.
289 * @returns {boolean} True if the string matches a valid supported time format.
290 */
291function wpbc_is_valid_time_string(time_str) {
292
293	if ( typeof time_str !== 'string' ) {
294		return false;
295	}
296
297	const str = time_str.trim();
298	if ( str === '' ) {
299		return false;
300	}
301
302	// 1-2 digit hours, 2 digit minutes, optional AM/PM (case-insensitive).
303	const match = str.match( /^(\d{1,2}):(\d{2})(?:\s*([AaPp][Mm]))?$/ );
304	if ( ! match ) {
305		return false;
306	}
307
308	const hour   = Number( match[1] );
309	const minute = Number( match[2] );
310	const ampm   = match[3] ? match[3].toUpperCase() : null;
311
312	if ( ! Number.isInteger( hour ) || ! Number.isInteger( minute ) ) {
313		return false;
314	}
315
316	if ( minute < 0 || minute > 59 ) {
317		return false;
318	}
319
320	// 12-hour mode (AM/PM provided): hour must be 1..12.
321	if ( ampm ) {
322		return hour >= 1 && hour <= 12;
323	}
324
325	// 24-hour mode (no AM/PM): hour must be 0..24, but 24 only allowed with :00.
326	if ( hour < 0 || hour > 24 ) {
327		return false;
328	}
329	if ( hour === 24 && minute !== 0 ) {
330		return false;
331	}
332
333	return true;
334}
335
336
337//TODO: Continue Refactoring here 2018-04-21
338
339	//PS: This function  from personal.js
340	function wpbc_is_this_time_selection_not_available( resource_id, form_elements ){
341
342		// Skip this checking if we are in the Admin  panel at Add booking page
343		if ( location.href.indexOf( 'page=wpbc-new' ) > 0 ) {
344			return false;
345		}
346
347		var count = form_elements.length;
348		var start_time = false;
349		var end_time = false;
350		var duration = false;
351		var element;
352		var element_start = false;
353		var element_end = false;
354		var element_duration = false;
355		var element_rangetime = false;
356
357		/**
358		 *  Get from booking form  'rangetime', 'durationtime', 'starttime', 'endtime',  if exists.
359		 */
360		for ( var i = 0; i < count; i++ ){
361
362			element = form_elements[ i ];
363
364			// Skip elements from garbage
365			if ( jQuery( element ).closest( '.booking_form_garbage' ).length ){											// FixIn: 7.1.2.14.
366				continue;
367			}
368
369			if (
370				   ( element.name != undefined )
371				&& ( element.name.indexOf( 'hint' ) === -1 )				//FixIn: 9.5.5.2		// FixIn: 9.6.3.9.
372			){
373				var my_element = element.name; //.toString();
374				if ( my_element.indexOf( 'rangetime' ) !== -1 ){                       	// Range Time
375					if ( element.value == '' ){                                 										//FixIn: 7.0.Beta.19
376					 	var notice_message_id = wpbc_front_end__show_message__warning( element, _wpbc.get_message( 'message_check_required' ) );
377						return true;
378					}
379					var my_rangetime = element.value.split( '-' );
380					if ( my_rangetime.length > 1 ){
381						start_time = my_rangetime[ 0 ].replace( /(^\s+)|(\s+$)/g, "" ); 	// Trim
382						end_time = my_rangetime[ 1 ].replace( /(^\s+)|(\s+$)/g, "" );
383						element_rangetime = element;
384					}
385				}
386				if ( (my_element.indexOf( 'durationtime' ) !== -1) ){                	// Duration
387					duration = element.value;
388					element_duration = element;
389				}
390				if ( my_element.indexOf( 'starttime' ) !== -1 ){                     	// Start Time
391					start_time = element.value;
392					element_start = element;
393				}
394				if ( my_element.indexOf( 'endtime' ) !== -1 ){                        	// End Time
395					end_time = element.value;
396					element_end = element;
397				}
398			}
399		}
400
401
402		// Duration get Values
403		if ( (duration !== false) && (start_time !== false) ){  // we have Duration and Start time so  try to get End time
404
405			var mylocalstarttime = start_time.split( ':' );
406			var d = new Date( 1980, 1, 1, mylocalstarttime[ 0 ], mylocalstarttime[ 1 ], 0 );
407
408			var my_duration = duration.split( ':' );
409			my_duration = my_duration[ 0 ] * 60 * 60 * 1000 + my_duration[ 1 ] * 60 * 1000;
410			d.setTime( d.getTime() + my_duration );
411
412			var my_hours = d.getHours();
413			if ( my_hours < 10 ) my_hours = '0' + (my_hours + '');
414			var my_minutes = d.getMinutes();
415			if ( my_minutes < 10 ) my_minutes = '0' + (my_minutes + '');
416
417			// We are get end time
418			end_time = (my_hours + '') + ':' + (my_minutes + '');
419			if ( end_time == '00:00' ) end_time = '23:59';
420		}
421
422
423		if ( (start_time === false) || (end_time === false) ){                     // We do not have Start or End time or Both of them, so do not check it
424
425			return false;
426
427		} else {
428
429			var valid_time = true;
430			if ( (start_time == '') || (end_time == '') ) valid_time = false;
431
432			if ( !wpbc_is_valid_time_string( start_time ) ) valid_time = false;
433			if ( !wpbc_is_valid_time_string( end_time ) ) valid_time = false;
434
435			if ( valid_time === true )
436				if (
437					(typeof(checkRecurentTimeInside) == 'function') &&
438
439					( _wpbc.get_other_param( 'is_enabled_booking_recurrent_time' ) == true )
440				){                                                                // Recheck Time here !!!
441					valid_time = checkRecurentTimeInside( [ start_time, end_time ], resource_id );
442				} else {
443
444					if ( typeof(checkTimeInside) == 'function' ){
445						valid_time = checkTimeInside( start_time, true, resource_id );
446					}
447
448					if ( valid_time === true ){
449						if ( typeof(checkTimeInside) == 'function' ){
450							valid_time = checkTimeInside( end_time, false, resource_id );
451						}
452					}
453				}
454
455			if ( valid_time !== true ){
456				//return false;                                                  // do not show warning for setting pending days selectable,  if making booking for time-slot   // FixIn: 7.0.1.23.
457				if ( (_wpbc.get_other_param( 'is_enabled_change_over' )) && (element_start !== false) && (element_end !== false) ){      // FixIn: 6.1.1.1.
458					wpbc_front_end__show_message__warning_under_element( '#date_booking' + resource_id, _wpbc.get_message( 'message_check_no_selected_dates' )  );
459				}
460				if ( element_rangetime !== false ){ wpbc_front_end__show_message__warning_under_element( element_rangetime, _wpbc.get_message( 'message_error_range_time' ) ); }
461				if ( element_duration !== false ){  wpbc_front_end__show_message__warning_under_element( element_duration, _wpbc.get_message( 'message_error_duration_time' ) ); }
462				if ( element_start !== false ){ 	wpbc_front_end__show_message__warning_under_element( element_start, _wpbc.get_message( 'message_error_start_time' ) ); }
463				if ( element_end !== false ){ 		wpbc_front_end__show_message__warning_under_element( element_end, _wpbc.get_message( 'message_error_end_time' ) ); }
464
465				return true;
466
467			} else {
468				return false;
469			}
470
471		}
472
473
474	}
475
476	function checkTimeInside( mytime, is_start_time, bk_type ){
477
478		var my_dates_str = document.getElementById( 'date_booking' + bk_type ).value;                 // GET DATES From TEXTAREA
479
480		if ( my_dates_str.indexOf( ' - ' ) != 0 ){
481
482			my_dates_str = my_dates_str.replace( ' - ', ', ' );										// FixIn: 10.2.3.2.
483		}
484
485		return checkTimeInsideProcess( mytime, is_start_time, bk_type, my_dates_str );
486	}
487
488	function checkRecurentTimeInside( my_rangetime, bk_type ){
489
490		var valid_time = true;
491		var my_dates_str = document.getElementById( 'date_booking' + bk_type ).value;                 // GET DATES From TEXTAREA
492		// recurrent time check for all days in loop
493
494		var date_array = my_dates_str.split( ", " );
495		if ( date_array.length == 2 ){ // This recheck is need for editing booking, with single day
496			if ( date_array[ 0 ] == date_array[ 1 ] ){
497				date_array = [ date_array[ 0 ] ];
498			}
499		}
500		var temp_date_str = '';
501		for ( var i = 0; i < date_array.length; i++ ){  // Get SORTED selected days array
502			temp_date_str = date_array[ i ];
503			if ( checkTimeInsideProcess( my_rangetime[ 0 ], true, bk_type, temp_date_str ) == false ) valid_time = false;
504			if ( checkTimeInsideProcess( my_rangetime[ 1 ], false, bk_type, temp_date_str ) == false ) valid_time = false;
505
506		}
507
508		return valid_time;
509	}
510
511	// Function check start and end time at selected days.
512	function checkTimeInsideProcess( mytime, is_start_time, bk_type, my_dates_str ){
513		var i, h, s, m;	// FixIn: 9.1.5.1.
514
515		var date_array = my_dates_str.split( ',' );
516		date_array = date_array.map( function (s) {
517			return s.trim();
518		} );
519		if ( date_array.length == 2 ){ // This recheck is need for editing booking, with single day
520			if ( date_array[ 0 ] == date_array[ 1 ] ){
521				date_array = [ date_array[ 0 ] ];
522			}
523		}
524
525		var temp_elemnt;
526		var td_class;
527		var sort_date_array = [];
528		var work_date_array = [];
529		var times_array = [];
530		var is_check_for_time;
531
532		for ( var i = 0; i < date_array.length; i++ ){  // Get SORTED selected days array
533			temp_elemnt = date_array[ i ].split( "." );
534			sort_date_array[ i ] = [ temp_elemnt[ 2 ], temp_elemnt[ 1 ] + '', temp_elemnt[ 0 ] + '' ]; // [2009,7,1],...
535		}
536		sort_date_array.sort();                                                                   // SORT    D a t e s
537		for ( i = 0; i < sort_date_array.length;
537 i++ ){                                  // trnasform to integers
538			sort_date_array[ i ] = [ parseInt( sort_date_array[ i ][ 0 ] * 1 ), parseInt( sort_date_array[ i ][ 1 ] * 1 ), parseInt( sort_date_array[ i ][ 2 ] * 1 ) ]; // [2009,7,1],...
539		}
540
541		if ( is_start_time ) {
542			if ( wpbc_is_time_in_the_past_for_today( mytime, sort_date_array ) ) {
543				return false;
544			}
545		}
546
547		//  CHECK FOR BOOKING INSIDE OF     S E L E C T E D    DAY RANGE AND FOR TOTALLY BOOKED DAYS AT THE START AND END OF RANGE
548		work_date_array = sort_date_array;
549		for ( var j = 0; j < work_date_array.length; j++ ){
550			td_class = work_date_array[ j ][ 1 ] + '-' + work_date_array[ j ][ 2 ] + '-' + work_date_array[ j ][ 0 ];
551
552			if ( (j == 0) || (j == (work_date_array.length - 1)) ) is_check_for_time = true;         // Check for time only start and end time
553			else is_check_for_time = false;
554
555
556		}  ///////////////////////////////////////////////////////////////////////////////////////////////////////
557
558
559		// Check    START   OR    END   time for time no in correct fee range
560		if ( is_start_time ) work_date_array = sort_date_array[ 0 ];
561		else work_date_array = sort_date_array[ sort_date_array.length - 1 ];
562
563		td_class = work_date_array[ 1 ] + '-' + work_date_array[ 2 ] + '-' + work_date_array[ 0 ];
564
565		// Get dates and time from pending dates
566		//deleted
567		// Get dates and time from pending dates
568		//deleted
569
570
571		times_array.sort();                     // SORT TIMES
572
573		var times_in_day = [];                  // array with all times
574		var times_in_day_interval_marks = [];   // array with time interval marks 1- stsrt time 2 - end time
575
576
577		for ( i = 0; i < times_array.length; i++ ){
578			s = times_array[ i ][ 2 ];         // s = 2 - end time,   s = 1 - start time
579			// Start close interval
580			if ( (s == 2) && (i == 0) ){
581				times_in_day[ times_in_day.length ] = 0;
582				times_in_day_interval_marks[ times_in_day_interval_marks.length ] = 1;
583			}
584			// Normal
585			times_in_day[ times_in_day.length ] = times_array[ i ][ 0 ] * 60 + parseInt( times_array[ i ][ 1 ] );
586			times_in_day_interval_marks[ times_in_day_interval_marks.length ] = s;
587			// End close interval
588			if ( (s == 1) && (i == (times_array.length - 1)) ){
589				times_in_day[ times_in_day.length ] = (24 * 60);
590				times_in_day_interval_marks[ times_in_day_interval_marks.length ] = 2;
591			}
592		}
593
594		// Get time from entered time
595		var mytime_value = mytime.split( ":" );
596		mytime_value = mytime_value[ 0 ] * 60 + parseInt( mytime_value[ 1 ] );
597
598//alert('My time:'+ mytime_value + '  List of times: '+ times_in_day + '  Saved indexes: ' + start_time_checking_index + ' Days: ' + sort_date_array ) ;
599
600		var start_i = 0;
601		if ( start_time_checking_index != undefined )
602			if ( start_time_checking_index[ 0 ] != undefined )
603				if ( (!is_start_time) && (sort_date_array.length == 1) ){
604					start_i = start_time_checking_index[ 0 ];
605					/*start_i++;*/
606				}
607		i = start_i;
608
609		// Main checking inside a day
610		for ( i = start_i; i < times_in_day.length; i++ ){
611			times_in_day[ i ] = parseInt( times_in_day[ i ] );
612			mytime_value = parseInt( mytime_value );
613			if ( is_start_time ){
614				if ( mytime_value > times_in_day[ i ] ){
615					// Its Ok, lets Loop to next item
616				} else if ( mytime_value == times_in_day[ i ] ){
617					if ( times_in_day_interval_marks[ i ] == 1 ){
618						return false;     //start time is begin with some other interval
619					} else {
620						if ( (i + 1) <= (times_in_day.length - 1) ){
621							if ( times_in_day[ i + 1 ] <= mytime_value ) return false;  //start time  is begin with next elemnt interval
622							else {                                                 // start time from end of some other
623								if ( sort_date_array.length > 1 )
624									if ( (i + 1) <= (times_in_day.length - 1) ) return false;   // Its mean that we make end booking at some other day then this and we have some booking time at this day after start booking  - its wrong
625								start_time_checking_index = [ i, td_class, mytime_value ];
626								return true;
627							}
628						}
629						if ( sort_date_array.length > 1 )
630							if ( (i + 1) <= (times_in_day.length - 1) ) return false;   // Its mean that we make end booking at some other day then this and we have some booking time at this day after start booking  - its wrong
631						start_time_checking_index = [ i, td_class, mytime_value ];
632						return true;                                            // start time from end of some other
633					}
634				} else if ( mytime_value < times_in_day[ i ] ){
635					if ( times_in_day_interval_marks[ i ] == 2 ){
636						return false;     // start time inside of some interval
637					} else {
638						if ( sort_date_array.length > 1 )
639							if ( (i + 1) <= (times_in_day.length - 1) ) return false;   // Its mean that we make end booking at some other day then this and we have some booking time at this day after start booking  - its wrong
640						start_time_checking_index = [ i, td_class, mytime_value ];
641						return true;
642					}
643				}
644			} else {
645				if ( sort_date_array.length == 1 ){
646
647					if ( start_time_checking_index != undefined )
648						if ( start_time_checking_index[ 2 ] != undefined )
649
650							if ( (start_time_checking_index[ 2 ] == times_in_day[ i ]) && (times_in_day_interval_marks[ i ] == 2) ){    // Good, because start time = end of some other interval and we need to get next interval for current end time.
651							} else if ( times_in_day[ i ] < mytime_value ) return false;                 // some interval begins before end of curent "end time"
652							else {
653								if ( start_time_checking_index[ 2 ] >= mytime_value ) return false;  // we are select only one day and end time is earlythe starttime its wrong
654								return true;                                                    // if we selected only one day so evrything is fine and end time no inside some other intervals
655							}
656				} else {
657					if ( times_in_day[ i ] < mytime_value ) return false;                 // Some other interval start before we make end time in the booking at the end day selection
658					else return true;
659				}
660
661			}
662		}
663
664		if ( is_start_time ) start_time_checking_index = [ i, td_class, mytime_value ];
665		else {
666			if ( start_time_checking_index != undefined )
667				if ( start_time_checking_index[ 2 ] != undefined )
668					if ( (sort_date_array.length == 1) && (start_time_checking_index[ 2 ] >= mytime_value) ) return false;  // we are select only one day and end time is earlythe starttime its wrong
669		}
670		return true;
671	}

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.