PageSourceSearch

https://andresbanquet.com/wp-content/themes/royal-event/fw/js/core.utils.js

js andresbanquet.com collected 2026-10-09 22:41:37 UTC 37,834 bytes, 1,189 lines download raw bytes

1/**
2 * Royal Event Framework: Utilities
3 *
4 * @package	royal_event
5 * @since	royal_event 1.0
6 */
7
8
9/* Global variables manipulations
10---------------------------------------------------------------- */
11
12// Global variables storage
13if (typeof ROYAL_EVENT_STORAGE == 'undefined') var ROYAL_EVENT_STORAGE = {};
14
15// Get global variable
16function royal_event_storage_get(var_name) {
17	"use strict";
18	return royal_event_isset(ROYAL_EVENT_STORAGE[var_name]) ? ROYAL_EVENT_STORAGE[var_name] : '';
19}
20
21// Set global variable
22function royal_event_storage_set(var_name, value) {
23	"use strict";
24	ROYAL_EVENT_STORAGE[var_name] = value;
25}
26
27// Inc/Dec global variable with specified value
28function royal_event_storage_inc(var_name) {
29	"use strict";
30	var value = arguments[1]==undefined ? 1 : arguments[1];
31	ROYAL_EVENT_STORAGE[var_name] += value;
32}
33
34// Concatenate global variable with specified value
35function royal_event_storage_concat(var_name, value) {
36	"use strict";
37	ROYAL_EVENT_STORAGE[var_name] += ''+value;
38}
39
40// Get global array element
41function royal_event_storage_get_array(var_name, key) {
42	"use strict";
43	return royal_event_isset(ROYAL_EVENT_STORAGE[var_name][key]) ? ROYAL_EVENT_STORAGE[var_name][key] : '';
44}
45
46// Set global array element
47function royal_event_storage_set_array(var_name, key, value) {
48	"use strict";
49	if (!royal_event_isset(ROYAL_EVENT_STORAGE[var_name])) ROYAL_EVENT_STORAGE[var_name] = {};
50	ROYAL_EVENT_STORAGE[var_name][key] = value;
51}
52
53// Inc/Dec global array element with specified value
54function royal_event_storage_inc_array(var_name, key) {
55	"use strict";
56	var value = arguments[2]==undefined ? 1 : arguments[2];
57	ROYAL_EVENT_STORAGE[var_name][key] += value;
58}
59
60// Concatenate global array element with specified value
61function royal_event_storage_concat_array(var_name, key, value) {
62	"use strict";
63	ROYAL_EVENT_STORAGE[var_name][key] += ''+value;
64}
65
66
67
68/* PHP-style functions
69---------------------------------------------------------------- */
70function royal_event_isset(obj) {
71	"use strict";
72	return typeof(obj) != 'undefined';
73}
74
75function royal_event_empty(obj) {
76	"use strict";
77	return typeof(obj) == 'undefined' || (typeof(obj)=='object' && obj == null) || (typeof(obj)=='array' && obj.length == 0) || (typeof(obj)=='string' && royal_event_alltrim(obj)=='') || obj===0;
78}
79
80function royal_event_is_array(obj)  {
81	"use strict";
82	return typeof(obj)=='array';
83}
84
85function royal_event_is_object(obj)  {
86	"use strict";
87	return typeof(obj)=='object';
88}
89
90function royal_event_clone_object(obj) {
91	"use strict";
92	if (obj == null || typeof(obj) != 'object') {
93		return obj;
94	}
95	var temp = {};
96	for (var key in obj) {
97		temp[key] = royal_event_clone_object(obj[key]);
98	}
99	return temp;
100}
101
102function royal_event_merge_objects(obj1, obj2)  {
103	"use strict";
104	for (var i in obj2)
105		if ( obj2.hasOwnProperty( i ) )
106			obj1[i] = obj2[i];
107	return obj1;
108}
109
110// Generates a storable representation of a value
111function royal_event_serialize(mixed_val) {
112	"use strict";
113	var obj_to_array = arguments.length==1 || argument[1]===true;
114
115	switch (typeof(mixed_val)) {
116
117		case "number":
118			if (isNaN(mixed_val) || !isFinite(mixed_val))
119				return false;
120			else
121				return (Math.floor(mixed_val) == mixed_val ? "i" : "d") + ":" + mixed_val + ";";
122
123		case "string":
124			return "s:" + mixed_val.length + ":\"" + mixed_val + "\";";
125
126		case "boolean":
127			return "b:" + (mixed_val ? "1" : "0") + ";";
128
129		case "object":
130			if (mixed_val == null)
131				return "N;";
132			else if (mixed_val instanceof Array) {
133				var idxobj = { idx: -1 };
134				var map = [];
135				for (var i=0; i<mixed_val.length; i++) {
136					idxobj.idx++;
137					var ser = royal_event_serialize(mixed_val[i]);
138					if (ser)
139						map.push(royal_event_serialize(idxobj.idx) + ser);
140				}                                      
141				return "a:" + mixed_val.length + ":{" + map.join("") + "}";
142			} else {
143				var class_name = royal_event_get_class(mixed_val);
144				if (class_name == undefined)
145					return false;
146				var props = new Array();
147				for (var prop in mixed_val) {
148					var ser = royal_event_serialize(mixed_val[prop]);
149					if (ser)
150						props.push(royal_event_serialize(prop) + ser);
151				}
152				if (obj_to_array)
153					return "a:" + props.length + ":{" + props.join("") + "}";
154				else
155					return "O:" + class_name.length + ":\"" + class_name + "\":" + props.length + ":{" + props.join("") + "}";
156			}
157
158		case "undefined":
159			return "N;";
160	}
161	return false;
162}
163
164// Returns the name of the class of an object
165function royal_event_get_class(obj) {
166	"use strict";
167	if (obj instanceof Object && !(obj instanceof Array) && !(obj instanceof Function) && obj.constructor) {
168		var arr = obj.constructor.toString().match(/function\s*(\w+)/);
169		if (arr && arr.length == 2) return arr[1];
170	}
171	return false;
172}
173
174
175
176/* String functions
177---------------------------------------------------------------- */
178
179function royal_event_in_list(str, list) {
180	"use strict";
181	var delim = arguments[2] ? arguments[2] : '|';
182	var icase = arguments[3] ? arguments[3] : true;
183	var retval = false;
184	if (icase) {
185		if (typeof(str)=='string') str = str.toLowerCase();
186		list = list.toLowerCase();
187	}
188	var parts = list.split(delim);
189	for (var i=0; i<parts.length; i++) {
190		if (parts[i]==str) {
191			retval=true;
192			break;
193		}
194	}
195	return retval;
196}
197
198function royal_event_alltrim(str) {
199	"use strict";
200	var dir = arguments[1] ? arguments[1] : 'a';
201	var rez = '';
202	var i, start = 0, end = str.length-1;
203	if (dir=='a' || dir=='l') {
204		for (i=0; i<str.length; i++) {
205			if (str.substr(i,1)!=' ') {
206				start = i;
207				break;
208			}
209		}
210	}
211	if (dir=='a' || dir=='r') {
212		for (i=str.length-1; i>=0; i--) {
213			if (str.substr(i,1)!=' ') {
214				end = i;
215				break;
216			}
217		}
218	}
219	return str.substring(start, end+1);
220}
221
222function royal_event_ltrim(str) {
223	"use strict";
224	return royal_event_alltrim(str, 'l');
225}
226
227function royal_event_rtrim(str) {
228	"use strict";
229	return royal_event_alltrim(str, 'r');
230}
231
232function royal_event_padl(str, len) {
233	"use strict";
234	var ch = arguments[2] ? arguments[2] : ' ';
235	var rez = str.substr(0,len);
236	if (rez.length < len) {
237		for (var i=0; i<len-str.length; i++)
238			rez += ch;
239	}
240	return rez;
241}
242
243function royal_event_padr(str, len) {
244	"use strict";
245	var ch = arguments[2] ? arguments[2] : ' ';
246	var rez = str.substr(0,len);
247	if (rez.length < len) {
248		for (var i=0; i<len-str.length; i++)
249			rez = ch + rez;
250	}
251	return rez;
252}
253
254function royal_event_padc(str, len) {
255	"use strict";
256	var ch = arguments[2] ? arguments[2] : ' ';
257	var rez = str.substr(0,len);
258	if (rez.length < len) {
259		for (var i=0; i<Math.floor((len-str.length)/2); i++)
260			rez = ch + rez + ch;
261	}
262	return rez+(rez.length<len ? ch : '');
263}
264
265function royal_event_replicate(str, num) {
266	"use strict";
267	var rez = '';
268	for (var i=0; i<num; i++) {
269		rez += str;
270	}
271	return rez;
272}
273
274
275
276/* Numbers functions
277---------------------------------------------------------------- */
278
279// Round number to specified precision.
280function royal_event_round_number(num) {
281	"use strict";
282	var precision = arguments[1] ? arguments[1] : 0;
283	var p = Math.pow(10, precision);
284	return Math.round(num*p)/p;
285}
286
287// Clear number from any characters and append it with 0 to desired precision
288function royal_event_clear_number(num) {
289	"use strict";
290	var precision = arguments[1] ? arguments[1] : 0;
291	var defa = arguments[2] ? arguments[2] : 0;
292	var res = '';
293	var decimals = -1;
294	num = ""+num;
295	if (num=="") num=""+defa;
296	for (var i=0; i<num.length; i++) {
297		if (decimals==0) break;
298		else if (decimals>0) decimals--;
299		var ch = num.substr(i,1);
300		if (ch=='.') {
301			if (precision>0) {
302				res += ch;
303			}
304			decimals = precision;
305		} else if ((ch>=0 && ch<=9) || (ch=='-' && i==0))
306			res+=ch;
307	}
308	if (precision>0 && decimals!=0) {
309		if (decimals==-1) {
310			res += '.';
311			decimals = precision;
312		}
313		for (i=decimals; i>0; i--)
314			res +='0'; 
315	}
316	return res;
317}
318
319// Convert number from decimal to hex
320function royal_event_dec2hex(n) { 
321	"use strict";
322	return Number(n).toString(16);
323}
324
325// Convert number from hex to decimal
326function royal_event_hex2dec(hex) {
327	"use strict";
328	return parseInt(hex,16); 
329}
330
331
332
333/* Array manipulations
334---------------------------------------------------------------- */
335
336function royal_event_in_array(val, thearray)  {
337	"use strict";
338	var rez = false;
339	for (var i=0; i<thearray.length-1; i++)  {
340		if (thearray[i] == val)  {
341			rez = true;
342			break;
343		}
344	}
345	return rez;
346}
347
348function royal_event_sort_array(thearray)  {
349	"use strict";
350	var caseSensitive = arguments[1] ? arguments[1] : false;
351	for (var x=0; x<thearray.length-1; x++)  {
352		for (var y=(x+1); y<thearray.length; y++)  {
353			if (caseSensitive) {
354				if (thearray[x] > thearray[y])  {
355					var tmp = thearray[x];
356					thearray[x] = thearray[y];
357					thearray[y] = tmp;
358				}  
359			} else {
360				if (thearray[x].toLowerCase() > thearray[y].toLowerCase())  {
361					var tmp = thearray[x];
362					thearray[x] = thearray[y];
363					thearray[y] = tmp;
364				}  
365			}
366		}  
367	}
368	return thearray;
369}
370
371
372
373/* Date manipulations
374---------------------------------------------------------------- */
375
376// Return array[Year, Month, Day, Hours, Minutes, Seconds]
377function royal_event_parse_date(dt) {
378	"use strict";
379	dt = dt.replace(/\//g, '-').replace(/\./g, '-').replace(/T/g, ' ').split('+')[0];
380	var dt2 = dt.split(' ');
381	var d = dt2[0].split('-');
382	var t = dt2[1].split(':');
383	d.push(t[0], t[1], t[2]);
384	return d;
385}
386
387// Return difference string between two dates
388function royal_event_get_date_difference(dt1) {
389	"use strict";
390	var dt2 = arguments[1]!==undefined ? arguments[1] : '';
391	var short_date = arguments[2]!==undefined ? arguments[2] : true;
392	var sec = arguments[3]!==undefined ? arguments[3] : false;
393	var a1 = royal_event_parse_date(dt1);
394	dt1 = Date.UTC(a1[0], a1[1], a1[2], a1[3], a1[4], a1[5]);
395	if (dt2 == '') {
396		dt2 = new Date();
397		var a2 = [dt2.getFullYear(), dt2.getMonth()+1, dt2.getDate(), dt2.getHours(), dt2.getMinutes(), dt2.getSeconds()];
398	} else
399		var a2 = royal_event_parse_date(dt2);
400	dt2 = Date.UTC(a2[0], a2[1], a2[2], a2[3], a2[4], a2[5]);
401	var diff = Math.round((dt2 - dt1)/1000);
402	var days = Math.floor(diff / (24*3600));
403	diff -= days * 24 * 3600;
404	var hours = Math.floor(diff / 3600);
405	diff -= hours * 3600;
406	var minutes = Math.floor(diff / 60);
407	diff -= minutes * 60;
408	var rez = '';
409	if (days > 0)
410		rez += (rez!='' ? ' ' : '') + days + ' day' + (days > 1 ? 's' : '');
411	if ((!short_date || rez=='') && hours > 0)
412		rez += (rez!='' ? ' ' : '') + hours + ' hour' + (hours > 1 ? 's' : '');
413	if ((!short_date || rez=='') && minutes > 0)
414		rez +=  (rez!='' ? ' ' : '') + minutes + ' minute' + (minutes > 1 ? 's' : '');
415	if (sec || rez=='')
416		rez +=  rez!='' || sec ? (' ' + diff + ' second' + (diff > 1 ? 's' : '')) : 'less then minute';
417	return rez;
418}
419
420
421
422/* Colors functions
423---------------------------------------------------------------- */
424
425function royal_event_hex2rgb(hex) {
426    "use strict";
427	hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
428	return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
429}
430
431function royal_event_rgb2hex(color) {
432	"use strict";
433	var aRGB;
434	color = color.replace(/\s/g,"").toLowerCase();
435	if (color=='rgba(0,0,0,0)' || color=='rgba(0%,0%,0%,0%)')
436		color = 'transparent';
437	if (color.indexOf('rgba(')==0)
438		aRGB = color.match(/^rgba\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i);
439	else	
440		aRGB = color.match(/^rgb\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i);
441	
442	if(aRGB) {
443		color = '';
444		for (var i=1; i<=3; i++) 
445			color += Math.round((aRGB[i][aRGB[i].length-1]=="%"?2.55:1)*parseInt(aRGB[i])).toString(16).replace(/^(.)$/,'0$1');
446	} else 
447		color = color.replace(/^#?([\da-f])([\da-f])([\da-f])$/i, '$1$1$2$2$3$3');
448	return (color.substr(0,1)!='#' ? '#' : '') + color;
449}
450
451function royal_event_components2hex(r,g,b) {
452	"use strict";
453	return '#'+
454		Number(r).toString(16).toUpperCase().replace(/^(.)$/,'0$1') +
455		Number(g).toString(16).toUpperCase().replace(/^(.)$/,'0$1') +
456		Number(b).toString(16).toUpperCase().replace(/^(.)$/,'0$1');
457}
458
459function royal_event_rgb2components(color) {
460	"use strict";
461	color = royal_event_rgb2hex(color);
462	var matches = color.match(/^#?([\dabcdef]{2})([\dabcdef]{2})([\dabcdef]{2})$/i);
463	if (!matches) return false;
464	for (var i=1, rgb = new Array(3); i<=3; i++)
465		rgb[i-1] = parseInt(matches[i],16);
466	return rgb;
467}
468
469function royal_event_hex2hsb(hex) {
470	"use strict";
471	return royal_event_rgb2hsb(royal_event_hex2rgb(hex));
472}
473
474function royal_event_hsb2hex(hsb) {
475    "use strict";
476	var rgb = royal_event_hsb2rgb(hsb);
477	return royal_event_components2hex(rgb.r, rgb.g, rgb.b);
478}
479
480function royal_event_rgb2hsb(rgb) {
481	"use strict";
482	var hsb = {};
483	hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b);
484	hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b);
485	hsb.b = Math.round((hsb.b /255)*100);
486	if ((rgb.r==rgb.g) && (rgb.g==rgb.b))  hsb.h = 0;
487	else if (rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b);
488	else if (rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60  + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b);
489	else if (rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r);
490	else if (rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r);
491	else if (rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g);
492	else if (rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g);
493	else 								   hsb.h = 0;
494	hsb.h = Math.round(hsb.h);
495	return hsb;
496}
497
498function royal_event_hsb2rgb(hsb) {
499    "use strict";
500	var rgb = {};
501	var h = Math.round(hsb.h);
502	var s = Math.round(hsb.s*255/100);
503	var v = Math.round(hsb.b*255/100);
504	if (s == 0) {
505		rgb.r = rgb.g = rgb.b = v;
506	} else {
507		var t1 = v;
508		var t2 = (255-s)*v/255;
509		var t3 = (t1-t2)*(h%60)/60;
510		if (h==360) h = 0;
511		if (h<60) 		{ rgb.r=t1;	rgb.b=t2;   rgb.g=t2+t3; }
512		else if (h<120) { rgb.g=t1; rgb.b=t2;	rgb.r=t1-t3; }
513		else if (h<180) { rgb.g=t1; rgb.r=t2;	rgb.b=t2+t3; }
514		else if (h<240) { rgb.b=t1; rgb.r=t2;	rgb.g=t1-t3; }
515		else if (h<300) { rgb.b=t1; rgb.g=t2;	rgb.r=t2+t3; }
516		else if (h<360) { rgb.r=t1; rgb.g=t2;	rgb.b=t1-t3; }
517		else 			{ rgb.r=0;  rgb.g=0;	rgb.b=0;	 }
518	}
519	return { r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b) };
520}
521
522function royal_event_color_picker(){
523	"use strict";
524	var id = arguments[0] ? arguments[0] : "iColorPicker"+Math.round(Math.random()*1000);
525	var colors = arguments[1] ? arguments[1] : 
526	'#f00,#ff0,#0f0,#0ff,#00f,#f0f,#fff,#ebebeb,#e1e1e1,#d7d7d7,#cccccc,#c2c2c2,#b7b7b7,#acacac,#a0a0a0,#959595,'
527	+'#ee1d24,#fff100,#00a650,#00aeef,#2f3192,#ed008c,#898989,#7d7d7d,#707070,#626262,#555,#464646,#363636,#262626,#111,#000,'
528	+'#f7977a,#fbad82,#fdc68c,#fff799,#c6df9c,#a4d49d,#81ca9d,#7bcdc9,#6ccff7,#7ca6d8,#8293ca,#8881be,#a286bd,#bc8cbf,#f49bc1,#f5999d,'
529	+'#f16c4d,#f68e54,#fbaf5a,#fff467,#acd372,#7dc473,#39b778,#16bcb4,#00bff3,#438ccb,#5573b7,#5e5ca7,#855fa8,#a763a9,#ef6ea8,#f16d7e,'
530	+'#ee1d24,#f16522,#f7941d,#fff100,#8fc63d,#37b44a,#00a650,#00a99e,#00aeef,#0072bc,#0054a5,#2f3192,#652c91,#91278f,#ed008c,#ee105a,'
531	+'#9d0a0f,#a1410d,#a36209,#aba000,#588528,#197b30,#007236,#00736a,#0076a4,#004a80,#003370,#1d1363,#450e61,#62055f,#9e005c,#9d0039,'
532	+'#790000,#7b3000,#7c4900,#827a00,#3e6617,#045f20,#005824,#005951,#005b7e,#003562,#002056,#0c004b,#30004a,#4b0048,#7a0045,#7a0026';
533	var colorsList = colors.split(',');
534	var tbl = '<table class="colorPickerTable"><thead>';
535	for (var i=0; i<colorsList.length; i++) {
536		if (i%16==0) tbl += (i>0 ? '</tr>' : '') + '<tr>';
537		tbl += '<td style="background-color:'+colorsList[i]+'">&nbsp;</td>';
538	}
539	tbl += '</tr></thead><tbody>'
540		+ '<tr style="height:60px;">'
541		+ '<td colspan="8" id="'+id+'_colorPreview" style="vertical-align:middle;text-align:center;border:1px solid #000;background:#fff;">'
542		+ '<input style="width:55px;color:#000;border:1px solid rgb(0, 0, 0);padding:5px;background-color:#fff;font:11px Arial, Helvetica, sans-serif;" maxlength="7" />'
543		+ '<a href="#" id="'+id+'_moreColors" class="iColorPicker_moreColors"></a>'
544		+ '</td>'
545		+ '<td colspan="8" id="'+id+'_colorOriginal" style="vertical-align:middle;text-align:center;border:1px solid #000;background:#fff;">'
546		+ '<input style="width:55px;color:#000;border:1px solid rgb(0, 0, 0);padding:5px;background-color:#fff;font:11px Arial, Helvetica, sans-serif;" readonly="readonly" />'
547		+ '</td>'
548		+ '</tr></tbody></table>';
549
550	jQuery(document.createElement("div"))
551		.attr("id", id)
552		.css('display','none')
553		.html(tbl)
554		.appendTo("body")
555		.addClass("iColorPickerTable")
556		.on('mouseover', 'thead td', function(){
557			"use strict";
558			var aaa = royal_event_rgb2hex(jQuery(this).css('background-color'));
559			jQuery('#'+id+'_colorPreview').css('background',aaa);
560			jQuery('#'+id+'_colorPreview input').val(aaa);
561		})
562		.on('keypress', '#'+id+'_colorPreview input', function(key){
563			"use strict";
564			var aaa = jQuery(this).val()
565			if (aaa.length<7 && ((key.which>=48 && key.which<=57) || (key.which>=97 && key.which<=102) || (key.which===35 || aaa.length===0))) {
566				aaa += String.fromCharCode(key.which);
567			} else if (key.which == 8 && aaa.length>0) {
568				aaa = aaa.substring(0, aaa.length-1);
569			} else if (key.which===13 && (aaa.length===4 || aaa.length===7)) {
570				var fld  = jQuery('#'+id).data('field');
571				var func = jQuery('#'+id).data('func');
572				if (func!=null && func!='undefined') {
573					func(fld, aaa);
574				} else {
575					fld.val(aaa).css('backgroundColor', aaa).trigger('change');
576				}
577				jQuery('#'+id+'_Bg').fadeOut(500);
578				jQuery('#'+id).fadeOut(500);
579				
580			} else {
581				key.preventDefault();
582				return false;
583			}
584			if (aaa.substr(0,1)==='#' && (aaa.length===4 || aaa.length===7)) {
585				jQuery('#'+id+'_colorPreview').css('background',aaa);
586			}
587		})
588		.on('click', 'thead td', function(e){
589			"use strict";
590			var fld  = jQuery('#'+id).data('field');
591			var func = jQuery('#'+id).data('func');
592			var aaa  = royal_event_rgb2hex(jQuery(this).css('background-color'));
593			if (func!=null && func!='undefined') {
594				func(fld, aaa);
595			} else {
596				fld.val(aaa).css('backgroundColor', aaa).trigger('change');
597			}
598			jQuery('#'+id+'_Bg').fadeOut(500);
599			jQuery('#'+id).fadeOut(500);
600			e.preventDefault();
601			return false;
602		})
603		.on('click', 'tbody .iColorPicker_moreColors', function(e){
604			"use strict";
605			var thead  = jQuery(this).parents('table').find('thead');
606			var out = '';
607			if (thead.hasClass('more_colors')) {
608				for (var i=0; i<colorsList.length; i++) {
609					if (i%16==0) out += (i>0 ? '</tr>' : '') + '<tr>';
610					out += '<td style="background-color:'+colorsList[i]+'">&nbsp;</td>';
611				}
612				thead.removeClass('more_colors').empty().html(out+'</tr>');
613				jQuery('#'+id+'_colorPreview').attr('colspan', 8);
614				jQuery('#'+id+'_colorOriginal').attr('colspan', 8);
615			} else {
616				var rgb=[0,0,0], i=0, j=-1;
617				while (rgb[0]<0xF || rgb[1]<0xF || rgb[2]<0xF) {
618					if (i%18==0) out += (i>0 ? '</tr>' : '') + '<tr>';
619					i++;
620					out += '<td style="background-color:'+royal_event_components2hex(rgb[0]*16+rgb[0],rgb[1]*16+rgb[1],rgb[2]*16+rgb[2])+'">&nbsp;</td>';
621					rgb[2]+=3;
622					if (rgb[2]>0xF) {
623						rgb[1]+=3;
624						if (rgb[1]>(j===0 ? 6 : 0xF)) {
625							rgb[0]+=3;
626							if (rgb[0]>0xF) {
627								if (j===0) {
628									j=1;
629									rgb[0]=0;
630									rgb[1]=9;
631									rgb[2]=0;
632								} else {
633									break;
634								}
635							} else {
636								rgb[1]=(j < 1 ? 0 : 9);
637								rgb[2]=0;
638							}
639						} else {
640							rgb[2]=0;
641						}
642					}
643				}
644				thead.addClass('more_colors').empty().html(out+'<td  style="background-color:#ffffff" colspan="8">&nbsp;</td></tr>');
645				jQuery('#'+id+'_colorPreview').attr('colspan', 9);
646				jQuery('#'+id+'_colorOriginal').attr('colspan', 9);
647			}
648			jQuery('#'+id+' table.colorPickerTable thead td')
649				.css({
650					'width':'12px',
651					'height':'14px',
652					'border':'1px solid #000',
653					'cursor':'pointer'
654				});
655			e.preventDefault();
656			return false;
657		});
658	jQuery(document.createElement("div"))
659		.attr("id", id+"_Bg")
660		.on('click', function(e) {
661			"use strict";
662			jQuery("#"+id+"_Bg").fadeOut(500);
663			jQuery("#"+id).fadeOut(500);
664			e.preventDefault();
665			return false;
666		})
667		.appendTo("body");
668	jQuery('#'+id+' table.colorPickerTable thead td')
669		.css({
670			'width':'12px',
671			'height':'14px',
672			'border':'1px solid #000',
673			'cursor':'pointer'
674		});
675	jQuery('#'+id+' table.colorPickerTable')
676		.css({'border-collapse':'collapse'});
677	jQuery('#'+id)
678		.css({
679			'border':'1px solid #ccc',
680			'background':'#333',
681			'padding':'5px',
682			'color':'#fff',
683			'z-index':999999
684		});
685	jQuery('#'+id+'_colorPreview')
686		.css({'height':'50px'});
687	return id;
688}
689
690function royal_event_color_picker_show(id, fld, func) { 
691	"use strict";
692	if (id===null || id==='') {
693		id = jQuery('.iColorPickerTable').attr('id');
694	}
695	var eICP = fld.offset();
696	var w = jQuery('#'+id).width();
697	var h = jQuery('#'+id).height();
698	var l = eICP.left + w < jQuery(window).width()-10 ? eICP.left : jQuery(window).width()-10 - w;
699	var t = eICP.top + fld.outerHeight() + h < jQuery(document).scrollTop() + jQuery(window).height()-10 ? eICP.top + fld.outerHeight() : eICP.top - h - 13;
700	jQuery("#"+id)
701		.data({field: fld, func: func})
702		.css({
703			'top':t+"px",
704			'left':l+"px",
705			'position':'absolute',
706			'z-index':100001
707		})
708		.fadeIn(500);
709	jQuery("#"+id+"_Bg")
710		.css({
711			'position':'fixed',
712			'z-index':100000,
713			'top':0,
714			'left':0,
715			'width':'100%',
716			'height':'100%'
717		})
718		.fadeIn(500);
719	var def = fld.val().substr(0, 1)=='#' ? fld.val() : royal_event_rgb2hex(fld.css('backgroundColor'));
720	jQuery('#'+id+'_colorPreview input,#'+id+'_colorOriginal input').val(def);
721	jQuery('#'+id+'_colorPreview,#'+id+'_colorOriginal').css('background',def);
722}
723
724
725/* Cookies manipulations
726---------------------------------------------------------------- */
727
728function royal_get_cookie(name) {
729	"use strict";
730	var defa = arguments[1]!=undefined ? arguments[1] : null;
731	var start = document.cookie.indexOf(name + '=');
732	var len = start + name.length + 1;
733	if ((!start) && (name != document.cookie.substring(0, name.length))) {
734		return defa;
735	}
736	if (start == -1)
737		return defa;
738	var end = document.cookie.indexOf(';', len);
739	if (end == -1)
740		end = document.cookie.length;
741	return unescape(document.cookie.substring(len, end));
742}
743
744
745function royal_set_cookie(name, value, expires, path, domain, secure) {
746	"use strict";
747	var expires = arguments[2]!=undefined ? arguments[2] : 0;
748	var path    = arguments[3]!=undefined ? arguments[3] : '/';
749	var domain  = arguments[4]!=undefined ? arguments[4] : '';
750	var secure  = arguments[5]!=undefined ? arguments[5] : '';
751	var today = new Date();
752	today.setTime(today.getTime());
753	if (expires) {
754		expires = expires * 1000 * 60 * 60 * 24;
755	}
756	var expires_date = new Date(today.getTime() + (expires));
757	document.cookie = name + '='
758			+ escape(value)
759			+ ((expires) ? ';expires=' + expires_date.toGMTString() : '')
760			+ ((path)    ? ';path=' + path : '')
761			+ ((domain)  ? ';domain=' + domain : '')
762			+ ((secure)  ? ';secure' : '');
763}
764
765
766function royal_del_cookie(name, path, domain) {
767	"use strict";
768	var path   = arguments[1]!=undefined ? arguments[1] : '/';
769	var domain = arguments[2]!=undefined ? arguments[2] : '';
770	if (royal_get_cookie(name))
771		document.cookie = name + '=' + ((path) ? ';path=' + path : '')
772				+ ((domain) ? ';domain=' + domain : '')
773				+ ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
774}
775
776
777
778
779
780/* Cookies manipulations
781---------------------------------------------------------------- */
782
783function royal_event_get_cookie(name) {
784	"use strict";
785	var defa = arguments[1]!=undefined ? arguments[1] : null;
786	var start = document.cookie.indexOf(name + '=');
787	var len = start + name.length + 1;
788	if ((!start) && (name != document.cookie.substring(0, name.length))) {
789		return defa;
790	}
791	if (start == -1)
792		return defa;
793	var end = document.cookie.indexOf(';', len);
794	if (end == -1)
795		end = document.cookie.length;
796	return unescape(document.cookie.substring(len, end));
797}
798
799
800function royal_event_set_cookie(name, value, expires, path, domain, secure) {
801	"use strict";
802	var expires = arguments[2]!=undefined ? arguments[2] : 0;
803	var path    = arguments[3]!=undefined ? arguments[3] : '/';
804	var domain  = arguments[4]!=undefined ? arguments[4] : '';
805	var secure  = arguments[5]!=undefined ? arguments[5] : '';
806	var today = new Date();
807	today.setTime(today.getTime());
808	if (expires) {
809		expires = expires * 1000 * 60 * 60 * 24;
810	}
811	var expires_date = new Date(today.getTime() + (expires));
812	document.cookie = name + '='
813			+ escape(value)
814			+ ((expires) ? ';expires=' + expires_date.toGMTString() : '')
815			+ ((path)    ? ';path=' + path : '')
816			+ ((domain)  ? ';domain=' + domain : '')
817			+ ((secure)  ? ';secure' : '');
818}
819
820
821function royal_event_del_cookie(name, path, domain) {
822	"use strict";
823	var path   = arguments[1]!=undefined ? arguments[1] : '/';
824	var domain = arguments[2]!=undefined ? arguments[2] : '';
825	if (royal_event_get_cookie(name))
826		document.cookie = name + '=' + ((path) ? ';path=' + path : '')
827				+ ((domain) ? ';domain=' + domain : '')
828				+ ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
829}
830
831
832
833/* ListBox and ComboBox manipulations
834---------------------------------------------------------------- */
835
836function royal_event_clear_listbox(box) {
837	"use strict";
838	for (var i=box.options.length-1; i>=0; i--)
839		box.options[i] = null;
840}
841
842function royal_event_add_listbox_item(box, val, text) {
843	"use strict";
844	var item = new Option();
845	item.value = val;
846	item.text = text;
847    box.options.add(item);
848}
849
850function royal_event_del_listbox_item_by_value(box, val) {
851	"use strict";
852	for (var i=0; i<box.options.length; i++) {
853		if (box.options[i].value == val) {
854			box.options[i] = null;
855			break;
856		}
857	}
858}
859
860function royal_event_del_listbox_item_by_text(box, txt) {
861	"use strict";
862	for (var i=0; i<box.options.length; i++) {
863		if (box.options[i].text == txt) {
864			box.options[i] = null;
865			break;
866		}
867	}
868}
869
870function royal_event_find_listbox_item_by_value(box, val) {
871	"use strict";
872	var idx = -1;
873	for (var i=0; i<box.options.length; i++) {
874		if (box.options[i].value == val) {
875			idx = i;
876			break;
877		}
878	}
879	return idx;
880}
881
882function royal_event_find_listbox_item_by_text(box, txt) {
883	"use strict";
884	var idx = -1;
885	for (var i=0; i<box.options.length; i++) {
886		if (box.options[i].text == txt) {
887			idx = i;
888			break;
889		}
890	}
891	return idx;
892}
893
894function royal_event_select_listbox_item_by_value(box, val) {
895	"use strict";
896	for (var i = 0; i < box.options.length; i++) {
897		box.options[i].selected = (val == box.options[i].value);
898	}
899}
900
901function royal_event_select_listbox_item_by_text(box, txt) {
902	"use strict";
903	for (var i = 0; i < box.options.length; i++) {
904		box.options[i].selected = (txt == box.options[i].text);
905	}
906}
907
908function royal_event_get_listbox_values(box) {
909	"use strict";
910	var delim = arguments[1] ? arguments[1] : ',';
911	var str = '';
912	for (var i=0; i<box.options.length; i++) {
913		str += (str ? delim : '') + box.options[i].value;
914	}
915	return str;
916}
917
918function royal_event_get_listbox_texts(box) {
919	"use strict";
920	var delim = arguments[1] ? arguments[1] : ',';
921	var str = '';
922	for (var i=0; i<box.options.length; i++) {
923		str += (str ? delim : '') + box.options[i].text;
924	}
925	return str;
926}
927
928function royal_event_sort_listbox(box)  {
929	"use strict";
930	var temp_opts = new Array();
931	var temp = new Option();
932	for(var i=0; i<box.options.length; i++)  {
933		temp_opts[i] = box.options[i].clone();
934	}
935	for(var x=0; x<temp_opts.length-1; x++)  {
936		for(var y=(x+1); y<temp_opts.length; y++)  {
937			if(temp_opts[x].text > temp_opts[y].text)  {
938				temp = temp_opts[x];
939				temp_opts[x] = temp_opts[y];
940				temp_opts[y] = temp;
941			}  
942		}  
943	}
944	for(var i=0; i<box.options.length; i++)  {
945		box.options[i] = temp_opts[i].clone();
946	}
947}
948
949function royal_event_get_listbox_selected_index(box) {
950	"use strict";
951	for (var i = 0; i < box.options.length; i++) {
952		if (box.options[i].selected)
953			return i;
954	}
955	return -1;
956}
957
958function royal_event_get_listbox_selected_value(box) {
959	"use strict";
960	if (typeof options=="undefined") {
961		return;
962	}
963	for (var i = 0; i < box.options.length; i++) {
964		if (box.options[i].selected) {
965			return box.options[i].value;
966		}
967	}
968	return null;
969}
970
971function royal_event_get_listbox_selected_text(box) {
972	"use strict";
973	for (var i = 0; i < box.options.length; i++) {
974		if (box.options[i].selected) {
975			return box.options[i].text;
976		}
977	}
978	return null;
979}
980
981function royal_event_get_listbox_selected_option(box) {
982	"use strict";
983	for (var i = 0; i < box.options.length; i++) {
984		if (box.options[i].selected) {
985			return box.options[i];
986		}
987	}
988	return null;
989}
990
991
992
993/* Radio buttons manipulations
994---------------------------------------------------------------- */
995
996function royal_event_get_radio_value(radioGroupObj) {
997	"use strict";
998	for (var i=0; i < radioGroupObj.length; i++)
999		if (radioGroupObj[i].checked) return radioGroupObj[i].value;
1000	return null;
1001}
1002
1003function royal_event_set_radio_checked_by_num(radioGroupObj, num) {
1004	"use strict";
1005	for (var i=0; i < radioGroupObj.length; i++)
1006		if (radioGroupObj[i].checked && i!=num) radioGroupObj[i].checked=false;
1007		else if (i==num) radioGroupObj[i].checked=true;
1008}
1009
1010function royal_event_set_radio_checked_by_value(radioGroupObj, val) {
1011	"use strict";
1012	for (var i=0; i < radioGroupObj.length; i++)
1013		if (radioGroupObj[i].checked && radioGroupObj[i].value!=val) radioGroupObj[i].checked=false;
1014		else if (radioGroupObj[i].value==val) radioGroupObj[i].checked=true;
1015}
1016
1017
1018
1019/* Form manipulations
1020---------------------------------------------------------------- */
1021function royal_event_form_validate(form, opt) {
1022	"use strict";
1023	var error_msg = '';
1024	form.find(":input").each(function() {
1025		"use strict";
1026		if (error_msg!='' && opt.exit_after_first_error) return;
1027		for (var i = 0; i < opt.rules.length; i++) {
1028			if (jQuery(this).attr("name") == opt.rules[i].field) {
1029				var val = jQuery(this).val();
1030				var error = false;
1031				if (typeof(opt.rules[i].min_length) == 'object') {
1032					if (opt.rules[i].min_length.value > 0 && val.length < opt.rules[i].min_length.value) {
1033						if (error_msg=='') jQuery(this).get(0).focus();
1034						error_msg += '<p class="error_item">' + (typeof(opt.rules[i].min_length.message)!='undefined' ? opt.rules[i].min_length.message : opt.error_message_text ) + '</p>'
1035						error = true;
1036					}
1037				}
1038				if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].max_length) == 'object') {
1039					if (opt.rules[i].max_length.value > 0 && val.length > opt.rules[i].max_length.value) {
1040						if (error_msg=='') jQuery(this).get(0).focus();
1041						error_msg += '<p class="error_item">' + (typeof(opt.rules[i].max_length.message)!='undefined' ? opt.rules[i].max_length.message : opt.error_message_text ) + '</p>'
1042						error = true;
1043					}
1044				}
1045				if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].mask) == 'object') {
1046					if (val.length > 0 && opt.rules[i].mask.value != '') {
1047						var regexp = new RegExp(opt.rules[i].mask.value);
1048						if (!regexp.test(val)) {
1049							if (error_msg=='') jQuery(this).get(0).focus();
1050							error_msg += '<p class="error_item">' + (typeof(opt.rules[i].mask.message)!='undefined' ? opt.rules[i].mask.message : opt.error_message_text ) + '</p>'
1051							error = true;
1052						}
1053					}
1054				}
1055				if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].state) == 'object') {
1056					if (opt.rules[i].state.value=='checked' && !jQuery(this).get(0).checked) {
1057						if (error_msg=='') jQuery(this).get(0).focus();
1058						error_msg += '<p class="error_item">' + (typeof(opt.rules[i].state.message)!='undefined' ? opt.rules[i].state.message : opt.error_message_text ) + '</p>'
1059						error = true;
1060					}
1061				}
1062				if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].equal_to) == 'object') {
1063					if (opt.rules[i].equal_to.value != '' && val!=jQuery(jQuery(this).get(0).form[opt.rules[i].equal_to.value]).val()) {
1064						if (error_msg=='') jQuery(this).get(0).focus();
1065						error_msg += '<p class="error_item">' + (typeof(opt.rules[i].equal_to.message)!='undefined' ? opt.rules[i].equal_to.message : opt.error_message_text ) + '</p>'
1066						error = true;
1067					}
1068				}
1069				if (opt.error_fields_class != '') jQuery(this).toggleClass(opt.error_fields_class, error);
1070			}
1071		}
1072	});
1073	if (error_msg!='' && opt.error_message_show) {
1074		var error_message_box = form.find(".result");
1075		if (error_message_box.length == 0) error_message_box = form.parent().find(".result");
1076		if (error_message_box.length == 0) {
1077			form.append('<div class="result"></div>');
1078			error_message_box = form.find(".result");
1079		}
1080		if (opt.error_message_class) error_message_box.toggleClass(opt.error_message_class, true);
1081		error_message_box.html(error_msg).fadeIn();
1082		setTimeout(function() { error_message_box.fadeOut(); }, opt.error_message_time);
1083	}
1084	return error_msg!='';
1085}
1086
1087
1088
1089/* Document manipulations
1090---------------------------------------------------------------- */
1091
1092// Animated scroll to selected id
1093function royal_event_document_animate_to(id) {
1094    "use strict";
1095	if (id.indexOf('#')==-1) id = '#' + id;
1096	var obj = jQuery(id).eq(0);
1097	if (obj.length == 0) return;
1098	var oft = jQuery(id).offset().top;
1099	var st  = jQuery(window).scrollTop();
1100	var speed = Math.min(1600, Math.max(400, Math.round(Math.abs(oft-st) / jQuery(window).height() * 100)));
1101	if (jQuery('body').find('#wpadminbar').length > 0 && jQuery('header.fixedTopMenu .topWrap').length > 0 ) {
1102		jQuery('body,html').animate( {scrollTop: oft - jQuery('#wpadminbar').height() - jQuery('header.fixedTopMenu .topWrap').height()}, speed, 'swing');
1103	} else {
1104		jQuery('body,html').stop(true).animate( {scrollTop: oft + 1}, speed, 'swing');
1105	}
1106}
1107
1108// Change browser address without reload page
1109function royal_event_document_set_location(curLoc){
1110    "use strict";
1111	try {
1112		history.pushState(null, null, curLoc);
1113		return;
1114	} catch(e) {}
1115	location.href = curLoc;
1116}
1117
1118// Add hidden elements init functions after tab, accordion, toggles activate
1119function royal_event_add_hidden_elements_handler(key, handler) {
1120    "use strict";
1121	royal_event_storage_set_array('init_hidden_elements', key, handler);
1122}
1123
1124// Init hidden elements after tab, accordion, toggles activate
1125function royal_event_init_hidden_elements(cont,key) {
1126    "use strict";
1127	if (ROYAL_EVENT_STORAGE['init_hidden_elements']) {
1128		for (key in ROYAL_EVENT_STORAGE['init_hidden_elements']) {
1129			ROYAL_EVENT_STORAGE['init_hidden_elements'][key](cont);
1130		}
1131	}
1132}
1133
1134
1135
1136/* Browsers detection
1137---------------------------------------------------------------- */
1138
1139function royal_event_browser_is_mobile() {
1140    "use strict";
1141	var check = false;
1142	(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
1143	return check;
1144}
1145function royal_event_browser_is_ios() {
1146    "use strict";
1147	return navigator.userAgent.match(/iPad|iPhone|iPod/i) != null;
1148}
1149function royal_event_is_retina() {
1150    "use strict";
1151	var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)';
1152	return (window.devicePixelRatio > 1) || (window.matchMedia && window.matchMedia(mediaQuery).matches);
1153}
1154
1155
1156/* Files functions
1157---------------------------------------------------------------- */
1158
1159function royal_event_get_file_name(path) {
1160    "use strict";
1161	path = path.replace(/\\/g, '/');
1162	var pos = path.lastIndexOf('/');
1163	if (pos >= 0)
1164		path = path.substr(pos+1);
1165	return path;
1166}
1167
1168function royal_event_get_file_ext(path) {
1169    "use strict";
1170	var pos = path.lastIndexOf('.');
1171	path = pos >= 0 ? path.substr(pos+1) : '';
1172	return path;
1173}
1174
1175
1176
1177/* Images functions
1178---------------------------------------------------------------- */
1179
1180// Return true, if all images in the specified container are loaded
1181function royal_event_check_images_complete(cont) {
1182    "use strict";
1183	var complete = true;
1184	cont.find('img').each(function() {
1185		if (!complete) return;
1186		if (!jQuery(this).get(0).complete) complete = false;
1187	});
1188	return complete;
1189}

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.