PageSourceSearch

https://fcsiauliai.lt/wp-content/themes/5roqaso85qxxw50vdqevn280036/files/resources/js/fj.js

js fcsiauliai.lt collected 2026-10-03 00:51:13 UTC 62,821 bytes, 2,453 lines download raw bytes

1function FJ() {
2}
3
4FJ.prototype.is_scrool_top = 15;
5FJ.prototype.translate = {};
6FJ.prototype.now = null;
7FJ.prototype.now_date = null;
8
9/** autocompletui **/
10FJ.prototype.accentMap = {
11    'ẚ': 'a',
12    'Á': 'a',
13    'á': 'a',
14    'À': 'a',
15    'à': 'a',
16    'Ă': 'a',
17    'ă': 'a',
18    'Ắ': 'a',
19    'ắ': 'a',
20    'Ằ': 'a',
21    'ằ': 'a',
22    'Ẵ': 'a',
23    'ẵ': 'a',
24    'Ẳ': 'a',
25    'ẳ': 'a',
26    'Â': 'a',
27    'â': 'a',
28    'Ấ': 'a',
29    'ấ': 'a',
30    'Ầ': 'a',
31    'ầ': 'a',
32    'Ẫ': 'a',
33    'ẫ': 'a',
34    'Ẩ': 'a',
35    'ẩ': 'a',
36    'Ǎ': 'a',
37    'ǎ': 'a',
38    'Å': 'a',
39    'Ã¥': 'a',
40    'Ǻ': 'a',
41    'Ç»': 'a',
42    'Ä': 'a',
43    'ä': 'a',
44    'Ǟ': 'a',
45    'ǟ': 'a',
46    'Ã': 'a',
47    'ã': 'a',
48    'Ȧ': 'a',
49    'ȧ': 'a',
50    'Ç ': 'a',
51    'Ç¡': 'a',
52    'Ą': 'a',
53    'ą': 'a',
54    'Ā': 'a',
55    'ā': 'a',
56    'Ả': 'a',
57    'ả': 'a',
58    'Ȁ': 'a',
59    'ȁ': 'a',
60    'Ȃ': 'a',
61    'ȃ': 'a',
62    'Ạ': 'a',
63    'ạ': 'a',
64    'Ặ': 'a',
65    'ặ': 'a',
66    'Ậ': 'a',
67    'ậ': 'a',
68    'Ḁ': 'a',
69    'ḁ': 'a',
70    'Ⱥ': 'a',
71    'â±¥': 'a',
72    'Ǽ': 'a',
73    'ǽ': 'a',
74    'Ç¢': 'a',
75    'Ç£': 'a',
76    'Ḃ': 'b',
77    'ḃ': 'b',
78    'Ḅ': 'b',
79    'ḅ': 'b',
80    'Ḇ': 'b',
81    'ḇ': 'b',
82    'Ƀ': 'b',
83    'ƀ': 'b',
84    'ᵬ': 'b',
85    'Ɓ': 'b',
86    'ɓ': 'b',
87    'Ƃ': 'b',
88    'ƃ': 'b',
89    'Ć': 'c',
90    'ć': 'c',
91    'Ĉ': 'c',
92    'ĉ': 'c',
93    'Č': 'c',
94    'č': 'c',
95    'Ċ': 'c',
96    'ċ': 'c',
97    'Ç': 'c',
98    'ç': 'c',
99    'Ḉ': 'c',
100    'ḉ': 'c',
101    'È»': 'c',
102    'ȼ': 'c',
103    'Ƈ': 'c',
104    'ƈ': 'c',
105    'ɕ': 'c',
106    'Ď': 'd',
107    'ď': 'd',
108    'Ḋ': 'd',
109    'ḋ': 'd',
110    'Ḑ': 'd',
111    'ḑ': 'd',
112    'Ḍ': 'd',
113    'ḍ': 'd',
114    'Ḓ': 'd',
115    'ḓ': 'd',
116    'Ḏ': 'd',
117    'ḏ': 'd',
118    'Đ': 'd',
119    'đ': 'd',
120    'áµ­': 'd',
121    'Ɖ': 'd',
122    'ɖ': 'd',
123    'Ɗ': 'd',
124    'ɗ': 'd',
125    'Ƌ': 'd',
126    'ƌ': 'd',
127    'È¡': 'd',
128    'ð': 'd',
129    'É': 'e',
130    'Ə': 'e',
131    'Ǝ': 'e',
132    'ǝ': 'e',
133    'é': 'e',
134    'È': 'e',
135    'è': 'e',
136    'Ĕ': 'e',
137    'ĕ': 'e',
138    'Ê': 'e',
139    'ê': 'e',
140    'Ế': 'e',
141    'ế': 'e',
142    'Ề': 'e',
143    'ề': 'e',
144    'Ễ': 'e',
145    'ễ': 'e',
146    'Ể': 'e',
147    'ể': 'e',
148    'Ě': 'e',
149    'ě': 'e',
150    'Ë': 'e',
151    'ë': 'e',
152    'Ẽ': 'e',
153    'ẽ': 'e',
154    'Ė': 'e',
155    'ė': 'e',
156    'Ȩ': 'e',
157    'È©': 'e',
158    'Ḝ': 'e',
159    'ḝ': 'e',
160    'Ę': 'e',
161    'ę': 'e',
162    'Ē': 'e',
163    'ē': 'e',
164    'Ḗ': 'e',
165    'ḗ': 'e',
166    'Ḕ': 'e',
167    'ḕ': 'e',
168    'Ẻ': 'e',
169    'ẻ': 'e',
170    'Ȅ': 'e',
171    'ȅ': 'e',
172    'Ȇ': 'e',
173    'ȇ': 'e',
174    'Ẹ': 'e',
175    'ẹ': 'e',
176    'Ệ': 'e',
177    'ệ': 'e',
178    'Ḙ': 'e',
179    'ḙ': 'e',
180    'Ḛ': 'e',
181    'ḛ': 'e',
182    'Ɇ': 'e',
183    'ɇ': 'e',
184    'ɚ': 'e',
185    'ɝ': 'e',
186    'Ḟ': 'f',
187    'ḟ': 'f',
188    'áµ®': 'f',
189    'Ƒ': 'f',
190    'ƒ': 'f',
191    'Ç´': 'g',
192    'ǵ': 'g',
193    'Ğ': 'g',
194    'ğ': 'g',
195    'Ĝ': 'g',
196    'ĝ': 'g',
197    'Ǧ': 'g',
198    'ǧ': 'g',
199    'Ä ': 'g',
200    'Ä¡': 'g',
201    'Ä¢': 'g',
202    'Ä£': 'g',
203    'Ḡ': 'g',
204    'ḡ': 'g',
205    'Ǥ': 'g',
206    'Ç¥': 'g',
207    'Ɠ': 'g',
208    'É ': 'g',
209    'Ĥ': 'h',
210    'Ä¥': 'h',
211    'Ȟ': 'h',
212    'ȟ': 'h',
213    'Ḧ': 'h',
214    'ḧ': 'h',
215    'Ḣ': 'h',
216    'ḣ': 'h',
217    'Ḩ': 'h',
218    'ḩ': 'h',
219    'Ḥ': 'h',
220    'ḥ': 'h',
221    'Ḫ': 'h',
222    'ḫ': 'h',
223    'H': 'h',
224    '̱': 'h',
225    'ẖ': 'h',
226    'Ħ': 'h',
227    'ħ': 'h',
228    'â±§': 'h',
229    'ⱨ': 'h',
230    'Í': 'i',
231    'í': 'i',
232    'Ì': 'i',
233    'ì': 'i',
234    'Ĭ': 'i',
235    'Ä­': 'i',
236    'Î': 'i',
237    'î': 'i',
238    'Ǐ': 'i',
239    'ǐ': 'i',
240    'Ï': 'i',
241    'ï': 'i',
242    'Ḯ': 'i',
243    'ḯ': 'i',
244    'Ĩ': 'i',
245    'Ä©': 'i',
246    'İ': 'i',
247    'i': 'i',
248    'Ä®': 'i',
249    'į': 'i',
250    'Ī': 'i',
251    'Ä«': 'i',
252    'Ỉ': 'i',
253    'ỉ': 'i',
254    'Ȉ': 'i',
255    'ȉ': 'i',
256    'Ȋ': 'i',
257    'ȋ': 'i',
258    'Ị': 'i',
259    'ị': 'i',
260    'Ḭ': 'i',
261    'ḭ': 'i',
262    'I': 'i',
263    'ı': 'i',
264    'Ɨ': 'i',
265    'ɨ': 'i',
266    'Ä´': 'j',
267    'ĵ': 'j',
268    'J': 'j',
269    '̌': 'j',
270    'ǰ': 'j',
271    'È·': 'j',
272    'Ɉ': 'j',
273    'ɉ': 'j',
274    'ʝ': 'j',
275    'ɟ': 'j',
276    'ʄ': 'j',
277    'Ḱ': 'k',
278    'ḱ': 'k',
279    'Ǩ': 'k',
280    'Ç©': 'k',
281    'Ķ': 'k',
282    'Ä·': 'k',
283    'Ḳ': 'k',
284    'ḳ': 'k',
285    'Ḵ': 'k',
286    'ḵ': 'k',
287    'Ƙ': 'k',
288    'ƙ': 'k',
289    'Ⱪ': 'k',
290    'ⱪ': 'k',
291    'Ĺ': 'a',
292    'ĺ': 'l',
293    'Ľ': 'l',
294    'ľ': 'l',
295    'Ä»': 'l',
296    'ļ': 'l',
297    'Ḷ': 'l',
298    'ḷ': 'l',
299    'Ḹ': 'l',
300    'ḹ': 'l',
301    'Ḽ': 'l',
302    'ḽ': 'l',
303    'Ḻ': 'l',
304    'ḻ': 'l',
305    'Ł': 'l',
306    'ł': 'l',
307    'Ł':'l',
308            'Ì£': 'l',
309    'ł':'l',
310            'Ì£':'l',
311            'Ä¿': 'l',
312    'ŀ': 'l',
313    'Ƚ': 'l',
314    'ƚ': 'l',
315    'â± ': 'l',
316    'ⱡ': 'l',
317    'â±¢': 'l',
318    'É«': 'l',
319    'ɬ': 'l',
320    'É­': 'l',
321    'È´': 'l',
322    'Ḿ': 'm',
323    'ḿ': 'm',
324    'Ṁ': 'm',
325    'ṁ': 'm',
326    'Ṃ': 'm',
327    'ṃ': 'm',
328    'ɱ': 'm',
329    'Ń': 'n',
330    'ń': 'n',
331    'Ǹ': 'n',
332    'ǹ': 'n',
333    'Ň': 'n',
334    'ň': 'n',
335    'Ñ': 'n',
336    'ñ': 'n',
337    'Ṅ': 'n',
338    'ṅ': 'n',
339    'Ņ': 'n',
340    'ņ': 'n',
341    'Ṇ': 'n',
342    'ṇ': 'n',
343    'Ṋ': 'n',
344    'ṋ': 'n',
345    'Ṉ': 'n',
346    'ṉ': 'n',
347    'Ɲ': 'n',
348    'ɲ': 'n',
349    'È ': 'n',
350    'ƞ': 'n',
351    'ɳ': 'n',
352    'ȵ': 'n',
353    'N': 'n',
354    '̈': 'n',
355    'n': 'n',
356    '̈':'n',
357            'Ó': 'o',
358    'ó': 'o',
359    'Ò': 'o',
360    'ò': 'o',
361    'Ŏ': 'o',
362    'ŏ': 'o',
363    'Ô': 'o',
364    'ô': 'o',
365    'Ố': 'o',
366    'ố': 'o',
367    'Ồ': 'o',
368    'ồ': 'o',
369    'Ỗ': 'o',
370    'ỗ': 'o',
371    'Ổ': 'o',
372    'ổ': 'o',
373    'Ǒ': 'o',
374    'ǒ': 'o',
375    'Ö': 'o',
376    'ö': 'o',
377    'Ȫ': 'o',
378    'È«': 'o',
379    'Ő': 'o',
380    'ő': 'o',
381    'Õ': 'o',
382    'õ': 'o',
383    'Ṍ': 'o',
384    'ṍ': 'o',
385    'Ṏ': 'o',
386    'ṏ': 'o',
387    'Ȭ': 'o',
388    'È­': 'o',
389    'È®': 'o',
390    'ȯ': 'o',
391    'Ȱ': 'o',
392    'ȱ': 'o',
393    'Ø': 'o',
394    'ø': 'o',
395    'Ǿ': 'o',
396    'Ç¿': 'o',
397    'Ǫ': 'o',
398    'Ç«': 'o',
399    'Ǭ': 'o',
400    'Ç­': 'o',
401    'Ō': 'o',
402    'ō': 'o',
403    'Ṓ': 'o',
404    'ṓ': 'o',
405    'Ṑ': 'o',
406    'ṑ': 'o',
407    'Ỏ': 'o',
408    'ỏ': 'o',
409    'Ȍ': 'o',
410    'ȍ': 'o',
411    'Ȏ': 'o',
412    'ȏ': 'o',
413    'Æ ': 'o',
414    'Æ¡': 'o',
415    'Ớ': 'o',
416    'ớ': 'o',
417    'Ờ': 'o',
418    'ờ': 'o',
419    'á» ': 'o',
420    'ỡ': 'o',
421    'Ở': 'o',
422    'ở': 'o',
423    'Ợ': 'o',
424    'ợ': 'o',
425    'Ọ': 'o',
426    'ọ': 'o',
427    'Ộ': 'o',
428    'ộ': 'o',
429    'Ɵ': 'o',
430    'ɵ': 'o',
431    'Ṕ': 'p',
432    'ṕ': 'p',
433    'Ṗ': 'p',
434    'ṗ': 'p',
435    'â±£': 'p',
436    'Ƥ': 'p',
437    'Æ¥': 'p',
438    'P': 'p',
439    '̃': 'p',
440    'p': 'p',
441    '̃':'p',
442            'Ê ': 'q',
443    'Ɋ': 'q',
444    'ɋ': 'q',
445    'Ŕ': 'r',
446    'ŕ': 'r',
447    'Ř': 'r',
448    'ř': 'r',
449    'Ṙ': 'r',
450    'ṙ': 'r',
451    'Ŗ': 'r',
452    'ŗ': 'r',
453    'Ȑ': 'r',
454    'ȑ': 'r',
455    'Ȓ': 'r',
456    'ȓ': 'r',
457    'Ṛ': 'r',
458    'ṛ': 'r',
459    'Ṝ': 'r',
460    'ṝ': 'r',
461    'Ṟ': 'r',
462    'ṟ': 'r',
463    'Ɍ': 'r',
464    'ɍ': 'r',
465    'áµ²': 'r',
466    'ɼ': 'r',
467    'Ɽ': 'r',
468    'ɽ': 'r',
469    'ɾ': 'r',
470    'áµ³': 'r',
471    'ß': 's',
472    'Ś': 's',
473    'ś': 's',
474    'Ṥ': 's',
475    'á¹¥': 's',
476    'Ŝ': 's',
477    'ŝ': 's',
478    'Å ': 's',
479    'Å¡': 's',
480    'Ṧ': 's',
481    'á¹§': 's',
482    'á¹ ': 's',
483    'ṡ': 's',
484    'ẛ': 's',
485    'Ş': 's',
486    'ş': 's',
487    'á¹¢': 's',
488    'á¹£': 's',
489    'Ṩ': 's',
490    'ṩ': 's',
491    'Ș': 's',
492    'ș': 's',
493    'ʂ': 's',
494    'S': 's',
495    'Ì©': 's',
496    's': 's',
497    'Ì©':'s',
498            'Þ': 't',
499    'þ': 't',
500    'Ť': 't',
501    'Å¥': 't',
502    'T': 't',
503    '̈':'t',
504            'ẗ': 't',
505    'Ṫ': 't',
506    'ṫ': 't',
507    'Å¢': 't',
508    'Å£': 't',
509    'Ṭ': 't',
510    'á¹­': 't',
511    'Ț': 't',
512    'ț': 't',
513    'á¹°': 't',
514    'á¹±': 't',
515    'á¹®': 't',
516    'ṯ': 't',
517    'Ŧ': 't',
518    'ŧ': 't',
519    'Ⱦ': 't',
520    'ⱦ': 't',
521    'áµµ': 't',
522    'Æ«': 't',
523    'Ƭ': 't',
524    'Æ­': 't',
525    'Æ®': 't',
526    'ʈ': 't',
527    'ȶ': 't',
528    'Ú': 'u',
529    'ú': 'u',
530    'Ù': 'u',
531    'ù': 'u',
532    'Ŭ': 'u',
533    'Å­': 'u',
534    'Û': 'u',
535    'û': 'u',
536    'Ǔ': 'u',
537    'ǔ': 'u',
538    'Å®': 'u',
539    'ů': 'u',
540    'Ü': 'u',
541    'ü': 'u',
542    'Ǘ': 'u',
543    'ǘ': 'u',
544    'Ǜ': 'u',
545    'ǜ': 'u',
546    'Ǚ': 'u',
547    'ǚ': 'u',
548    'Ǖ': 'u',
549    'ǖ': 'u',
550    'Ű': 'u',
551    'ű': 'u',
552    'Ũ': 'u',
553    'Å©': 'u',
554    'Ṹ': 'u',
555    'á¹¹': 'u',
556    'Ų': 'u',
557    'ų': 'u',
558    'Ū': 'u',
559    'Å«': 'u',
560    'Ṻ': 'u',
561    'á¹»': 'u',
562    'Ủ': 'u',
563    'á»§': 'u',
564    'Ȕ': 'u',
565    'ȕ': 'u',
566    'Ȗ': 'u',
567    'ȗ': 'u',
568    'Ư': 'u',
569    'ư': 'u',
570    'Ứ': 'u',
571    'ứ': 'u',
572    'Ừ': 'u',
573    'ừ': 'u',
574    'á»®': 'u',
575    'ữ': 'u',
576    'Ử': 'u',
577    'á»­': 'u',
578    'á»°': 'u',
579    'á»±': 'u',
580    'Ụ': 'u',
581    'ụ': 'u',
582    'á¹²': 'u',
583    'á¹³': 'u',
584    'á¹¶': 'u',
585    'á¹·': 'u',
586    'á¹´': 'u',
587    'á¹µ': 'u',
588    'Ʉ': 'u',
589    'ʉ': 'u',
590    'á¹¼': 'v',
591    'á¹½': 'v',
592    'á¹¾': 'v',
593    'ṿ': 'v',
594    'Ʋ': 'v',
595    'ʋ': 'v',
596    'Ẃ': 'w',
597    'ẃ': 'w',
598    'Ẁ': 'w',
599    'ẁ': 'w',
600    'Å´': 'w',
601    'ŵ': 'w',
602    'W': 'w',
603    '̊': 'w',
604    'ẘ': 'w',
605    'Ẅ': 'w',
606    'ẅ': 'w',
607    'Ẇ': 'w',
608    'ẇ': 'w',
609    'Ẉ': 'w',
610    'ẉ': 'w',
611    'Ẍ': 'x',
612    'ẍ': 'x',
613    'Ẋ': 'x',
614    'ẋ': 'x',
615    'Ý': 'y',
616    'ý': 'y',
617    'Ỳ': 'y',
618    'ỳ': 'y',
619    'Ŷ': 'y',
620    'Å·': 'y',
621    'Y': 'y',
622    '̊':'y',
623            'ẙ': 'y',
624    'Ÿ': 'y',
625    'ÿ': 'y',
626    'Ỹ': 'y',
627    'ỹ': 'y',
628    'Ẏ': 'y',
629    'ẏ': 'y',
630    'Ȳ': 'y',
631    'ȳ': 'y',
632    'á»¶': 'y',
633    'á»·': 'y',
634    'á»´': 'y',
635    'ỵ': 'y',
636    'ʏ': 'y',
637    'Ɏ': 'y',
638    'ɏ': 'y',
639    'Ƴ': 'y',
640    'Æ´': 'y',
641    'Ź': 'z',
642    'ź': 'z',
643    'Ẑ': 'z',
644    'ẑ': 'z',
645    'Ž': 'z',
646    'ž': 'z',
647    'Å»': 'z',
648    'ż': 'z',
649    'Ẓ': 'z',
650    'ẓ': 'z',
651    'Ẕ': 'z',
652    'ẕ': 'z',
653    'Ƶ': 'z',
654    'ƶ': 'z',
655    'Ȥ': 'z',
656    'È¥': 'z',
657    'ʐ': 'z',
658    'ʑ': 'z',
659    'Ⱬ': 'z',
660    'ⱬ': 'z',
661    'Ç®': 'z',
662    'ǯ': 'z',
663    'ƺ': 'z',
664// Roman fullwidth ascii equivalents: 0xff00 to 0xff5e
665    '2': '2',
666    '6': '6',
667    'ï¼¢': 'B',
668    'F': 'F',
669    'J': 'J',
670    'ï¼®': 'N',
671    'ï¼²': 'R',
672    'ï¼¶': 'V',
673    'Z': 'Z',
674    'b': 'b',
675    'f': 'f',
676    'j': 'j',
677    'n': 'n',
678    'r': 'r',
679    'v': 'v',
680    'z': 'z',
681    '1': '1',
682    '5': '5',
683    '9': '9',
684    'A': 'A',
685    'ï¼¥': 'E',
686    'I': 'I',
687    'ï¼­': 'M',
688    'ï¼±': 'Q',
689    'ï¼µ': 'U',
690    'ï¼¹': 'Y',
691    'a': 'a',
692    'e': 'e',
693    'i': 'i',
694    'm': 'm',
695    'q': 'q',
696    'u': 'u',
697    'y': 'y',
698    '0': '0',
699    '4': '4',
700    '8': '8',
701    'D': 'D',
702    'H': 'H',
703    'L': 'L',
704    'ï¼°': 'P',
705    'ï¼´': 'T',
706    'X': 'X',
707    'd': 'd',
708    'h': 'h',
709    'l': 'l',
710    'p': 'p',
711    't': 't',
712    'x': 'x',
713    '3': '3',
714    '7': '7',
715    'ï¼£': 'C',
716    'ï¼§': 'G',
717    'K': 'K',
718    'O': 'O',
719    'ï¼³': 'S',
720    'ï¼·': 'W',
721    'c': 'c',
722    'g': 'g',
723    'k': 'k',
724    'o': 'o',
725    's': 's',
726    'w': 'w'};
727
728FJ.prototype.normalize = function(term)
729{
730
731    var ret = "";
732    for (var i = 0; i < term.length; i++) {
733        ret += fjObj.accentMap[ term.charAt(i) ] || term.charAt(i);
734    }
735    return ret;
736}
737
738FJ.prototype.getAutocompleteSource = function(source)
739{
740    return function(request, response) {
741        var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
742        response($.grep(source, function(value) {
743            value = value.label || value.value || value;
744            return matcher.test(value) || matcher.test(fjObj.normalize(value));
745        }));
746    }
747}
748
749/** popup **/
750FJ.prototype.showAjaxPopup = function(action, query, options)
751{
752    $.ajax({
753        type: 'GET',
754        url: action,
755        data: query,
756        cache: false,
757        success: function(data) {
758            if (data.html)
759                fjObj.showPopup(data.html, options);
760            else
761                fjObj.showPopup(data, options);
762        }
763
764    });
765}
766
767FJ.prototype.showPopup = function(html, options)
768{
769    var popup;
770
771    if (!isset(options))
772        options = {};
773
774    if (!options.notClearPopupsMessage)
775        $('.fj-popup-message').remove();
776
777    if (!options.notClearPopups)
778        $('.popup').remove();
779
780    if (html)
781    {
782        popup = $(html);
783        $('body').append(popup);
784    }
785    else
786    {
787        popup = $('.popup');
788    }
789
790    if (popup.length > 0)
791    {
792        fjObj.showBGOverlay();
793
794        if (!options.disable_hide)
795            popup.hide();
796
797        popup.fadeIn();
798        popup.find('.fj-popup-close').click(function(e) {
799            e.preventDefault();
800            fjObj.closePopup();
801        });
802
803        if (options.positionX == 'center')
804        {
805            popup.css({
806                'margin-left': popup.width() / (-2),
807            });
808        }
809
810        if (options.positionY == 'center')
811        {
812            popup.css({
813                'margin-left': popup.width() / (-2)
814            });
815        }
816
817        if (options.fixedPosition || popup.data('fixedPosition'))
818        {
819            popup.css({
820                'margin-left': popup.width() / (-2),
821                'margin-top': popup.height() / (-2),
822                'position': 'fixed'
823            });
824        }
825
826        if (options.scrollable)
827        {
828            if (popup.position().top < $(window).scrollTop())
829                $(window).scrollTo('.popup', 500, {
830                    offset: -20
831                });
832        }
833
834        if (options.set_position)
835        {
836            var position_top = options.set_position_top ? options.set_position_top : 0;
837
838            if ($(window).scrollTop() + position_top + popup.height() > $('body').height())
839            {
840                $(window).scrollTo('.popup', 500, {
841                    offset: -20
842                });
843
844            }
845            else
846                popup.css('top', $(window).scrollTop() + position_top);
847        }
848
849        if (options.buttons)
850        {
851            $.each(options.buttons, function(key, val) {
852                popup.find(val.selector).click(val.callback);
853            })
854
855        }
856    }
857
858}
859
860FJ.prototype.showBGOverlay = function()
861{
862    if (!$('.popup-overlay').is(':visible'))
863        $('.popup-overlay').show();
864}
865
866FJ.prototype.closePopup = function(obj)
867{
868    var popup = null;
869
870    if (isset(obj))
871        popup = obj.closest('.popup');
872    else
873        popup = $('.popup');
874
875    popup.fadeOut(400, function() {
876        if (!popup.data('hide'))
877            $(this).remove();
878
879        if ($('.popup').length == 0)
880            $('.popup-overlay').hide();
881    });
882}
883
884FJ.prototype.popupInit = function()
885{
886    $('.fj-catalog-compare').click(function(e) {
887        e.preventDefault();
888        fjObj.showAjaxPopup($(this).attr('href'));
889
890    })
891
892    $('.fj-popup-login-register').each(function() {
893        $(this).click(function(e) {
894            e.preventDefault();
895            fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/users/login-register?type=popup');
896        });
897    })
898
899    $('.fj-form-ask').click(function(e) {
900        e.preventDefault();
901        fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/contacts/contact',
902                {type: 'popup'},
903        {
904            set_position: 1,
905            set_position_top: 50
906        });
907    });
908
909    $('.fj-popup-newsletter').each(function() {
910        $(this).click(function(e) {
911            e.preventDefault();
912            fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/forms/newsletter?type=popup');
913        });
914    });
915
916    $('.fj-popup-search').each(function() {
917        $(this).click(function(e) {
918            e.preventDefault();
919            fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/search?type=popup');
920        });
921    })
922}
923
924
925FJ.prototype.ajaxContent = function(options)
926{
927    $.ajax({
928        type: 'GET',
929        url: options.url,
930        cache: false,
931        success: function(data) {
932            options.target.html(data);
933        }
934    });
935}
936
937/**
938 * reikia siu bloku fj-ajax-container, fj-ajax-loader,fj-ajax-content 
939 *
940 */
941FJ.prototype.ajaxPost = function(options)
942{
943    $(options.form).submit(function() {
944        var popup = $(options.form).parents('.fj-ajax-container');
945        var loader = $(options.form).parents('.fj-ajax-container').find('.fj-ajax-loader');
946        loader.fadeIn()
947        try {
948            $.ajax({
949                type: 'POST',
950                url: $(this).attr('action'),
951                data: $(this).serialize() + "&" + options.submit,
952                dataType: 'json',
953                success: function(data) {
954                    loader.hide();
955                    var parent = $(options.form).closest('.fj-ajax-content');
956                    var form = '';
957
958                    if (data.html.length > 0)
959                    {
960                        if ($(data['html']).length)
961                            form = $(data['html']);
962                        else
963                            form = $('<p>').html(data['html']);
964                    }
965
966                    $(options.form).remove();
967                    parent.append(form);
968                    form.find('.errors').fadeIn();
969                    fjObj.errorsInit();
970
971                    if (data['success'])
972                    {
973                        if (options.onSuccess)
974                            options.onSuccess(data);
975                    }
976                },
977                cache: false
978            });
979        }
980        catch (e) {
981
982        }
983        return false;
984    })
985
986}
987
988/*********************************  cart ***********************************/
989FJ.prototype.cartAdd = function(obj, options)
990{
991    if (!isset(options))
992        options = {};
993    if (options.animate != false)
994        obj.css({opacity: 0}).animate({opacity: 1}, 800)
995
996    $.ajax({
997        type: 'POST',
998        url: '/' + $('html').attr('lang') + '/cart/add',
999        data: {
1000            id: obj.data('id'),
1001            quantity: obj.data('quantity'),
1002            change: obj.data('change'),
1003            options: obj.data('options')
1004        },
1005        dataType: 'json',
1006        cache: false,
1007        success: function(data) {
1008            if (data && isset(data.result))
1009            {
1010                if (isset(data.result.layout.amount))
1011                    fjObj.cartPlaceHolder(data.result.layout.amount);
1012
1013                if (isset(data.result.layout.content))
1014                    fjObj.cartLayoutContent({
1015                        html: data.result.layout.content
1016                    });
1017
1018                if (isset(data.result['recommended-quantity']))
1019                    options.input.val(roundDown(data.result['recommended-quantity'], 3));
1020
1021                if (data.result.success)
1022                {
1023                    if (obj.parent().find('.fj-cart-buy').css('display') == 'none')
1024                        obj.parent().find('.fj-cart-buy').css({opacity: 0, display: 'inline-block'}).animate({opacity: 1});
1025
1026                    obj.closest('.fj-product-list-item').addClass('fj-in-cart');
1027                }
1028
1029                if (data.result.max && obj.prop("tagName") == 'INPUT')
1030                {
1031                    obj.val(parseFloat(data.result.quantity)).data('quantity', parseFloat(data.result.quantity));
1032                }
1033
1034                if (data.result.shipment_price)
1035                {
1036                    $('.fj-shipment-price').html(data.result.shipment_price);
1037                }
1038
1039                fjObj.cartItemTotal(obj);
1040                if (isset(data.result.popup))
1041                    fjObj.showPopup(data.result.popup, {
1042                        fixedPosition: true
1043                    });
1044            }
1045        },
1046        complete: function(jqXHR, textStatus) {
1047            if (options.animate != false)
1048                obj.stop(true, true).animate({opacity: 1}, 800);
1049        }
1050    });
1051}
1052
1053FJ.prototype.cartAddCheckQuantity = function(obj, quantity, options)
1054{
1055    options = $.extend({}, {
1056        showPopup: true
1057    }, options);
1058    if (!floatEq(quantity, Math.round(quantity / obj.data('step')) * obj.data('step')))
1059    {
1060        var val = parseFloat((Math.ceil(quantity / obj.data('step')) * obj.data('step')).toFixed(6));
1061        fjObj.showPopup(arrayReplace(messagesPopup.addCartRecomendedQuantity.html, {
1062            "'%quantity%'": val,
1063            "'%measure%'": obj.data('measure')
1064        }));
1065        return false;
1066    }
1067
1068    return true;
1069}
1070
1071FJ.prototype.cartRemoveItemInit = function(obj)
1072{
1073    obj.click(function() {
1074        fjObj.cartRemoveItem($(this));
1075    });
1076}
1077
1078FJ.prototype.cartRemoveItem = function(obj)
1079{
1080
1081    var current_obj = obj;
1082    fjObj.showPopup(_messages.cartRemove.html, {
1083        buttons: {
1084            ok: {
1085                selector: '.fj-button-ok',
1086                callback: function() {
1087                    $.ajax({
1088                        type: 'GET',
1089                        url: '/' + $('html').attr('lang') + "/cart/remove",
1090                        data: {
1091                            id: current_obj.parents('.fj-cart-item').data('id')
1092                        },
1093                        dataType: 'json',
1094                        success: function(data) {
1095                            if (data)
1096                            {
1097                                if (isset(data.result.layout.amount))
1098                                    fjObj.cartPlaceHolder(data.result.layout.amount);
1099                                if (isset(data.result.layout.content))
1100                                    fjObj.cartLayoutContent({
1101                                        html: data.result.layout.content
1102                                    });
1103                                var table = current_obj.closest('.fj-cart-items');
1104                                if (data['result']['success'])
1105                                {
1106                                    $('.fj-cart-item[data-id=' + current_obj.parents('.fj-cart-item').data('id') + ']').fadeOut(function() {
1107                                        $(this).remove();
1108                                        if (table.find('.fj-cart-item').length == 0)
1109                                        {
1110                                            table.fadeOut();
1111                                            $('input[name="cartSubmit"]').fadeOut();
1112                                        }
1113
1114                                        if (data.result.shipment_price)
1115                                        {
1116                                            $('.fj-shipment-price').html(data.result.shipment_price);
1117                                        }
1118
1119                                        fjObj.cartItemTotal(obj);
1120                                        fjProject.cartTotal(obj);
1121                                    });
1122                                }
1123
1124
1125                            }
1126                        },
1127                        cache: false
1128                    });
1129                    fjObj.closePopup();
1130                }
1131            },
1132            cancel: {
1133                selector: '.fj-button-cancel',
1134                callback: function() {
1135                    fjObj.closePopup();
1136                }
1137            }
1138        },
1139        fixedPosition: true
1140    });
1141}
1142
1143FJ.prototype.cartRemoveHistory = function(obj)
1144{
1145
1146    try {
1147        var current_obj = obj;
1148        fjObj.showPopup(_messages.cartRemove.html, {
1149            buttons: {
1150                ok: {
1151                    selector: '.fj-button-ok',
1152                    callback: function() {
1153                        $.ajax({
1154                            type: 'GET',
1155                            url: '/' + $('html').attr('lang') + '/cart/order',
1156                            data: {
1157                                public_id: current_obj.closest('.fj-order-item').data('id'),
1158                                act: 'remove'
1159                            },
1160                            dataType: 'json',
1161                            success: function(data) {
1162                                if (data['success'])
1163                                {
1164                                    current_obj.parents('.fj-order-item').fadeOut(function() {
1165                                        $(this).remove();
1166                                    });
1167                                }
1168                            },
1169                            cache: false
1170                        });
1171                        fjObj.closePopup();
1172                    }
1173                },
1174                cancel: {
1175                    selector: '.fj-button-cancel',
1176                    callback: function() {
1177                        fjObj.closePopup();
1178                    }
1179                }
1180            },
1181            fixedPosition: true
1182        });
1183    }
1184    catch (e) {
1185
1186    }
1187}
1188
1189FJ.prototype.cartAddButtonsOptions = function(options)
1190{
1191    var item_options = $('.fj-cart-add').data('options');
1192    $.each(options, function(key, val) {
1193        if (!isset(item_options.key))
1194        {
1195            item_options[key] = val
1196        }
1197        else {
1198            $.each(item_options[key], function(key1, val1) {
1199                item_options[key][key1] = val1;
1200            });
1201        }
1202    });
1203    $('.fj-cart-add').data('options', item_options);
1204}
1205
1206FJ.prototype.cartLayoutContent = function(options)
1207{
1208    if (!isset(options))
1209        options = {};
1210    if (options.html)
1211    {
1212        $('.fj-cart-layout-content').html(options.html);
1213    }
1214
1215    $('.fj-cart-layout-content .fj-cart-item').each(function(key, val) {
1216        if (key < 5)
1217            $(this).fadeIn();
1218        else
1219            $(this).hide();
1220    });
1221    fjObj.cartRemoveItemInit($('.fj-cart-layout-content .fj-cart-remove'));
1222    // cart layout content'o kontroles buttonas
1223    if ($('.fj-cart-layout-content .fj-cart-item').length)
1224        $('.fj-cart-layout-control').fadeIn();
1225    else
1226    {
1227        if (options.control_hide == true)
1228            $('.fj-cart-layout-control').hide();
1229        else
1230            $('.fj-cart-layout-control').fadeOut();
1231    }
1232}
1233
1234FJ.prototype.cartPlaceHolder = function(html)
1235{
1236    $('.fj-cart-layout-amount').html(html);
1237    $('.fj-cart-layout-amount').hide();
1238    $('.fj-cart-layout-amount').fadeIn();
1239}
1240
1241FJ.prototype.cartParseQuantity = function(quantity)
1242{
1243    quantity = parseFloat(quantity);
1244    if (isNaN(quantity) || quantity < 0)
1245        quantity = 0;
1246    if (quantity > 100000)
1247        quantity = 100000;
1248    return quantity;
1249};
1250FJ.prototype.cartEdit = function(obj)
1251{
1252    if (obj.val() == obj.data('quantity'))
1253        return;
1254    var quantity = fjObj.cartParseQuantity(obj.val())
1255
1256    obj.val(quantity);
1257    obj.data('quantity', quantity);
1258    obj.data('options', {
1259        id: obj.closest('.fj-cart-item').data('id'),
1260        type: obj.data('type')
1261    });
1262    fjObj.cartAdd(obj, {animate: false});
1263    fjObj.cartItemTotal(obj, {loader: true});
1264};
1265FJ.prototype.cartEditSilent = function(obj)
1266{
1267    var quantity = fjObj.cartParseQuantity(obj.val())
1268
1269    obj.val(quantity);
1270    fjObj.cartItemTotal(obj, {loader: true});
1271    if (obj.data('timer'))
1272        clearTimeout(obj.data('timer'));
1273    obj.data('timer', setTimeout(function() {
1274        fjObj.cartEdit(obj);
1275    }, 1000));
1276};
1277FJ.prototype.cartItemTotal = function(obj, options)
1278{
1279    if (!isset(options))
1280        options = {};
1281    var item = obj.closest('.fj-cart-item');
1282    if (item.length)
1283    {
1284        item.find('.fj-cart-item-total').html(item.find('.fj-cart-item-price').asNumber({regi
1284on: currencyRegion}) * obj.val()).formatCurrency({
1285            region: currencyRegion
1286        });
1287    }
1288
1289    fjObj.cartTotal(obj.closest('.fj-cart-items'), options);
1290};
1291FJ.prototype.cartTotal = function(obj, options)
1292{
1293    if (!$('.fj-cart-total').length)
1294        return;
1295    if (!isset(options))
1296        options = {};
1297    var obj = $('.fj-cart-total').closest('.fj-cart-items');
1298    var total = 0;
1299    obj.find('.fj-cart-item').each(function() {
1300        total += $(this).find('.fj-cart-item-price').asNumber({region: currencyRegion}) * $(this).find('.fj-cart-item-quantity').val();
1301    });
1302    var shipment_price = obj.find('.fj-shipment-price');
1303    if (shipment_price.length)
1304    {
1305        total += shipment_price.asNumber({region: currencyRegion});
1306    }
1307
1308    if (options.loader)
1309    {
1310        obj.find('.fj-cart-total').html(_messages.cartLoader);
1311        obj.find('.fj-shipment-price').html(_messages.cartLoader);
1312    }
1313    else
1314        obj.find('.fj-cart-total').html(total).formatCurrency({
1315            region: currencyRegion
1316        });
1317};
1318FJ.prototype.cartInit = function()
1319{
1320    fjObj.cartTotal($('.fj-cart-items'));
1321    $('.fj-cart-items .fj-cart-item-quantity').each(function() {
1322        $(this).blur(function() {
1323            fjObj.cartEdit($(this));
1324        }).keyup(function(e) {
1325            var arrs = {38: 'up', 40: 'down', 9: 'tab'};
1326            if (arrs[e.keyCode])
1327                return;
1328            fjObj.cartEditSilent($(this));
1329        }).autoNumeric({
1330            aSep: '',
1331            vMin: 0,
1332            vMax: '99999999999999999999.999999',
1333            aPad: false
1334        }).jStepper({
1335            decimalSeparator: ".",
1336            minValue: 0,
1337            maxValue: $(this).data('max') == -1 ? null : $(this).data('max'),
1338            allowDecimals: false,
1339            normalStep: $(this).data('step'),
1340            onStep: function(obj, bDirection) {
1341                fjObj.cartEditSilent(obj);
1342            }
1343        });
1344    });
1345    fjObj.cartRemoveItemInit($('.fj-cart-items .fj-cart-item-remove'));
1346};
1347/***************************************************************************/
1348
1349/**************** select blok'ui ***********************/
1350FJ.prototype.initSelect = function(obj)
1351{
1352    fjObj.initSelectSpanClick(obj.find('.select span'));
1353    fjObj.initSelectLiClick(obj.find('.select li'));
1354    fjObj.initSelectMultipleClick(obj.find('.select[data-select-type="multiple"] input[type="checkbox"]'));
1355//fjObj.selectCurrentItem(obj.find('input[type=hidden]:first'));
1356}
1357
1358FJ.prototype.initSelectSpanClick = function(obj)
1359{
1360    obj.click(function() {
1361        if ($(this).parent().find('ul').is(':visible') == false) {
1362            if (!isset($(this).parent().attr('disabled')))
1363                $(this).parent().find('ul').show();
1364        } else {
1365            $(this).parent().find('ul').hide();
1366        }
1367    });
1368    obj.parents('.select').mouseleave(function() {
1369        if ($(this).data('selectType') == 'multiple' && $(this).find('ul').css('display') == 'block' && obj.parents('.select').data('changed') == 1)
1370        {
1371            obj.parents('.select').data('changed', 0);
1372            fjObj.selectExecFunc(obj);
1373        }
1374
1375        $(this).find('ul').hide();
1376    });
1377}
1378
1379FJ.prototype.initSelectLiClick = function(obj)
1380{
1381    obj.click(function() {
1382        var select = $(this).parents('.select');
1383        if (select.data('selectType') == 'multiple')
1384            return;
1385        select.find('.active').removeClass('active');
1386        var clone = $(this).clone();
1387        var title = clone.find('input').remove().end().html();
1388        $(this).addClass('active').parents('.select').find('.selected span').html(title);
1389        select.find('ul').hide();
1390        var block = $(this).parents('.select');
1391        var input = '';
1392        if (block.data('targetInput'))
1393            input = block.parents('.select-block').find('#' + block.data('targetInput'))
1394
1395        if (block.data('targetInputName'))
1396            input = block.parents('.select-block').find('input[name=' + block.data('targetInputName') + ']')
1397
1398        if (input == '')
1399        {
1400            input = block.parents('.select-block').find('input[type=hidden]');
1401        }
1402
1403        if (block.data('targetType') == 'date')
1404        {
1405            input.val(fjObj.parseDateValue(block.parents('.select-block').find('.year li.active').attr('data-id')) + '-' + fjObj.parseDateValue(block.parents('.select-block').find('.month li.active').attr('data-id')) + '-' + fjObj.parseDateValue(block.parents('.select-block').find('.day li.active').attr('data-id')));
1406            fjObj.selectCurrentDateItem(input);
1407        }
1408        else
1409            input.val($(this).data('id'));
1410        fjObj.selectExecFunc(input);
1411    });
1412}
1413
1414FJ.prototype.initSelectMultipleClick = function(obj)
1415{
1416    obj.each(function() {
1417
1418        var select = $(this).parents('.select');
1419        var clone = $(this).parents('li').clone();
1420        if (select.data('selectType') != 'multiple')
1421            return;
1422        if ($(this).is(':checked'))
1423        {
1424            $(this).parents('li').addClass('active')
1425        }
1426
1427        $(this).click(function() {
1428            if ($(this).is(':checked'))
1429            {
1430                $(this).parents('li').addClass('active')
1431
1432                if ($(this).data('all') == '1')
1433                {
1434                    select.find('.select-item input').attr('checked', 'checked');
1435                    select.find('.select-item').addClass('active')
1436                }
1437            }
1438            else
1439            {
1440                $(this).parents('li').removeClass('active');
1441                if ($(this).data('all') == '1')
1442                {
1443                    select.find('.select-item input').removeAttr('checked');
1444                    select.find('.select-item').removeClass('active')
1445                }
1446                else
1447                {
1448                    var item_all = select.find('.select-item input[data-all="1"]');
1449                    if (item_all.length)
1450                    {
1451                        item_all.removeAttr('checked');
1452                        item_all.parents('.select-item').removeClass('active');
1453                    }
1454                }
1455            }
1456
1457
1458
1459            select.data('changed', 1);
1460            fjObj.setSelectMultipleTitle($(this));
1461        })
1462
1463
1464
1465    });
1466}
1467
1468FJ.prototype.setSelectMultipleTitle = function(obj)
1469{
1470    var select = obj.parents('.select-block').find('.select');
1471    var selected_span = obj.parents('.select-block').find('.selected span');
1472    var title = '';
1473    select.find('li').each(function() {
1474        if ($(this).find('input').is(':checked'))
1475        {
1476            // jei pazymim kad visos kategorijos
1477            if ($(this).find('input').data('all') == '1')
1478            {
1479                title = $(this).find('input').attr('title');
1480                return false;
1481            }
1482
1483            title += (title.length == 0 ? '' : ', ') + $(this).find('input').attr('title');
1484        }
1485    });
1486    if (title.length > 0)
1487    {
1488        if (title.length > 27)
1489            selected_span.html(title.substring(0, 27) + '...');
1490        else
1491            selected_span.html(title);
1492        selected_span.attr('title', title);
1493    }
1494    else
1495    {
1496        selected_span.html(select.data('empty'));
1497    }
1498}
1499
1500/**
1501 * obj - li active elementas
1502 *    
1503 **/
1504FJ.prototype.selectExecFunc = function(obj)
1505{
1506    var block = obj.parents('.select-block').find('.select');
1507    if (block.data('func'))
1508    {
1509
1510        if (window[block.data('func')])
1511        {
1512            window[block.data('func')](obj);
1513        }
1514    }
1515
1516    if (block.data('targetAjax'))
1517    {
1518        $.getJSON(
1519                block.data('targetAjax'),
1520                {
1521                    pid: $(this).data('id')
1522                },
1523        function(data) {
1524            var select = block.parents('form').find('#' + block.data('targetSelect'));
1525            select.find('.selected span').html('');
1526            select.find('ul').remove();
1527            if (data)
1528            {
1529                select.append('<ul></ul>');
1530                var select_ul = select.find('ul');
1531                $.each(data, function(key, val) {
1532                    select_ul.append('<li data-id="' + key + '">' + val + '</li>');
1533                });
1534                fjObj.initSelectLiClick(select.find('li'));
1535            }
1536
1537            if (select.data('targetInput'))
1538            {
1539                select.parent().find('#' + select.data('targetInput')).val('');
1540                fjObj.selectCurrentItem($('#' + select.data('targetInput')));
1541            }
1542        });
1543    }
1544
1545}
1546
1547/**
1548 * obj - hidden elementas
1549 *    
1550 **/
1551FJ.prototype.selectCurrentItem = function(obj)
1552{
1553
1554    obj.each(function() {
1555        var select = $(this).parents('.select-block').find('.select');
1556        var item = $(this).parents('.select-block').find('li[data-id=' + $(this).val() + ']');
1557        if (select.data('selectType') == 'multiple')
1558        {
1559            fjObj.setSelectMultipleTitle($(this));
1560        }
1561        else {
1562            if ($(this).val() && $(this).val() != 0 && item.length)
1563            {
1564                item.addClass('active');
1565                $(this).parents('.select-block').find('.selected span').html(item.html());
1566            }
1567            else
1568            {
1569                $(this).parents('.select-block').find('.selected span').html($(this).parents('.select-block').find('.select').data('empty'));
1570                $(this).val('');
1571            }
1572        }
1573    })
1574
1575}
1576
1577FJ.prototype.selectCurrentDateItem = function(obj)
1578{
1579    var date = '';
1580    if (isset(obj.val()))
1581        date = obj.val().split('-');
1582    var y = 0, m = 0, d = 0;
1583    if (isset(date[0]))
1584        y = date[0];
1585    fjObj.selectCurrentDateItemElement(obj, '.year', y);
1586    if (isset(date[1]))
1587        m = date[1];
1588    fjObj.selectCurrentDateItemElement(obj, '.month', m);
1589    fjObj.selectCurrentDateFillDays(obj);
1590    if (isset(date[2]))
1591        m = date[2];
1592    fjObj.selectCurrentDateItemElement(obj, '.day', m);
1593}
1594
1595FJ.prototype.selectCurrentDateItemElement = function(obj, selector, val)
1596{
1597    var item = obj.parents('.select-block').find(selector + ' li[data-id=' + val + ']');
1598    if (item.length)
1599    {
1600        item.addClass('active');
1601        obj.parents('.select-block').find(selector + ' .selected span').html(item.html());
1602    }
1603    else
1604    {
1605        obj.parents('.select-block').find(selector + ' li').removeClass('active');
1606        obj.parents('.select-block').find(selector + ' .selected span').html(obj.parent().find(selector).data('empty'));
1607    }
1608
1609}
1610
1611FJ.prototype.selectCurrentDateFillDays = function(obj)
1612{
1613    var active = obj.parents('.select-block').find('.month li.active');
1614    obj.parents('.select-block').find('.day ul').remove();
1615    if (active)
1616    {
1617        var days = fjObj.parseInt(active.data('days'));
1618        var y = obj.parents('.select-block').find('.year li.active');
1619        if (y && active.data('id') == 2 && y.data('id') % 4 == 0)
1620            days = 29;
1621        obj.parents('.select-block').find('.day').append('<ul></ul>');
1622        var days_ul = obj.parents('.select-block').find('.day ul');
1623        for (var i = 1; i <= days; i++)
1624        {
1625            var val = i < 10 ? '0' + i : i;
1626            days_ul.append('<li data-id="' + val + '">' + val + '</li>')
1627        }
1628
1629        fjObj.initSelectLiClick(days_ul.find('li'));
1630    }
1631}
1632/***************************************************************************/
1633
1634/******************************* KITA*********************************/
1635FJ.prototype.addLabelInit = function(obj)
1636{
1637    var label;
1638    obj.each(function() {
1639        if (isset($(this).attr('title')) && $(this).hasClass('add-label'))
1640        {
1641            if (!$(this).val().length)
1642                label = $('<span class="label-text">' + $(this).attr('title') + '</span>');
1643            else
1644                label = $('<span class="label-text" style="display:none;">' + $(this).attr('title') + '</span>');
1645            label.css({
1646                'padding-top': obj.css('padding-top'),
1647                'padding-bottom': obj.css('padding-bottom'),
1648                'padding-left': obj.css('padding-left'),
1649                'padding-right': obj.css('padding-right'),
1650                'font-family': obj.css('font-family'),
1651                'font-size': obj.css('font-size'),
1652                'font-weight': obj.css('font-weight'),
1653                'font-style': obj.css('font-style'),
1654                'line-height': obj.css('height'),
1655                'height': obj.css('height'),
1656                'width': obj.css('width'),
1657                'overflow': 'hidden',
1658                'position': 'absolute'
1659            }).offset({
1660                'top': 0 + 1,
1661                'left': 0 + 2
1662            });
1663            $(this).parent().css('position', 'relative');
1664            $(this).parent().append(label);
1665            $(this).parent().find('.label-text').click(function() {
1666                $(this).parent().find('input[type=text], input[type=password], textarea:first').focus();
1667            })
1668
1669            $(this).focusin(function() {
1670                $(this).parent().find('.label-text').addClass('active');
1671            }).focusout(function() {
1672                $(this).parent().find('.label-text').removeClass('active');
1673            }).keydown(function() {
1674                if ($(this).val() != '')
1675                    $(this).parent().find('.label-text').hide();
1676                else
1677                    $(this).parent().find('.label-text').show();
1678            }).keyup(function() {
1679                if ($(this).val() != '')
1680                    $(this).parent().find('.label-text').hide();
1681                else
1682                    $(this).parent().find('.label-text').show();
1683            });
1684        }
1685
1686
1687    });
1688}
1689
1690FJ.prototype.initToolTip = function(obj)
1691{
1692    obj.each(function() {
1693        $(this).cluetip({
1694            showTitle: false,
1695            splitTitle: '|',
1696            arrows: true,
1697            dropShadow: false,
1698            cluetipClass: 'jtip',
1699            positionBy: 'topBottom',
1700            cursor: 'pointer',
1701            cluezIndex: 10000
1702        });
1703    });
1704}
1705
1706FJ.prototype.imgSlide = function(obj)
1707{
1708    $(obj).slides({
1709    });
1710}
1711
1712FJ.prototype.owexxHover = function()
1713{
1714    $('.fj-owexx-footer').each(function() {
1715        $(this).find('img').data('src', $(this).find('img').attr('src'));
1716        $(this).hover(function() {
1717            $(this).find('img').attr('src', $(this).find('img').attr('rev'));
1718        }, function() {
1719            $(this).find('img').attr('src', $(this).find('img').data('src'));
1720        });
1721    })
1722}
1723
1724FJ.prototype.imposeMaxLength = function(obj, MaxLen)
1725{
1726    return (obj.value.length <= MaxLen);
1727}
1728
1729/**
1730 * <ul class="product-nav fj-tabs" id="product-tabs">
1731 * <li><a href="#info" id="info" ></a></li>
1732 * 
1733 *  <div class="article fj-tab-content" rel="info" data-parent="product-tabs">
1734 *  
1735 *  id="product-tabs" -> data-parent="product-tabs
1736 *  id="info" -> rel="info"
1737 */
1738FJ.prototype.activeTab = function(obj)
1739{
1740    obj.parents('.fj-tabs').find('li a').removeClass('active');
1741    obj.addClass('active');
1742    $('.fj-tab-content[data-parent="' + obj.parents('.fj-tabs').attr('id') + '"]').hide();
1743    $('.fj-tab-content[rel="' + obj.attr('id') + '"]').fadeIn(600);
1744}
1745
1746FJ.prototype.addToFavorite = function(obj)
1747{
1748    try
1749    {
1750        obj.fadeOut(function() {
1751            $(this).fadeIn();
1752        });
1753        $.ajax({
1754            type: 'GET',
1755            url: obj.data('href'),
1756            dataType: 'json',
1757            success: function(data) {
1758                if (data['success'])
1759                {
1760                    if ($('.fj-catalog-favorite-count').find('.fj-count').lenght)
1761                        $('.fj-catalog-favorite-count').find('.fj-count').html(data.count)
1762                    else
1763                        $('.fj-catalog-favorite-count').html(data.count);
1764                }
1765            },
1766            complete: function(jqXHR, textStatus) {
1767            },
1768            cache: false
1769        });
1770    }
1771    catch (e) {
1772
1773    }
1774
1775}
1776
1777FJ.prototype.catalogRemoveFavorite = function(obj)
1778{
1779    try {
1780        var current_obj = obj;
1781        fjObj.showPopup(_messages.cartRemove.html, {
1782            buttons: {
1783                ok: {
1784                    selector: '.fj-button-ok',
1785                    callback: function() {
1786                        $.ajax({
1787                            type: 'GET',
1788                            url: current_obj.data('href'),
1789                            dataType: 'json',
1790                            success: function(data) {
1791                                if (data['success'])
1792                                {
1793                                    current_obj.parents('.fj-catalog-favorite-item').fadeOut(function() {
1794                                        $(this).remove();
1795                                    });
1796
1797                                    if ($('.fj-catalog-favorite-count').find('.fj-count').lenght)
1798                                        $('.fj-catalog-favorite-count').find('.fj-count').html(data.count)
1799                                    else
1800                                        $('.fj-catalog-favorite-count').html(data.count);
1801                                }
1802                            },
1803                            cache: false
1804                        });
1805                        fjObj.closePopup();
1806                    }
1807                },
1808                cancel: {
1809                    selector: '.fj-button-cancel',
1810                    callback: function() {
1811                        fjObj.closePopup();
1812                    }
1813                }
1814            },
1815            fixedPosition: true
1816        });
1817    }
1818    catch (e) {
1819
1820    }
1821}
1822
1823FJ.prototype.catalogRemoveHistory = function(obj)
1824{
1825    try {
1826        var current_obj = obj;
1827        fjObj.showPopup(_messages.cartRemove.html, {
1828            buttons: {
1829                ok: {
1830                    selector: '.fj-button-ok',
1831                    callback: function() {
1832                        $.ajax({
1833                            type: 'GET',
1834                            url: current_obj.data('href'),
1835                            dataType: 'json',
1836                            success: function(data) {
1837                                if (data['success'])
1838                                {
1839                                    current_obj.parents('.fj-catalog-history-item').fadeOut(function() {
1840                                        $(this).remove();
1841                                    });
1842
1843                                    if ($('.fj-catalog-history-count').find('.fj-count').lenght)
1844                                        $('.fj-catalog-history-count').find('.fj-count').html(data.count)
1845                                    else
1846                                        $('.fj-catalog-history-count').html(data.count);
1847                                }
1848                            },
1849                            cache: false
1850                        });
1851                        fjObj.closePopup();
1852                    }
1853                },
1854                cancel: {
1855                    selector: '.fj-button-cancel',
1856                    callback: function() {
1857                        fjObj.closePopup();
1858                    }
1859                }
1860            },
1861            fixedPosition: true
1862        });
1863    }
1864    catch (e) {
1865
1866    }
1867
1868}
1869
1870FJ.prototype.addCompare = function(obj)
1871{
1872    try
1873    {
1874        if (obj.data('isCompared'))
1875        {
1876            fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/catalog/view-compare/', null, {set_position: 1, set_position_top: 30});
1877            return;
1878        }
1879
1880        obj.fadeOut(function() {
1881            obj.text(obj.data('titleAlt'));
1882            obj.data('isCompared', 1);
1883            $(this).fadeIn();
1884        });
1885
1886        $.ajax({
1887            type: 'GET',
1888            url: obj.data('href'),
1889            dataType: 'json',
1890            success: function(data) {
1891                if (data['success'])
1892                    if ($('.fj-catalog-compare-count').find('.fj-count').lenght)
1893                        $('.fj-catalog-compare-count').find('.fj-count').html(data.count)
1894                    else
1895                        $('.fj-catalog-compare-count').html(data.count);
1896                ;
1897            },
1898            complete: function(jqXHR, textStatus) {
1899            },
1900            cache: false
1901        });
1902    }
1903    catch (e) {
1904
1905    }
1906
1907}
1908
1909FJ.prototype.catalogRemoveCompare = function(obj)
1910{
1911    try {
1912        var current_obj = obj;
1913        var id = current_obj.closest('.fj-compare-item').data('id');
1914        fjObj.showPopup(_messages.cartRemove.html, {
1915            notClearPopups: true,
1916            buttons: {
1917                ok: {
1918                    selector: '.fj-button-ok',
1919                    callback: function() {
1920                        $.ajax({
1921                            type: 'GET',
1922                            url: '/' + $('html').attr('lang') + '/catalog/remove-compare/' + id,
1923                            dataType: 'json',
1924                            success: function(data) {
1925                                if (data['success'])
1926                                {
1927                                    current_obj.closest('.fj-compare-container').find('.fj-compare-item[data-id="' + id + '"]').fadeOut(function() {
1928                                        $(this).remove();
1929                                    });
1930
1931                                    if ($('.fj-catalog-compare-count').find('.fj-count').lenght)
1932                                        $('.fj-catalog-compare-count').find('.fj-count').html(data.count)
1933                                    else
1934                                        $('.fj-catalog-compare-count').html(data.count);
1935                                }
1936                            },
1937                            cache: false
1938                        });
1939                        fjObj.closePopup($(this));
1940                    }
1941                },
1942                cancel: {
1943                    selector: '.fj-button-cancel',
1944                    callback: function() {
1945                        fjObj.closePopup($(this));
1946                    }
1947                }
1948            },
1949            fixedPosition: true
1950        });
1951    }
1952    catch (e) {
1953
1954    }
1955
1956}
1957
1958FJ.prototype.catalogToggleFilter = function(options)
1959{
1960    try
1961    {
1962        $.ajax({
1963            type: 'GET',
1964            url: '/catalog/toggle-filter',
1965            data: options.data,
1966            dataType: 'json',
1967            success: function(data) {
1968                if (data['success'])
1969                    ;
1970            },
1971            complete: function(jqXHR, textStatus) {
1972            },
1973            cache: false
1974        });
1975    }
1976    catch (e) {
1977
1978    }
1979
1980}
1981
1982FJ.prototype.backToTopInit = function(obj, options)
1983{
1984    if (!isset(options))
1985        options = {};
1986    obj.click(function() {
1987        $(window).scrollTo(options.target, 300, {
1988            //            offset:-50
1989        });
1990    })
1991
1992    $(window).scroll(function() {
1993        if ($(window).scrollTop() > 0)
1994        {
1995            if (fjObj.is_scrool_top)
1996                obj.stop(true, true).fadeIn();
1997            fjObj.is_scrool_top = false;
1998        }
1999        else
2000        {
2001            if (!fjObj.is_scrool_top)
2002                obj.stop(true, true).fadeOut();
2003            fjObj.is_scrool_top = true;
2004        }
2005    });
2006}
2007
2008FJ.prototype.blockSwicher = function(obj, options)
2009{
2010    if (obj.data('switch') && obj.data('parent'))
2011    {
2012        $(obj.data('parent')).hide();
2013        $(obj.data('switch')).fadeIn();
2014    }
2015}
2016
2017/******************************* USER PLACE HOLDER (ajax login) *********************************/
2018FJ.prototype.userPlaceHolder = function(html)
2019{
2020    $('.fj-user-place').hide();
2021    $('.fj-user-place').html(html);
2022    $('.fj-user-place').fadeIn();
2023
2024    fjObj.menuInit($('.fj-user-place .fj-menu-open'));
2025
2026};
2027
2028/******************************* USERS FORM **************************************/
2029FJ.prototype.usersLoginRemindChange = function(obj)
2030{
2031    if (obj.hasClass('fj-login-remind'))
2032    {
2033        $('.fj-form-login-bock').hide();
2034        $('.fj-form-remind-bock').fadeIn();
2035    }
2036    else
2037    {
2038        $('.fj-form-remind-bock').hide();
2039        $('.fj-form-login-bock').fadeIn();
2040    }
2041
2042}
2043
2044/******************************* MENU FADE **************************************/
2045FJ.prototype.menuInit = function(obj)
2046{
2047
2048    if (!isset(obj))
2049        obj = $('.fj-menu-open');
2050
2051
2052
2053    $('.fj-menu').bind('click', function(e) {
2054        e.stopPropagation();
2055    });
2056
2057
2058
2059    obj.each(function() {
2060
2061        var submenu = $(this).closest('.fj-menu').find('.fj-submenu');
2062
2063        if (!submenu.length)
2064            return;
2065
2066        $(this).click(function(e) {
2067            e.preventDefault();
2068
2069            if ($(this).data('fade'))
2070                $(this).stop(true, true).fadeOut();
2071
2072            submenu.stop(true, true).fadeIn();
2073        });
2074
2075        submenu.find('.fj-menu-close').each(function() {
2076            $(this).click(function(e) {
2077                e.preventDefault();
2078                fjObj.menuClose($(this));
2079            });
2080        });
2081
2082        submenu.hover(function() {
2083            if (isset(submenu.data('isHover')))
2084                $(this).stop(true, true).fadeIn();
2085            $(this).data('isHover', 1);
2086
2087            if (isset(submenu.data('timer')))
2088                clearTimeout(submenu.data('timer'));
2089        }, function() {
2090            $(this).data('isHover', 0);
2091            $(this).data('timer',
2092                    setTimeout(function() {
2093                if (!submenu.data('isHover'))
2094                    fjObj.menuClose(submenu);
2095            }, 1000));
2096        });
2097
2098        $('body').click(function() {
2099            fjObj.menuClose(submenu);
2100        });
2101
2102
2103    });
2104}
2105
2106FJ.prototype.menuClose = function(obj)
2107{
2108    var submenu = obj.closest('.fj-menu').find('.fj-submenu');
2109
2110    submenu.fadeOut(200, function() {
2111        submenu.removeData('isHover');
2112    });
2113
2114    var menu_open = obj.closest('.fj-menu').find('.fj-menu-open');
2115    if (menu_open.data('fade'))
2116        menu_open.stop(true, true).fadeIn();
2117}
2118
2119/************************* SKYPE ******************************************/
2120FJ.prototype.skypeInit = function()
2121{
2122    $('.fj-skype').each(function() {
2123        var obj = $(this);
2124
2125        if (!obj.data('skypeName'))
2126            return;
2127
2128        $.ajax({
2129            url: 'http://www.owexx.com/skype.php',
2130            cache: false,
2131            dataType: 'jsonp',
2132            data: {
2133                name: obj.data('skypeName')
2134            },
2135            success: function(data) {
2136                if (data.status == 2) {
2137                    obj.addClass('active');
2138                }
2139            }
2140        });
2141    })
2142}
2143
2144/************************* LIVE CHAT ******************************************/
2145FJ.prototype.initLiveChat = function(options)
2146{
2147    var live_chat = $(options.link.selector);
2148
2149    if (live_chat.length > 0 && !live_chat.data('changed'))
2150    {
2151        live_chat.each(function() {
2152            if (!$(this).data('changed'))
2153            {
2154                if ($(this).hasClass('offline'))
2155                {
2156                    $(this).html(options.link.title.offline)
2157
2158                    if (options.link.onclick.offline)
2159                    {
2160                        $(this).click(options.link.onclick.offline);
2161                    }
2162                }
2163                else
2164                {
2165                    $(this).html(options.link.title.online)
2166                }
2167                $(this).data('changed', 1);
2168            }
2169        })
2170    }
2171    else
2172    {
2173        setTimeout(function() {
2174            fjObj.initLiveChat(options);
2175        }, 100);
2176    }
2177
2178}
2179/************************* OTHER ******************************************/
2180FJ.prototype.errorsInit = function()
2181{
2182    var error = $('.errors');
2183    var target = error;
2184    var offset = -50;
2185
2186    if (error.parent().children('label').size())
2187    {
2188        target = error.parent().find('label');
2189        offset = 0;
2190    }
2191
2192    if (target.size())
2193        $(window).scrollTo(target, 700, {
2194            offset: offset
2195        });
2196}
2197
2198/************************* IMAGE MANAGER ******************************************/
2199FJ.prototype.imageManager = function(obj)
2200{
2201    $.ajax({
2202        type: 'POST',
2203        url: obj.closest('.fj-im-cotrol').data('url'),
2204        data: {
2205            act: obj.data('act')
2206        },
2207        cache: false,
2208        success: function(data) {
2209            if (data.success)
2210            {
2211                switch (obj.data('act'))
2212                {
2213                    case 'delete':
2214                        obj.closest('.fj-im-list-item').fadeOut(function() {
2215                            $(this).remove();
2216                        });
2217                        break;
2218                    case 'move-up':
2219                        var item = obj.closest('.fj-im-list-item');
2220                        var target = item.prev();
2221                        if (target.length)
2222                        {
2223                            target.before(item);
2224                        }
2225                        break;
2226                    case 'move-down':
2227                        var item = obj.closest('.fj-im-list-item');
2228                        var target = item.next();
2229                        if (target.length)
2230                        {
2231                            target.after(item);
2232                        }
2233                        break;
2234                    case 'spin':
2235                        var img = obj.closest('.fj-im-list-item').find('.fj-im-img');
2236                        img.attr('src', data.thumbnail_url).parent().attr('url', data.url);
2237                        break;
2238                }
2239            }
2240        }
2241
2242    });
2243}
2244
2245/************************* VIDEO MANAGER ******************************************/
2246FJ.prototype.videoManager = function(obj)
2247{
2248    $.ajax({
2249        type: 'POST',
2250        url: obj.closest('.fj-vm-cotrol').data('url'),
2251        data: {
2252            act: obj.data('act')
2253        },
2254        cache: false,
2255        success: function(data) {
2256            if (data.success)
2257            {
2258                switch (obj.data('act'))
2259                {
2260                    case 'delete':
2261                        obj.closest('.fj-vm-list-item').fadeOut(function() {
2262                            $(this).remove();
2263                        });
2264                        break;
2265                    case 'move-up':
2266                        var item = obj.closest('.fj-vm-list-item');
2267                        var target = item.prev();
2268                        if (target.length)
2269                        {
2270                            target.before(item);
2271                        }
2272                        break;
2273                    case 'move-down':
2274                        var item = obj.closest('.fj-vm-list-item');
2275                        var target = item.next();
2276                        if (target.length)
2277                        {
2278                            target.after(item);
2279                        }
2280                        break;
2281                }
2282            }
2283        }
2284
2285    });
2286}
2287
2288/************************* FUNCTIONS ******************************************/
2289
2290FJ.prototype.parseInt = function(val)
2291{
2292    val = parseInt(val);
2293    if (isNaN(val))
2294        val = 0;
2295
2296    return val;
2297}
2298
2299FJ.prototype.parseFloat = function(val)
2300{
2301    val = parseFloat(val);
2302    if (isNaN(val))
2303        val = 0;
2304
2305    return val;
2306}
2307
2308FJ.prototype.parseDateValue = function(val)
2309{
2310    if (isset(val))
2311        return val;
2312    else
2313        return '';
2314}
2315
2316
2317FJ.prototype.serviceInit = function(obj)
2318{
2319    $('.fj-service-settings-elem').change(function() {
2320        var fj_service_item = $(this).closest('.fj-service-item');
2321        var fj_service_container = $(this).closest('.fj-service-container');
2322
2323        fjObj.serviceCalculate(fj_service_item);
2324        fjObj.serviceCalculateTotal(fj_service_container);
2325    });
2326
2327
2328    // sukalculuojam kaina po onLoado
2329    $('.fj-service-container').each(function() {
2330        var fj_service_container = $(this);
2331        $('.fj-service-item', fj_service_container).each(function() {
2332            var fj_service_item = $(this).closest('.fj-service-item');
2333            fjObj.serviceCalculate(fj_service_item);
2334        });
2335        fjObj.serviceCalculateTotal(fj_service_container);
2336    });
2337
2338}
2339
2340FJ.prototype.serviceCalculate = function(fj_service_item)
2341{
2342
2343    var service = fj_service_item.data('fjServiceSettings');
2344    var total = null;
2345    var total_price = 0;
2346
2347    fj_service_item.find('.fj-service-settings-elem').each(function() {
2348
2349        var setting = isset(service['settings'][$(this).val()]) ? service['settings'][$(this).val()] : null;
2350        if (setting)
2351        {
2352            if (total == null)
2353                total = fjObj.parseFloat(service.price);
2354
2355            if (isset(setting.price))
2356                total_price += fjObj.parseFloat(setting.price);
2357            else if (isNumber(setting.value) && setting.setting_type == 'periods' || setting.setting_type == 'priorities')
2358                total *= fjObj.parseFloat(setting.value);
2359        }
2360        else if ($(this).data('fjSettingType') == 'periods' || $(this).data('fjSettingType') == 'priorities')
2361            total = 0;
2362    });
2363
2364    if (total == null)
2365        total = 0;
2366
2367    total += total_price;
2368
2369    fj_service_item.find('.fj-service-item-total').data('fjTotal', total).html(total);
2370}
2371
2372FJ.prototype.serviceCalculateTotal = function(fj_service_container)
2373{
2374    var total = 0;
2375    fj_service_container.find('.fj-service-item-total').each(function() {
2376        total += fjObj.parseFloat($(this).data('fjTotal'));
2377    });
2378
2379    fj_service_container.find('.fj-service-total').html(total);
2380}
2381
2382FJ.prototype.getFirstDay = function(year, month)
2383{
2384    var date = new Date(year, month, 1);
2385    return date.getDay();
2386}
2387
2388FJ.prototype.getLastDay = function(year, month)
2389{
2390    var date = new Date(year, month + 1, 0);
2391    return date.getDate();
2392}
2393
2394
2395function isset(variable) {
2396    return typeof(variable) != "undefined" && variable !== null;
2397}
2398
2399function isNumber(n) {
2400    return !isNaN(parseFloat(n)) && isFinite(n);
2401}
2402
2403function floatEq(var1, var2)
2404{
2405    if (Math.abs(var1 - var2) < epsilon)
2406        return true;
2407    return false;
2408}
2409
2410function arrayReplace(variable, data)
2411{
2412    $.each(data, function(key, val) {
2413        variable = variable.replace(key, val);
2414    });
2415    return variable;
2416}
2417
2418function roundUp(rnum, rlength) {
2419    var newnumber = Math.ceil(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength);
2420    return newnumber;
2421}
2422
2423function roundDown(rnum, rlength) {
2424    var newnumber = Math.floor(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength);
2425    return newnumber;
2426}
2427/*****************************************************************************/
2428
2429var epsilon = 0.0000001;
2430var fjObj = new FJ();
2431$(function() {
2432// fjObj.initToolTip($('.tooltip'));
2433
2434    fjObj.menuInit();
2435    fjObj.skypeInit();
2436    fjObj.owexxHover();
2437    $('.fj-popup-overlay').click(function() {
2438        fjObj.closePopup();
2439    });
2440
2441    if ($('.popup').length > 0)
2442    {
2443        fjObj.showPopup(null, {
2444            notClearPopups: 1,
2445            notClearPopupsMessage: 1
2446        });
2447    }
2448
2449    fjObj.popupInit();
2450    fjObj.errorsInit();
2451    fjObj.cartRemoveItemInit($('.fj-cart-remove'));
2452    fjObj.cartLayoutContent({control_hide: true});
2453});

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.