Unlimited Elements For Elementor (Free Widgets, Addons, Templates) - Version 1.5.22

Version Description

Download this release

Release Info

Developer valiano
Plugin Icon 128x128 Unlimited Elements For Elementor (Free Widgets, Addons, Templates)
Version 1.5.22
Comparing to
See all releases

Code changes from version 1.5.11 to 1.5.22

assets_libraries/fancybox3/jquery.fancybox.css ADDED
@@ -0,0 +1,895 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body.compensate-for-scrollbar {
2
+ overflow: hidden;
3
+ }
4
+
5
+ .fancybox-active {
6
+ height: auto;
7
+ }
8
+
9
+ .fancybox-is-hidden {
10
+ left: -9999px;
11
+ margin: 0;
12
+ position: absolute !important;
13
+ top: -9999px;
14
+ visibility: hidden;
15
+ }
16
+
17
+ .fancybox-container {
18
+ -webkit-backface-visibility: hidden;
19
+ height: 100%;
20
+ left: 0;
21
+ outline: none;
22
+ position: fixed;
23
+ -webkit-tap-highlight-color: transparent;
24
+ top: 0;
25
+ -ms-touch-action: manipulation;
26
+ touch-action: manipulation;
27
+ transform: translateZ(0);
28
+ width: 100%;
29
+ z-index: 99992;
30
+ }
31
+
32
+ .fancybox-container * {
33
+ box-sizing: border-box;
34
+ }
35
+
36
+ .fancybox-outer,
37
+ .fancybox-inner,
38
+ .fancybox-bg,
39
+ .fancybox-stage {
40
+ bottom: 0;
41
+ left: 0;
42
+ position: absolute;
43
+ right: 0;
44
+ top: 0;
45
+ }
46
+
47
+ .fancybox-outer {
48
+ -webkit-overflow-scrolling: touch;
49
+ overflow-y: auto;
50
+ }
51
+
52
+ .fancybox-bg {
53
+ background: rgb(30, 30, 30);
54
+ opacity: 0;
55
+ transition-duration: inherit;
56
+ transition-property: opacity;
57
+ transition-timing-function: cubic-bezier(.47, 0, .74, .71);
58
+ }
59
+
60
+ .fancybox-is-open .fancybox-bg {
61
+ opacity: .9;
62
+ transition-timing-function: cubic-bezier(.22, .61, .36, 1);
63
+ }
64
+
65
+ .fancybox-infobar,
66
+ .fancybox-toolbar,
67
+ .fancybox-caption,
68
+ .fancybox-navigation .fancybox-button {
69
+ direction: ltr;
70
+ opacity: 0;
71
+ position: absolute;
72
+ transition: opacity .25s ease, visibility 0s ease .25s;
73
+ visibility: hidden;
74
+ z-index: 99997;
75
+ }
76
+
77
+ .fancybox-show-infobar .fancybox-infobar,
78
+ .fancybox-show-toolbar .fancybox-toolbar,
79
+ .fancybox-show-caption .fancybox-caption,
80
+ .fancybox-show-nav .fancybox-navigation .fancybox-button {
81
+ opacity: 1;
82
+ transition: opacity .25s ease 0s, visibility 0s ease 0s;
83
+ visibility: visible;
84
+ }
85
+
86
+ .fancybox-infobar {
87
+ color: #ccc;
88
+ font-size: 13px;
89
+ -webkit-font-smoothing: subpixel-antialiased;
90
+ height: 44px;
91
+ left: 0;
92
+ line-height: 44px;
93
+ min-width: 44px;
94
+ mix-blend-mode: difference;
95
+ padding: 0 10px;
96
+ pointer-events: none;
97
+ top: 0;
98
+ -webkit-touch-callout: none;
99
+ -webkit-user-select: none;
100
+ -moz-user-select: none;
101
+ -ms-user-select: none;
102
+ user-select: none;
103
+ }
104
+
105
+ .fancybox-toolbar {
106
+ right: 0;
107
+ top: 0;
108
+ }
109
+
110
+ .fancybox-stage {
111
+ direction: ltr;
112
+ overflow: visible;
113
+ transform: translateZ(0);
114
+ z-index: 99994;
115
+ }
116
+
117
+ .fancybox-is-open .fancybox-stage {
118
+ overflow: hidden;
119
+ }
120
+
121
+ .fancybox-slide {
122
+ -webkit-backface-visibility: hidden;
123
+ /* Using without prefix would break IE11 */
124
+ display: none;
125
+ height: 100%;
126
+ left: 0;
127
+ outline: none;
128
+ overflow: auto;
129
+ -webkit-overflow-scrolling: touch;
130
+ padding: 44px;
131
+ position: absolute;
132
+ text-align: center;
133
+ top: 0;
134
+ transition-property: transform, opacity;
135
+ white-space: normal;
136
+ width: 100%;
137
+ z-index: 99994;
138
+ }
139
+
140
+ .fancybox-slide::before {
141
+ content: '';
142
+ display: inline-block;
143
+ font-size: 0;
144
+ height: 100%;
145
+ vertical-align: middle;
146
+ width: 0;
147
+ }
148
+
149
+ .fancybox-is-sliding .fancybox-slide,
150
+ .fancybox-slide--previous,
151
+ .fancybox-slide--current,
152
+ .fancybox-slide--next {
153
+ display: block;
154
+ }
155
+
156
+ .fancybox-slide--image {
157
+ overflow: hidden;
158
+ padding: 44px 0;
159
+ }
160
+
161
+ .fancybox-slide--image::before {
162
+ display: none;
163
+ }
164
+
165
+ .fancybox-slide--html {
166
+ padding: 6px;
167
+ }
168
+
169
+ .fancybox-content {
170
+ background: #fff;
171
+ display: inline-block;
172
+ margin: 0;
173
+ max-width: 100%;
174
+ overflow: auto;
175
+ -webkit-overflow-scrolling: touch;
176
+ padding: 44px;
177
+ position: relative;
178
+ text-align: left;
179
+ vertical-align: middle;
180
+ }
181
+
182
+ .fancybox-slide--image .fancybox-content {
183
+ animation-timing-function: cubic-bezier(.5, 0, .14, 1);
184
+ -webkit-backface-visibility: hidden;
185
+ background: transparent;
186
+ background-repeat: no-repeat;
187
+ background-size: 100% 100%;
188
+ left: 0;
189
+ max-width: none;
190
+ overflow: visible;
191
+ padding: 0;
192
+ position: absolute;
193
+ top: 0;
194
+ -ms-transform-origin: top left;
195
+ transform-origin: top left;
196
+ transition-property: transform, opacity;
197
+ -webkit-user-select: none;
198
+ -moz-user-select: none;
199
+ -ms-user-select: none;
200
+ user-select: none;
201
+ z-index: 99995;
202
+ }
203
+
204
+ .fancybox-can-zoomOut .fancybox-content {
205
+ cursor: zoom-out;
206
+ }
207
+
208
+ .fancybox-can-zoomIn .fancybox-content {
209
+ cursor: zoom-in;
210
+ }
211
+
212
+ .fancybox-can-swipe .fancybox-content,
213
+ .fancybox-can-pan .fancybox-content {
214
+ cursor: -webkit-grab;
215
+ cursor: grab;
216
+ }
217
+
218
+ .fancybox-is-grabbing .fancybox-content {
219
+ cursor: -webkit-grabbing;
220
+ cursor: grabbing;
221
+ }
222
+
223
+ .fancybox-container [data-selectable='true'] {
224
+ cursor: text;
225
+ }
226
+
227
+ .fancybox-image,
228
+ .fancybox-spaceball {
229
+ background: transparent;
230
+ border: 0;
231
+ height: 100%;
232
+ left: 0;
233
+ margin: 0;
234
+ max-height: none;
235
+ max-width: none;
236
+ padding: 0;
237
+ position: absolute;
238
+ top: 0;
239
+ -webkit-user-select: none;
240
+ -moz-user-select: none;
241
+ -ms-user-select: none;
242
+ user-select: none;
243
+ width: 100%;
244
+ }
245
+
246
+ .fancybox-spaceball {
247
+ z-index: 1;
248
+ }
249
+
250
+ .fancybox-slide--video .fancybox-content,
251
+ .fancybox-slide--map .fancybox-content,
252
+ .fancybox-slide--pdf .fancybox-content,
253
+ .fancybox-slide--iframe .fancybox-content {
254
+ height: 100%;
255
+ overflow: visible;
256
+ padding: 0;
257
+ width: 100%;
258
+ }
259
+
260
+ .fancybox-slide--video .fancybox-content {
261
+ background: #000;
262
+ }
263
+
264
+ .fancybox-slide--map .fancybox-content {
265
+ background: #e5e3df;
266
+ }
267
+
268
+ .fancybox-slide--iframe .fancybox-content {
269
+ background: #fff;
270
+ }
271
+
272
+ .fancybox-video,
273
+ .fancybox-iframe {
274
+ background: transparent;
275
+ border: 0;
276
+ display: block;
277
+ height: 100%;
278
+ margin: 0;
279
+ overflow: hidden;
280
+ padding: 0;
281
+ width: 100%;
282
+ }
283
+
284
+ /* Fix iOS */
285
+ .fancybox-iframe {
286
+ left: 0;
287
+ position: absolute;
288
+ top: 0;
289
+ }
290
+
291
+ .fancybox-error {
292
+ background: #fff;
293
+ cursor: default;
294
+ max-width: 400px;
295
+ padding: 40px;
296
+ width: 100%;
297
+ }
298
+
299
+ .fancybox-error p {
300
+ color: #444;
301
+ font-size: 16px;
302
+ line-height: 20px;
303
+ margin: 0;
304
+ padding: 0;
305
+ }
306
+
307
+ /* Buttons */
308
+
309
+ .fancybox-button {
310
+ background: rgba(30, 30, 30, .6);
311
+ border: 0;
312
+ border-radius: 0;
313
+ box-shadow: none;
314
+ cursor: pointer;
315
+ display: inline-block;
316
+ height: 44px;
317
+ margin: 0;
318
+ padding: 10px;
319
+ position: relative;
320
+ transition: color .2s;
321
+ vertical-align: top;
322
+ visibility: inherit;
323
+ width: 44px;
324
+ }
325
+
326
+ .fancybox-button,
327
+ .fancybox-button:visited,
328
+ .fancybox-button:link {
329
+ color: #ccc;
330
+ }
331
+
332
+ .fancybox-button:hover {
333
+ color: #fff;
334
+ }
335
+
336
+ .fancybox-button:focus {
337
+ outline: none;
338
+ }
339
+
340
+ .fancybox-button.fancybox-focus {
341
+ outline: 1px dotted;
342
+ }
343
+
344
+ .fancybox-button[disabled],
345
+ .fancybox-button[disabled]:hover {
346
+ color: #888;
347
+ cursor: default;
348
+ outline: none;
349
+ }
350
+
351
+ /* Fix IE11 */
352
+ .fancybox-button div {
353
+ height: 100%;
354
+ }
355
+
356
+ .fancybox-button svg {
357
+ display: block;
358
+ height: 100%;
359
+ overflow: visible;
360
+ position: relative;
361
+ width: 100%;
362
+ }
363
+
364
+ .fancybox-button svg path {
365
+ fill: currentColor;
366
+ stroke-width: 0;
367
+ }
368
+
369
+ .fancybox-button--play svg:nth-child(2),
370
+ .fancybox-button--fsenter svg:nth-child(2) {
371
+ display: none;
372
+ }
373
+
374
+ .fancybox-button--pause svg:nth-child(1),
375
+ .fancybox-button--fsexit svg:nth-child(1) {
376
+ display: none;
377
+ }
378
+
379
+ .fancybox-progress {
380
+ background: #ff5268;
381
+ height: 2px;
382
+ left: 0;
383
+ position: absolute;
384
+ right: 0;
385
+ top: 0;
386
+ -ms-transform: scaleX(0);
387
+ transform: scaleX(0);
388
+ -ms-transform-origin: 0;
389
+ transform-origin: 0;
390
+ transition-property: transform;
391
+ transition-timing-function: linear;
392
+ z-index: 99998;
393
+ }
394
+
395
+ /* Close button on the top right corner of html content */
396
+
397
+ .fancybox-close-small {
398
+ background: transparent;
399
+ border: 0;
400
+ border-radius: 0;
401
+ color: #ccc;
402
+ cursor: pointer;
403
+ opacity: .8;
404
+ padding: 8px;
405
+ position: absolute;
406
+ right: -12px;
407
+ top: -44px;
408
+ z-index: 401;
409
+ }
410
+
411
+ .fancybox-close-small:hover {
412
+ color: #fff;
413
+ opacity: 1;
414
+ }
415
+
416
+ .fancybox-slide--html .fancybox-close-small {
417
+ color: currentColor;
418
+ padding: 10px;
419
+ right: 0;
420
+ top: 0;
421
+ }
422
+
423
+ .fancybox-slide--image.fancybox-is-scaling .fancybox-content {
424
+ overflow: hidden;
425
+ }
426
+
427
+ .fancybox-is-scaling .fancybox-close-small,
428
+ .fancybox-is-zoomable.fancybox-can-pan .fancybox-close-small {
429
+ display: none;
430
+ }
431
+
432
+ /* Navigation arrows */
433
+
434
+ .fancybox-navigation .fancybox-button {
435
+ background-clip: content-box;
436
+ height: 100px;
437
+ opacity: 0;
438
+ position: absolute;
439
+ top: calc(50% - 50px);
440
+ width: 70px;
441
+ }
442
+
443
+ .fancybox-navigation .fancybox-button div {
444
+ padding: 7px;
445
+ }
446
+
447
+ .fancybox-navigation .fancybox-button--arrow_left {
448
+ left: 0;
449
+ left: env(safe-area-inset-left);
450
+ padding: 31px 26px 31px 6px;
451
+ }
452
+
453
+ .fancybox-navigation .fancybox-button--arrow_right {
454
+ padding: 31px 6px 31px 26px;
455
+ right: 0;
456
+ right: env(safe-area-inset-right);
457
+ }
458
+
459
+ /* Caption */
460
+
461
+ .fancybox-caption {
462
+ background: linear-gradient(to top,
463
+ rgba(0, 0, 0, .85) 0%,
464
+ rgba(0, 0, 0, .3) 50%,
465
+ rgba(0, 0, 0, .15) 65%,
466
+ rgba(0, 0, 0, .075) 75.5%,
467
+ rgba(0, 0, 0, .037) 82.85%,
468
+ rgba(0, 0, 0, .019) 88%,
469
+ rgba(0, 0, 0, 0) 100%);
470
+ bottom: 0;
471
+ color: #eee;
472
+ font-size: 14px;
473
+ font-weight: 400;
474
+ left: 0;
475
+ line-height: 1.5;
476
+ padding: 75px 44px 25px 44px;
477
+ pointer-events: none;
478
+ right: 0;
479
+ text-align: center;
480
+ z-index: 99996;
481
+ }
482
+
483
+ @supports (padding: max(0px)) {
484
+ .fancybox-caption {
485
+ padding: 75px max(44px, env(safe-area-inset-right)) max(25px, env(safe-area-inset-bottom)) max(44px, env(safe-area-inset-left));
486
+ }
487
+ }
488
+
489
+ .fancybox-caption--separate {
490
+ margin-top: -50px;
491
+ }
492
+
493
+ .fancybox-caption__body {
494
+ max-height: 50vh;
495
+ overflow: auto;
496
+ pointer-events: all;
497
+ }
498
+
499
+ .fancybox-caption a,
500
+ .fancybox-caption a:link,
501
+ .fancybox-caption a:visited {
502
+ color: #ccc;
503
+ text-decoration: none;
504
+ }
505
+
506
+ .fancybox-caption a:hover {
507
+ color: #fff;
508
+ text-decoration: underline;
509
+ }
510
+
511
+ /* Loading indicator */
512
+
513
+ .fancybox-loading {
514
+ animation: fancybox-rotate 1s linear infinite;
515
+ background: transparent;
516
+ border: 4px solid #888;
517
+ border-bottom-color: #fff;
518
+ border-radius: 50%;
519
+ height: 50px;
520
+ left: 50%;
521
+ margin: -25px 0 0 -25px;
522
+ opacity: .7;
523
+ padding: 0;
524
+ position: absolute;
525
+ top: 50%;
526
+ width: 50px;
527
+ z-index: 99999;
528
+ }
529
+
530
+ @keyframes fancybox-rotate {
531
+ 100% {
532
+ transform: rotate(360deg);
533
+ }
534
+ }
535
+
536
+ /* Transition effects */
537
+
538
+ .fancybox-animated {
539
+ transition-timing-function: cubic-bezier(0, 0, .25, 1);
540
+ }
541
+
542
+ /* transitionEffect: slide */
543
+
544
+ .fancybox-fx-slide.fancybox-slide--previous {
545
+ opacity: 0;
546
+ transform: translate3d(-100%, 0, 0);
547
+ }
548
+
549
+ .fancybox-fx-slide.fancybox-slide--next {
550
+ opacity: 0;
551
+ transform: translate3d(100%, 0, 0);
552
+ }
553
+
554
+ .fancybox-fx-slide.fancybox-slide--current {
555
+ opacity: 1;
556
+ transform: translate3d(0, 0, 0);
557
+ }
558
+
559
+ /* transitionEffect: fade */
560
+
561
+ .fancybox-fx-fade.fancybox-slide--previous,
562
+ .fancybox-fx-fade.fancybox-slide--next {
563
+ opacity: 0;
564
+ transition-timing-function: cubic-bezier(.19, 1, .22, 1);
565
+ }
566
+
567
+ .fancybox-fx-fade.fancybox-slide--current {
568
+ opacity: 1;
569
+ }
570
+
571
+ /* transitionEffect: zoom-in-out */
572
+
573
+ .fancybox-fx-zoom-in-out.fancybox-slide--previous {
574
+ opacity: 0;
575
+ transform: scale3d(1.5, 1.5, 1.5);
576
+ }
577
+
578
+ .fancybox-fx-zoom-in-out.fancybox-slide--next {
579
+ opacity: 0;
580
+ transform: scale3d(.5, .5, .5);
581
+ }
582
+
583
+ .fancybox-fx-zoom-in-out.fancybox-slide--current {
584
+ opacity: 1;
585
+ transform: scale3d(1, 1, 1);
586
+ }
587
+
588
+ /* transitionEffect: rotate */
589
+
590
+ .fancybox-fx-rotate.fancybox-slide--previous {
591
+ opacity: 0;
592
+ -ms-transform: rotate(-360deg);
593
+ transform: rotate(-360deg);
594
+ }
595
+
596
+ .fancybox-fx-rotate.fancybox-slide--next {
597
+ opacity: 0;
598
+ -ms-transform: rotate(360deg);
599
+ transform: rotate(360deg);
600
+ }
601
+
602
+ .fancybox-fx-rotate.fancybox-slide--current {
603
+ opacity: 1;
604
+ -ms-transform: rotate(0deg);
605
+ transform: rotate(0deg);
606
+ }
607
+
608
+ /* transitionEffect: circular */
609
+
610
+ .fancybox-fx-circular.fancybox-slide--previous {
611
+ opacity: 0;
612
+ transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0);
613
+ }
614
+
615
+ .fancybox-fx-circular.fancybox-slide--next {
616
+ opacity: 0;
617
+ transform: scale3d(0, 0, 0) translate3d(100%, 0, 0);
618
+ }
619
+
620
+ .fancybox-fx-circular.fancybox-slide--current {
621
+ opacity: 1;
622
+ transform: scale3d(1, 1, 1) translate3d(0, 0, 0);
623
+ }
624
+
625
+ /* transitionEffect: tube */
626
+
627
+ .fancybox-fx-tube.fancybox-slide--previous {
628
+ transform: translate3d(-100%, 0, 0) scale(.1) skew(-10deg);
629
+ }
630
+
631
+ .fancybox-fx-tube.fancybox-slide--next {
632
+ transform: translate3d(100%, 0, 0) scale(.1) skew(10deg);
633
+ }
634
+
635
+ .fancybox-fx-tube.fancybox-slide--current {
636
+ transform: translate3d(0, 0, 0) scale(1);
637
+ }
638
+
639
+ /* Styling for Small-Screen Devices */
640
+ @media all and (max-height: 576px) {
641
+ .fancybox-slide {
642
+ padding-left: 6px;
643
+ padding-right: 6px;
644
+ }
645
+
646
+ .fancybox-slide--image {
647
+ padding: 6px 0;
648
+ }
649
+
650
+ .fancybox-close-small {
651
+ right: -6px;
652
+ }
653
+
654
+ .fancybox-slide--image .fancybox-close-small {
655
+ background: #4e4e4e;
656
+ color: #f2f4f6;
657
+ height: 36px;
658
+ opacity: 1;
659
+ padding: 6px;
660
+ right: 0;
661
+ top: 0;
662
+ width: 36px;
663
+ }
664
+
665
+ .fancybox-caption {
666
+ padding-left: 12px;
667
+ padding-right: 12px;
668
+ }
669
+
670
+ @supports (padding: max(0px)) {
671
+ .fancybox-caption {
672
+ padding-left: max(12px, env(safe-area-inset-left));
673
+ padding-right: max(12px, env(safe-area-inset-right));
674
+ }
675
+ }
676
+ }
677
+ /* Share */
678
+
679
+ .fancybox-share {
680
+ background: #f4f4f4;
681
+ border-radius: 3px;
682
+ max-width: 90%;
683
+ padding: 30px;
684
+ text-align: center;
685
+ }
686
+
687
+ .fancybox-share h1 {
688
+ color: #222;
689
+ font-size: 35px;
690
+ font-weight: 700;
691
+ margin: 0 0 20px 0;
692
+ }
693
+
694
+ .fancybox-share p {
695
+ margin: 0;
696
+ padding: 0;
697
+ }
698
+
699
+ .fancybox-share__button {
700
+ border: 0;
701
+ border-radius: 3px;
702
+ display: inline-block;
703
+ font-size: 14px;
704
+ font-weight: 700;
705
+ line-height: 40px;
706
+ margin: 0 5px 10px 5px;
707
+ min-width: 130px;
708
+ padding: 0 15px;
709
+ text-decoration: none;
710
+ transition: all .2s;
711
+ -webkit-user-select: none;
712
+ -moz-user-select: none;
713
+ -ms-user-select: none;
714
+ user-select: none;
715
+ white-space: nowrap;
716
+ }
717
+
718
+ .fancybox-share__button:visited,
719
+ .fancybox-share__button:link {
720
+ color: #fff;
721
+ }
722
+
723
+ .fancybox-share__button:hover {
724
+ text-decoration: none;
725
+ }
726
+
727
+ .fancybox-share__button--fb {
728
+ background: #3b5998;
729
+ }
730
+
731
+ .fancybox-share__button--fb:hover {
732
+ background: #344e86;
733
+ }
734
+
735
+ .fancybox-share__button--pt {
736
+ background: #bd081d;
737
+ }
738
+
739
+ .fancybox-share__button--pt:hover {
740
+ background: #aa0719;
741
+ }
742
+
743
+ .fancybox-share__button--tw {
744
+ background: #1da1f2;
745
+ }
746
+
747
+ .fancybox-share__button--tw:hover {
748
+ background: #0d95e8;
749
+ }
750
+
751
+ .fancybox-share__button svg {
752
+ height: 25px;
753
+ margin-right: 7px;
754
+ position: relative;
755
+ top: -1px;
756
+ vertical-align: middle;
757
+ width: 25px;
758
+ }
759
+
760
+ .fancybox-share__button svg path {
761
+ fill: #fff;
762
+ }
763
+
764
+ .fancybox-share__input {
765
+ background: transparent;
766
+ border: 0;
767
+ border-bottom: 1px solid #d7d7d7;
768
+ border-radius: 0;
769
+ color: #5d5b5b;
770
+ font-size: 14px;
771
+ margin: 10px 0 0 0;
772
+ outline: none;
773
+ padding: 10px 15px;
774
+ width: 100%;
775
+ }
776
+ /* Thumbs */
777
+
778
+ .fancybox-thumbs {
779
+ background: #ddd;
780
+ bottom: 0;
781
+ display: none;
782
+ margin: 0;
783
+ -webkit-overflow-scrolling: touch;
784
+ -ms-overflow-style: -ms-autohiding-scrollbar;
785
+ padding: 2px 2px 4px 2px;
786
+ position: absolute;
787
+ right: 0;
788
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
789
+ top: 0;
790
+ width: 212px;
791
+ z-index: 99995;
792
+ }
793
+
794
+ .fancybox-thumbs-x {
795
+ overflow-x: auto;
796
+ overflow-y: hidden;
797
+ }
798
+
799
+ .fancybox-show-thumbs .fancybox-thumbs {
800
+ display: block;
801
+ }
802
+
803
+ .fancybox-show-thumbs .fancybox-inner {
804
+ right: 212px;
805
+ }
806
+
807
+ .fancybox-thumbs__list {
808
+ font-size: 0;
809
+ height: 100%;
810
+ list-style: none;
811
+ margin: 0;
812
+ overflow-x: hidden;
813
+ overflow-y: auto;
814
+ padding: 0;
815
+ position: absolute;
816
+ position: relative;
817
+ white-space: nowrap;
818
+ width: 100%;
819
+ }
820
+
821
+ .fancybox-thumbs-x .fancybox-thumbs__list {
822
+ overflow: hidden;
823
+ }
824
+
825
+ .fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar {
826
+ width: 7px;
827
+ }
828
+
829
+ .fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-track {
830
+ background: #fff;
831
+ border-radius: 10px;
832
+ box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
833
+ }
834
+
835
+ .fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-thumb {
836
+ background: #2a2a2a;
837
+ border-radius: 10px;
838
+ }
839
+
840
+ .fancybox-thumbs__list a {
841
+ -webkit-backface-visibility: hidden;
842
+ backface-visibility: hidden;
843
+ background-color: rgba(0, 0, 0, .1);
844
+ background-position: center center;
845
+ background-repeat: no-repeat;
846
+ background-size: cover;
847
+ cursor: pointer;
848
+ float: left;
849
+ height: 75px;
850
+ margin: 2px;
851
+ max-height: calc(100% - 8px);
852
+ max-width: calc(50% - 4px);
853
+ outline: none;
854
+ overflow: hidden;
855
+ padding: 0;
856
+ position: relative;
857
+ -webkit-tap-highlight-color: transparent;
858
+ width: 100px;
859
+ }
860
+
861
+ .fancybox-thumbs__list a::before {
862
+ border: 6px solid #ff5268;
863
+ bottom: 0;
864
+ content: '';
865
+ left: 0;
866
+ opacity: 0;
867
+ position: absolute;
868
+ right: 0;
869
+ top: 0;
870
+ transition: all .2s cubic-bezier(.25, .46, .45, .94);
871
+ z-index: 99991;
872
+ }
873
+
874
+ .fancybox-thumbs__list a:focus::before {
875
+ opacity: .5;
876
+ }
877
+
878
+ .fancybox-thumbs__list a.fancybox-thumbs-active::before {
879
+ opacity: 1;
880
+ }
881
+
882
+ /* Styling for Small-Screen Devices */
883
+ @media all and (max-width: 576px) {
884
+ .fancybox-thumbs {
885
+ width: 110px;
886
+ }
887
+
888
+ .fancybox-show-thumbs .fancybox-inner {
889
+ right: 110px;
890
+ }
891
+
892
+ .fancybox-thumbs__list a {
893
+ max-width: calc(100% - 10px);
894
+ }
895
+ }
assets_libraries/fancybox3/jquery.fancybox.js ADDED
@@ -0,0 +1,5632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ==================================================
2
+ // fancyBox v3.5.7
3
+ //
4
+ // Licensed GPLv3 for open source use
5
+ // or fancyBox Commercial License for commercial use
6
+ //
7
+ // http://fancyapps.com/fancybox/
8
+ // Copyright 2019 fancyApps
9
+ //
10
+ // ==================================================
11
+ (function (window, document, $, undefined) {
12
+ "use strict";
13
+
14
+ window.console = window.console || {
15
+ info: function (stuff) {}
16
+ };
17
+
18
+ // If there's no jQuery, fancyBox can't work
19
+ // =========================================
20
+
21
+ if (!$) {
22
+ return;
23
+ }
24
+
25
+ // Check if fancyBox is already initialized
26
+ // ========================================
27
+
28
+ if ($.fn.fancybox) {
29
+ console.info("fancyBox already initialized");
30
+
31
+ return;
32
+ }
33
+
34
+ // Private default settings
35
+ // ========================
36
+
37
+ var defaults = {
38
+ // Close existing modals
39
+ // Set this to false if you do not need to stack multiple instances
40
+ closeExisting: false,
41
+
42
+ // Enable infinite gallery navigation
43
+ loop: false,
44
+
45
+ // Horizontal space between slides
46
+ gutter: 50,
47
+
48
+ // Enable keyboard navigation
49
+ keyboard: true,
50
+
51
+ // Should allow caption to overlap the content
52
+ preventCaptionOverlap: true,
53
+
54
+ // Should display navigation arrows at the screen edges
55
+ arrows: true,
56
+
57
+ // Should display counter at the top left corner
58
+ infobar: true,
59
+
60
+ // Should display close button (using `btnTpl.smallBtn` template) over the content
61
+ // Can be true, false, "auto"
62
+ // If "auto" - will be automatically enabled for "html", "inline" or "ajax" items
63
+ smallBtn: "auto",
64
+
65
+ // Should display toolbar (buttons at the top)
66
+ // Can be true, false, "auto"
67
+ // If "auto" - will be automatically hidden if "smallBtn" is enabled
68
+ toolbar: "auto",
69
+
70
+ // What buttons should appear in the top right corner.
71
+ // Buttons will be created using templates from `btnTpl` option
72
+ // and they will be placed into toolbar (class="fancybox-toolbar"` element)
73
+ buttons: [
74
+ "zoom",
75
+ //"share",
76
+ "slideShow",
77
+ //"fullScreen",
78
+ //"download",
79
+ "thumbs",
80
+ "close"
81
+ ],
82
+
83
+ // Detect "idle" time in seconds
84
+ idleTime: 3,
85
+
86
+ // Disable right-click and use simple image protection for images
87
+ protect: false,
88
+
89
+ // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc
90
+ modal: false,
91
+
92
+ image: {
93
+ // Wait for images to load before displaying
94
+ // true - wait for image to load and then display;
95
+ // false - display thumbnail and load the full-sized image over top,
96
+ // requires predefined image dimensions (`data-width` and `data-height` attributes)
97
+ preload: false
98
+ },
99
+
100
+ ajax: {
101
+ // Object containing settings for ajax request
102
+ settings: {
103
+ // This helps to indicate that request comes from the modal
104
+ // Feel free to change naming
105
+ data: {
106
+ fancybox: true
107
+ }
108
+ }
109
+ },
110
+
111
+ iframe: {
112
+ // Iframe template
113
+ tpl: '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""></iframe>',
114
+
115
+ // Preload iframe before displaying it
116
+ // This allows to calculate iframe content width and height
117
+ // (note: Due to "Same Origin Policy", you can't get cross domain data).
118
+ preload: true,
119
+
120
+ // Custom CSS styling for iframe wrapping element
121
+ // You can use this to set custom iframe dimensions
122
+ css: {},
123
+
124
+ // Iframe tag attributes
125
+ attr: {
126
+ scrolling: "auto"
127
+ }
128
+ },
129
+
130
+ // For HTML5 video only
131
+ video: {
132
+ tpl: '<video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}">' +
133
+ '<source src="{{src}}" type="{{format}}" />' +
134
+ 'Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!' +
135
+ "</video>",
136
+ format: "", // custom video format
137
+ autoStart: true
138
+ },
139
+
140
+ // Default content type if cannot be detected automatically
141
+ defaultType: "image",
142
+
143
+ // Open/close animation type
144
+ // Possible values:
145
+ // false - disable
146
+ // "zoom" - zoom images from/to thumbnail
147
+ // "fade"
148
+ // "zoom-in-out"
149
+ //
150
+ animationEffect: "zoom",
151
+
152
+ // Duration in ms for open/close animation
153
+ animationDuration: 366,
154
+
155
+ // Should image change opacity while zooming
156
+ // If opacity is "auto", then opacity will be changed if image and thumbnail have different aspect ratios
157
+ zoomOpacity: "auto",
158
+
159
+ // Transition effect between slides
160
+ //
161
+ // Possible values:
162
+ // false - disable
163
+ // "fade'
164
+ // "slide'
165
+ // "circular'
166
+ // "tube'
167
+ // "zoom-in-out'
168
+ // "rotate'
169
+ //
170
+ transitionEffect: "fade",
171
+
172
+ // Duration in ms for transition animation
173
+ transitionDuration: 366,
174
+
175
+ // Custom CSS class for slide element
176
+ slideClass: "",
177
+
178
+ // Custom CSS class for layout
179
+ baseClass: "",
180
+
181
+ // Base template for layout
182
+ baseTpl: '<div class="fancybox-container" role="dialog" tabindex="-1">' +
183
+ '<div class="fancybox-bg"></div>' +
184
+ '<div class="fancybox-inner">' +
185
+ '<div class="fancybox-infobar"><span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span></div>' +
186
+ '<div class="fancybox-toolbar">{{buttons}}</div>' +
187
+ '<div class="fancybox-navigation">{{arrows}}</div>' +
188
+ '<div class="fancybox-stage"></div>' +
189
+ '<div class="fancybox-caption"><div class="fancybox-caption__body"></div></div>' +
190
+ "</div>" +
191
+ "</div>",
192
+
193
+ // Loading indicator template
194
+ spinnerTpl: '<div class="fancybox-loading"></div>',
195
+
196
+ // Error message template
197
+ errorTpl: '<div class="fancybox-error"><p>{{ERROR}}</p></div>',
198
+
199
+ btnTpl: {
200
+ download: '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' +
201
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg>' +
202
+ "</a>",
203
+
204
+ zoom: '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
205
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg>' +
206
+ "</button>",
207
+
208
+ close: '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
209
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' +
210
+ "</button>",
211
+
212
+ // Arrows
213
+ arrowLeft: '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
214
+ '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div>' +
215
+ "</button>",
216
+
217
+ arrowRight: '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
218
+ '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div>' +
219
+ "</button>",
220
+
221
+ // This small close button will be appended to your html/inline/ajax content by default,
222
+ // if "smallBtn" option is not set to false
223
+ smallBtn: '<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' +
224
+ '<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg>' +
225
+ "</button>"
226
+ },
227
+
228
+ // Container is injected into this element
229
+ parentEl: "body",
230
+
231
+ // Hide browser vertical scrollbars; use at your own risk
232
+ hideScrollbar: true,
233
+
234
+ // Focus handling
235
+ // ==============
236
+
237
+ // Try to focus on the first focusable element after opening
238
+ autoFocus: true,
239
+
240
+ // Put focus back to active element after closing
241
+ backFocus: true,
242
+
243
+ // Do not let user to focus on element outside modal content
244
+ trapFocus: true,
245
+
246
+ // Module specific options
247
+ // =======================
248
+
249
+ fullScreen: {
250
+ autoStart: false
251
+ },
252
+
253
+ // Set `touch: false` to disable panning/swiping
254
+ touch: {
255
+ vertical: true, // Allow to drag content vertically
256
+ momentum: true // Continue movement after releasing mouse/touch when panning
257
+ },
258
+
259
+ // Hash value when initializing manually,
260
+ // set `false` to disable hash change
261
+ hash: null,
262
+
263
+ // Customize or add new media types
264
+ // Example:
265
+ /*
266
+ media : {
267
+ youtube : {
268
+ params : {
269
+ autoplay : 0
270
+ }
271
+ }
272
+ }
273
+ */
274
+ media: {},
275
+
276
+ slideShow: {
277
+ autoStart: false,
278
+ speed: 3000
279
+ },
280
+
281
+ thumbs: {
282
+ autoStart: false, // Display thumbnails on opening
283
+ hideOnClose: true, // Hide thumbnail grid when closing animation starts
284
+ parentEl: ".fancybox-container", // Container is injected into this element
285
+ axis: "y" // Vertical (y) or horizontal (x) scrolling
286
+ },
287
+
288
+ // Use mousewheel to navigate gallery
289
+ // If 'auto' - enabled for images only
290
+ wheel: "auto",
291
+
292
+ // Callbacks
293
+ //==========
294
+
295
+ // See Documentation/API/Events for more information
296
+ // Example:
297
+ /*
298
+ afterShow: function( instance, current ) {
299
+ console.info( 'Clicked element:' );
300
+ console.info( current.opts.$orig );
301
+ }
302
+ */
303
+
304
+ onInit: $.noop, // When instance has been initialized
305
+
306
+ beforeLoad: $.noop, // Before the content of a slide is being loaded
307
+ afterLoad: $.noop, // When the content of a slide is done loading
308
+
309
+ beforeShow: $.noop, // Before open animation starts
310
+ afterShow: $.noop, // When content is done loading and animating
311
+
312
+ beforeClose: $.noop, // Before the instance attempts to close. Return false to cancel the close.
313
+ afterClose: $.noop, // After instance has been closed
314
+
315
+ onActivate: $.noop, // When instance is brought to front
316
+ onDeactivate: $.noop, // When other instance has been activated
317
+
318
+ // Interaction
319
+ // ===========
320
+
321
+ // Use options below to customize taken action when user clicks or double clicks on the fancyBox area,
322
+ // each option can be string or method that returns value.
323
+ //
324
+ // Possible values:
325
+ // "close" - close instance
326
+ // "next" - move to next gallery item
327
+ // "nextOrClose" - move to next gallery item or close if gallery has only one item
328
+ // "toggleControls" - show/hide controls
329
+ // "zoom" - zoom image (if loaded)
330
+ // false - do nothing
331
+
332
+ // Clicked on the content
333
+ clickContent: function (current, event) {
334
+ return current.type === "image" ? "zoom" : false;
335
+ },
336
+
337
+ // Clicked on the slide
338
+ clickSlide: "close",
339
+
340
+ // Clicked on the background (backdrop) element;
341
+ // if you have not changed the layout, then most likely you need to use `clickSlide` option
342
+ clickOutside: "close",
343
+
344
+ // Same as previous two, but for double click
345
+ dblclickContent: false,
346
+ dblclickSlide: false,
347
+ dblclickOutside: false,
348
+
349
+ // Custom options when mobile device is detected
350
+ // =============================================
351
+
352
+ mobile: {
353
+ preventCaptionOverlap: false,
354
+ idleTime: false,
355
+ clickContent: function (current, event) {
356
+ return current.type === "image" ? "toggleControls" : false;
357
+ },
358
+ clickSlide: function (current, event) {
359
+ return current.type === "image" ? "toggleControls" : "close";
360
+ },
361
+ dblclickContent: function (current, event) {
362
+ return current.type === "image" ? "zoom" : false;
363
+ },
364
+ dblclickSlide: function (current, event) {
365
+ return current.type === "image" ? "zoom" : false;
366
+ }
367
+ },
368
+
369
+ // Internationalization
370
+ // ====================
371
+
372
+ lang: "en",
373
+ i18n: {
374
+ en: {
375
+ CLOSE: "Close",
376
+ NEXT: "Next",
377
+ PREV: "Previous",
378
+ ERROR: "The requested content cannot be loaded. <br/> Please try again later.",
379
+ PLAY_START: "Start slideshow",
380
+ PLAY_STOP: "Pause slideshow",
381
+ FULL_SCREEN: "Full screen",
382
+ THUMBS: "Thumbnails",
383
+ DOWNLOAD: "Download",
384
+ SHARE: "Share",
385
+ ZOOM: "Zoom"
386
+ },
387
+ de: {
388
+ CLOSE: "Schlie&szlig;en",
389
+ NEXT: "Weiter",
390
+ PREV: "Zur&uuml;ck",
391
+ ERROR: "Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es sp&auml;ter nochmal.",
392
+ PLAY_START: "Diaschau starten",
393
+ PLAY_STOP: "Diaschau beenden",
394
+ FULL_SCREEN: "Vollbild",
395
+ THUMBS: "Vorschaubilder",
396
+ DOWNLOAD: "Herunterladen",
397
+ SHARE: "Teilen",
398
+ ZOOM: "Vergr&ouml;&szlig;ern"
399
+ }
400
+ }
401
+ };
402
+
403
+ // Few useful variables and methods
404
+ // ================================
405
+
406
+ var $W = $(window);
407
+ var $D = $(document);
408
+
409
+ var called = 0;
410
+
411
+ // Check if an object is a jQuery object and not a native JavaScript object
412
+ // ========================================================================
413
+ var isQuery = function (obj) {
414
+ return obj && obj.hasOwnProperty && obj instanceof $;
415
+ };
416
+
417
+ // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame"
418
+ // ===============================================================================
419
+ var requestAFrame = (function () {
420
+ return (
421
+ window.requestAnimationFrame ||
422
+ window.webkitRequestAnimationFrame ||
423
+ window.mozRequestAnimationFrame ||
424
+ window.oRequestAnimationFrame ||
425
+ // if all else fails, use setTimeout
426
+ function (callback) {
427
+ return window.setTimeout(callback, 1000 / 60);
428
+ }
429
+ );
430
+ })();
431
+
432
+ var cancelAFrame = (function () {
433
+ return (
434
+ window.cancelAnimationFrame ||
435
+ window.webkitCancelAnimationFrame ||
436
+ window.mozCancelAnimationFrame ||
437
+ window.oCancelAnimationFrame ||
438
+ function (id) {
439
+ window.clearTimeout(id);
440
+ }
441
+ );
442
+ })();
443
+
444
+ // Detect the supported transition-end event property name
445
+ // =======================================================
446
+ var transitionEnd = (function () {
447
+ var el = document.createElement("fakeelement"),
448
+ t;
449
+
450
+ var transitions = {
451
+ transition: "transitionend",
452
+ OTransition: "oTransitionEnd",
453
+ MozTransition: "transitionend",
454
+ WebkitTransition: "webkitTransitionEnd"
455
+ };
456
+
457
+ for (t in transitions) {
458
+ if (el.style[t] !== undefined) {
459
+ return transitions[t];
460
+ }
461
+ }
462
+
463
+ return "transitionend";
464
+ })();
465
+
466
+ // Force redraw on an element.
467
+ // This helps in cases where the browser doesn't redraw an updated element properly
468
+ // ================================================================================
469
+ var forceRedraw = function ($el) {
470
+ return $el && $el.length && $el[0].offsetHeight;
471
+ };
472
+
473
+ // Exclude array (`buttons`) options from deep merging
474
+ // ===================================================
475
+ var mergeOpts = function (opts1, opts2) {
476
+ var rez = $.extend(true, {}, opts1, opts2);
477
+
478
+ $.each(opts2, function (key, value) {
479
+ if ($.isArray(value)) {
480
+ rez[key] = value;
481
+ }
482
+ });
483
+
484
+ return rez;
485
+ };
486
+
487
+ // How much of an element is visible in viewport
488
+ // =============================================
489
+
490
+ var inViewport = function (elem) {
491
+ var elemCenter, rez;
492
+
493
+ if (!elem || elem.ownerDocument !== document) {
494
+ return false;
495
+ }
496
+
497
+ $(".fancybox-container").css("pointer-events", "none");
498
+
499
+ elemCenter = {
500
+ x: elem.getBoundingClientRect().left + elem.offsetWidth / 2,
501
+ y: elem.getBoundingClientRect().top + elem.offsetHeight / 2
502
+ };
503
+
504
+ rez = document.elementFromPoint(elemCenter.x, elemCenter.y) === elem;
505
+
506
+ $(".fancybox-container").css("pointer-events", "");
507
+
508
+ return rez;
509
+ };
510
+
511
+ // Class definition
512
+ // ================
513
+
514
+ var FancyBox = function (content, opts, index) {
515
+ var self = this;
516
+
517
+ self.opts = mergeOpts({
518
+ index: index
519
+ }, $.fancybox.defaults);
520
+
521
+ if ($.isPlainObject(opts)) {
522
+ self.opts = mergeOpts(self.opts, opts);
523
+ }
524
+
525
+ if ($.fancybox.isMobile) {
526
+ self.opts = mergeOpts(self.opts, self.opts.mobile);
527
+ }
528
+
529
+ self.id = self.opts.id || ++called;
530
+
531
+ self.currIndex = parseInt(self.opts.index, 10) || 0;
532
+ self.prevIndex = null;
533
+
534
+ self.prevPos = null;
535
+ self.currPos = 0;
536
+
537
+ self.firstRun = true;
538
+
539
+ // All group items
540
+ self.group = [];
541
+
542
+ // Existing slides (for current, next and previous gallery items)
543
+ self.slides = {};
544
+
545
+ // Create group elements
546
+ self.addContent(content);
547
+
548
+ if (!self.group.length) {
549
+ return;
550
+ }
551
+
552
+ self.init();
553
+ };
554
+
555
+ $.extend(FancyBox.prototype, {
556
+ // Create DOM structure
557
+ // ====================
558
+
559
+ init: function () {
560
+ var self = this,
561
+ firstItem = self.group[self.currIndex],
562
+ firstItemOpts = firstItem.opts,
563
+ $container,
564
+ buttonStr;
565
+
566
+ if (firstItemOpts.closeExisting) {
567
+ $.fancybox.close(true);
568
+ }
569
+
570
+ // Hide scrollbars
571
+ // ===============
572
+
573
+ $("body").addClass("fancybox-active");
574
+
575
+ if (
576
+ !$.fancybox.getInstance() &&
577
+ firstItemOpts.hideScrollbar !== false &&
578
+ !$.fancybox.isMobile &&
579
+ document.body.scrollHeight > window.innerHeight
580
+ ) {
581
+ $("head").append(
582
+ '<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar{margin-right:' +
583
+ (window.innerWidth - document.documentElement.clientWidth) +
584
+ "px;}</style>"
585
+ );
586
+
587
+ $("body").addClass("compensate-for-scrollbar");
588
+ }
589
+
590
+ // Build html markup and set references
591
+ // ====================================
592
+
593
+ // Build html code for buttons and insert into main template
594
+ buttonStr = "";
595
+
596
+ $.each(firstItemOpts.buttons, function (index, value) {
597
+ buttonStr += firstItemOpts.btnTpl[value] || "";
598
+ });
599
+
600
+ // Create markup from base template, it will be initially hidden to
601
+ // avoid unnecessary work like painting while initializing is not complete
602
+ $container = $(
603
+ self.translate(
604
+ self,
605
+ firstItemOpts.baseTpl
606
+ .replace("{{buttons}}", buttonStr)
607
+ .replace("{{arrows}}", firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)
608
+ )
609
+ )
610
+ .attr("id", "fancybox-container-" + self.id)
611
+ .addClass(firstItemOpts.baseClass)
612
+ .data("FancyBox", self)
613
+ .appendTo(firstItemOpts.parentEl);
614
+
615
+ // Create object holding references to jQuery wrapped nodes
616
+ self.$refs = {
617
+ container: $container
618
+ };
619
+
620
+ ["bg", "inner", "infobar", "toolbar", "stage", "caption", "navigation"].forEach(function (item) {
621
+ self.$refs[item] = $container.find(".fancybox-" + item);
622
+ });
623
+
624
+ self.trigger("onInit");
625
+
626
+ // Enable events, deactive previous instances
627
+ self.activate();
628
+
629
+ // Build slides, load and reveal content
630
+ self.jumpTo(self.currIndex);
631
+ },
632
+
633
+ // Simple i18n support - replaces object keys found in template
634
+ // with corresponding values
635
+ // ============================================================
636
+
637
+ translate: function (obj, str) {
638
+ var arr = obj.opts.i18n[obj.opts.lang] || obj.opts.i18n.en;
639
+
640
+ return str.replace(/\{\{(\w+)\}\}/g, function (match, n) {
641
+ return arr[n] === undefined ? match : arr[n];
642
+ });
643
+ },
644
+
645
+ // Populate current group with fresh content
646
+ // Check if each object has valid type and content
647
+ // ===============================================
648
+
649
+ addContent: function (content) {
650
+ var self = this,
651
+ items = $.makeArray(content),
652
+ thumbs;
653
+
654
+ $.each(items, function (i, item) {
655
+ var obj = {},
656
+ opts = {},
657
+ $item,
658
+ type,
659
+ found,
660
+ src,
661
+ srcParts;
662
+
663
+ // Step 1 - Make sure we have an object
664
+ // ====================================
665
+
666
+ if ($.isPlainObject(item)) {
667
+ // We probably have manual usage here, something like
668
+ // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] )
669
+
670
+ obj = item;
671
+ opts = item.opts || item;
672
+ } else if ($.type(item) === "object" && $(item).length) {
673
+ // Here we probably have jQuery collection returned by some selector
674
+ $item = $(item);
675
+
676
+ // Support attributes like `data-options='{"touch" : false}'` and `data-touch='false'`
677
+ opts = $item.data() || {};
678
+ opts = $.extend(true, {}, opts, opts.options);
679
+
680
+ // Here we store clicked element
681
+ opts.$orig = $item;
682
+
683
+ obj.src = self.opts.src || opts.src || $item.attr("href");
684
+
685
+ // Assume that simple syntax is used, for example:
686
+ // `$.fancybox.open( $("#test"), {} );`
687
+ if (!obj.type && !obj.src) {
688
+ obj.type = "inline";
689
+ obj.src = item;
690
+ }
691
+ } else {
692
+ // Assume we have a simple html code, for example:
693
+ // $.fancybox.open( '<div><h1>Hi!</h1></div>' );
694
+ obj = {
695
+ type: "html",
696
+ src: item + ""
697
+ };
698
+ }
699
+
700
+ // Each gallery object has full collection of options
701
+ obj.opts = $.extend(true, {}, self.opts, opts);
702
+
703
+ // Do not merge buttons array
704
+ if ($.isArray(opts.buttons)) {
705
+ obj.opts.buttons = opts.buttons;
706
+ }
707
+
708
+ if ($.fancybox.isMobile && obj.opts.mobile) {
709
+ obj.opts = mergeOpts(obj.opts, obj.opts.mobile);
710
+ }
711
+
712
+ // Step 2 - Make sure we have content type, if not - try to guess
713
+ // ==============================================================
714
+
715
+ type = obj.type || obj.opts.type;
716
+ src = obj.src || "";
717
+
718
+ if (!type && src) {
719
+ if ((found = src.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))) {
720
+ type = "video";
721
+
722
+ if (!obj.opts.video.format) {
723
+ obj.opts.video.format = "video/" + (found[1] === "ogv" ? "ogg" : found[1]);
724
+ }
725
+ } else if (src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)) {
726
+ type = "image";
727
+ } else if (src.match(/\.(pdf)((\?|#).*)?$/i)) {
728
+ type = "iframe";
729
+ obj = $.extend(true, obj, {
730
+ contentType: "pdf",
731
+ opts: {
732
+ iframe: {
733
+ preload: false
734
+ }
735
+ }
736
+ });
737
+ } else if (src.charAt(0) === "#") {
738
+ type = "inline";
739
+ }
740
+ }
741
+
742
+ if (type) {
743
+ obj.type = type;
744
+ } else {
745
+ self.trigger("objectNeedsType", obj);
746
+ }
747
+
748
+ if (!obj.contentType) {
749
+ obj.contentType = $.inArray(obj.type, ["html", "inline", "ajax"]) > -1 ? "html" : obj.type;
750
+ }
751
+
752
+ // Step 3 - Some adjustments
753
+ // =========================
754
+
755
+ obj.index = self.group.length;
756
+
757
+ if (obj.opts.smallBtn == "auto") {
758
+ obj.opts.smallBtn = $.inArray(obj.type, ["html", "inline", "ajax"]) > -1;
759
+ }
760
+
761
+ if (obj.opts.toolbar === "auto") {
762
+ obj.opts.toolbar = !obj.opts.smallBtn;
763
+ }
764
+
765
+ // Find thumbnail image, check if exists and if is in the viewport
766
+ obj.$thumb = obj.opts.$thumb || null;
767
+
768
+ if (obj.opts.$trigger && obj.index === self.opts.index) {
769
+ obj.$thumb = obj.opts.$trigger.find("img:first");
770
+
771
+ if (obj.$thumb.length) {
772
+ obj.opts.$orig = obj.opts.$trigger;
773
+ }
774
+ }
775
+
776
+ if (!(obj.$thumb && obj.$thumb.length) && obj.opts.$orig) {
777
+ obj.$thumb = obj.opts.$orig.find("img:first");
778
+ }
779
+
780
+ if (obj.$thumb && !obj.$thumb.length) {
781
+ obj.$thumb = null;
782
+ }
783
+
784
+ obj.thumb = obj.opts.thumb || (obj.$thumb ? obj.$thumb[0].src : null);
785
+
786
+ // "caption" is a "special" option, it can be used to customize caption per gallery item
787
+ if ($.type(obj.opts.caption) === "function") {
788
+ obj.opts.caption = obj.opts.caption.apply(item, [self, obj]);
789
+ }
790
+
791
+ if ($.type(self.opts.caption) === "function") {
792
+ obj.opts.caption = self.opts.caption.apply(item, [self, obj]);
793
+ }
794
+
795
+ // Make sure we have caption as a string or jQuery object
796
+ if (!(obj.opts.caption instanceof $)) {
797
+ obj.opts.caption = obj.opts.caption === undefined ? "" : obj.opts.caption + "";
798
+ }
799
+
800
+ // Check if url contains "filter" used to filter the content
801
+ // Example: "ajax.html #something"
802
+ if (obj.type === "ajax") {
803
+ srcParts = src.split(/\s+/, 2);
804
+
805
+ if (srcParts.length > 1) {
806
+ obj.src = srcParts.shift();
807
+
808
+ obj.opts.filter = srcParts.shift();
809
+ }
810
+ }
811
+
812
+ // Hide all buttons and disable interactivity for modal items
813
+ if (obj.opts.modal) {
814
+ obj.opts = $.extend(true, obj.opts, {
815
+ trapFocus: true,
816
+ // Remove buttons
817
+ infobar: 0,
818
+ toolbar: 0,
819
+
820
+ smallBtn: 0,
821
+
822
+ // Disable keyboard navigation
823
+ keyboard: 0,
824
+
825
+ // Disable some modules
826
+ slideShow: 0,
827
+ fullScreen: 0,
828
+ thumbs: 0,
829
+ touch: 0,
830
+
831
+ // Disable click event handlers
832
+ clickContent: false,
833
+ clickSlide: false,
834
+ clickOutside: false,
835
+ dblclickContent: false,
836
+ dblclickSlide: false,
837
+ dblclickOutside: false
838
+ });
839
+ }
840
+
841
+ // Step 4 - Add processed object to group
842
+ // ======================================
843
+
844
+ self.group.push(obj);
845
+ });
846
+
847
+ // Update controls if gallery is already opened
848
+ if (Object.keys(self.slides).length) {
849
+ self.updateControls();
850
+
851
+ // Update thumbnails, if needed
852
+ thumbs = self.Thumbs;
853
+
854
+ if (thumbs && thumbs.isActive) {
855
+ thumbs.create();
856
+
857
+ thumbs.focus();
858
+ }
859
+ }
860
+ },
861
+
862
+ // Attach an event handler functions for:
863
+ // - navigation buttons
864
+ // - browser scrolling, resizing;
865
+ // - focusing
866
+ // - keyboard
867
+ // - detecting inactivity
868
+ // ======================================
869
+
870
+ addEvents: function () {
871
+ var self = this;
872
+
873
+ self.removeEvents();
874
+
875
+ // Make navigation elements clickable
876
+ // ==================================
877
+
878
+ self.$refs.container
879
+ .on("click.fb-close", "[data-fancybox-close]", function (e) {
880
+ e.stopPropagation();
881
+ e.preventDefault();
882
+
883
+ self.close(e);
884
+ })
885
+ .on("touchstart.fb-prev click.fb-prev", "[data-fancybox-prev]", function (e) {
886
+ e.stopPropagation();
887
+ e.preventDefault();
888
+
889
+ self.previous();
890
+ })
891
+ .on("touchstart.fb-next click.fb-next", "[data-fancybox-next]", function (e) {
892
+ e.stopPropagation();
893
+ e.preventDefault();
894
+
895
+ self.next();
896
+ })
897
+ .on("click.fb", "[data-fancybox-zoom]", function (e) {
898
+ // Click handler for zoom button
899
+ self[self.isScaledDown() ? "scaleToActual" : "scaleToFit"]();
900
+ });
901
+
902
+ // Handle page scrolling and browser resizing
903
+ // ==========================================
904
+
905
+ $W.on("orientationchange.fb resize.fb", function (e) {
906
+ if (e && e.originalEvent && e.originalEvent.type === "resize") {
907
+ if (self.requestId) {
908
+ cancelAFrame(self.requestId);
909
+ }
910
+
911
+ self.requestId = requestAFrame(function () {
912
+ self.update(e);
913
+ });
914
+ } else {
915
+ if (self.current && self.current.type === "iframe") {
916
+ self.$refs.stage.hide();
917
+ }
918
+
919
+ setTimeout(
920
+ function () {
921
+ self.$refs.stage.show();
922
+
923
+ self.update(e);
924
+ },
925
+ $.fancybox.isMobile ? 600 : 250
926
+ );
927
+ }
928
+ });
929
+
930
+ $D.on("keydown.fb", function (e) {
931
+ var instance = $.fancybox ? $.fancybox.getInstance() : null,
932
+ current = instance.current,
933
+ keycode = e.keyCode || e.which;
934
+
935
+ // Trap keyboard focus inside of the modal
936
+ // =======================================
937
+
938
+ if (keycode == 9) {
939
+ if (current.opts.trapFocus) {
940
+ self.focus(e);
941
+ }
942
+
943
+ return;
944
+ }
945
+
946
+ // Enable keyboard navigation
947
+ // ==========================
948
+
949
+ if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input,textarea,video,audio,select")) {
950
+ return;
951
+ }
952
+
953
+ // Backspace and Esc keys
954
+ if (keycode === 8 || keycode === 27) {
955
+ e.preventDefault();
956
+
957
+ self.close(e);
958
+
959
+ return;
960
+ }
961
+
962
+ // Left arrow and Up arrow
963
+ if (keycode === 37 || keycode === 38) {
964
+ e.preventDefault();
965
+
966
+ self.previous();
967
+
968
+ return;
969
+ }
970
+
971
+ // Righ arrow and Down arrow
972
+ if (keycode === 39 || keycode === 40) {
973
+ e.preventDefault();
974
+
975
+ self.next();
976
+
977
+ return;
978
+ }
979
+
980
+ self.trigger("afterKeydown", e, keycode);
981
+ });
982
+
983
+ // Hide controls after some inactivity period
984
+ if (self.group[self.currIndex].opts.idleTime) {
985
+ self.idleSecondsCounter = 0;
986
+
987
+ $D.on(
988
+ "mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",
989
+ function (e) {
990
+ self.idleSecondsCounter = 0;
991
+
992
+ if (self.isIdle) {
993
+ self.showControls();
994
+ }
995
+
996
+ self.isIdle = false;
997
+ }
998
+ );
999
+
1000
+ self.idleInterval = window.setInterval(function () {
1001
+ self.idleSecondsCounter++;
1002
+
1003
+ if (self.idleSecondsCounter >= self.group[self.currIndex].opts.idleTime && !self.isDragging) {
1004
+ self.isIdle = true;
1005
+ self.idleSecondsCounter = 0;
1006
+
1007
+ self.hideControls();
1008
+ }
1009
+ }, 1000);
1010
+ }
1011
+ },
1012
+
1013
+ // Remove events added by the core
1014
+ // ===============================
1015
+
1016
+ removeEvents: function () {
1017
+ var self = this;
1018
+
1019
+ $W.off("orientationchange.fb resize.fb");
1020
+ $D.off("keydown.fb .fb-idle");
1021
+
1022
+ this.$refs.container.off(".fb-close .fb-prev .fb-next");
1023
+
1024
+ if (self.idleInterval) {
1025
+ window.clearInterval(self.idleInterval);
1026
+
1027
+ self.idleInterval = null;
1028
+ }
1029
+ },
1030
+
1031
+ // Change to previous gallery item
1032
+ // ===============================
1033
+
1034
+ previous: function (duration) {
1035
+ return this.jumpTo(this.currPos - 1, duration);
1036
+ },
1037
+
1038
+ // Change to next gallery item
1039
+ // ===========================
1040
+
1041
+ next: function (duration) {
1042
+ return this.jumpTo(this.currPos + 1, duration);
1043
+ },
1044
+
1045
+ // Switch to selected gallery item
1046
+ // ===============================
1047
+
1048
+ jumpTo: function (pos, duration) {
1049
+ var self = this,
1050
+ groupLen = self.group.length,
1051
+ firstRun,
1052
+ isMoved,
1053
+ loop,
1054
+ current,
1055
+ previous,
1056
+ slidePos,
1057
+ stagePos,
1058
+ prop,
1059
+ diff;
1060
+
1061
+ if (self.isDragging || self.isClosing || (self.isAnimating && self.firstRun)) {
1062
+ return;
1063
+ }
1064
+
1065
+ // Should loop?
1066
+ pos = parseInt(pos, 10);
1067
+ loop = self.current ? self.current.opts.loop : self.opts.loop;
1068
+
1069
+ if (!loop && (pos < 0 || pos >= groupLen)) {
1070
+ return false;
1071
+ }
1072
+
1073
+ // Check if opening for the first time; this helps to speed things up
1074
+ firstRun = self.firstRun = !Object.keys(self.slides).length;
1075
+
1076
+ // Create slides
1077
+ previous = self.current;
1078
+
1079
+ self.prevIndex = self.currIndex;
1080
+ self.prevPos = self.currPos;
1081
+
1082
+ current = self.createSlide(pos);
1083
+
1084
+ if (groupLen > 1) {
1085
+ if (loop || current.index < groupLen - 1) {
1086
+ self.createSlide(pos + 1);
1087
+ }
1088
+
1089
+ if (loop || current.index > 0) {
1090
+ self.createSlide(pos - 1);
1091
+ }
1092
+ }
1093
+
1094
+ self.current = current;
1095
+ self.currIndex = current.index;
1096
+ self.currPos = current.pos;
1097
+
1098
+ self.trigger("beforeShow", firstRun);
1099
+
1100
+ self.updateControls();
1101
+
1102
+ // Validate duration length
1103
+ current.forcedDuration = undefined;
1104
+
1105
+ if ($.isNumeric(duration)) {
1106
+ current.forcedDuration = duration;
1107
+ } else {
1108
+ duration = current.opts[firstRun ? "animationDuration" : "transitionDuration"];
1109
+ }
1110
+
1111
+ duration = parseInt(duration, 10);
1112
+
1113
+ // Check if user has swiped the slides or if still animating
1114
+ isMoved = self.isMoved(current);
1115
+
1116
+ // Make sure current slide is visible
1117
+ current.$slide.addClass("fancybox-slide--current");
1118
+
1119
+ // Fresh start - reveal container, current slide and start loading content
1120
+ if (firstRun) {
1121
+ if (current.opts.animationEffect && duration) {
1122
+ self.$refs.container.css("transition-duration", duration + "ms");
1123
+ }
1124
+
1125
+ self.$refs.container.addClass("fancybox-is-open").trigger("focus");
1126
+
1127
+ // Attempt to load content into slide
1128
+ // This will later call `afterLoad` -> `revealContent`
1129
+ self.loadSlide(current);
1130
+
1131
+ self.preload("image");
1132
+
1133
+ return;
1134
+ }
1135
+
1136
+ // Get actual slide/stage positions (before cleaning up)
1137
+ slidePos = $.fancybox.getTranslate(previous.$slide);
1138
+ stagePos = $.fancybox.getTranslate(self.$refs.stage);
1139
+
1140
+ // Clean up all slides
1141
+ $.each(self.slides, function (index, slide) {
1142
+ $.fancybox.stop(slide.$slide, true);
1143
+ });
1144
+
1145
+ if (previous.pos !== current.pos) {
1146
+ previous.isComplete = false;
1147
+ }
1148
+
1149
+ previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current");
1150
+
1151
+ // If slides are out of place, then animate them to correct position
1152
+ if (isMoved) {
1153
+ // Calculate horizontal swipe distance
1154
+ diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter);
1155
+
1156
+ $.each(self.slides, function (index, slide) {
1157
+ slide.$slide.removeClass("fancybox-animated").removeClass(function (index, className) {
1158
+ return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
1159
+ });
1160
+
1161
+ // Make sure that each slide is in equal distance
1162
+ // This is mostly needed for freshly added slides, because they are not yet positioned
1163
+ var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter;
1164
+
1165
+ $.fancybox.setTranslate(slide.$slide, {
1166
+ top: 0,
1167
+ left: leftPos - stagePos.left + diff
1168
+ });
1169
+
1170
+ if (slide.pos !== current.pos) {
1171
+ slide.$slide.addClass("fancybox-slide--" + (slide.pos > current.pos ? "next" : "previous"));
1172
+ }
1173
+
1174
+ // Redraw to make sure that transition will start
1175
+ forceRedraw(slide.$slide);
1176
+
1177
+ // Animate the slide
1178
+ $.fancybox.animate(
1179
+ slide.$slide, {
1180
+ top: 0,
1181
+ left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter
1182
+ },
1183
+ duration,
1184
+ function () {
1185
+ slide.$slide
1186
+ .css({
1187
+ transform: "",
1188
+ opacity: ""
1189
+ })
1190
+ .removeClass("fancybox-slide--next fancybox-slide--previous");
1191
+
1192
+ if (slide.pos === self.currPos) {
1193
+ self.complete();
1194
+ }
1195
+ }
1196
+ );
1197
+ });
1198
+ } else if (duration && current.opts.transitionEffect) {
1199
+ // Set transition effect for previously active slide
1200
+ prop = "fancybox-animated fancybox-fx-" + current.opts.transitionEffect;
1201
+
1202
+ previous.$slide.addClass("fancybox-slide--" + (previous.pos > current.pos ? "next" : "previous"));
1203
+
1204
+ $.fancybox.animate(
1205
+ previous.$slide,
1206
+ prop,
1207
+ duration,
1208
+ function () {
1209
+ previous.$slide.removeClass(prop).removeClass("fancybox-slide--next fancybox-slide--previous");
1210
+ },
1211
+ false
1212
+ );
1213
+ }
1214
+
1215
+ if (current.isLoaded) {
1216
+ self.revealContent(current);
1217
+ } else {
1218
+ self.loadSlide(current);
1219
+ }
1220
+
1221
+ self.preload("image");
1222
+ },
1223
+
1224
+ // Create new "slide" element
1225
+ // These are gallery items that are actually added to DOM
1226
+ // =======================================================
1227
+
1228
+ createSlide: function (pos) {
1229
+ var self = this,
1230
+ $slide,
1231
+ index;
1232
+
1233
+ index = pos % self.group.length;
1234
+ index = index < 0 ? self.group.length + index : index;
1235
+
1236
+ if (!self.slides[pos] && self.group[index]) {
1237
+ $slide = $('<div class="fancybox-slide"></div>').appendTo(self.$refs.stage);
1238
+
1239
+ self.slides[pos] = $.extend(true, {}, self.group[index], {
1240
+ pos: pos,
1241
+ $slide: $slide,
1242
+ isLoaded: false
1243
+ });
1244
+
1245
+ self.updateSlide(self.slides[pos]);
1246
+ }
1247
+
1248
+ return self.slides[pos];
1249
+ },
1250
+
1251
+ // Scale image to the actual size of the image;
1252
+ // x and y values should be relative to the slide
1253
+ // ==============================================
1254
+
1255
+ scaleToActual: function (x, y, duration) {
1256
+ var self = this,
1257
+ current = self.current,
1258
+ $content = current.$content,
1259
+ canvasWidth = $.fancybox.getTranslate(current.$slide).width,
1260
+ canvasHeight = $.fancybox.getTranslate(current.$slide).height,
1261
+ newImgWidth = current.width,
1262
+ newImgHeight = current.height,
1263
+ imgPos,
1264
+ posX,
1265
+ posY,
1266
+ scaleX,
1267
+ scaleY;
1268
+
1269
+ if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" && current.isLoaded && !current.hasError)) {
1270
+ return;
1271
+ }
1272
+
1273
+ self.isAnimating = true;
1274
+
1275
+ $.fancybox.stop($content);
1276
+
1277
+ x = x === undefined ? canvasWidth * 0.5 : x;
1278
+ y = y === undefined ? canvasHeight * 0.5 : y;
1279
+
1280
+ imgPos = $.fancybox.getTranslate($content);
1281
+
1282
+ imgPos.top -= $.fancybox.getTranslate(current.$slide).top;
1283
+ imgPos.left -= $.fancybox.getTranslate(current.$slide).left;
1284
+
1285
+ scaleX = newImgWidth / imgPos.width;
1286
+ scaleY = newImgHeight / imgPos.height;
1287
+
1288
+ // Get center position for original image
1289
+ posX = canvasWidth * 0.5 - newImgWidth * 0.5;
1290
+ posY = canvasHeight * 0.5 - newImgHeight * 0.5;
1291
+
1292
+ // Make sure image does not move away from edges
1293
+ if (newImgWidth > canvasWidth) {
1294
+ posX = imgPos.left * scaleX - (x * scaleX - x);
1295
+
1296
+ if (posX > 0) {
1297
+ posX = 0;
1298
+ }
1299
+
1300
+ if (posX < canvasWidth - newImgWidth) {
1301
+ posX = canvasWidth - newImgWidth;
1302
+ }
1303
+ }
1304
+
1305
+ if (newImgHeight > canvasHeight) {
1306
+ posY = imgPos.top * scaleY - (y * scaleY - y);
1307
+
1308
+ if (posY > 0) {
1309
+ posY = 0;
1310
+ }
1311
+
1312
+ if (posY < canvasHeight - newImgHeight) {
1313
+ posY = canvasHeight - newImgHeight;
1314
+ }
1315
+ }
1316
+
1317
+ self.updateCursor(newImgWidth, newImgHeight);
1318
+
1319
+ $.fancybox.animate(
1320
+ $content, {
1321
+ top: posY,
1322
+ left: posX,
1323
+ scaleX: scaleX,
1324
+ scaleY: scaleY
1325
+ },
1326
+ duration || 366,
1327
+ function () {
1328
+ self.isAnimating = false;
1329
+ }
1330
+ );
1331
+
1332
+ // Stop slideshow
1333
+ if (self.SlideShow && self.SlideShow.isActive) {
1334
+ self.SlideShow.stop();
1335
+ }
1336
+ },
1337
+
1338
+ // Scale image to fit inside parent element
1339
+ // ========================================
1340
+
1341
+ scaleToFit: function (duration) {
1342
+ var self = this,
1343
+ current = self.current,
1344
+ $content = current.$content,
1345
+ end;
1346
+
1347
+ if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" && current.isLoaded && !current.hasError)) {
1348
+ return;
1349
+ }
1350
+
1351
+ self.isAnimating = true;
1352
+
1353
+ $.fancybox.stop($content);
1354
+
1355
+ end = self.getFitPos(current);
1356
+
1357
+ self.updateCursor(end.width, end.height);
1358
+
1359
+ $.fancybox.animate(
1360
+ $content, {
1361
+ top: end.top,
1362
+ left: end.left,
1363
+ scaleX: end.width / $content.width(),
1364
+ scaleY: end.height / $content.height()
1365
+ },
1366
+ duration || 366,
1367
+ function () {
1368
+ self.isAnimating = false;
1369
+ }
1370
+ );
1371
+ },
1372
+
1373
+ // Calculate image size to fit inside viewport
1374
+ // ===========================================
1375
+
1376
+ getFitPos: function (slide) {
1377
+ var self = this,
1378
+ $content = slide.$content,
1379
+ $slide = slide.$slide,
1380
+ width = slide.width || slide.opts.width,
1381
+ height = slide.height || slide.opts.height,
1382
+ maxWidth,
1383
+ maxHeight,
1384
+ minRatio,
1385
+ aspectRatio,
1386
+ rez = {};
1387
+
1388
+ if (!slide.isLoaded || !$content || !$content.length) {
1389
+ return false;
1390
+ }
1391
+
1392
+ maxWidth = $.fancybox.getTranslate(self.$refs.stage).width;
1393
+ maxHeight = $.fancybox.getTranslate(self.$refs.stage).height;
1394
+
1395
+ maxWidth -=
1396
+ parseFloat($slide.css("paddingLeft")) +
1397
+ parseFloat($slide.css("paddingRight")) +
1398
+ parseFloat($content.css("marginLeft")) +
1399
+ parseFloat($content.css("marginRight"));
1400
+
1401
+ maxHeight -=
1402
+ parseFloat($slide.css("paddingTop")) +
1403
+ parseFloat($slide.css("paddingBottom")) +
1404
+ parseFloat($content.css("marginTop")) +
1405
+ parseFloat($content.css("marginBottom"));
1406
+
1407
+ if (!width || !height) {
1408
+ width = maxWidth;
1409
+ height = maxHeight;
1410
+ }
1411
+
1412
+ minRatio = Math.min(1, maxWidth / width, maxHeight / height);
1413
+
1414
+ width = minRatio * width;
1415
+ height = minRatio * height;
1416
+
1417
+ // Adjust width/height to precisely fit into container
1418
+ if (width > maxWidth - 0.5) {
1419
+ width = maxWidth;
1420
+ }
1421
+
1422
+ if (height > maxHeight - 0.5) {
1423
+ height = maxHeight;
1424
+ }
1425
+
1426
+ if (slide.type === "image") {
1427
+ rez.top = Math.floor((maxHeight - height) * 0.5) + parseFloat($slide.css("paddingTop"));
1428
+ rez.left = Math.floor((maxWidth - width) * 0.5) + parseFloat($slide.css("paddingLeft"));
1429
+ } else if (slide.contentType === "video") {
1430
+ // Force aspect ratio for the video
1431
+ // "I say the whole world must learn of our peaceful ways… by force!"
1432
+ aspectRatio = slide.opts.width && slide.opts.height ? width / height : slide.opts.ratio || 16 / 9;
1433
+
1434
+ if (height > width / aspectRatio) {
1435
+ height = width / aspectRatio;
1436
+ } else if (width > height * aspectRatio) {
1437
+ width = height * aspectRatio;
1438
+ }
1439
+ }
1440
+
1441
+ rez.width = width;
1442
+ rez.height = height;
1443
+
1444
+ return rez;
1445
+ },
1446
+
1447
+ // Update content size and position for all slides
1448
+ // ==============================================
1449
+
1450
+ update: function (e) {
1451
+ var self = this;
1452
+
1453
+ $.each(self.slides, function (key, slide) {
1454
+ self.updateSlide(slide, e);
1455
+ });
1456
+ },
1457
+
1458
+ // Update slide content position and size
1459
+ // ======================================
1460
+
1461
+ updateSlide: function (slide, e) {
1462
+ var self = this,
1463
+ $content = slide && slide.$content,
1464
+ width = slide.width || slide.opts.width,
1465
+ height = slide.height || slide.opts.height,
1466
+ $slide = slide.$slide;
1467
+
1468
+ // First, prevent caption overlap, if needed
1469
+ self.adjustCaption(slide);
1470
+
1471
+ // Then resize content to fit inside the slide
1472
+ if ($content && (width || height || slide.contentType === "video") && !slide.hasError) {
1473
+ $.fancybox.stop($content);
1474
+
1475
+ $.fancybox.setTranslate($content, self.getFitPos(slide));
1476
+
1477
+ if (slide.pos === self.currPos) {
1478
+ self.isAnimating = false;
1479
+
1480
+ self.updateCursor();
1481
+ }
1482
+ }
1483
+
1484
+ // Then some adjustments
1485
+ self.adjustLayout(slide);
1486
+
1487
+ if ($slide.length) {
1488
+ $slide.trigger("refresh");
1489
+
1490
+ if (slide.pos === self.currPos) {
1491
+ self.$refs.toolbar
1492
+ .add(self.$refs.navigation.find(".fancybox-button--arrow_right"))
1493
+ .toggleClass("compensate-for-scrollbar", $slide.get(0).scrollHeight > $slide.get(0).clientHeight);
1494
+ }
1495
+ }
1496
+
1497
+ self.trigger("onUpdate", slide, e);
1498
+ },
1499
+
1500
+ // Horizontally center slide
1501
+ // =========================
1502
+
1503
+ centerSlide: function (duration) {
1504
+ var self = this,
1505
+ current = self.current,
1506
+ $slide = current.$slide;
1507
+
1508
+ if (self.isClosing || !current) {
1509
+ return;
1510
+ }
1511
+
1512
+ $slide.siblings().css({
1513
+ transform: "",
1514
+ opacity: ""
1515
+ });
1516
+
1517
+ $slide
1518
+ .parent()
1519
+ .children()
1520
+ .removeClass("fancybox-slide--previous fancybox-slide--next");
1521
+
1522
+ $.fancybox.animate(
1523
+ $slide, {
1524
+ top: 0,
1525
+ left: 0,
1526
+ opacity: 1
1527
+ },
1528
+ duration === undefined ? 0 : duration,
1529
+ function () {
1530
+ // Clean up
1531
+ $slide.css({
1532
+ transform: "",
1533
+ opacity: ""
1534
+ });
1535
+
1536
+ if (!current.isComplete) {
1537
+ self.complete();
1538
+ }
1539
+ },
1540
+ false
1541
+ );
1542
+ },
1543
+
1544
+ // Check if current slide is moved (swiped)
1545
+ // ========================================
1546
+
1547
+ isMoved: function (slide) {
1548
+ var current = slide || this.current,
1549
+ slidePos,
1550
+ stagePos;
1551
+
1552
+ if (!current) {
1553
+ return false;
1554
+ }
1555
+
1556
+ stagePos = $.fancybox.getTranslate(this.$refs.stage);
1557
+ slidePos = $.fancybox.getTranslate(current.$slide);
1558
+
1559
+ return (
1560
+ !current.$slide.hasClass("fancybox-animated") &&
1561
+ (Math.abs(slidePos.top - stagePos.top) > 0.5 || Math.abs(slidePos.left - stagePos.left) > 0.5)
1562
+ );
1563
+ },
1564
+
1565
+ // Update cursor style depending if content can be zoomed
1566
+ // ======================================================
1567
+
1568
+ updateCursor: function (nextWidth, nextHeight) {
1569
+ var self = this,
1570
+ current = self.current,
1571
+ $container = self.$refs.container,
1572
+ canPan,
1573
+ isZoomable;
1574
+
1575
+ if (!current || self.isClosing || !self.Guestures) {
1576
+ return;
1577
+ }
1578
+
1579
+ $container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan");
1580
+
1581
+ canPan = self.canPan(nextWidth, nextHeight);
1582
+
1583
+ isZoomable = canPan ? true : self.isZoomable();
1584
+
1585
+ $container.toggleClass("fancybox-is-zoomable", isZoomable);
1586
+
1587
+ $("[data-fancybox-zoom]").prop("disabled", !isZoomable);
1588
+
1589
+ if (canPan) {
1590
+ $container.addClass("fancybox-can-pan");
1591
+ } else if (
1592
+ isZoomable &&
1593
+ (current.opts.clickContent === "zoom" || ($.isFunction(current.opts.clickContent) && current.opts.clickContent(current) == "zoom"))
1594
+ ) {
1595
+ $container.addClass("fancybox-can-zoomIn");
1596
+ } else if (current.opts.touch && (current.opts.touch.vertical || self.group.length > 1) && current.contentType !== "video") {
1597
+ $container.addClass("fancybox-can-swipe");
1598
+ }
1599
+ },
1600
+
1601
+ // Check if current slide is zoomable
1602
+ // ==================================
1603
+
1604
+ isZoomable: function () {
1605
+ var self = this,
1606
+ current = self.current,
1607
+ fitPos;
1608
+
1609
+ // Assume that slide is zoomable if:
1610
+ // - image is still loading
1611
+ // - actual size of the image is smaller than available area
1612
+ if (current && !self.isClosing && current.type === "image" && !current.hasError) {
1613
+ if (!current.isLoaded) {
1614
+ return true;
1615
+ }
1616
+
1617
+ fitPos = self.getFitPos(current);
1618
+
1619
+ if (fitPos && (current.width > fitPos.width || current.height > fitPos.height)) {
1620
+ return true;
1621
+ }
1622
+ }
1623
+
1624
+ return false;
1625
+ },
1626
+
1627
+ // Check if current image dimensions are smaller than actual
1628
+ // =========================================================
1629
+
1630
+ isScaledDown: function (nextWidth, nextHeight) {
1631
+ var self = this,
1632
+ rez = false,
1633
+ current = self.current,
1634
+ $content = current.$content;
1635
+
1636
+ if (nextWidth !== undefined && nextHeight !== undefined) {
1637
+ rez = nextWidth < current.width && nextHeight < current.height;
1638
+ } else if ($content) {
1639
+ rez = $.fancybox.getTranslate($content);
1640
+ rez = rez.width < current.width && rez.height < current.height;
1641
+ }
1642
+
1643
+ return rez;
1644
+ },
1645
+
1646
+ // Check if image dimensions exceed parent element
1647
+ // ===============================================
1648
+
1649
+ canPan: function (nextWidth, nextHeight) {
1650
+ var self = this,
1651
+ current = self.current,
1652
+ pos = null,
1653
+ rez = false;
1654
+
1655
+ if (current.type === "image" && (current.isComplete || (nextWidth && nextHeight)) && !current.hasError) {
1656
+ rez = self.getFitPos(current);
1657
+
1658
+ if (nextWidth !== undefined && nextHeight !== undefined) {
1659
+ pos = {
1660
+ width: nextWidth,
1661
+ height: nextHeight
1662
+ };
1663
+ } else if (current.isComplete) {
1664
+ pos = $.fancybox.getTranslate(current.$content);
1665
+ }
1666
+
1667
+ if (pos && rez) {
1668
+ rez = Math.abs(pos.width - rez.width) > 1.5 || Math.abs(pos.height - rez.height) > 1.5;
1669
+ }
1670
+ }
1671
+
1672
+ return rez;
1673
+ },
1674
+
1675
+ // Load content into the slide
1676
+ // ===========================
1677
+
1678
+ loadSlide: function (slide) {
1679
+ var self = this,
1680
+ type,
1681
+ $slide,
1682
+ ajaxLoad;
1683
+
1684
+ if (slide.isLoading || slide.isLoaded) {
1685
+ return;
1686
+ }
1687
+
1688
+ slide.isLoading = true;
1689
+
1690
+ if (self.trigger("beforeLoad", slide) === false) {
1691
+ slide.isLoading = false;
1692
+
1693
+ return false;
1694
+ }
1695
+
1696
+ type = slide.type;
1697
+ $slide = slide.$slide;
1698
+
1699
+ $slide
1700
+ .off("refresh")
1701
+ .trigger("onReset")
1702
+ .addClass(slide.opts.slideClass);
1703
+
1704
+ // Create content depending on the type
1705
+ switch (type) {
1706
+ case "image":
1707
+ self.setImage(slide);
1708
+
1709
+ break;
1710
+
1711
+ case "iframe":
1712
+ self.setIframe(slide);
1713
+
1714
+ break;
1715
+
1716
+ case "html":
1717
+ self.setContent(slide, slide.src || slide.content);
1718
+
1719
+ break;
1720
+
1721
+ case "video":
1722
+ self.setContent(
1723
+ slide,
1724
+ slide.opts.video.tpl
1725
+ .replace(/\{\{src\}\}/gi, slide.src)
1726
+ .replace("{{format}}", slide.opts.videoFormat || slide.opts.video.format || "")
1727
+ .replace("{{poster}}", slide.thumb || "")
1728
+ );
1729
+
1730
+ break;
1731
+
1732
+ case "inline":
1733
+ if ($(slide.src).length) {
1734
+ self.setContent(slide, $(slide.src));
1735
+ } else {
1736
+ self.setError(slide);
1737
+ }
1738
+
1739
+ break;
1740
+
1741
+ case "ajax":
1742
+ self.showLoading(slide);
1743
+
1744
+ ajaxLoad = $.ajax(
1745
+ $.extend({}, slide.opts.ajax.settings, {
1746
+ url: slide.src,
1747
+ success: function (data, textStatus) {
1748
+ if (textStatus === "success") {
1749
+ self.setContent(slide, data);
1750
+ }
1751
+ },
1752
+ error: function (jqXHR, textStatus) {
1753
+ if (jqXHR && textStatus !== "abort") {
1754
+ self.setError(slide);
1755
+ }
1756
+ }
1757
+ })
1758
+ );
1759
+
1760
+ $slide.one("onReset", function () {
1761
+ ajaxLoad.abort();
1762
+ });
1763
+
1764
+ break;
1765
+
1766
+ default:
1767
+ self.setError(slide);
1768
+
1769
+ break;
1770
+ }
1771
+
1772
+ return true;
1773
+ },
1774
+
1775
+ // Use thumbnail image, if possible
1776
+ // ================================
1777
+
1778
+ setImage: function (slide) {
1779
+ var self = this,
1780
+ ghost;
1781
+
1782
+ // Check if need to show loading icon
1783
+ setTimeout(function () {
1784
+ var $img = slide.$image;
1785
+
1786
+ if (!self.isClosing && slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) {
1787
+ self.showLoading(slide);
1788
+ }
1789
+ }, 50);
1790
+
1791
+ //Check if image has srcset
1792
+ self.checkSrcset(slide);
1793
+
1794
+ // This will be wrapper containing both ghost and actual image
1795
+ slide.$content = $('<div class="fancybox-content"></div>')
1796
+ .addClass("fancybox-is-hidden")
1797
+ .appendTo(slide.$slide.addClass("fancybox-slide--image"));
1798
+
1799
+ // If we have a thumbnail, we can display it while actual image is loading
1800
+ // Users will not stare at black screen and actual image will appear gradually
1801
+ if (slide.opts.preload !== false && slide.opts.width && slide.opts.height && slide.thumb) {
1802
+ slide.width = slide.opts.width;
1803
+ slide.height = slide.opts.height;
1804
+
1805
+ ghost = document.createElement("img");
1806
+
1807
+ ghost.onerror = function () {
1808
+ $(this).remove();
1809
+
1810
+ slide.$ghost = null;
1811
+ };
1812
+
1813
+ ghost.onload = function () {
1814
+ self.afterLoad(slide);
1815
+ };
1816
+
1817
+ slide.$ghost = $(ghost)
1818
+ .addClass("fancybox-image")
1819
+ .appendTo(slide.$content)
1820
+ .attr("src", slide.thumb);
1821
+ }
1822
+
1823
+ // Start loading actual image
1824
+ self.setBigImage(slide);
1825
+ },
1826
+
1827
+ // Check if image has srcset and get the source
1828
+ // ============================================
1829
+ checkSrcset: function (slide) {
1830
+ var srcset = slide.opts.srcset || slide.opts.image.srcset,
1831
+ found,
1832
+ temp,
1833
+ pxRatio,
1834
+ windowWidth;
1835
+
1836
+ // If we have "srcset", then we need to find first matching "src" value.
1837
+ // This is necessary, because when you set an src attribute, the browser will preload the image
1838
+ // before any javascript or even CSS is applied.
1839
+ if (srcset) {
1840
+ pxRatio = window.devicePixelRatio || 1;
1841
+ windowWidth = window.innerWidth * pxRatio;
1842
+
1843
+ temp = srcset.split(",").map(function (el) {
1844
+ var ret = {};
1845
+
1846
+ el.trim()
1847
+ .split(/\s+/)
1848
+ .forEach(function (el, i) {
1849
+ var value = parseInt(el.substring(0, el.length - 1), 10);
1850
+
1851
+ if (i === 0) {
1852
+ return (ret.url = el);
1853
+ }
1854
+
1855
+ if (value) {
1856
+ ret.value = value;
1857
+ ret.postfix = el[el.length - 1];
1858
+ }
1859
+ });
1860
+
1861
+ return ret;
1862
+ });
1863
+
1864
+ // Sort by value
1865
+ temp.sort(function (a, b) {
1866
+ return a.value - b.value;
1867
+ });
1868
+
1869
+ // Ok, now we have an array of all srcset values
1870
+ for (var j = 0; j < temp.length; j++) {
1871
+ var el = temp[j];
1872
+
1873
+ if ((el.postfix === "w" && el.value >= windowWidth) || (el.postfix === "x" && el.value >= pxRatio)) {
1874
+ found = el;
1875
+ break;
1876
+ }
1877
+ }
1878
+
1879
+ // If not found, take the last one
1880
+ if (!found && temp.length) {
1881
+ found = temp[temp.length - 1];
1882
+ }
1883
+
1884
+ if (found) {
1885
+ slide.src = found.url;
1886
+
1887
+ // If we have default width/height values, we can calculate height for matching source
1888
+ if (slide.width && slide.height && found.postfix == "w") {
1889
+ slide.height = (slide.width / slide.height) * found.value;
1890
+ slide.width = found.value;
1891
+ }
1892
+
1893
+ slide.opts.srcset = srcset;
1894
+ }
1895
+ }
1896
+ },
1897
+
1898
+ // Create full-size image
1899
+ // ======================
1900
+
1901
+ setBigImage: function (slide) {
1902
+ var self = this,
1903
+ img = document.createElement("img"),
1904
+ $img = $(img);
1905
+
1906
+ slide.$image = $img
1907
+ .one("error", function () {
1908
+ self.setError(slide);
1909
+ })
1910
+ .one("load", function () {
1911
+ var sizes;
1912
+
1913
+ if (!slide.$ghost) {
1914
+ self.resolveImageSlideSize(slide, this.naturalWidth, this.naturalHeight);
1915
+
1916
+ self.afterLoad(slide);
1917
+ }
1918
+
1919
+ if (self.isClosing) {
1920
+ return;
1921
+ }
1922
+
1923
+ if (slide.opts.srcset) {
1924
+ sizes = slide.opts.sizes;
1925
+
1926
+ if (!sizes || sizes === "auto") {
1927
+ sizes =
1928
+ (slide.width / slide.height > 1 && $W.width() / $W.height() > 1 ? "100" : Math.round((slide.width / slide.height) * 100)) +
1929
+ "vw";
1930
+ }
1931
+
1932
+ $img.attr("sizes", sizes).attr("srcset", slide.opts.srcset);
1933
+ }
1934
+
1935
+ // Hide temporary image after some delay
1936
+ if (slide.$ghost) {
1937
+ setTimeout(function () {
1938
+ if (slide.$ghost && !self.isClosing) {
1939
+ slide.$ghost.hide();
1940
+ }
1941
+ }, Math.min(300, Math.max(1000, slide.height / 1600)));
1942
+ }
1943
+
1944
+ self.hideLoading(slide);
1945
+ })
1946
+ .addClass("fancybox-image")
1947
+ .attr("src", slide.src)
1948
+ .appendTo(slide.$content);
1949
+
1950
+ if ((img.complete || img.readyState == "complete") && $img.naturalWidth && $img.naturalHeight) {
1951
+ $img.trigger("load");
1952
+ } else if (img.error) {
1953
+ $img.trigger("error");
1954
+ }
1955
+ },
1956
+
1957
+ // Computes the slide size from image size and maxWidth/maxHeight
1958
+ // ==============================================================
1959
+
1960
+ resolveImageSlideSize: function (slide, imgWidth, imgHeight) {
1961
+ var maxWidth = parseInt(slide.opts.width, 10),
1962
+ maxHeight = parseInt(slide.opts.height, 10);
1963
+
1964
+ // Sets the default values from the image
1965
+ slide.width = imgWidth;
1966
+ slide.height = imgHeight;
1967
+
1968
+ if (maxWidth > 0) {
1969
+ slide.width = maxWidth;
1970
+ slide.height = Math.floor((maxWidth * imgHeight) / imgWidth);
1971
+ }
1972
+
1973
+ if (maxHeight > 0) {
1974
+ slide.width = Math.floor((maxHeight * imgWidth) / imgHeight);
1975
+ slide.height = maxHeight;
1976
+ }
1977
+ },
1978
+
1979
+ // Create iframe wrapper, iframe and bindings
1980
+ // ==========================================
1981
+
1982
+ setIframe: function (slide) {
1983
+ var self = this,
1984
+ opts = slide.opts.iframe,
1985
+ $slide = slide.$slide,
1986
+ $iframe;
1987
+
1988
+ slide.$content = $('<div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden" : "") + '"></div>')
1989
+ .css(opts.css)
1990
+ .appendTo($slide);
1991
+
1992
+ $slide.addClass("fancybox-slide--" + slide.contentType);
1993
+
1994
+ slide.$iframe = $iframe = $(opts.tpl.replace(/\{rnd\}/g, new Date().getTime()))
1995
+ .attr(opts.attr)
1996
+ .appendTo(slide.$content);
1997
+
1998
+ if (opts.preload) {
1999
+ self.showLoading(slide);
2000
+
2001
+ // Unfortunately, it is not always possible to determine if iframe is successfully loaded
2002
+ // (due to browser security policy)
2003
+
2004
+ $iframe.on("load.fb error.fb", function (e) {
2005
+ this.isReady = 1;
2006
+
2007
+ slide.$slide.trigger("refresh");
2008
+
2009
+ self.afterLoad(slide);
2010
+ });
2011
+
2012
+ // Recalculate iframe content size
2013
+ // ===============================
2014
+
2015
+ $slide.on("refresh.fb", function () {
2016
+ var $content = slide.$content,
2017
+ frameWidth = opts.css.width,
2018
+ frameHeight = opts.css.height,
2019
+ $contents,
2020
+ $body;
2021
+
2022
+ if ($iframe[0].isReady !== 1) {
2023
+ return;
2024
+ }
2025
+
2026
+ try {
2027
+ $contents = $iframe.contents();
2028
+ $body = $contents.find("body");
2029
+ } catch (ignore) {}
2030
+
2031
+ // Calculate content dimensions, if it is accessible
2032
+ if ($body && $body.length && $body.children().length) {
2033
+ // Avoid scrolling to top (if multiple instances)
2034
+ $slide.css("overflow", "visible");
2035
+
2036
+ $content.css({
2037
+ width: "100%",
2038
+ "max-width": "100%",
2039
+ height: "9999px"
2040
+ });
2041
+
2042
+ if (frameWidth === undefined) {
2043
+ frameWidth = Math.ceil(Math.max($body[0].clientWidth, $body.outerWidth(true)));
2044
+ }
2045
+
2046
+ $content.css("width", frameWidth ? frameWidth : "").css("max-width", "");
2047
+
2048
+ if (frameHeight === undefined) {
2049
+ frameHeight = Math.ceil(Math.max($body[0].clientHeight, $body.outerHeight(true)));
2050
+ }
2051
+
2052
+ $content.css("height", frameHeight ? frameHeight : "");
2053
+
2054
+ $slide.css("overflow", "auto");
2055
+ }
2056
+
2057
+ $content.removeClass("fancybox-is-hidden");
2058
+ });
2059
+ } else {
2060
+ self.afterLoad(slide);
2061
+ }
2062
+
2063
+ $iframe.attr("src", slide.src);
2064
+
2065
+ // Remove iframe if closing or changing gallery item
2066
+ $slide.one("onReset", function () {
2067
+ // This helps IE not to throw errors when closing
2068
+ try {
2069
+ $(this)
2070
+ .find("iframe")
2071
+ .hide()
2072
+ .unbind()
2073
+ .attr("src", "//about:blank");
2074
+ } catch (ignore) {}
2075
+
2076
+ $(this)
2077
+ .off("refresh.fb")
2078
+ .empty();
2079
+
2080
+ slide.isLoaded = false;
2081
+ slide.isRevealed = false;
2082
+ });
2083
+ },
2084
+
2085
+ // Wrap and append content to the slide
2086
+ // ======================================
2087
+
2088
+ setContent: function (slide, content) {
2089
+ var self = this;
2090
+
2091
+ if (self.isClosing) {
2092
+ return;
2093
+ }
2094
+
2095
+ self.hideLoading(slide);
2096
+
2097
+ if (slide.$content) {
2098
+ $.fancybox.stop(slide.$content);
2099
+ }
2100
+
2101
+ slide.$slide.empty();
2102
+
2103
+ // If content is a jQuery object, then it will be moved to the slide.
2104
+ // The placeholder is created so we will know where to put it back.
2105
+ if (isQuery(content) && content.parent().length) {
2106
+ // Make sure content is not already moved to fancyBox
2107
+ if (content.hasClass("fancybox-content") || content.parent().hasClass("fancybox-content")) {
2108
+ content.parents(".fancybox-slide").trigger("onReset");
2109
+ }
2110
+
2111
+ // Create temporary element marking original place of the content
2112
+ slide.$placeholder = $("<div>")
2113
+ .hide()
2114
+ .insertAfter(content);
2115
+
2116
+ // Make sure content is visible
2117
+ content.css("display", "inline-block");
2118
+ } else if (!slide.hasError) {
2119
+ // If content is just a plain text, try to convert it to html
2120
+ if ($.type(content) === "string") {
2121
+ content = $("<div>")
2122
+ .append($.trim(content))
2123
+ .contents();
2124
+ }
2125
+
2126
+ // If "filter" option is provided, then filter content
2127
+ if (slide.opts.filter) {
2128
+ content = $("<div>")
2129
+ .html(content)
2130
+ .find(slide.opts.filter);
2131
+ }
2132
+ }
2133
+
2134
+ slide.$slide.one("onReset", function () {
2135
+ // Pause all html5 video/audio
2136
+ $(this)
2137
+ .find("video,audio")
2138
+ .trigger("pause");
2139
+
2140
+ // Put content back
2141
+ if (slide.$placeholder) {
2142
+ slide.$placeholder.after(content.removeClass("fancybox-content").hide()).remove();
2143
+
2144
+ slide.$placeholder = null;
2145
+ }
2146
+
2147
+ // Remove custom close button
2148
+ if (slide.$smallBtn) {
2149
+ slide.$smallBtn.remove();
2150
+
2151
+ slide.$smallBtn = null;
2152
+ }
2153
+
2154
+ // Remove content and mark slide as not loaded
2155
+ if (!slide.hasError) {
2156
+ $(this).empty();
2157
+
2158
+ slide.isLoaded = false;
2159
+ slide.isRevealed = false;
2160
+ }
2161
+ });
2162
+
2163
+ $(content).appendTo(slide.$slide);
2164
+
2165
+ if ($(content).is("video,audio")) {
2166
+ $(content).addClass("fancybox-video");
2167
+
2168
+ $(content).wrap("<div></div>");
2169
+
2170
+ slide.contentType = "video";
2171
+
2172
+ slide.opts.width = slide.opts.width || $(content).attr("width");
2173
+ slide.opts.height = slide.opts.height || $(content).attr("height");
2174
+ }
2175
+
2176
+ slide.$content = slide.$slide
2177
+ .children()
2178
+ .filter("div,form,main,video,audio,article,.fancybox-content")
2179
+ .first();
2180
+
2181
+ slide.$content.siblings().hide();
2182
+
2183
+ // Re-check if there is a valid content
2184
+ // (in some cases, ajax response can contain various elements or plain text)
2185
+ if (!slide.$content.length) {
2186
+ slide.$content = slide.$slide
2187
+ .wrapInner("<div></div>")
2188
+ .children()
2189
+ .first();
2190
+ }
2191
+
2192
+ slide.$content.addClass("fancybox-content");
2193
+
2194
+ slide.$slide.addClass("fancybox-slide--" + slide.contentType);
2195
+
2196
+ self.afterLoad(slide);
2197
+ },
2198
+
2199
+ // Display error message
2200
+ // =====================
2201
+
2202
+ setError: function (slide) {
2203
+ slide.hasError = true;
2204
+
2205
+ slide.$slide
2206
+ .trigger("onReset")
2207
+ .removeClass("fancybox-slide--" + slide.contentType)
2208
+ .addClass("fancybox-slide--error");
2209
+
2210
+ slide.contentType = "html";
2211
+
2212
+ this.setContent(slide, this.translate(slide, slide.opts.errorTpl));
2213
+
2214
+ if (slide.pos === this.currPos) {
2215
+ this.isAnimating = false;
2216
+ }
2217
+ },
2218
+
2219
+ // Show loading icon inside the slide
2220
+ // ==================================
2221
+
2222
+ showLoading: function (slide) {
2223
+ var self = this;
2224
+
2225
+ slide = slide || self.current;
2226
+
2227
+ if (slide && !slide.$spinner) {
2228
+ slide.$spinner = $(self.translate(self, self.opts.spinnerTpl))
2229
+ .appendTo(slide.$slide)
2230
+ .hide()
2231
+ .fadeIn("fast");
2232
+ }
2233
+ },
2234
+
2235
+ // Remove loading icon from the slide
2236
+ // ==================================
2237
+
2238
+ hideLoading: function (slide) {
2239
+ var self = this;
2240
+
2241
+ slide = slide || self.current;
2242
+
2243
+ if (slide && slide.$spinner) {
2244
+ slide.$spinner.stop().remove();
2245
+
2246
+ delete slide.$spinner;
2247
+ }
2248
+ },
2249
+
2250
+ // Adjustments after slide content has been loaded
2251
+ // ===============================================
2252
+
2253
+ afterLoad: function (slide) {
2254
+ var self = this;
2255
+
2256
+ if (self.isClosing) {
2257
+ return;
2258
+ }
2259
+
2260
+ slide.isLoading = false;
2261
+ slide.isLoaded = true;
2262
+
2263
+ self.trigger("afterLoad", slide);
2264
+
2265
+ self.hideLoading(slide);
2266
+
2267
+ // Add small close button
2268
+ if (slide.opts.smallBtn && (!slide.$smallBtn || !slide.$smallBtn.length)) {
2269
+ slide.$smallBtn = $(self.translate(slide, slide.opts.btnTpl.smallBtn)).appendTo(slide.$content);
2270
+ }
2271
+
2272
+ // Disable right click
2273
+ if (slide.opts.protect && slide.$content && !slide.hasError) {
2274
+ slide.$content.on("contextmenu.fb", function (e) {
2275
+ if (e.button == 2) {
2276
+ e.preventDefault();
2277
+ }
2278
+
2279
+ return true;
2280
+ });
2281
+
2282
+ // Add fake element on top of the image
2283
+ // This makes a bit harder for user to select image
2284
+ if (slide.type === "image") {
2285
+ $('<div class="fancybox-spaceball"></div>').appendTo(slide.$content);
2286
+ }
2287
+ }
2288
+
2289
+ self.adjustCaption(slide);
2290
+
2291
+ self.adjustLayout(slide);
2292
+
2293
+ if (slide.pos === self.currPos) {
2294
+ self.updateCursor();
2295
+ }
2296
+
2297
+ self.revealContent(slide);
2298
+ },
2299
+
2300
+ // Prevent caption overlap,
2301
+ // fix css inconsistency across browsers
2302
+ // =====================================
2303
+
2304
+ adjustCaption: function (slide) {
2305
+ var self = this,
2306
+ current = slide || self.current,
2307
+ caption = current.opts.caption,
2308
+ preventOverlap = current.opts.preventCaptionOverlap,
2309
+ $caption = self.$refs.caption,
2310
+ $clone,
2311
+ captionH = false;
2312
+
2313
+ $caption.toggleClass("fancybox-caption--separate", preventOverlap);
2314
+
2315
+ if (preventOverlap && caption && caption.length) {
2316
+ if (current.pos !== self.currPos) {
2317
+ $clone = $caption.clone().appendTo($caption.parent());
2318
+
2319
+ $clone
2320
+ .children()
2321
+ .eq(0)
2322
+ .empty()
2323
+ .html(caption);
2324
+
2325
+ captionH = $clone.outerHeight(true);
2326
+
2327
+ $clone.empty().remove();
2328
+ } else if (self.$caption) {
2329
+ captionH = self.$caption.outerHeight(true);
2330
+ }
2331
+
2332
+ current.$slide.css("padding-bottom", captionH || "");
2333
+ }
2334
+ },
2335
+
2336
+ // Simple hack to fix inconsistency across browsers, described here (affects Edge, too):
2337
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=748518
2338
+ // ====================================================================================
2339
+
2340
+ adjustLayout: function (slide) {
2341
+ var self = this,
2342
+ current = slide || self.current,
2343
+ scrollHeight,
2344
+ marginBottom,
2345
+ inlinePadding,
2346
+ actualPadding;
2347
+
2348
+ if (current.isLoaded && current.opts.disableLayoutFix !== true) {
2349
+ current.$content.css("margin-bottom", "");
2350
+
2351
+ // If we would always set margin-bottom for the content,
2352
+ // then it would potentially break vertical align
2353
+ if (current.$content.outerHeight() > current.$slide.height() + 0.5) {
2354
+ inlinePadding = current.$slide[0].style["padding-bottom"];
2355
+ actualPadding = current.$slide.css("padding-bottom");
2356
+
2357
+ if (parseFloat(actualPadding) > 0) {
2358
+ scrollHeight = current.$slide[0].scrollHeight;
2359
+
2360
+ current.$slide.css("padding-bottom", 0);
2361
+
2362
+ if (Math.abs(scrollHeight - current.$slide[0].scrollHeight) < 1) {
2363
+ marginBottom = actualPadding;
2364
+ }
2365
+
2366
+ current.$slide.css("padding-bottom", inlinePadding);
2367
+ }
2368
+ }
2369
+
2370
+ current.$content.css("margin-bottom", marginBottom);
2371
+ }
2372
+ },
2373
+
2374
+ // Make content visible
2375
+ // This method is called right after content has been loaded or
2376
+ // user navigates gallery and transition should start
2377
+ // ============================================================
2378
+
2379
+ revealContent: function (slide) {
2380
+ var self = this,
2381
+ $slide = slide.$slide,
2382
+ end = false,
2383
+ start = false,
2384
+ isMoved = self.isMoved(slide),
2385
+ isRevealed = slide.isRevealed,
2386
+ effect,
2387
+ effectClassName,
2388
+ duration,
2389
+ opacity;
2390
+
2391
+ slide.isRevealed = true;
2392
+
2393
+ effect = slide.opts[self.firstRun ? "animationEffect" : "transitionEffect"];
2394
+ duration = slide.opts[self.firstRun ? "animationDuration" : "transitionDuration"];
2395
+
2396
+ duration = parseInt(slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10);
2397
+
2398
+ if (isMoved || slide.pos !== self.currPos || !duration) {
2399
+ effect = false;
2400
+ }
2401
+
2402
+ // Check if can zoom
2403
+ if (effect === "zoom") {
2404
+ if (slide.pos === self.currPos && duration && slide.type === "image" && !slide.hasError && (start = self.getThumbPos(slide))) {
2405
+ end = self.getFitPos(slide);
2406
+ } else {
2407
+ effect = "fade";
2408
+ }
2409
+ }
2410
+
2411
+ // Zoom animation
2412
+ // ==============
2413
+ if (effect === "zoom") {
2414
+ self.isAnimating = true;
2415
+
2416
+ end.scaleX = end.width / start.width;
2417
+ end.scaleY = end.height / start.height;
2418
+
2419
+ // Check if we need to animate opacity
2420
+ opacity = slide.opts.zoomOpacity;
2421
+
2422
+ if (opacity == "auto") {
2423
+ opacity = Math.abs(slide.width / slide.height - start.width / start.height) > 0.1;
2424
+ }
2425
+
2426
+ if (opacity) {
2427
+ start.opacity = 0.1;
2428
+ end.opacity = 1;
2429
+ }
2430
+
2431
+ // Draw image at start position
2432
+ $.fancybox.setTranslate(slide.$content.removeClass("fancybox-is-hidden"), start);
2433
+
2434
+ forceRedraw(slide.$content);
2435
+
2436
+ // Start animation
2437
+ $.fancybox.animate(slide.$content, end, duration, function () {
2438
+ self.isAnimating = false;
2439
+
2440
+ self.complete();
2441
+ });
2442
+
2443
+ return;
2444
+ }
2445
+
2446
+ self.updateSlide(slide);
2447
+
2448
+ // Simply show content if no effect
2449
+ // ================================
2450
+ if (!effect) {
2451
+ slide.$content.removeClass("fancybox-is-hidden");
2452
+
2453
+ if (!isRevealed && isMoved && slide.type === "image" && !slide.hasError) {
2454
+ slide.$content.hide().fadeIn("fast");
2455
+ }
2456
+
2457
+ if (slide.pos === self.currPos) {
2458
+ self.complete();
2459
+ }
2460
+
2461
+ return;
2462
+ }
2463
+
2464
+ // Prepare for CSS transiton
2465
+ // =========================
2466
+ $.fancybox.stop($slide);
2467
+
2468
+ //effectClassName = "fancybox-animated fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-fx-" + effect;
2469
+ effectClassName = "fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-animated fancybox-fx-" + effect;
2470
+
2471
+ $slide.addClass(effectClassName).removeClass("fancybox-slide--current"); //.addClass(effectClassName);
2472
+
2473
+ slide.$content.removeClass("fancybox-is-hidden");
2474
+
2475
+ // Force reflow
2476
+ forceRedraw($slide);
2477
+
2478
+ if (slide.type !== "image") {
2479
+ slide.$content.hide().show(0);
2480
+ }
2481
+
2482
+ $.fancybox.animate(
2483
+ $slide,
2484
+ "fancybox-slide--current",
2485
+ duration,
2486
+ function () {
2487
+ $slide.removeClass(effectClassName).css({
2488
+ transform: "",
2489
+ opacity: ""
2490
+ });
2491
+
2492
+ if (slide.pos === self.currPos) {
2493
+ self.complete();
2494
+ }
2495
+ },
2496
+ true
2497
+ );
2498
+ },
2499
+
2500
+ // Check if we can and have to zoom from thumbnail
2501
+ //================================================
2502
+
2503
+ getThumbPos: function (slide) {
2504
+ var rez = false,
2505
+ $thumb = slide.$thumb,
2506
+ thumbPos,
2507
+ btw,
2508
+ brw,
2509
+ bbw,
2510
+ blw;
2511
+
2512
+ if (!$thumb || !inViewport($thumb[0])) {
2513
+ return false;
2514
+ }
2515
+
2516
+ thumbPos = $.fancybox.getTranslate($thumb);
2517
+
2518
+ btw = parseFloat($thumb.css("border-top-width") || 0);
2519
+ brw = parseFloat($thumb.css("border-right-width") || 0);
2520
+ bbw = parseFloat($thumb.css("border-bottom-width") || 0);
2521
+ blw = parseFloat($thumb.css("border-left-width") || 0);
2522
+
2523
+ rez = {
2524
+ top: thumbPos.top + btw,
2525
+ left: thumbPos.left + blw,
2526
+ width: thumbPos.width - brw - blw,
2527
+ height: thumbPos.height - btw - bbw,
2528
+ scaleX: 1,
2529
+ scaleY: 1
2530
+ };
2531
+
2532
+ return thumbPos.width > 0 && thumbPos.height > 0 ? rez : false;
2533
+ },
2534
+
2535
+ // Final adjustments after current gallery item is moved to position
2536
+ // and it`s content is loaded
2537
+ // ==================================================================
2538
+
2539
+ complete: function () {
2540
+ var self = this,
2541
+ current = self.current,
2542
+ slides = {},
2543
+ $el;
2544
+
2545
+ if (self.isMoved() || !current.isLoaded) {
2546
+ return;
2547
+ }
2548
+
2549
+ if (!current.isComplete) {
2550
+ current.isComplete = true;
2551
+
2552
+ current.$slide.siblings().trigger("onReset");
2553
+
2554
+ self.preload("inline");
2555
+
2556
+ // Trigger any CSS transiton inside the slide
2557
+ forceRedraw(current.$slide);
2558
+
2559
+ current.$slide.addClass("fancybox-slide--complete");
2560
+
2561
+ // Remove unnecessary slides
2562
+ $.each(self.slides, function (key, slide) {
2563
+ if (slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1) {
2564
+ slides[slide.pos] = slide;
2565
+ } else if (slide) {
2566
+ $.fancybox.stop(slide.$slide);
2567
+
2568
+ slide.$slide.off().remove();
2569
+ }
2570
+ });
2571
+
2572
+ self.slides = slides;
2573
+ }
2574
+
2575
+ self.isAnimating = false;
2576
+
2577
+ self.updateCursor();
2578
+
2579
+ self.trigger("afterShow");
2580
+
2581
+ // Autoplay first html5 video/audio
2582
+ if (!!current.opts.video.autoStart) {
2583
+ current.$slide
2584
+ .find("video,audio")
2585
+ .filter(":visible:first")
2586
+ .trigger("play")
2587
+ .one("ended", function () {
2588
+ if (Document.exitFullscreen) {
2589
+ Document.exitFullscreen();
2590
+ } else if (this.webkitExitFullscreen) {
2591
+ this.webkitExitFullscreen();
2592
+ }
2593
+
2594
+ self.next();
2595
+ });
2596
+ }
2597
+
2598
+ // Try to focus on the first focusable element
2599
+ if (current.opts.autoFocus && current.contentType === "html") {
2600
+ // Look for the first input with autofocus attribute
2601
+ $el = current.$content.find("input[autofocus]:enabled:visible:first");
2602
+
2603
+ if ($el.length) {
2604
+ $el.trigger("focus");
2605
+ } else {
2606
+ self.focus(null, true);
2607
+ }
2608
+ }
2609
+
2610
+ // Avoid jumping
2611
+ current.$slide.scrollTop(0).scrollLeft(0);
2612
+ },
2613
+
2614
+ // Preload next and previous slides
2615
+ // ================================
2616
+
2617
+ preload: function (type) {
2618
+ var self = this,
2619
+ prev,
2620
+ next;
2621
+
2622
+ if (self.group.length < 2) {
2623
+ return;
2624
+ }
2625
+
2626
+ next = self.slides[self.currPos + 1];
2627
+ prev = self.slides[self.currPos - 1];
2628
+
2629
+ if (prev && prev.type === type) {
2630
+ self.loadSlide(prev);
2631
+ }
2632
+
2633
+ if (next && next.type === type) {
2634
+ self.loadSlide(next);
2635
+ }
2636
+ },
2637
+
2638
+ // Try to find and focus on the first focusable element
2639
+ // ====================================================
2640
+
2641
+ focus: function (e, firstRun) {
2642
+ var self = this,
2643
+ focusableStr = [
2644
+ "a[href]",
2645
+ "area[href]",
2646
+ 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
2647
+ "select:not([disabled]):not([aria-hidden])",
2648
+ "textarea:not([disabled]):not([aria-hidden])",
2649
+ "button:not([disabled]):not([aria-hidden])",
2650
+ "iframe",
2651
+ "object",
2652
+ "embed",
2653
+ "video",
2654
+ "audio",
2655
+ "[contenteditable]",
2656
+ '[tabindex]:not([tabindex^="-"])'
2657
+ ].join(","),
2658
+ focusableItems,
2659
+ focusedItemIndex;
2660
+
2661
+ if (self.isClosing) {
2662
+ return;
2663
+ }
2664
+
2665
+ if (e || !self.current || !self.current.isComplete) {
2666
+ // Focus on any element inside fancybox
2667
+ focusableItems = self.$refs.container.find("*:visible");
2668
+ } else {
2669
+ // Focus inside current slide
2670
+ focusableItems = self.current.$slide.find("*:visible" + (firstRun ? ":not(.fancybox-close-small)" : ""));
2671
+ }
2672
+
2673
+ focusableItems = focusableItems.filter(focusableStr).filter(function () {
2674
+ return $(this).css("visibility") !== "hidden" && !$(this).hasClass("disabled");
2675
+ });
2676
+
2677
+ if (focusableItems.length) {
2678
+ focusedItemIndex = focusableItems.index(document.activeElement);
2679
+
2680
+ if (e && e.shiftKey) {
2681
+ // Back tab
2682
+ if (focusedItemIndex < 0 || focusedItemIndex == 0) {
2683
+ e.preventDefault();
2684
+
2685
+ focusableItems.eq(focusableItems.length - 1).trigger("focus");
2686
+ }
2687
+ } else {
2688
+ // Outside or Forward tab
2689
+ if (focusedItemIndex < 0 || focusedItemIndex == focusableItems.length - 1) {
2690
+ if (e) {
2691
+ e.preventDefault();
2692
+ }
2693
+
2694
+ focusableItems.eq(0).trigger("focus");
2695
+ }
2696
+ }
2697
+ } else {
2698
+ self.$refs.container.trigger("focus");
2699
+ }
2700
+ },
2701
+
2702
+ // Activates current instance - brings container to the front and enables keyboard,
2703
+ // notifies other instances about deactivating
2704
+ // =================================================================================
2705
+
2706
+ activate: function () {
2707
+ var self = this;
2708
+
2709
+ // Deactivate all instances
2710
+ $(".fancybox-container").each(function () {
2711
+ var instance = $(this).data("FancyBox");
2712
+
2713
+ // Skip self and closing instances
2714
+ if (instance && instance.id !== self.id && !instance.isClosing) {
2715
+ instance.trigger("onDeactivate");
2716
+
2717
+ instance.removeEvents();
2718
+
2719
+ instance.isVisible = false;
2720
+ }
2721
+ });
2722
+
2723
+ self.isVisible = true;
2724
+
2725
+ if (self.current || self.isIdle) {
2726
+ self.update();
2727
+
2728
+ self.updateControls();
2729
+ }
2730
+
2731
+ self.trigger("onActivate");
2732
+
2733
+ self.addEvents();
2734
+ },
2735
+
2736
+ // Start closing procedure
2737
+ // This will start "zoom-out" animation if needed and clean everything up afterwards
2738
+ // =================================================================================
2739
+
2740
+ close: function (e, d) {
2741
+ var self = this,
2742
+ current = self.current,
2743
+ effect,
2744
+ duration,
2745
+ $content,
2746
+ domRect,
2747
+ opacity,
2748
+ start,
2749
+ end;
2750
+
2751
+ var done = function () {
2752
+ self.cleanUp(e);
2753
+ };
2754
+
2755
+ if (self.isClosing) {
2756
+ return false;
2757
+ }
2758
+
2759
+ self.isClosing = true;
2760
+
2761
+ // If beforeClose callback prevents closing, make sure content is centered
2762
+ if (self.trigger("beforeClose", e) === false) {
2763
+ self.isClosing = false;
2764
+
2765
+ requestAFrame(function () {
2766
+ self.update();
2767
+ });
2768
+
2769
+ return false;
2770
+ }
2771
+
2772
+ // Remove all events
2773
+ // If there are multiple instances, they will be set again by "activate" method
2774
+ self.removeEvents();
2775
+
2776
+ $content = current.$content;
2777
+ effect = current.opts.animationEffect;
2778
+ duration = $.isNumeric(d) ? d : effect ? current.opts.animationDuration : 0;
2779
+
2780
+ current.$slide.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated");
2781
+
2782
+ if (e !== true) {
2783
+ $.fancybox.stop(current.$slide);
2784
+ } else {
2785
+ effect = false;
2786
+ }
2787
+
2788
+ // Remove other slides
2789
+ current.$slide
2790
+ .siblings()
2791
+ .trigger("onReset")
2792
+ .remove();
2793
+
2794
+ // Trigger animations
2795
+ if (duration) {
2796
+ self.$refs.container
2797
+ .removeClass("fancybox-is-open")
2798
+ .addClass("fancybox-is-closing")
2799
+ .css("transition-duration", duration + "ms");
2800
+ }
2801
+
2802
+ // Clean up
2803
+ self.hideLoading(current);
2804
+
2805
+ self.hideControls(true);
2806
+
2807
+ self.updateCursor();
2808
+
2809
+ // Check if possible to zoom-out
2810
+ if (
2811
+ effect === "zoom" &&
2812
+ !($content && duration && current.type === "image" && !self.isMoved() && !current.hasError && (end = self.getThumbPos(current)))
2813
+ ) {
2814
+ effect = "fade";
2815
+ }
2816
+
2817
+ if (effect === "zoom") {
2818
+ $.fancybox.stop($content);
2819
+
2820
+ domRect = $.fancybox.getTranslate($content);
2821
+
2822
+ start = {
2823
+ top: domRect.top,
2824
+ left: domRect.left,
2825
+ scaleX: domRect.width / end.width,
2826
+ scaleY: domRect.height / end.height,
2827
+ width: end.width,
2828
+ height: end.height
2829
+ };
2830
+
2831
+ // Check if we need to animate opacity
2832
+ opacity = current.opts.zoomOpacity;
2833
+
2834
+ if (opacity == "auto") {
2835
+ opacity = Math.abs(current.width / current.height - end.width / end.height) > 0.1;
2836
+ }
2837
+
2838
+ if (opacity) {
2839
+ end.opacity = 0;
2840
+ }
2841
+
2842
+ $.fancybox.setTranslate($content, start);
2843
+
2844
+ forceRedraw($content);
2845
+
2846
+ $.fancybox.animate($content, end, duration, done);
2847
+
2848
+ return true;
2849
+ }
2850
+
2851
+ if (effect && duration) {
2852
+ $.fancybox.animate(
2853
+ current.$slide.addClass("fancybox-slide--previous").removeClass("fancybox-slide--current"),
2854
+ "fancybox-animated fancybox-fx-" + effect,
2855
+ duration,
2856
+ done
2857
+ );
2858
+ } else {
2859
+ // If skip animation
2860
+ if (e === true) {
2861
+ setTimeout(done, duration);
2862
+ } else {
2863
+ done();
2864
+ }
2865
+ }
2866
+
2867
+ return true;
2868
+ },
2869
+
2870
+ // Final adjustments after removing the instance
2871
+ // =============================================
2872
+
2873
+ cleanUp: function (e) {
2874
+ var self = this,
2875
+ instance,
2876
+ $focus = self.current.opts.$orig,
2877
+ x,
2878
+ y;
2879
+
2880
+ self.current.$slide.trigger("onReset");
2881
+
2882
+ self.$refs.container.empty().remove();
2883
+
2884
+ self.trigger("afterClose", e);
2885
+
2886
+ // Place back focus
2887
+ if (!!self.current.opts.backFocus) {
2888
+ if (!$focus || !$focus.length || !$focus.is(":visible")) {
2889
+ $focus = self.$trigger;
2890
+ }
2891
+
2892
+ if ($focus && $focus.length) {
2893
+ x = window.scrollX;
2894
+ y = window.scrollY;
2895
+
2896
+ $focus.trigger("focus");
2897
+
2898
+ $("html, body")
2899
+ .scrollTop(y)
2900
+ .scrollLeft(x);
2901
+ }
2902
+ }
2903
+
2904
+ self.current = null;
2905
+
2906
+ // Check if there are other instances
2907
+ instance = $.fancybox.getInstance();
2908
+
2909
+ if (instance) {
2910
+ instance.activate();
2911
+ } else {
2912
+ $("body").removeClass("fancybox-active compensate-for-scrollbar");
2913
+
2914
+ $("#fancybox-style-noscroll").remove();
2915
+ }
2916
+ },
2917
+
2918
+ // Call callback and trigger an event
2919
+ // ==================================
2920
+
2921
+ trigger: function (name, slide) {
2922
+ var args = Array.prototype.slice.call(arguments, 1),
2923
+ self = this,
2924
+ obj = slide && slide.opts ? slide : self.current,
2925
+ rez;
2926
+
2927
+ if (obj) {
2928
+ args.unshift(obj);
2929
+ } else {
2930
+ obj = self;
2931
+ }
2932
+
2933
+ args.unshift(self);
2934
+
2935
+ if ($.isFunction(obj.opts[name])) {
2936
+ rez = obj.opts[name].apply(obj, args);
2937
+ }
2938
+
2939
+ if (rez === false) {
2940
+ return rez;
2941
+ }
2942
+
2943
+ if (name === "afterClose" || !self.$refs) {
2944
+ $D.trigger(name + ".fb", args);
2945
+ } else {
2946
+ self.$refs.container.trigger(name + ".fb", args);
2947
+ }
2948
+ },
2949
+
2950
+ // Update infobar values, navigation button states and reveal caption
2951
+ // ==================================================================
2952
+
2953
+ updateControls: function () {
2954
+ var self = this,
2955
+ current = self.current,
2956
+ index = current.index,
2957
+ $container = self.$refs.container,
2958
+ $caption = self.$refs.caption,
2959
+ caption = current.opts.caption;
2960
+
2961
+ // Recalculate content dimensions
2962
+ current.$slide.trigger("refresh");
2963
+
2964
+ // Set caption
2965
+ if (caption && caption.length) {
2966
+ self.$caption = $caption;
2967
+
2968
+ $caption
2969
+ .children()
2970
+ .eq(0)
2971
+ .html(caption);
2972
+ } else {
2973
+ self.$caption = null;
2974
+ }
2975
+
2976
+ if (!self.hasHiddenControls && !self.isIdle) {
2977
+ self.showControls();
2978
+ }
2979
+
2980
+ // Update info and navigation elements
2981
+ $container.find("[data-fancybox-count]").html(self.group.length);
2982
+ $container.find("[data-fancybox-index]").html(index + 1);
2983
+
2984
+ $container.find("[data-fancybox-prev]").prop("disabled", !current.opts.loop && index <= 0);
2985
+ $container.find("[data-fancybox-next]").prop("disabled", !current.opts.loop && index >= self.group.length - 1);
2986
+
2987
+ if (current.type === "image") {
2988
+ // Re-enable buttons; update download button source
2989
+ $container
2990
+ .find("[data-fancybox-zoom]")
2991
+ .show()
2992
+ .end()
2993
+ .find("[data-fancybox-download]")
2994
+ .attr("href", current.opts.image.src || current.src)
2995
+ .show();
2996
+ } else if (current.opts.toolbar) {
2997
+ $container.find("[data-fancybox-download],[data-fancybox-zoom]").hide();
2998
+ }
2999
+
3000
+ // Make sure focus is not on disabled button/element
3001
+ if ($(document.activeElement).is(":hidden,[disabled]")) {
3002
+ self.$refs.container.trigger("focus");
3003
+ }
3004
+ },
3005
+
3006
+ // Hide toolbar and caption
3007
+ // ========================
3008
+
3009
+ hideControls: function (andCaption) {
3010
+ var self = this,
3011
+ arr = ["infobar", "toolbar", "nav"];
3012
+
3013
+ if (andCaption || !self.current.opts.preventCaptionOverlap) {
3014
+ arr.push("caption");
3015
+ }
3016
+
3017
+ this.$refs.container.removeClass(
3018
+ arr
3019
+ .map(function (i) {
3020
+ return "fancybox-show-" + i;
3021
+ })
3022
+ .join(" ")
3023
+ );
3024
+
3025
+ this.hasHiddenControls = true;
3026
+ },
3027
+
3028
+ showControls: function () {
3029
+ var self = this,
3030
+ opts = self.current ? self.current.opts : self.opts,
3031
+ $container = self.$refs.container;
3032
+
3033
+ self.hasHiddenControls = false;
3034
+ self.idleSecondsCounter = 0;
3035
+
3036
+ $container
3037
+ .toggleClass("fancybox-show-toolbar", !!(opts.toolbar && opts.buttons))
3038
+ .toggleClass("fancybox-show-infobar", !!(opts.infobar && self.group.length > 1))
3039
+ .toggleClass("fancybox-show-caption", !!self.$caption)
3040
+ .toggleClass("fancybox-show-nav", !!(opts.arrows && self.group.length > 1))
3041
+ .toggleClass("fancybox-is-modal", !!opts.modal);
3042
+ },
3043
+
3044
+ // Toggle toolbar and caption
3045
+ // ==========================
3046
+
3047
+ toggleControls: function () {
3048
+ if (this.hasHiddenControls) {
3049
+ this.showControls();
3050
+ } else {
3051
+ this.hideControls();
3052
+ }
3053
+ }
3054
+ });
3055
+
3056
+ $.fancybox = {
3057
+ version: "3.5.7",
3058
+ defaults: defaults,
3059
+
3060
+ // Get current instance and execute a command.
3061
+ //
3062
+ // Examples of usage:
3063
+ //
3064
+ // $instance = $.fancybox.getInstance();
3065
+ // $.fancybox.getInstance().jumpTo( 1 );
3066
+ // $.fancybox.getInstance( 'jumpTo', 1 );
3067
+ // $.fancybox.getInstance( function() {
3068
+ // console.info( this.currIndex );
3069
+ // });
3070
+ // ======================================================
3071
+
3072
+ getInstance: function (command) {
3073
+ var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),
3074
+ args = Array.prototype.slice.call(arguments, 1);
3075
+
3076
+ if (instance instanceof FancyBox) {
3077
+ if ($.type(command) === "string") {
3078
+ instance[command].apply(instance, args);
3079
+ } else if ($.type(command) === "function") {
3080
+ command.apply(instance, args);
3081
+ }
3082
+
3083
+ return instance;
3084
+ }
3085
+
3086
+ return false;
3087
+ },
3088
+
3089
+ // Create new instance
3090
+ // ===================
3091
+
3092
+ open: function (items, opts, index) {
3093
+ return new FancyBox(items, opts, index);
3094
+ },
3095
+
3096
+ // Close current or all instances
3097
+ // ==============================
3098
+
3099
+ close: function (all) {
3100
+ var instance = this.getInstance();
3101
+
3102
+ if (instance) {
3103
+ instance.close();
3104
+
3105
+ // Try to find and close next instance
3106
+ if (all === true) {
3107
+ this.close(all);
3108
+ }
3109
+ }
3110
+ },
3111
+
3112
+ // Close all instances and unbind all events
3113
+ // =========================================
3114
+
3115
+ destroy: function () {
3116
+ this.close(true);
3117
+
3118
+ $D.add("body").off("click.fb-start", "**");
3119
+ },
3120
+
3121
+ // Try to detect mobile devices
3122
+ // ============================
3123
+
3124
+ isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
3125
+
3126
+ // Detect if 'translate3d' support is available
3127
+ // ============================================
3128
+
3129
+ use3d: (function () {
3130
+ var div = document.createElement("div");
3131
+
3132
+ return (
3133
+ window.getComputedStyle &&
3134
+ window.getComputedStyle(div) &&
3135
+ window.getComputedStyle(div).getPropertyValue("transform") &&
3136
+ !(document.documentMode && document.documentMode < 11)
3137
+ );
3138
+ })(),
3139
+
3140
+ // Helper function to get current visual state of an element
3141
+ // returns array[ top, left, horizontal-scale, vertical-scale, opacity ]
3142
+ // =====================================================================
3143
+
3144
+ getTranslate: function ($el) {
3145
+ var domRect;
3146
+
3147
+ if (!$el || !$el.length) {
3148
+ return false;
3149
+ }
3150
+
3151
+ domRect = $el[0].getBoundingClientRect();
3152
+
3153
+ return {
3154
+ top: domRect.top || 0,
3155
+ left: domRect.left || 0,
3156
+ width: domRect.width,
3157
+ height: domRect.height,
3158
+ opacity: parseFloat($el.css("opacity"))
3159
+ };
3160
+ },
3161
+
3162
+ // Shortcut for setting "translate3d" properties for element
3163
+ // Can set be used to set opacity, too
3164
+ // ========================================================
3165
+
3166
+ setTranslate: function ($el, props) {
3167
+ var str = "",
3168
+ css = {};
3169
+
3170
+ if (!$el || !props) {
3171
+ return;
3172
+ }
3173
+
3174
+ if (props.left !== undefined || props.top !== undefined) {
3175
+ str =
3176
+ (props.left === undefined ? $el.position().left : props.left) +
3177
+ "px, " +
3178
+ (props.top === undefined ? $el.position().top : props.top) +
3179
+ "px";
3180
+
3181
+ if (this.use3d) {
3182
+ str = "translate3d(" + str + ", 0px)";
3183
+ } else {
3184
+ str = "translate(" + str + ")";
3185
+ }
3186
+ }
3187
+
3188
+ if (props.scaleX !== undefined && props.scaleY !== undefined) {
3189
+ str += " scale(" + props.scaleX + ", " + props.scaleY + ")";
3190
+ } else if (props.scaleX !== undefined) {
3191
+ str += " scaleX(" + props.scaleX + ")";
3192
+ }
3193
+
3194
+ if (str.length) {
3195
+ css.transform = str;
3196
+ }
3197
+
3198
+ if (props.opacity !== undefined) {
3199
+ css.opacity = props.opacity;
3200
+ }
3201
+
3202
+ if (props.width !== undefined) {
3203
+ css.width = props.width;
3204
+ }
3205
+
3206
+ if (props.height !== undefined) {
3207
+ css.height = props.height;
3208
+ }
3209
+
3210
+ return $el.css(css);
3211
+ },
3212
+
3213
+ // Simple CSS transition handler
3214
+ // =============================
3215
+
3216
+ animate: function ($el, to, duration, callback, leaveAnimationName) {
3217
+ var self = this,
3218
+ from;
3219
+
3220
+ if ($.isFunction(duration)) {
3221
+ callback = duration;
3222
+ duration = null;
3223
+ }
3224
+
3225
+ self.stop($el);
3226
+
3227
+ from = self.getTranslate($el);
3228
+
3229
+ $el.on(transitionEnd, function (e) {
3230
+ // Skip events from child elements and z-index change
3231
+ if (e && e.originalEvent && (!$el.is(e.originalEvent.target) || e.originalEvent.propertyName == "z-index")) {
3232
+ return;
3233
+ }
3234
+
3235
+ self.stop($el);
3236
+
3237
+ if ($.isNumeric(duration)) {
3238
+ $el.css("transition-duration", "");
3239
+ }
3240
+
3241
+ if ($.isPlainObject(to)) {
3242
+ if (to.scaleX !== undefined && to.scaleY !== undefined) {
3243
+ self.setTranslate($el, {
3244
+ top: to.top,
3245
+ left: to.left,
3246
+ width: from.width * to.scaleX,
3247
+ height: from.height * to.scaleY,
3248
+ scaleX: 1,
3249
+ scaleY: 1
3250
+ });
3251
+ }
3252
+ } else if (leaveAnimationName !== true) {
3253
+ $el.removeClass(to);
3254
+ }
3255
+
3256
+ if ($.isFunction(callback)) {
3257
+ callback(e);
3258
+ }
3259
+ });
3260
+
3261
+ if ($.isNumeric(duration)) {
3262
+ $el.css("transition-duration", duration + "ms");
3263
+ }
3264
+
3265
+ // Start animation by changing CSS properties or class name
3266
+ if ($.isPlainObject(to)) {
3267
+ if (to.scaleX !== undefined && to.scaleY !== undefined) {
3268
+ delete to.width;
3269
+ delete to.height;
3270
+
3271
+ if ($el.parent().hasClass("fancybox-slide--image")) {
3272
+ $el.parent().addClass("fancybox-is-scaling");
3273
+ }
3274
+ }
3275
+
3276
+ $.fancybox.setTranslate($el, to);
3277
+ } else {
3278
+ $el.addClass(to);
3279
+ }
3280
+
3281
+ // Make sure that `transitionend` callback gets fired
3282
+ $el.data(
3283
+ "timer",
3284
+ setTimeout(function () {
3285
+ $el.trigger(transitionEnd);
3286
+ }, duration + 33)
3287
+ );
3288
+ },
3289
+
3290
+ stop: function ($el, callCallback) {
3291
+ if ($el && $el.length) {
3292
+ clearTimeout($el.data("timer"));
3293
+
3294
+ if (callCallback) {
3295
+ $el.trigger(transitionEnd);
3296
+ }
3297
+
3298
+ $el.off(transitionEnd).css("transition-duration", "");
3299
+
3300
+ $el.parent().removeClass("fancybox-is-scaling");
3301
+ }
3302
+ }
3303
+ };
3304
+
3305
+ // Default click handler for "fancyboxed" links
3306
+ // ============================================
3307
+
3308
+ function _run(e, opts) {
3309
+ var items = [],
3310
+ index = 0,
3311
+ $target,
3312
+ value,
3313
+ instance;
3314
+
3315
+ // Avoid opening multiple times
3316
+ if (e && e.isDefaultPrevented()) {
3317
+ return;
3318
+ }
3319
+
3320
+ e.preventDefault();
3321
+
3322
+ opts = opts || {};
3323
+
3324
+ if (e && e.data) {
3325
+ opts = mergeOpts(e.data.options, opts);
3326
+ }
3327
+
3328
+ $target = opts.$target || $(e.currentTarget).trigger("blur");
3329
+ instance = $.fancybox.getInstance();
3330
+
3331
+ if (instance && instance.$trigger && instance.$trigger.is($target)) {
3332
+ return;
3333
+ }
3334
+
3335
+ if (opts.selector) {
3336
+ items = $(opts.selector);
3337
+ } else {
3338
+ // Get all related items and find index for clicked one
3339
+ value = $target.attr("data-fancybox") || "";
3340
+
3341
+ if (value) {
3342
+ items = e.data ? e.data.items : [];
3343
+ items = items.length ? items.filter('[data-fancybox="' + value + '"]') : $('[data-fancybox="' + value + '"]');
3344
+ } else {
3345
+ items = [$target];
3346
+ }
3347
+ }
3348
+
3349
+ index = $(items).index($target);
3350
+
3351
+ // Sometimes current item can not be found
3352
+ if (index < 0) {
3353
+ index = 0;
3354
+ }
3355
+
3356
+ instance = $.fancybox.open(items, opts, index);
3357
+
3358
+ // Save last active element
3359
+ instance.$trigger = $target;
3360
+ }
3361
+
3362
+ // Create a jQuery plugin
3363
+ // ======================
3364
+
3365
+ $.fn.fancybox = function (options) {
3366
+ var selector;
3367
+
3368
+ options = options || {};
3369
+ selector = options.selector || false;
3370
+
3371
+ if (selector) {
3372
+ // Use body element instead of document so it executes first
3373
+ $("body")
3374
+ .off("click.fb-start", selector)
3375
+ .on("click.fb-start", selector, {
3376
+ options: options
3377
+ }, _run);
3378
+ } else {
3379
+ this.off("click.fb-start").on(
3380
+ "click.fb-start", {
3381
+ items: this,
3382
+ options: options
3383
+ },
3384
+ _run
3385
+ );
3386
+ }
3387
+
3388
+ return this;
3389
+ };
3390
+
3391
+ // Self initializing plugin for all elements having `data-fancybox` attribute
3392
+ // ==========================================================================
3393
+
3394
+ $D.on("click.fb-start", "[data-fancybox]", _run);
3395
+
3396
+ // Enable "trigger elements"
3397
+ // =========================
3398
+
3399
+ $D.on("click.fb-start", "[data-fancybox-trigger]", function (e) {
3400
+ $('[data-fancybox="' + $(this).attr("data-fancybox-trigger") + '"]')
3401
+ .eq($(this).attr("data-fancybox-index") || 0)
3402
+ .trigger("click.fb-start", {
3403
+ $trigger: $(this)
3404
+ });
3405
+ });
3406
+
3407
+ // Track focus event for better accessibility styling
3408
+ // ==================================================
3409
+ (function () {
3410
+ var buttonStr = ".fancybox-button",
3411
+ focusStr = "fancybox-focus",
3412
+ $pressed = null;
3413
+
3414
+ $D.on("mousedown mouseup focus blur", buttonStr, function (e) {
3415
+ switch (e.type) {
3416
+ case "mousedown":
3417
+ $pressed = $(this);
3418
+ break;
3419
+ case "mouseup":
3420
+ $pressed = null;
3421
+ break;
3422
+ case "focusin":
3423
+ $(buttonStr).removeClass(focusStr);
3424
+
3425
+ if (!$(this).is($pressed) && !$(this).is("[disabled]")) {
3426
+ $(this).addClass(focusStr);
3427
+ }
3428
+ break;
3429
+ case "focusout":
3430
+ $(buttonStr).removeClass(focusStr);
3431
+ break;
3432
+ }
3433
+ });
3434
+ })();
3435
+ })(window, document, jQuery);
3436
+ // ==========================================================================
3437
+ //
3438
+ // Media
3439
+ // Adds additional media type support
3440
+ //
3441
+ // ==========================================================================
3442
+ (function ($) {
3443
+ "use strict";
3444
+
3445
+ // Object containing properties for each media type
3446
+ var defaults = {
3447
+ youtube: {
3448
+ matcher: /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,
3449
+ params: {
3450
+ autoplay: 1,
3451
+ autohide: 1,
3452
+ fs: 1,
3453
+ rel: 0,
3454
+ hd: 1,
3455
+ wmode: "transparent",
3456
+ enablejsapi: 1,
3457
+ html5: 1
3458
+ },
3459
+ paramPlace: 8,
3460
+ type: "iframe",
3461
+ url: "https://www.youtube-nocookie.com/embed/$4",
3462
+ thumb: "https://img.youtube.com/vi/$4/hqdefault.jpg"
3463
+ },
3464
+
3465
+ vimeo: {
3466
+ matcher: /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,
3467
+ params: {
3468
+ autoplay: 1,
3469
+ hd: 1,
3470
+ show_title: 1,
3471
+ show_byline: 1,
3472
+ show_portrait: 0,
3473
+ fullscreen: 1
3474
+ },
3475
+ paramPlace: 3,
3476
+ type: "iframe",
3477
+ url: "//player.vimeo.com/video/$2"
3478
+ },
3479
+
3480
+ instagram: {
3481
+ matcher: /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
3482
+ type: "image",
3483
+ url: "//$1/p/$2/media/?size=l"
3484
+ },
3485
+
3486
+ // Examples:
3487
+ // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
3488
+ // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z
3489
+ // https://www.google.com/maps/@52.2111123,2.9237542,6.61z?hl=en
3490
+ // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572
3491
+ gmap_place: {
3492
+ matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,
3493
+ type: "iframe",
3494
+ url: function (rez) {
3495
+ return (
3496
+ "//maps.google." +
3497
+ rez[2] +
3498
+ "/?ll=" +
3499
+ (rez[9] ? rez[9] + "&z=" + Math.floor(rez[10]) + (rez[12] ? rez[12].replace(/^\//, "&") : "") : rez[12] + "").replace(/\?/, "&") +
3500
+ "&output=" +
3501
+ (rez[12] && rez[12].indexOf("layer=c") > 0 ? "svembed" : "embed")
3502
+ );
3503
+ }
3504
+ },
3505
+
3506
+ // Examples:
3507
+ // https://www.google.com/maps/search/Empire+State+Building/
3508
+ // https://www.google.com/maps/search/?api=1&query=centurylink+field
3509
+ // https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393
3510
+ gmap_search: {
3511
+ matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,
3512
+ type: "iframe",
3513
+ url: function (rez) {
3514
+ return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&output=embed";
3515
+ }
3516
+ }
3517
+ };
3518
+
3519
+ // Formats matching url to final form
3520
+ var format = function (url, rez, params) {
3521
+ if (!url) {
3522
+ return;
3523
+ }
3524
+
3525
+ params = params || "";
3526
+
3527
+ if ($.type(params) === "object") {
3528
+ params = $.param(params, true);
3529
+ }
3530
+
3531
+ $.each(rez, function (key, value) {
3532
+ url = url.replace("$" + key, value || "");
3533
+ });
3534
+
3535
+ if (params.length) {
3536
+ url += (url.indexOf("?") > 0 ? "&" : "?") + params;
3537
+ }
3538
+
3539
+ return url;
3540
+ };
3541
+
3542
+ $(document).on("objectNeedsType.fb", function (e, instance, item) {
3543
+ var url = item.src || "",
3544
+ type = false,
3545
+ media,
3546
+ thumb,
3547
+ rez,
3548
+ params,
3549
+ urlParams,
3550
+ paramObj,
3551
+ provider;
3552
+
3553
+ media = $.extend(true, {}, defaults, item.opts.media);
3554
+
3555
+ // Look for any matching media type
3556
+ $.each(media, function (providerName, providerOpts) {
3557
+ rez = url.match(providerOpts.matcher);
3558
+
3559
+ if (!rez) {
3560
+ return;
3561
+ }
3562
+
3563
+ type = providerOpts.type;
3564
+ provider = providerName;
3565
+ paramObj = {};
3566
+
3567
+ if (providerOpts.paramPlace && rez[providerOpts.paramPlace]) {
3568
+ urlParams = rez[providerOpts.paramPlace];
3569
+
3570
+ if (urlParams[0] == "?") {
3571
+ urlParams = urlParams.substring(1);
3572
+ }
3573
+
3574
+ urlParams = urlParams.split("&");
3575
+
3576
+ for (var m = 0; m < urlParams.length; ++m) {
3577
+ var p = urlParams[m].split("=", 2);
3578
+
3579
+ if (p.length == 2) {
3580
+ paramObj[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
3581
+ }
3582
+ }
3583
+ }
3584
+
3585
+ params = $.extend(true, {}, providerOpts.params, item.opts[providerName], paramObj);
3586
+
3587
+ url =
3588
+ $.type(providerOpts.url) === "function" ? providerOpts.url.call(this, rez, params, item) : format(providerOpts.url, rez, params);
3589
+
3590
+ thumb =
3591
+ $.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);
3592
+
3593
+ if (providerName === "youtube") {
3594
+ url = url.replace(/&t=((\d+)m)?(\d+)s/, function (match, p1, m, s) {
3595
+ return "&start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
3596
+ });
3597
+ } else if (providerName === "vimeo") {
3598
+ url = url.replace("&%23", "#");
3599
+ }
3600
+
3601
+ return false;
3602
+ });
3603
+
3604
+ // If it is found, then change content type and update the url
3605
+
3606
+ if (type) {
3607
+ if (!item.opts.thumb && !(item.opts.$thumb && item.opts.$thumb.length)) {
3608
+ item.opts.thumb = thumb;
3609
+ }
3610
+
3611
+ if (type === "iframe") {
3612
+ item.opts = $.extend(true, item.opts, {
3613
+ iframe: {
3614
+ preload: false,
3615
+ attr: {
3616
+ scrolling: "no"
3617
+ }
3618
+ }
3619
+ });
3620
+ }
3621
+
3622
+ $.extend(item, {
3623
+ type: type,
3624
+ src: url,
3625
+ origSrc: item.src,
3626
+ contentSource: provider,
3627
+ contentType: type === "image" ? "image" : provider == "gmap_place" || provider == "gmap_search" ? "map" : "video"
3628
+ });
3629
+ } else if (url) {
3630
+ item.type = item.opts.defaultType;
3631
+ }
3632
+ });
3633
+
3634
+ // Load YouTube/Video API on request to detect when video finished playing
3635
+ var VideoAPILoader = {
3636
+ youtube: {
3637
+ src: "https://www.youtube.com/iframe_api",
3638
+ class: "YT",
3639
+ loading: false,
3640
+ loaded: false
3641
+ },
3642
+
3643
+ vimeo: {
3644
+ src: "https://player.vimeo.com/api/player.js",
3645
+ class: "Vimeo",
3646
+ loading: false,
3647
+ loaded: false
3648
+ },
3649
+
3650
+ load: function (vendor) {
3651
+ var _this = this,
3652
+ script;
3653
+
3654
+ if (this[vendor].loaded) {
3655
+ setTimeout(function () {
3656
+ _this.done(vendor);
3657
+ });
3658
+ return;
3659
+ }
3660
+
3661
+ if (this[vendor].loading) {
3662
+ return;
3663
+ }
3664
+
3665
+ this[vendor].loading = true;
3666
+
3667
+ script = document.createElement("script");
3668
+ script.type = "text/javascript";
3669
+ script.src = this[vendor].src;
3670
+
3671
+ if (vendor === "youtube") {
3672
+ window.onYouTubeIframeAPIReady = function () {
3673
+ _this[vendor].loaded = true;
3674
+ _this.done(vendor);
3675
+ };
3676
+ } else {
3677
+ script.onload = function () {
3678
+ _this[vendor].loaded = true;
3679
+ _this.done(vendor);
3680
+ };
3681
+ }
3682
+
3683
+ document.body.appendChild(script);
3684
+ },
3685
+ done: function (vendor) {
3686
+ var instance, $el, player;
3687
+
3688
+ if (vendor === "youtube") {
3689
+ delete window.onYouTubeIframeAPIReady;
3690
+ }
3691
+
3692
+ instance = $.fancybox.getInstance();
3693
+
3694
+ if (instance) {
3695
+ $el = instance.current.$content.find("iframe");
3696
+
3697
+ if (vendor === "youtube" && YT !== undefined && YT) {
3698
+ player = new YT.Player($el.attr("id"), {
3699
+ events: {
3700
+ onStateChange: function (e) {
3701
+ if (e.data == 0) {
3702
+ instance.next();
3703
+ }
3704
+ }
3705
+ }
3706
+ });
3707
+ } else if (vendor === "vimeo" && Vimeo !== undefined && Vimeo) {
3708
+ player = new Vimeo.Player($el);
3709
+
3710
+ player.on("ended", function () {
3711
+ instance.next();
3712
+ });
3713
+ }
3714
+ }
3715
+ }
3716
+ };
3717
+
3718
+ $(document).on({
3719
+ "afterShow.fb": function (e, instance, current) {
3720
+ if (instance.group.length > 1 && (current.contentSource === "youtube" || current.contentSource === "vimeo")) {
3721
+ VideoAPILoader.load(current.contentSource);
3722
+ }
3723
+ }
3724
+ });
3725
+ })(jQuery);
3726
+ // ==========================================================================
3727
+ //
3728
+ // Guestures
3729
+ // Adds touch guestures, handles click and tap events
3730
+ //
3731
+ // ==========================================================================
3732
+ (function (window, document, $) {
3733
+ "use strict";
3734
+
3735
+ var requestAFrame = (function () {
3736
+ return (
3737
+ window.requestAnimationFrame ||
3738
+ window.webkitRequestAnimationFrame ||
3739
+ window.mozRequestAnimationFrame ||
3740
+ window.oRequestAnimationFrame ||
3741
+ // if all else fails, use setTimeout
3742
+ function (callback) {
3743
+ return window.setTimeout(callback, 1000 / 60);
3744
+ }
3745
+ );
3746
+ })();
3747
+
3748
+ var cancelAFrame = (function () {
3749
+ return (
3750
+ window.cancelAnimationFrame ||
3751
+ window.webkitCancelAnimationFrame ||
3752
+ window.mozCancelAnimationFrame ||
3753
+ window.oCancelAnimationFrame ||
3754
+ function (id) {
3755
+ window.clearTimeout(id);
3756
+ }
3757
+ );
3758
+ })();
3759
+
3760
+ var getPointerXY = function (e) {
3761
+ var result = [];
3762
+
3763
+ e = e.originalEvent || e || window.e;
3764
+ e = e.touches && e.touches.length ? e.touches : e.changedTouches && e.changedTouches.length ? e.changedTouches : [e];
3765
+
3766
+ for (var key in e) {
3767
+ if (e[key].pageX) {
3768
+ result.push({
3769
+ x: e[key].pageX,
3770
+ y: e[key].pageY
3771
+ });
3772
+ } else if (e[key].clientX) {
3773
+ result.push({
3774
+ x: e[key].clientX,
3775
+ y: e[key].clientY
3776
+ });
3777
+ }
3778
+ }
3779
+
3780
+ return result;
3781
+ };
3782
+
3783
+ var distance = function (point2, point1, what) {
3784
+ if (!point1 || !point2) {
3785
+ return 0;
3786
+ }
3787
+
3788
+ if (what === "x") {
3789
+ return point2.x - point1.x;
3790
+ } else if (what === "y") {
3791
+ return point2.y - point1.y;
3792
+ }
3793
+
3794
+ return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
3795
+ };
3796
+
3797
+ var isClickable = function ($el) {
3798
+ if (
3799
+ $el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
3800
+ $.isFunction($el.get(0).onclick) ||
3801
+ $el.data("selectable")
3802
+ ) {
3803
+ return true;
3804
+ }
3805
+
3806
+ // Check for attributes like data-fancybox-next or data-fancybox-close
3807
+ for (var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++) {
3808
+ if (atts[i].nodeName.substr(0, 14) === "data-fancybox-") {
3809
+ return true;
3810
+ }
3811
+ }
3812
+
3813
+ return false;
3814
+ };
3815
+
3816
+ var hasScrollbars = function (el) {
3817
+ var overflowY = window.getComputedStyle(el)["overflow-y"],
3818
+ overflowX = window.getComputedStyle(el)["overflow-x"],
3819
+ vertical = (overflowY === "scroll" || overflowY === "auto") && el.scrollHeight > el.clientHeight,
3820
+ horizontal = (overflowX === "scroll" || overflowX === "auto") && el.scrollWidth > el.clientWidth;
3821
+
3822
+ return vertical || horizontal;
3823
+ };
3824
+
3825
+ var isScrollable = function ($el) {
3826
+ var rez = false;
3827
+
3828
+ while (true) {
3829
+ rez = hasScrollbars($el.get(0));
3830
+
3831
+ if (rez) {
3832
+ break;
3833
+ }
3834
+
3835
+ $el = $el.parent();
3836
+
3837
+ if (!$el.length || $el.hasClass("fancybox-stage") || $el.is("body")) {
3838
+ break;
3839
+ }
3840
+ }
3841
+
3842
+ return rez;
3843
+ };
3844
+
3845
+ var Guestures = function (instance) {
3846
+ var self = this;
3847
+
3848
+ self.instance = instance;
3849
+
3850
+ self.$bg = instance.$refs.bg;
3851
+ self.$stage = instance.$refs.stage;
3852
+ self.$container = instance.$refs.container;
3853
+
3854
+ self.destroy();
3855
+
3856
+ self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
3857
+ };
3858
+
3859
+ Guestures.prototype.destroy = function () {
3860
+ var self = this;
3861
+
3862
+ self.$container.off(".fb.touch");
3863
+
3864
+ $(document).off(".fb.touch");
3865
+
3866
+ if (self.requestId) {
3867
+ cancelAFrame(self.requestId);
3868
+ self.requestId = null;
3869
+ }
3870
+
3871
+ if (self.tapped) {
3872
+ clearTimeout(self.tapped);
3873
+ self.tapped = null;
3874
+ }
3875
+ };
3876
+
3877
+ Guestures.prototype.ontouchstart = function (e) {
3878
+ var self = this,
3879
+ $target = $(e.target),
3880
+ instance = self.instance,
3881
+ current = instance.current,
3882
+ $slide = current.$slide,
3883
+ $content = current.$content,
3884
+ isTouchDevice = e.type == "touchstart";
3885
+
3886
+ // Do not respond to both (touch and mouse) events
3887
+ if (isTouchDevice) {
3888
+ self.$container.off("mousedown.fb.touch");
3889
+ }
3890
+
3891
+ // Ignore right click
3892
+ if (e.originalEvent && e.originalEvent.button == 2) {
3893
+ return;
3894
+ }
3895
+
3896
+ // Ignore taping on links, buttons, input elements
3897
+ if (!$slide.length || !$target.length || isClickable($target) || isClickable($target.parent())) {
3898
+ return;
3899
+ }
3900
+ // Ignore clicks on the scrollbar
3901
+ if (!$target.is("img") && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left) {
3902
+ return;
3903
+ }
3904
+
3905
+ // Ignore clicks while zooming or closing
3906
+ if (!current || instance.isAnimating || current.$slide.hasClass("fancybox-animated")) {
3907
+ e.stopPropagation();
3908
+ e.preventDefault();
3909
+
3910
+ return;
3911
+ }
3912
+
3913
+ self.realPoints = self.startPoints = getPointerXY(e);
3914
+
3915
+ if (!self.startPoints.length) {
3916
+ return;
3917
+ }
3918
+
3919
+ // Allow other scripts to catch touch event if "touch" is set to false
3920
+ if (current.touch) {
3921
+ e.stopPropagation();
3922
+ }
3923
+
3924
+ self.startEvent = e;
3925
+
3926
+ self.canTap = true;
3927
+ self.$target = $target;
3928
+ self.$content = $content;
3929
+ self.opts = current.opts.touch;
3930
+
3931
+ self.isPanning = false;
3932
+ self.isSwiping = false;
3933
+ self.isZooming = false;
3934
+ self.isScrolling = false;
3935
+ self.canPan = instance.canPan();
3936
+
3937
+ self.startTime = new Date().getTime();
3938
+ self.distanceX = self.distanceY = self.distance = 0;
3939
+
3940
+ self.canvasWidth = Math.round($slide[0].clientWidth);
3941
+ self.canvasHeight = Math.round($slide[0].clientHeight);
3942
+
3943
+ self.contentLastPos = null;
3944
+ self.contentStartPos = $.fancybox.getTranslate(self.$content) || {
3945
+ top: 0,
3946
+ left: 0
3947
+ };
3948
+ self.sliderStartPos = $.fancybox.getTranslate($slide);
3949
+
3950
+ // Since position will be absolute, but we need to make it relative to the stage
3951
+ self.stagePos = $.fancybox.getTranslate(instance.$refs.stage);
3952
+
3953
+ self.sliderStartPos.top -= self.stagePos.top;
3954
+ self.sliderStartPos.left -= self.stagePos.left;
3955
+
3956
+ self.contentStartPos.top -= self.stagePos.top;
3957
+ self.contentStartPos.left -= self.stagePos.left;
3958
+
3959
+ $(document)
3960
+ .off(".fb.touch")
3961
+ .on(isTouchDevice ? "touchend.fb.touch touchcancel.fb.touch" : "mouseup.fb.touch mouseleave.fb.touch", $.proxy(self, "ontouchend"))
3962
+ .on(isTouchDevice ? "touchmove.fb.touch" : "mousemove.fb.touch", $.proxy(self, "ontouchmove"));
3963
+
3964
+ if ($.fancybox.isMobile) {
3965
+ document.addEventListener("scroll", self.onscroll, true);
3966
+ }
3967
+
3968
+ // Skip if clicked outside the sliding area
3969
+ if (!(self.opts || self.canPan) || !($target.is(self.$stage) || self.$stage.find($target).length)) {
3970
+ if ($target.is(".fancybox-image")) {
3971
+ e.preventDefault();
3972
+ }
3973
+
3974
+ if (!($.fancybox.isMobile && $target.parents(".fancybox-caption").length)) {
3975
+ return;
3976
+ }
3977
+ }
3978
+
3979
+ self.isScrollable = isScrollable($target) || isScrollable($target.parent());
3980
+
3981
+ // Check if element is scrollable and try to prevent default behavior (scrolling)
3982
+ if (!($.fancybox.isMobile && self.isScrollable)) {
3983
+ e.preventDefault();
3984
+ }
3985
+
3986
+ // One finger or mouse click - swipe or pan an image
3987
+ if (self.startPoints.length === 1 || current.hasError) {
3988
+ if (self.canPan) {
3989
+ $.fancybox.stop(self.$content);
3990
+
3991
+ self.isPanning = true;
3992
+ } else {
3993
+ self.isSwiping = true;
3994
+ }
3995
+
3996
+ self.$container.addClass("fancybox-is-grabbing");
3997
+ }
3998
+
3999
+ // Two fingers - zoom image
4000
+ if (self.startPoints.length === 2 && current.type === "image" && (current.isLoaded || current.$ghost)) {
4001
+ self.canTap = false;
4002
+ self.isSwiping = false;
4003
+ self.isPanning = false;
4004
+
4005
+ self.isZooming = true;
4006
+
4007
+ $.fancybox.stop(self.$content);
4008
+
4009
+ self.centerPointStartX = (self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft();
4010
+ self.centerPointStartY = (self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop();
4011
+
4012
+ self.percentageOfImageAtPinchPointX = (self.centerPointStartX - self.contentStartPos.left) / self.contentStartPos.width;
4013
+ self.percentageOfImageAtPinchPointY = (self.centerPointStartY - self.contentStartPos.top) / self.contentStartPos.height;
4014
+
4015
+ self.startDistanceBetweenFingers = distance(self.startPoints[0], self.startPoints[1]);
4016
+ }
4017
+ };
4018
+
4019
+ Guestures.prototype.onscroll = function (e) {
4020
+ var self = this;
4021
+
4022
+ self.isScrolling = true;
4023
+
4024
+ document.removeEventListener("scroll", self.onscroll, true);
4025
+ };
4026
+
4027
+ Guestures.prototype.ontouchmove = function (e) {
4028
+ var self = this;
4029
+
4030
+ // Make sure user has not released over iframe or disabled element
4031
+ if (e.originalEvent.buttons !== undefined && e.originalEvent.buttons === 0) {
4032
+ self.ontouchend(e);
4033
+ return;
4034
+ }
4035
+
4036
+ if (self.isScrolling) {
4037
+ self.canTap = false;
4038
+ return;
4039
+ }
4040
+
4041
+ self.newPoints = getPointerXY(e);
4042
+
4043
+ if (!(self.opts || self.canPan) || !self.newPoints.length || !self.newPoints.length) {
4044
+ return;
4045
+ }
4046
+
4047
+ if (!(self.isSwiping && self.isSwiping === true)) {
4048
+ e.preventDefault();
4049
+ }
4050
+
4051
+ self.distanceX = distance(self.newPoints[0], self.startPoints[0], "x");
4052
+ self.distanceY = distance(self.newPoints[0], self.startPoints[0], "y");
4053
+
4054
+ self.distance = distance(self.newPoints[0], self.startPoints[0]);
4055
+
4056
+ // Skip false ontouchmove events (Chrome)
4057
+ if (self.distance > 0) {
4058
+ if (self.isSwiping) {
4059
+ self.onSwipe(e);
4060
+ } else if (self.isPanning) {
4061
+ self.onPan();
4062
+ } else if (self.isZooming) {
4063
+ self.onZoom();
4064
+ }
4065
+ }
4066
+ };
4067
+
4068
+ Guestures.prototype.onSwipe = function (e) {
4069
+ var self = this,
4070
+ instance = self.instance,
4071
+ swiping = self.isSwiping,
4072
+ left = self.sliderStartPos.left || 0,
4073
+ angle;
4074
+
4075
+ // If direction is not yet determined
4076
+ if (swiping === true) {
4077
+ // We need at least 10px distance to correctly calculate an angle
4078
+ if (Math.abs(self.distance) > 10) {
4079
+ self.canTap = false;
4080
+
4081
+ if (instance.group.length < 2 && self.opts.vertical) {
4082
+ self.isSwiping = "y";
4083
+ } else if (instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) {
4084
+ self.isSwiping = "x";
4085
+ } else {
4086
+ angle = Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI);
4087
+
4088
+ self.isSwiping = angle > 45 && angle < 135 ? "y" : "x";
4089
+ }
4090
+
4091
+ if (self.isSwiping === "y" && $.fancybox.isMobile && self.isScrollable) {
4092
+ self.isScrolling = true;
4093
+
4094
+ return;
4095
+ }
4096
+
4097
+ instance.isDragging = self.isSwiping;
4098
+
4099
+ // Reset points to avoid jumping, because we dropped first swipes to calculate the angle
4100
+ self.startPoints = self.newPoints;
4101
+
4102
+ $.each(instance.slides, function (index, slide) {
4103
+ var slidePos, stagePos;
4104
+
4105
+ $.fancybox.stop(slide.$slide);
4106
+
4107
+ slidePos = $.fancybox.getTranslate(slide.$slide);
4108
+ stagePos = $.fancybox.getTranslate(instance.$refs.stage);
4109
+
4110
+ slide.$slide
4111
+ .css({
4112
+ transform: "",
4113
+ opacity: "",
4114
+ "transition-duration": ""
4115
+ })
4116
+ .removeClass("fancybox-animated")
4117
+ .removeClass(function (index, className) {
4118
+ return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
4119
+ });
4120
+
4121
+ if (slide.pos === instance.current.pos) {
4122
+ self.sliderStartPos.top = slidePos.top - stagePos.top;
4123
+ self.sliderStartPos.left = slidePos.left - stagePos.left;
4124
+ }
4125
+
4126
+ $.fancybox.setTranslate(slide.$slide, {
4127
+ top: slidePos.top - stagePos.top,
4128
+ left: slidePos.left - stagePos.left
4129
+ });
4130
+ });
4131
+
4132
+ // Stop slideshow
4133
+ if (instance.SlideShow && instance.SlideShow.isActive) {
4134
+ instance.SlideShow.stop();
4135
+ }
4136
+ }
4137
+
4138
+ return;
4139
+ }
4140
+
4141
+ // Sticky edges
4142
+ if (swiping == "x") {
4143
+ if (
4144
+ self.distanceX > 0 &&
4145
+ (self.instance.group.length < 2 || (self.instance.current.index === 0 && !self.instance.current.opts.loop))
4146
+ ) {
4147
+ left = left + Math.pow(self.distanceX, 0.8);
4148
+ } else if (
4149
+ self.distanceX < 0 &&
4150
+ (self.instance.group.length < 2 ||
4151
+ (self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop))
4152
+ ) {
4153
+ left = left - Math.pow(-self.distanceX, 0.8);
4154
+ } else {
4155
+ left = left + self.distanceX;
4156
+ }
4157
+ }
4158
+
4159
+ self.sliderLastPos = {
4160
+ top: swiping == "x" ? 0 : self.sliderStartPos.top + self.distanceY,
4161
+ left: left
4162
+ };
4163
+
4164
+ if (self.requestId) {
4165
+ cancelAFrame(self.requestId);
4166
+
4167
+ self.requestId = null;
4168
+ }
4169
+
4170
+ self.requestId = requestAFrame(function () {
4171
+ if (self.sliderLastPos) {
4172
+ $.each(self.instance.slides, function (index, slide) {
4173
+ var pos = slide.pos - self.instance.currPos;
4174
+
4175
+ $.fancybox.setTranslate(slide.$slide, {
4176
+ top: self.sliderLastPos.top,
4177
+ left: self.sliderLastPos.left + pos * self.canvasWidth + pos * slide.opts.gutter
4178
+ });
4179
+ });
4180
+
4181
+ self.$container.addClass("fancybox-is-sliding");
4182
+ }
4183
+ });
4184
+ };
4185
+
4186
+ Guestures.prototype.onPan = function () {
4187
+ var self = this;
4188
+
4189
+ // Prevent accidental movement (sometimes, when tapping casually, finger can move a bit)
4190
+ if (distance(self.newPoints[0], self.realPoints[0]) < ($.fancybox.isMobile ? 10 : 5)) {
4191
+ self.startPoints = self.newPoints;
4192
+ return;
4193
+ }
4194
+
4195
+ self.canTap = false;
4196
+
4197
+ self.contentLastPos = self.limitMovement();
4198
+
4199
+ if (self.requestId) {
4200
+ cancelAFrame(self.requestId);
4201
+ }
4202
+
4203
+ self.requestId = requestAFrame(function () {
4204
+ $.fancybox.setTranslate(self.$content, self.contentLastPos);
4205
+ });
4206
+ };
4207
+
4208
+ // Make panning sticky to the edges
4209
+ Guestures.prototype.limitMovement = function () {
4210
+ var self = this;
4211
+
4212
+ var canvasWidth = self.canvasWidth;
4213
+ var canvasHeight = self.canvasHeight;
4214
+
4215
+ var distanceX = self.distanceX;
4216
+ var distanceY = self.distanceY;
4217
+
4218
+ var contentStartPos = self.contentStartPos;
4219
+
4220
+ var currentOffsetX = contentStartPos.left;
4221
+ var currentOffsetY = contentStartPos.top;
4222
+
4223
+ var currentWidth = contentStartPos.width;
4224
+ var currentHeight = contentStartPos.height;
4225
+
4226
+ var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY, newOffsetX, newOffsetY;
4227
+
4228
+ if (currentWidth > canvasWidth) {
4229
+ newOffsetX = currentOffsetX + distanceX;
4230
+ } else {
4231
+ newOffsetX = currentOffsetX;
4232
+ }
4233
+
4234
+ newOffsetY = currentOffsetY + distanceY;
4235
+
4236
+ // Slow down proportionally to traveled distance
4237
+ minTranslateX = Math.max(0, canvasWidth * 0.5 - currentWidth * 0.5);
4238
+ minTranslateY = Math.max(0, canvasHeight * 0.5 - currentHeight * 0.5);
4239
+
4240
+ maxTranslateX = Math.min(canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5);
4241
+ maxTranslateY = Math.min(canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5);
4242
+
4243
+ // ->
4244
+ if (distanceX > 0 && newOffsetX > minTranslateX) {
4245
+ newOffsetX = minTranslateX - 1 + Math.pow(-minTranslateX + currentOffsetX + distanceX, 0.8) || 0;
4246
+ }
4247
+
4248
+ // <-
4249
+ if (distanceX < 0 && newOffsetX < maxTranslateX) {
4250
+ newOffsetX = maxTranslateX + 1 - Math.pow(maxTranslateX - currentOffsetX - distanceX, 0.8) || 0;
4251
+ }
4252
+
4253
+ // \/
4254
+ if (distanceY > 0 && newOffsetY > minTranslateY) {
4255
+ newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8) || 0;
4256
+ }
4257
+
4258
+ // /\
4259
+ if (distanceY < 0 && newOffsetY < maxTranslateY) {
4260
+ newOffsetY = maxTranslateY + 1 - Math.pow(maxTranslateY - currentOffsetY - distanceY, 0.8) || 0;
4261
+ }
4262
+
4263
+ return {
4264
+ top: newOffsetY,
4265
+ left: newOffsetX
4266
+ };
4267
+ };
4268
+
4269
+ Guestures.prototype.limitPosition = function (newOffsetX, newOffsetY, newWidth, newHeight) {
4270
+ var self = this;
4271
+
4272
+ var canvasWidth = self.canvasWidth;
4273
+ var canvasHeight = self.canvasHeight;
4274
+
4275
+ if (newWidth > canvasWidth) {
4276
+ newOffsetX = newOffsetX > 0 ? 0 : newOffsetX;
4277
+ newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX;
4278
+ } else {
4279
+ // Center horizontally
4280
+ newOffsetX = Math.max(0, canvasWidth / 2 - newWidth / 2);
4281
+ }
4282
+
4283
+ if (newHeight > canvasHeight) {
4284
+ newOffsetY = newOffsetY > 0 ? 0 : newOffsetY;
4285
+ newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY;
4286
+ } else {
4287
+ // Center vertically
4288
+ newOffsetY = Math.max(0, canvasHeight / 2 - newHeight / 2);
4289
+ }
4290
+
4291
+ return {
4292
+ top: newOffsetY,
4293
+ left: newOffsetX
4294
+ };
4295
+ };
4296
+
4297
+ Guestures.prototype.onZoom = function () {
4298
+ var self = this;
4299
+
4300
+ // Calculate current distance between points to get pinch ratio and new width and height
4301
+ var contentStartPos = self.contentStartPos;
4302
+
4303
+ var currentWidth = contentStartPos.width;
4304
+ var currentHeight = contentStartPos.height;
4305
+
4306
+ var currentOffsetX = contentStartPos.left;
4307
+ var currentOffsetY = contentStartPos.top;
4308
+
4309
+ var endDistanceBetweenFingers = distance(self.newPoints[0], self.newPoints[1]);
4310
+
4311
+ var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers;
4312
+
4313
+ var newWidth = Math.floor(currentWidth * pinchRatio);
4314
+ var newHeight = Math.floor(currentHeight * pinchRatio);
4315
+
4316
+ // This is the translation due to pinch-zooming
4317
+ var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX;
4318
+ var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY;
4319
+
4320
+ // Point between the two touches
4321
+ var centerPointEndX = (self.newPoints[0].x + self.newPoints[1].x) / 2 - $(window).scrollLeft();
4322
+ var centerPointEndY = (self.newPoints[0].y + self.newPoints[1].y) / 2 - $(window).scrollTop();
4323
+
4324
+ // And this is the translation due to translation of the centerpoint
4325
+ // between the two fingers
4326
+ var translateFromTranslatingX = centerPointEndX - self.centerPointStartX;
4327
+ var translateFromTranslatingY = centerPointEndY - self.centerPointStartY;
4328
+
4329
+ // The new offset is the old/current one plus the total translation
4330
+ var newOffsetX = currentOffsetX + (translateFromZoomingX + translateFromTranslatingX);
4331
+ var newOffsetY = currentOffsetY + (translateFromZoomingY + translateFromTranslatingY);
4332
+
4333
+ var newPos = {
4334
+ top: newOffsetY,
4335
+ left: newOffsetX,
4336
+ scaleX: pinchRatio,
4337
+ scaleY: pinchRatio
4338
+ };
4339
+
4340
+ self.canTap = false;
4341
+
4342
+ self.newWidth = newWidth;
4343
+ self.newHeight = newHeight;
4344
+
4345
+ self.contentLastPos = newPos;
4346
+
4347
+ if (self.requestId) {
4348
+ cancelAFrame(self.requestId);
4349
+ }
4350
+
4351
+ self.requestId = requestAFrame(function () {
4352
+ $.fancybox.setTranslate(self.$content, self.contentLastPos);
4353
+ });
4354
+ };
4355
+
4356
+ Guestures.prototype.ontouchend = function (e) {
4357
+ var self = this;
4358
+
4359
+ var swiping = self.isSwiping;
4360
+ var panning = self.isPanning;
4361
+ var zooming = self.isZooming;
4362
+ var scrolling = self.isScrolling;
4363
+
4364
+ self.endPoints = getPointerXY(e);
4365
+ self.dMs = Math.max(new Date().getTime() - self.startTime, 1);
4366
+
4367
+ self.$container.removeClass("fancybox-is-grabbing");
4368
+
4369
+ $(document).off(".fb.touch");
4370
+
4371
+ document.removeEventListener("scroll", self.onscroll, true);
4372
+
4373
+ if (self.requestId) {
4374
+ cancelAFrame(self.requestId);
4375
+
4376
+ self.requestId = null;
4377
+ }
4378
+
4379
+ self.isSwiping = false;
4380
+ self.isPanning = false;
4381
+ self.isZooming = false;
4382
+ self.isScrolling = false;
4383
+
4384
+ self.instance.isDragging = false;
4385
+
4386
+ if (self.canTap) {
4387
+ return self.onTap(e);
4388
+ }
4389
+
4390
+ self.speed = 100;
4391
+
4392
+ // Speed in px/ms
4393
+ self.velocityX = (self.distanceX / self.dMs) * 0.5;
4394
+ self.velocityY = (self.distanceY / self.dMs) * 0.5;
4395
+
4396
+ if (panning) {
4397
+ self.endPanning();
4398
+ } else if (zooming) {
4399
+ self.endZooming();
4400
+ } else {
4401
+ self.endSwiping(swiping, scrolling);
4402
+ }
4403
+
4404
+ return;
4405
+ };
4406
+
4407
+ Guestures.prototype.endSwiping = function (swiping, scrolling) {
4408
+ var self = this,
4409
+ ret = false,
4410
+ len = self.instance.group.length,
4411
+ distanceX = Math.abs(self.distanceX),
4412
+ canAdvance = swiping == "x" && len > 1 && ((self.dMs > 130 && distanceX > 10) || distanceX > 50),
4413
+ speedX = 300;
4414
+
4415
+ self.sliderLastPos = null;
4416
+
4417
+ // Close if swiped vertically / navigate if horizontally
4418
+ if (swiping == "y" && !scrolling && Math.abs(self.distanceY) > 50) {
4419
+ // Continue vertical movement
4420
+ $.fancybox.animate(
4421
+ self.instance.current.$slide, {
4422
+ top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
4423
+ opacity: 0
4424
+ },
4425
+ 200
4426
+ );
4427
+ ret = self.instance.close(true, 250);
4428
+ } else if (canAdvance && self.distanceX > 0) {
4429
+ ret = self.instance.previous(speedX);
4430
+ } else if (canAdvance && self.distanceX < 0) {
4431
+ ret = self.instance.next(speedX);
4432
+ }
4433
+
4434
+ if (ret === false && (swiping == "x" || swiping == "y")) {
4435
+ self.instance.centerSlide(200);
4436
+ }
4437
+
4438
+ self.$container.removeClass("fancybox-is-sliding");
4439
+ };
4440
+
4441
+ // Limit panning from edges
4442
+ // ========================
4443
+ Guestures.prototype.endPanning = function () {
4444
+ var self = this,
4445
+ newOffsetX,
4446
+ newOffsetY,
4447
+ newPos;
4448
+
4449
+ if (!self.contentLastPos) {
4450
+ return;
4451
+ }
4452
+
4453
+ if (self.opts.momentum === false || self.dMs > 350) {
4454
+ newOffsetX = self.contentLastPos.left;
4455
+ newOffsetY = self.contentLastPos.top;
4456
+ } else {
4457
+ // Continue movement
4458
+ newOffsetX = self.contentLastPos.left + self.velocityX * 500;
4459
+ newOffsetY = self.contentLastPos.top + self.velocityY * 500;
4460
+ }
4461
+
4462
+ newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);
4463
+
4464
+ newPos.width = self.contentStartPos.width;
4465
+ newPos.height = self.contentStartPos.height;
4466
+
4467
+ $.fancybox.animate(self.$content, newPos, 366);
4468
+ };
4469
+
4470
+ Guestures.prototype.endZooming = function () {
4471
+ var self = this;
4472
+
4473
+ var current = self.instance.current;
4474
+
4475
+ var newOffsetX, newOffsetY, newPos, reset;
4476
+
4477
+ var newWidth = self.newWidth;
4478
+ var newHeight = self.newHeight;
4479
+
4480
+ if (!self.contentLastPos) {
4481
+ return;
4482
+ }
4483
+
4484
+ newOffsetX = self.contentLastPos.left;
4485
+ newOffsetY = self.contentLastPos.top;
4486
+
4487
+ reset = {
4488
+ top: newOffsetY,
4489
+ left: newOffsetX,
4490
+ width: newWidth,
4491
+ height: newHeight,
4492
+ scaleX: 1,
4493
+ scaleY: 1
4494
+ };
4495
+
4496
+ // Reset scalex/scaleY values; this helps for perfomance and does not break animation
4497
+ $.fancybox.setTranslate(self.$content, reset);
4498
+
4499
+ if (newWidth < self.canvasWidth && newHeight < self.canvasHeight) {
4500
+ self.instance.scaleToFit(150);
4501
+ } else if (newWidth > current.width || newHeight > current.height) {
4502
+ self.instance.scaleToActual(self.centerPointStartX, self.centerPointStartY, 150);
4503
+ } else {
4504
+ newPos = self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);
4505
+
4506
+ $.fancybox.animate(self.$content, newPos, 150);
4507
+ }
4508
+ };
4509
+
4510
+ Guestures.prototype.onTap = function (e) {
4511
+ var self = this;
4512
+ var $target = $(e.target);
4513
+
4514
+ var instance = self.instance;
4515
+ var current = instance.current;
4516
+
4517
+ var endPoints = (e && getPointerXY(e)) || self.startPoints;
4518
+
4519
+ var tapX = endPoints[0] ? endPoints[0].x - $(window).scrollLeft() - self.stagePos.left : 0;
4520
+ var tapY = endPoints[0] ? endPoints[0].y - $(window).scrollTop() - self.stagePos.top : 0;
4521
+
4522
+ var where;
4523
+
4524
+ var process = function (prefix) {
4525
+ var action = current.opts[prefix];
4526
+
4527
+ if ($.isFunction(action)) {
4528
+ action = action.apply(instance, [current, e]);
4529
+ }
4530
+
4531
+ if (!action) {
4532
+ return;
4533
+ }
4534
+
4535
+ switch (action) {
4536
+ case "close":
4537
+ instance.close(self.startEvent);
4538
+
4539
+ break;
4540
+
4541
+ case "toggleControls":
4542
+ instance.toggleControls();
4543
+
4544
+ break;
4545
+
4546
+ case "next":
4547
+ instance.next();
4548
+
4549
+ break;
4550
+
4551
+ case "nextOrClose":
4552
+ if (instance.group.length > 1) {
4553
+ instance.next();
4554
+ } else {
4555
+ instance.close(self.startEvent);
4556
+ }
4557
+
4558
+ break;
4559
+
4560
+ case "zoom":
4561
+ if (current.type == "image" && (current.isLoaded || current.$ghost)) {
4562
+ if (instance.canPan()) {
4563
+ instance.scaleToFit();
4564
+ } else if (instance.isScaledDown()) {
4565
+ instance.scaleToActual(tapX, tapY);
4566
+ } else if (instance.group.length < 2) {
4567
+ instance.close(self.startEvent);
4568
+ }
4569
+ }
4570
+
4571
+ break;
4572
+ }
4573
+ };
4574
+
4575
+ // Ignore right click
4576
+ if (e.originalEvent && e.originalEvent.button == 2) {
4577
+ return;
4578
+ }
4579
+
4580
+ // Skip if clicked on the scrollbar
4581
+ if (!$target.is("img") && tapX > $target[0].clientWidth + $target.offset().left) {
4582
+ return;
4583
+ }
4584
+
4585
+ // Check where is clicked
4586
+ if ($target.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container")) {
4587
+ where = "Outside";
4588
+ } else if ($target.is(".fancybox-slide")) {
4589
+ where = "Slide";
4590
+ } else if (
4591
+ instance.current.$content &&
4592
+ instance.current.$content
4593
+ .find($target)
4594
+ .addBack()
4595
+ .filter($target).length
4596
+ ) {
4597
+ where = "Content";
4598
+ } else {
4599
+ return;
4600
+ }
4601
+
4602
+ // Check if this is a double tap
4603
+ if (self.tapped) {
4604
+ // Stop previously created single tap
4605
+ clearTimeout(self.tapped);
4606
+ self.tapped = null;
4607
+
4608
+ // Skip if distance between taps is too big
4609
+ if (Math.abs(tapX - self.tapX) > 50 || Math.abs(tapY - self.tapY) > 50) {
4610
+ return this;
4611
+ }
4612
+
4613
+ // OK, now we assume that this is a double-tap
4614
+ process("dblclick" + where);
4615
+ } else {
4616
+ // Single tap will be processed if user has not clicked second time within 300ms
4617
+ // or there is no need to wait for double-tap
4618
+ self.tapX = tapX;
4619
+ self.tapY = tapY;
4620
+
4621
+ if (current.opts["dblclick" + where] && current.opts["dblclick" + where] !== current.opts["click" + where]) {
4622
+ self.tapped = setTimeout(function () {
4623
+ self.tapped = null;
4624
+
4625
+ if (!instance.isAnimating) {
4626
+ process("click" + where);
4627
+ }
4628
+ }, 500);
4629
+ } else {
4630
+ process("click" + where);
4631
+ }
4632
+ }
4633
+
4634
+ return this;
4635
+ };
4636
+
4637
+ $(document)
4638
+ .on("onActivate.fb", function (e, instance) {
4639
+ if (instance && !instance.Guestures) {
4640
+ instance.Guestures = new Guestures(instance);
4641
+ }
4642
+ })
4643
+ .on("beforeClose.fb", function (e, instance) {
4644
+ if (instance && instance.Guestures) {
4645
+ instance.Guestures.destroy();
4646
+ }
4647
+ });
4648
+ })(window, document, jQuery);
4649
+ // ==========================================================================
4650
+ //
4651
+ // SlideShow
4652
+ // Enables slideshow functionality
4653
+ //
4654
+ // Example of usage:
4655
+ // $.fancybox.getInstance().SlideShow.start()
4656
+ //
4657
+ // ==========================================================================
4658
+ (function (document, $) {
4659
+ "use strict";
4660
+
4661
+ $.extend(true, $.fancybox.defaults, {
4662
+ btnTpl: {
4663
+ slideShow: '<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}">' +
4664
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 5.4v13.2l11-6.6z"/></svg>' +
4665
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/></svg>' +
4666
+ "</button>"
4667
+ },
4668
+ slideShow: {
4669
+ autoStart: false,
4670
+ speed: 3000,
4671
+ progress: true
4672
+ }
4673
+ });
4674
+
4675
+ var SlideShow = function (instance) {
4676
+ this.instance = instance;
4677
+ this.init();
4678
+ };
4679
+
4680
+ $.extend(SlideShow.prototype, {
4681
+ timer: null,
4682
+ isActive: false,
4683
+ $button: null,
4684
+
4685
+ init: function () {
4686
+ var self = this,
4687
+ instance = self.instance,
4688
+ opts = instance.group[instance.currIndex].opts.slideShow;
4689
+
4690
+ self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function () {
4691
+ self.toggle();
4692
+ });
4693
+
4694
+ if (instance.group.length < 2 || !opts) {
4695
+ self.$button.hide();
4696
+ } else if (opts.progress) {
4697
+ self.$progress = $('<div class="fancybox-progress"></div>').appendTo(instance.$refs.inner);
4698
+ }
4699
+ },
4700
+
4701
+ set: function (force) {
4702
+ var self = this,
4703
+ instance = self.instance,
4704
+ current = instance.current;
4705
+
4706
+ // Check if reached last element
4707
+ if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) {
4708
+ if (self.isActive && current.contentType !== "video") {
4709
+ if (self.$progress) {
4710
+ $.fancybox.animate(self.$progress.show(), {
4711
+ scaleX: 1
4712
+ }, current.opts.slideShow.speed);
4713
+ }
4714
+
4715
+ self.timer = setTimeout(function () {
4716
+ if (!instance.current.opts.loop && instance.current.index == instance.group.length - 1) {
4717
+ instance.jumpTo(0);
4718
+ } else {
4719
+ instance.next();
4720
+ }
4721
+ }, current.opts.slideShow.speed);
4722
+ }
4723
+ } else {
4724
+ self.stop();
4725
+ instance.idleSecondsCounter = 0;
4726
+ instance.showControls();
4727
+ }
4728
+ },
4729
+
4730
+ clear: function () {
4731
+ var self = this;
4732
+
4733
+ clearTimeout(self.timer);
4734
+
4735
+ self.timer = null;
4736
+
4737
+ if (self.$progress) {
4738
+ self.$progress.removeAttr("style").hide();
4739
+ }
4740
+ },
4741
+
4742
+ start: function () {
4743
+ var self = this,
4744
+ current = self.instance.current;
4745
+
4746
+ if (current) {
4747
+ self.$button
4748
+ .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_STOP)
4749
+ .removeClass("fancybox-button--play")
4750
+ .addClass("fancybox-button--pause");
4751
+
4752
+ self.isActive = true;
4753
+
4754
+ if (current.isComplete) {
4755
+ self.set(true);
4756
+ }
4757
+
4758
+ self.instance.trigger("onSlideShowChange", true);
4759
+ }
4760
+ },
4761
+
4762
+ stop: function () {
4763
+ var self = this,
4764
+ current = self.instance.current;
4765
+
4766
+ self.clear();
4767
+
4768
+ self.$button
4769
+ .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_START)
4770
+ .removeClass("fancybox-button--pause")
4771
+ .addClass("fancybox-button--play");
4772
+
4773
+ self.isActive = false;
4774
+
4775
+ self.instance.trigger("onSlideShowChange", false);
4776
+
4777
+ if (self.$progress) {
4778
+ self.$progress.removeAttr("style").hide();
4779
+ }
4780
+ },
4781
+
4782
+ toggle: function () {
4783
+ var self = this;
4784
+
4785
+ if (self.isActive) {
4786
+ self.stop();
4787
+ } else {
4788
+ self.start();
4789
+ }
4790
+ }
4791
+ });
4792
+
4793
+ $(document).on({
4794
+ "onInit.fb": function (e, instance) {
4795
+ if (instance && !instance.SlideShow) {
4796
+ instance.SlideShow = new SlideShow(instance);
4797
+ }
4798
+ },
4799
+
4800
+ "beforeShow.fb": function (e, instance, current, firstRun) {
4801
+ var SlideShow = instance && instance.SlideShow;
4802
+
4803
+ if (firstRun) {
4804
+ if (SlideShow && current.opts.slideShow.autoStart) {
4805
+ SlideShow.start();
4806
+ }
4807
+ } else if (SlideShow && SlideShow.isActive) {
4808
+ SlideShow.clear();
4809
+ }
4810
+ },
4811
+
4812
+ "afterShow.fb": function (e, instance, current) {
4813
+ var SlideShow = instance && instance.SlideShow;
4814
+
4815
+ if (SlideShow && SlideShow.isActive) {
4816
+ SlideShow.set();
4817
+ }
4818
+ },
4819
+
4820
+ "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
4821
+ var SlideShow = instance && instance.SlideShow;
4822
+
4823
+ // "P" or Spacebar
4824
+ if (SlideShow && current.opts.slideShow && (keycode === 80 || keycode === 32) && !$(document.activeElement).is("button,a,input")) {
4825
+ keypress.preventDefault();
4826
+
4827
+ SlideShow.toggle();
4828
+ }
4829
+ },
4830
+
4831
+ "beforeClose.fb onDeactivate.fb": function (e, instance) {
4832
+ var SlideShow = instance && instance.SlideShow;
4833
+
4834
+ if (SlideShow) {
4835
+ SlideShow.stop();
4836
+ }
4837
+ }
4838
+ });
4839
+
4840
+ // Page Visibility API to pause slideshow when window is not active
4841
+ $(document).on("visibilitychange", function () {
4842
+ var instance = $.fancybox.getInstance(),
4843
+ SlideShow = instance && instance.SlideShow;
4844
+
4845
+ if (SlideShow && SlideShow.isActive) {
4846
+ if (document.hidden) {
4847
+ SlideShow.clear();
4848
+ } else {
4849
+ SlideShow.set();
4850
+ }
4851
+ }
4852
+ });
4853
+ })(document, jQuery);
4854
+ // ==========================================================================
4855
+ //
4856
+ // FullScreen
4857
+ // Adds fullscreen functionality
4858
+ //
4859
+ // ==========================================================================
4860
+ (function (document, $) {
4861
+ "use strict";
4862
+
4863
+ // Collection of methods supported by user browser
4864
+ var fn = (function () {
4865
+ var fnMap = [
4866
+ ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
4867
+ // new WebKit
4868
+ [
4869
+ "webkitRequestFullscreen",
4870
+ "webkitExitFullscreen",
4871
+ "webkitFullscreenElement",
4872
+ "webkitFullscreenEnabled",
4873
+ "webkitfullscreenchange",
4874
+ "webkitfullscreenerror"
4875
+ ],
4876
+ // old WebKit (Safari 5.1)
4877
+ [
4878
+ "webkitRequestFullScreen",
4879
+ "webkitCancelFullScreen",
4880
+ "webkitCurrentFullScreenElement",
4881
+ "webkitCancelFullScreen",
4882
+ "webkitfullscreenchange",
4883
+ "webkitfullscreenerror"
4884
+ ],
4885
+ [
4886
+ "mozRequestFullScreen",
4887
+ "mozCancelFullScreen",
4888
+ "mozFullScreenElement",
4889
+ "mozFullScreenEnabled",
4890
+ "mozfullscreenchange",
4891
+ "mozfullscreenerror"
4892
+ ],
4893
+ ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]
4894
+ ];
4895
+
4896
+ var ret = {};
4897
+
4898
+ for (var i = 0; i < fnMap.length; i++) {
4899
+ var val = fnMap[i];
4900
+
4901
+ if (val && val[1] in document) {
4902
+ for (var j = 0; j < val.length; j++) {
4903
+ ret[fnMap[0][j]] = val[j];
4904
+ }
4905
+
4906
+ return ret;
4907
+ }
4908
+ }
4909
+
4910
+ return false;
4911
+ })();
4912
+
4913
+ if (fn) {
4914
+ var FullScreen = {
4915
+ request: function (elem) {
4916
+ elem = elem || document.documentElement;
4917
+
4918
+ elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
4919
+ },
4920
+ exit: function () {
4921
+ document[fn.exitFullscreen]();
4922
+ },
4923
+ toggle: function (elem) {
4924
+ elem = elem || document.documentElement;
4925
+
4926
+ if (this.isFullscreen()) {
4927
+ this.exit();
4928
+ } else {
4929
+ this.request(elem);
4930
+ }
4931
+ },
4932
+ isFullscreen: function () {
4933
+ return Boolean(document[fn.fullscreenElement]);
4934
+ },
4935
+ enabled: function () {
4936
+ return Boolean(document[fn.fullscreenEnabled]);
4937
+ }
4938
+ };
4939
+
4940
+ $.extend(true, $.fancybox.defaults, {
4941
+ btnTpl: {
4942
+ fullScreen: '<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' +
4943
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>' +
4944
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg>' +
4945
+ "</button>"
4946
+ },
4947
+ fullScreen: {
4948
+ autoStart: false
4949
+ }
4950
+ });
4951
+
4952
+ $(document).on(fn.fullscreenchange, function () {
4953
+ var isFullscreen = FullScreen.isFullscreen(),
4954
+ instance = $.fancybox.getInstance();
4955
+
4956
+ if (instance) {
4957
+ // If image is zooming, then force to stop and reposition properly
4958
+ if (instance.current && instance.current.type === "image" && instance.isAnimating) {
4959
+ instance.isAnimating = false;
4960
+
4961
+ instance.update(true, true, 0);
4962
+
4963
+ if (!instance.isComplete) {
4964
+ instance.complete();
4965
+ }
4966
+ }
4967
+
4968
+ instance.trigger("onFullscreenChange", isFullscreen);
4969
+
4970
+ instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen);
4971
+
4972
+ instance.$refs.toolbar
4973
+ .find("[data-fancybox-fullscreen]")
4974
+ .toggleClass("fancybox-button--fsenter", !isFullscreen)
4975
+ .toggleClass("fancybox-button--fsexit", isFullscreen);
4976
+ }
4977
+ });
4978
+ }
4979
+
4980
+ $(document).on({
4981
+ "onInit.fb": function (e, instance) {
4982
+ var $container;
4983
+
4984
+ if (!fn) {
4985
+ instance.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();
4986
+
4987
+ return;
4988
+ }
4989
+
4990
+ if (instance && instance.group[instance.currIndex].opts.fullScreen) {
4991
+ $container = instance.$refs.container;
4992
+
4993
+ $container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function (e) {
4994
+ e.stopPropagation();
4995
+ e.preventDefault();
4996
+
4997
+ FullScreen.toggle();
4998
+ });
4999
+
5000
+ if (instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true) {
5001
+ FullScreen.request();
5002
+ }
5003
+
5004
+ // Expose API
5005
+ instance.FullScreen = FullScreen;
5006
+ } else if (instance) {
5007
+ instance.$refs.toolbar.find("[data-fancybox-fullscreen]").hide();
5008
+ }
5009
+ },
5010
+
5011
+ "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
5012
+ // "F"
5013
+ if (instance && instance.FullScreen && keycode === 70) {
5014
+ keypress.preventDefault();
5015
+
5016
+ instance.FullScreen.toggle();
5017
+ }
5018
+ },
5019
+
5020
+ "beforeClose.fb": function (e, instance) {
5021
+ if (instance && instance.FullScreen && instance.$refs.container.hasClass("fancybox-is-fullscreen")) {
5022
+ FullScreen.exit();
5023
+ }
5024
+ }
5025
+ });
5026
+ })(document, jQuery);
5027
+ // ==========================================================================
5028
+ //
5029
+ // Thumbs
5030
+ // Displays thumbnails in a grid
5031
+ //
5032
+ // ==========================================================================
5033
+ (function (document, $) {
5034
+ "use strict";
5035
+
5036
+ var CLASS = "fancybox-thumbs",
5037
+ CLASS_ACTIVE = CLASS + "-active";
5038
+
5039
+ // Make sure there are default values
5040
+ $.fancybox.defaults = $.extend(
5041
+ true, {
5042
+ btnTpl: {
5043
+ thumbs: '<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}">' +
5044
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.59 14.59h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76H5.65V5.65z"/></svg>' +
5045
+ "</button>"
5046
+ },
5047
+ thumbs: {
5048
+ autoStart: false, // Display thumbnails on opening
5049
+ hideOnClose: true, // Hide thumbnail grid when closing animation starts
5050
+ parentEl: ".fancybox-container", // Container is injected into this element
5051
+ axis: "y" // Vertical (y) or horizontal (x) scrolling
5052
+ }
5053
+ },
5054
+ $.fancybox.defaults
5055
+ );
5056
+
5057
+ var FancyThumbs = function (instance) {
5058
+ this.init(instance);
5059
+ };
5060
+
5061
+ $.extend(FancyThumbs.prototype, {
5062
+ $button: null,
5063
+ $grid: null,
5064
+ $list: null,
5065
+ isVisible: false,
5066
+ isActive: false,
5067
+
5068
+ init: function (instance) {
5069
+ var self = this,
5070
+ group = instance.group,
5071
+ enabled = 0;
5072
+
5073
+ self.instance = instance;
5074
+ self.opts = group[instance.currIndex].opts.thumbs;
5075
+
5076
+ instance.Thumbs = self;
5077
+
5078
+ self.$button = instance.$refs.toolbar.find("[data-fancybox-thumbs]");
5079
+
5080
+ // Enable thumbs if at least two group items have thumbnails
5081
+ for (var i = 0, len = group.length; i < len; i++) {
5082
+ if (group[i].thumb) {
5083
+ enabled++;
5084
+ }
5085
+
5086
+ if (enabled > 1) {
5087
+ break;
5088
+ }
5089
+ }
5090
+
5091
+ if (enabled > 1 && !!self.opts) {
5092
+ self.$button.removeAttr("style").on("click", function () {
5093
+ self.toggle();
5094
+ });
5095
+
5096
+ self.isActive = true;
5097
+ } else {
5098
+ self.$button.hide();
5099
+ }
5100
+ },
5101
+
5102
+ create: function () {
5103
+ var self = this,
5104
+ instance = self.instance,
5105
+ parentEl = self.opts.parentEl,
5106
+ list = [],
5107
+ src;
5108
+
5109
+ if (!self.$grid) {
5110
+ // Create main element
5111
+ self.$grid = $('<div class="' + CLASS + " " + CLASS + "-" + self.opts.axis + '"></div>').appendTo(
5112
+ instance.$refs.container
5113
+ .find(parentEl)
5114
+ .addBack()
5115
+ .filter(parentEl)
5116
+ );
5117
+
5118
+ // Add "click" event that performs gallery navigation
5119
+ self.$grid.on("click", "a", function () {
5120
+ instance.jumpTo($(this).attr("data-index"));
5121
+ });
5122
+ }
5123
+
5124
+ // Build the list
5125
+ if (!self.$list) {
5126
+ self.$list = $('<div class="' + CLASS + '__list">').appendTo(self.$grid);
5127
+ }
5128
+
5129
+ $.each(instance.group, function (i, item) {
5130
+ src = item.thumb;
5131
+
5132
+ if (!src && item.type === "image") {
5133
+ src = item.src;
5134
+ }
5135
+
5136
+ list.push(
5137
+ '<a href="javascript:;" tabindex="0" data-index="' +
5138
+ i +
5139
+ '"' +
5140
+ (src && src.length ? ' style="background-image:url(' + src + ')"' : 'class="fancybox-thumbs-missing"') +
5141
+ "></a>"
5142
+ );
5143
+ });
5144
+
5145
+ self.$list[0].innerHTML = list.join("");
5146
+
5147
+ if (self.opts.axis === "x") {
5148
+ // Set fixed width for list element to enable horizontal scrolling
5149
+ self.$list.width(
5150
+ parseInt(self.$grid.css("padding-right"), 10) +
5151
+ instance.group.length *
5152
+ self.$list
5153
+ .children()
5154
+ .eq(0)
5155
+ .outerWidth(true)
5156
+ );
5157
+ }
5158
+ },
5159
+
5160
+ focus: function (duration) {
5161
+ var self = this,
5162
+ $list = self.$list,
5163
+ $grid = self.$grid,
5164
+ thumb,
5165
+ thumbPos;
5166
+
5167
+ if (!self.instance.current) {
5168
+ return;
5169
+ }
5170
+
5171
+ thumb = $list
5172
+ .children()
5173
+ .removeClass(CLASS_ACTIVE)
5174
+ .filter('[data-index="' + self.instance.current.index + '"]')
5175
+ .addClass(CLASS_ACTIVE);
5176
+
5177
+ thumbPos = thumb.position();
5178
+
5179
+ // Check if need to scroll to make current thumb visible
5180
+ if (self.opts.axis === "y" && (thumbPos.top < 0 || thumbPos.top > $list.height() - thumb.outerHeight())) {
5181
+ $list.stop().animate({
5182
+ scrollTop: $list.scrollTop() + thumbPos.top
5183
+ },
5184
+ duration
5185
+ );
5186
+ } else if (
5187
+ self.opts.axis === "x" &&
5188
+ (thumbPos.left < $grid.scrollLeft() || thumbPos.left > $grid.scrollLeft() + ($grid.width() - thumb.outerWidth()))
5189
+ ) {
5190
+ $list
5191
+ .parent()
5192
+ .stop()
5193
+ .animate({
5194
+ scrollLeft: thumbPos.left
5195
+ },
5196
+ duration
5197
+ );
5198
+ }
5199
+ },
5200
+
5201
+ update: function () {
5202
+ var that = this;
5203
+ that.instance.$refs.container.toggleClass("fancybox-show-thumbs", this.isVisible);
5204
+
5205
+ if (that.isVisible) {
5206
+ if (!that.$grid) {
5207
+ that.create();
5208
+ }
5209
+
5210
+ that.instance.trigger("onThumbsShow");
5211
+
5212
+ that.focus(0);
5213
+ } else if (that.$grid) {
5214
+ that.instance.trigger("onThumbsHide");
5215
+ }
5216
+
5217
+ // Update content position
5218
+ that.instance.update();
5219
+ },
5220
+
5221
+ hide: function () {
5222
+ this.isVisible = false;
5223
+ this.update();
5224
+ },
5225
+
5226
+ show: function () {
5227
+ this.isVisible = true;
5228
+ this.update();
5229
+ },
5230
+
5231
+ toggle: function () {
5232
+ this.isVisible = !this.isVisible;
5233
+ this.update();
5234
+ }
5235
+ });
5236
+
5237
+ $(document).on({
5238
+ "onInit.fb": function (e, instance) {
5239
+ var Thumbs;
5240
+
5241
+ if (instance && !instance.Thumbs) {
5242
+ Thumbs = new FancyThumbs(instance);
5243
+
5244
+ if (Thumbs.isActive && Thumbs.opts.autoStart === true) {
5245
+ Thumbs.show();
5246
+ }
5247
+ }
5248
+ },
5249
+
5250
+ "beforeShow.fb": function (e, instance, item, firstRun) {
5251
+ var Thumbs = instance && instance.Thumbs;
5252
+
5253
+ if (Thumbs && Thumbs.isVisible) {
5254
+ Thumbs.focus(firstRun ? 0 : 250);
5255
+ }
5256
+ },
5257
+
5258
+ "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
5259
+ var Thumbs = instance && instance.Thumbs;
5260
+
5261
+ // "G"
5262
+ if (Thumbs && Thumbs.isActive && keycode === 71) {
5263
+ keypress.preventDefault();
5264
+
5265
+ Thumbs.toggle();
5266
+ }
5267
+ },
5268
+
5269
+ "beforeClose.fb": function (e, instance) {
5270
+ var Thumbs = instance && instance.Thumbs;
5271
+
5272
+ if (Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false) {
5273
+ Thumbs.$grid.hide();
5274
+ }
5275
+ }
5276
+ });
5277
+ })(document, jQuery);
5278
+ //// ==========================================================================
5279
+ //
5280
+ // Share
5281
+ // Displays simple form for sharing current url
5282
+ //
5283
+ // ==========================================================================
5284
+ (function (document, $) {
5285
+ "use strict";
5286
+
5287
+ $.extend(true, $.fancybox.defaults, {
5288
+ btnTpl: {
5289
+ share: '<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}">' +
5290
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.55 19c1.4-8.4 9.1-9.8 11.9-9.8V5l7 7-7 6.3v-3.5c-2.8 0-10.5 2.1-11.9 4.2z"/></svg>' +
5291
+ "</button>"
5292
+ },
5293
+ share: {
5294
+ url: function (instance, item) {
5295
+ return (
5296
+ (!instance.currentHash && !(item.type === "inline" || item.type === "html") ? item.origSrc || item.src : false) || window.location
5297
+ );
5298
+ },
5299
+ tpl: '<div class="fancybox-share">' +
5300
+ "<h1>{{SHARE}}</h1>" +
5301
+ "<p>" +
5302
+ '<a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}">' +
5303
+ '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m287 456v-299c0-21 6-35 35-35h38v-63c-7-1-29-3-55-3-54 0-91 33-91 94v306m143-254h-205v72h196" /></svg>' +
5304
+ "<span>Facebook</span>" +
5305
+ "</a>" +
5306
+ '<a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&text={{descr}}">' +
5307
+ '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" /></svg>' +
5308
+ "<span>Twitter</span>" +
5309
+ "</a>" +
5310
+ '<a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&description={{descr}}&media={{media}}">' +
5311
+ '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m265 56c-109 0-164 78-164 144 0 39 15 74 47 87 5 2 10 0 12-5l4-19c2-6 1-8-3-13-9-11-15-25-15-45 0-58 43-110 113-110 62 0 96 38 96 88 0 67-30 122-73 122-24 0-42-19-36-44 6-29 20-60 20-81 0-19-10-35-31-35-25 0-44 26-44 60 0 21 7 36 7 36l-30 125c-8 37-1 83 0 87 0 3 4 4 5 2 2-3 32-39 42-75l16-64c8 16 31 29 56 29 74 0 124-67 124-157 0-69-58-132-146-132z" fill="#fff"/></svg>' +
5312
+ "<span>Pinterest</span>" +
5313
+ "</a>" +
5314
+ "</p>" +
5315
+ '<p><input class="fancybox-share__input" type="text" value="{{url_raw}}" onclick="select()" /></p>' +
5316
+ "</div>"
5317
+ }
5318
+ });
5319
+
5320
+ function escapeHtml(string) {
5321
+ var entityMap = {
5322
+ "&": "&amp;",
5323
+ "<": "&lt;",
5324
+ ">": "&gt;",
5325
+ '"': "&quot;",
5326
+ "'": "&#39;",
5327
+ "/": "&#x2F;",
5328
+ "`": "&#x60;",
5329
+ "=": "&#x3D;"
5330
+ };
5331
+
5332
+ return String(string).replace(/[&<>"'`=\/]/g, function (s) {
5333
+ return entityMap[s];
5334
+ });
5335
+ }
5336
+
5337
+ $(document).on("click", "[data-fancybox-share]", function () {
5338
+ var instance = $.fancybox.getInstance(),
5339
+ current = instance.current || null,
5340
+ url,
5341
+ tpl;
5342
+
5343
+ if (!current) {
5344
+ return;
5345
+ }
5346
+
5347
+ if ($.type(current.opts.share.url) === "function") {
5348
+ url = current.opts.share.url.apply(current, [instance, current]);
5349
+ }
5350
+
5351
+ tpl = current.opts.share.tpl
5352
+ .replace(/\{\{media\}\}/g, current.type === "image" ? encodeURIComponent(current.src) : "")
5353
+ .replace(/\{\{url\}\}/g, encodeURIComponent(url))
5354
+ .replace(/\{\{url_raw\}\}/g, escapeHtml(url))
5355
+ .replace(/\{\{descr\}\}/g, instance.$caption ? encodeURIComponent(instance.$caption.text()) : "");
5356
+
5357
+ $.fancybox.open({
5358
+ src: instance.translate(instance, tpl),
5359
+ type: "html",
5360
+ opts: {
5361
+ touch: false,
5362
+ animationEffect: false,
5363
+ afterLoad: function (shareInstance, shareCurrent) {
5364
+ // Close self if parent instance is closing
5365
+ instance.$refs.container.one("beforeClose.fb", function () {
5366
+ shareInstance.close(null, 0);
5367
+ });
5368
+
5369
+ // Opening links in a popup window
5370
+ shareCurrent.$content.find(".fancybox-share__button").click(function () {
5371
+ window.open(this.href, "Share", "width=550, height=450");
5372
+ return false;
5373
+ });
5374
+ },
5375
+ mobile: {
5376
+ autoFocus: false
5377
+ }
5378
+ }
5379
+ });
5380
+ });
5381
+ })(document, jQuery);
5382
+ // ==========================================================================
5383
+ //
5384
+ // Hash
5385
+ // Enables linking to each modal
5386
+ //
5387
+ // ==========================================================================
5388
+ (function (window, document, $) {
5389
+ "use strict";
5390
+
5391
+ // Simple $.escapeSelector polyfill (for jQuery prior v3)
5392
+ if (!$.escapeSelector) {
5393
+ $.escapeSelector = function (sel) {
5394
+ var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
5395
+ var fcssescape = function (ch, asCodePoint) {
5396
+ if (asCodePoint) {
5397
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
5398
+ if (ch === "\0") {
5399
+ return "\uFFFD";
5400
+ }
5401
+
5402
+ // Control characters and (dependent upon position) numbers get escaped as code points
5403
+ return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
5404
+ }
5405
+
5406
+ // Other potentially-special ASCII characters get backslash-escaped
5407
+ return "\\" + ch;
5408
+ };
5409
+
5410
+ return (sel + "").replace(rcssescape, fcssescape);
5411
+ };
5412
+ }
5413
+
5414
+ // Get info about gallery name and current index from url
5415
+ function parseUrl() {
5416
+ var hash = window.location.hash.substr(1),
5417
+ rez = hash.split("-"),
5418
+ index = rez.length > 1 && /^\+?\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,
5419
+ gallery = rez.join("-");
5420
+
5421
+ return {
5422
+ hash: hash,
5423
+ /* Index is starting from 1 */
5424
+ index: index < 1 ? 1 : index,
5425
+ gallery: gallery
5426
+ };
5427
+ }
5428
+
5429
+ // Trigger click evnt on links to open new fancyBox instance
5430
+ function triggerFromUrl(url) {
5431
+ if (url.gallery !== "") {
5432
+ // If we can find element matching 'data-fancybox' atribute,
5433
+ // then triggering click event should start fancyBox
5434
+ $("[data-fancybox='" + $.escapeSelector(url.gallery) + "']")
5435
+ .eq(url.index - 1)
5436
+ .focus()
5437
+ .trigger("click.fb-start");
5438
+ }
5439
+ }
5440
+
5441
+ // Get gallery name from current instance
5442
+ function getGalleryID(instance) {
5443
+ var opts, ret;
5444
+
5445
+ if (!instance) {
5446
+ return false;
5447
+ }
5448
+
5449
+ opts = instance.current ? instance.current.opts : instance.opts;
5450
+ ret = opts.hash || (opts.$orig ? opts.$orig.data("fancybox") || opts.$orig.data("fancybox-trigger") : "");
5451
+
5452
+ return ret === "" ? false : ret;
5453
+ }
5454
+
5455
+ // Start when DOM becomes ready
5456
+ $(function () {
5457
+ // Check if user has disabled this module
5458
+ if ($.fancybox.defaults.hash === false) {
5459
+ return;
5460
+ }
5461
+
5462
+ // Update hash when opening/closing fancyBox
5463
+ $(document).on({
5464
+ "onInit.fb": function (e, instance) {
5465
+ var url, gallery;
5466
+
5467
+ if (instance.group[instance.currIndex].opts.hash === false) {
5468
+ return;
5469
+ }
5470
+
5471
+ url = parseUrl();
5472
+ gallery = getGalleryID(instance);
5473
+
5474
+ // Make sure gallery start index matches index from hash
5475
+ if (gallery && url.gallery && gallery == url.gallery) {
5476
+ instance.currIndex = url.index - 1;
5477
+ }
5478
+ },
5479
+
5480
+ "beforeShow.fb": function (e, instance, current, firstRun) {
5481
+ var gallery;
5482
+
5483
+ if (!current || current.opts.hash === false) {
5484
+ return;
5485
+ }
5486
+
5487
+ // Check if need to update window hash
5488
+ gallery = getGalleryID(instance);
5489
+
5490
+ if (!gallery) {
5491
+ return;
5492
+ }
5493
+
5494
+ // Variable containing last hash value set by fancyBox
5495
+ // It will be used to determine if fancyBox needs to close after hash change is detected
5496
+ instance.currentHash = gallery + (instance.group.length > 1 ? "-" + (current.index + 1) : "");
5497
+
5498
+ // If current hash is the same (this instance most likely is opened by hashchange), then do nothing
5499
+ if (window.location.hash === "#" + instance.currentHash) {
5500
+ return;
5501
+ }
5502
+
5503
+ if (firstRun && !instance.origHash) {
5504
+ instance.origHash = window.location.hash;
5505
+ }
5506
+
5507
+ if (instance.hashTimer) {
5508
+ clearTimeout(instance.hashTimer);
5509
+ }
5510
+
5511
+ // Update hash
5512
+ instance.hashTimer = setTimeout(function () {
5513
+ if ("replaceState" in window.history) {
5514
+ window.history[firstRun ? "pushState" : "replaceState"]({},
5515
+ document.title,
5516
+ window.location.pathname + window.location.search + "#" + instance.currentHash
5517
+ );
5518
+
5519
+ if (firstRun) {
5520
+ instance.hasCreatedHistory = true;
5521
+ }
5522
+ } else {
5523
+ window.location.hash = instance.currentHash;
5524
+ }
5525
+
5526
+ instance.hashTimer = null;
5527
+ }, 300);
5528
+ },
5529
+
5530
+ "beforeClose.fb": function (e, instance, current) {
5531
+ if (!current || current.opts.hash === false) {
5532
+ return;
5533
+ }
5534
+
5535
+ clearTimeout(instance.hashTimer);
5536
+
5537
+ // Goto previous history entry
5538
+ if (instance.currentHash && instance.hasCreatedHistory) {
5539
+ window.history.back();
5540
+ } else if (instance.currentHash) {
5541
+ if ("replaceState" in window.history) {
5542
+ window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (instance.origHash || ""));
5543
+ } else {
5544
+ window.location.hash = instance.origHash;
5545
+ }
5546
+ }
5547
+
5548
+ instance.currentHash = null;
5549
+ }
5550
+ });
5551
+
5552
+ // Check if need to start/close after url has changed
5553
+ $(window).on("hashchange.fb", function () {
5554
+ var url = parseUrl(),
5555
+ fb = null;
5556
+
5557
+ // Find last fancyBox instance that has "hash"
5558
+ $.each(
5559
+ $(".fancybox-container")
5560
+ .get()
5561
+ .reverse(),
5562
+ function (index, value) {
5563
+ var tmp = $(value).data("FancyBox");
5564
+
5565
+ if (tmp && tmp.currentHash) {
5566
+ fb = tmp;
5567
+ return false;
5568
+ }
5569
+ }
5570
+ );
5571
+
5572
+ if (fb) {
5573
+ // Now, compare hash values
5574
+ if (fb.currentHash !== url.gallery + "-" + url.index && !(url.index === 1 && fb.currentHash == url.gallery)) {
5575
+ fb.currentHash = null;
5576
+
5577
+ fb.close();
5578
+ }
5579
+ } else if (url.gallery !== "") {
5580
+ triggerFromUrl(url);
5581
+ }
5582
+ });
5583
+
5584
+ // Check current hash and trigger click event on matching element to start fancyBox, if needed
5585
+ setTimeout(function () {
5586
+ if (!$.fancybox.getInstance()) {
5587
+ triggerFromUrl(parseUrl());
5588
+ }
5589
+ }, 50);
5590
+ });
5591
+ })(window, document, jQuery);
5592
+ // ==========================================================================
5593
+ //
5594
+ // Wheel
5595
+ // Basic mouse weheel support for gallery navigation
5596
+ //
5597
+ // ==========================================================================
5598
+ (function (document, $) {
5599
+ "use strict";
5600
+
5601
+ var prevTime = new Date().getTime();
5602
+
5603
+ $(document).on({
5604
+ "onInit.fb": function (e, instance, current) {
5605
+ instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function (e) {
5606
+ var current = instance.current,
5607
+ currTime = new Date().getTime();
5608
+
5609
+ if (instance.group.length < 2 || current.opts.wheel === false || (current.opts.wheel === "auto" && current.type !== "image")) {
5610
+ return;
5611
+ }
5612
+
5613
+ e.preventDefault();
5614
+ e.stopPropagation();
5615
+
5616
+ if (current.$slide.hasClass("fancybox-animated")) {
5617
+ return;
5618
+ }
5619
+
5620
+ e = e.originalEvent || e;
5621
+
5622
+ if (currTime - prevTime < 250) {
5623
+ return;
5624
+ }
5625
+
5626
+ prevTime = currTime;
5627
+
5628
+ instance[(-e.deltaY || -e.deltaX || e.wheelDelta || -e.detail) < 0 ? "next" : "previous"]();
5629
+ });
5630
+ }
5631
+ });
5632
+ })(document, jQuery);
assets_libraries/fancybox3/jquery.fancybox.min.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";body.fancybox-active{overflow:hidden}body.fancybox-iosfix{position:fixed;left:0;right:0}.fancybox-is-hidden{position:absolute;top:-9999px;left:-9999px;visibility:hidden}.fancybox-container{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99992;-webkit-tap-highlight-color:transparent;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-stage{position:absolute;top:0;right:0;bottom:0;left:0}.fancybox-outer{overflow-y:auto;-webkit-overflow-scrolling:touch}.fancybox-bg{background:#1e1e1e;opacity:0;transition-duration:inherit;transition-property:opacity;transition-timing-function:cubic-bezier(.47,0,.74,.71)}.fancybox-is-open .fancybox-bg{opacity:.87;transition-timing-function:cubic-bezier(.22,.61,.36,1)}.fancybox-caption-wrap,.fancybox-infobar,.fancybox-toolbar{position:absolute;direction:ltr;z-index:99997;opacity:0;visibility:hidden;transition:opacity .25s,visibility 0s linear .25s;box-sizing:border-box}.fancybox-show-caption .fancybox-caption-wrap,.fancybox-show-infobar .fancybox-infobar,.fancybox-show-toolbar .fancybox-toolbar{opacity:1;visibility:visible;transition:opacity .25s,visibility 0s}.fancybox-infobar{top:0;left:0;font-size:13px;padding:0 10px;height:44px;min-width:44px;line-height:44px;color:#ccc;text-align:center;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:subpixel-antialiased;mix-blend-mode:exclusion}.fancybox-toolbar{top:0;right:0;margin:0;padding:0}.fancybox-stage{overflow:hidden;direction:ltr;z-index:99994;-webkit-transform:translateZ(0)}.fancybox-is-closing .fancybox-stage{overflow:visible}.fancybox-slide{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;overflow:auto;outline:none;white-space:normal;box-sizing:border-box;text-align:center;z-index:99994;-webkit-overflow-scrolling:touch;display:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.fancybox-slide:before{content:"";display:inline-block;vertical-align:middle;height:100%;width:0}.fancybox-is-sliding .fancybox-slide,.fancybox-slide--current,.fancybox-slide--next,.fancybox-slide--previous{display:block}.fancybox-slide--image{overflow:visible}.fancybox-slide--image:before{display:none}.fancybox-slide--video .fancybox-content,.fancybox-slide--video iframe{background:#000}.fancybox-slide--map .fancybox-content,.fancybox-slide--map iframe{background:#e5e3df}.fancybox-slide--next{z-index:99995}.fancybox-slide>*{display:inline-block;position:relative;padding:24px;margin:44px 0;border-width:0;vertical-align:middle;text-align:left;background-color:#fff;overflow:auto;box-sizing:border-box}.fancybox-slide>base,.fancybox-slide>link,.fancybox-slide>meta,.fancybox-slide>script,.fancybox-slide>style,.fancybox-slide>title{display:none}.fancybox-slide .fancybox-image-wrap{position:absolute;top:0;left:0;margin:0;padding:0;border:0;z-index:99995;background:transparent;cursor:default;overflow:visible;-webkit-transform-origin:top left;transform-origin:top left;background-size:100% 100%;background-repeat:no-repeat;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.fancybox-can-zoomOut .fancybox-image-wrap{cursor:zoom-out}.fancybox-can-zoomIn .fancybox-image-wrap{cursor:zoom-in}.fancybox-can-drag .fancybox-image-wrap{cursor:-webkit-grab;cursor:grab}.fancybox-is-dragging .fancybox-image-wrap{cursor:-webkit-grabbing;cursor:grabbing}.fancybox-image,.fancybox-spaceball{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;border:0;max-width:none;max-height:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-spaceball{z-index:1}.fancybox-slide--iframe .fancybox-content{padding:0;width:80%;height:80%;max-width:calc(100% - 100px);max-height:calc(100% - 88px);overflow:visible;background:#fff}.fancybox-iframe{display:block;padding:0;border:0;height:100%}.fancybox-error,.fancybox-iframe{margin:0;width:100%;background:#fff}.fancybox-error{padding:40px;max-width:380px;cursor:default}.fancybox-error p{margin:0;padding:0;color:#444;font-size:16px;line-height:20px}.fancybox-button{box-sizing:border-box;display:inline-block;vertical-align:top;width:44px;height:44px;margin:0;padding:10px;border:0;border-radius:0;background:rgba(30,30,30,.6);transition:color .3s ease;cursor:pointer;outline:none}.fancybox-button,.fancybox-button:link,.fancybox-button:visited{color:#ccc}.fancybox-button:focus,.fancybox-button:hover{color:#fff}.fancybox-button[disabled]{color:#ccc;cursor:default;opacity:.6}.fancybox-button svg{display:block;position:relative;overflow:visible;shape-rendering:geometricPrecision}.fancybox-button svg path{fill:currentColor;stroke:currentColor;stroke-linejoin:round;stroke-width:3}.fancybox-button--share svg path{stroke-width:1}.fancybox-button--pause svg path:nth-child(1),.fancybox-button--play svg path:nth-child(2){display:none}.fancybox-button--zoom svg path{fill:transparent}.fancybox-navigation{display:none}.fancybox-show-nav .fancybox-navigation{display:block}.fancybox-navigation button{position:absolute;top:50%;margin:-50px 0 0;z-index:99997;background:transparent;width:60px;height:100px;padding:17px}.fancybox-navigation button:before{content:"";position:absolute;top:30px;right:10px;width:40px;height:40px;background:rgba(30,30,30,.6)}.fancybox-navigation .fancybox-button--arrow_left{left:0}.fancybox-navigation .fancybox-button--arrow_right{right:0}.fancybox-close-small{position:absolute;top:0;right:0;width:40px;height:40px;padding:0;margin:0;border:0;border-radius:0;background:transparent;z-index:10;cursor:pointer}.fancybox-close-small:after{content:"×";position:absolute;top:5px;right:5px;width:30px;height:30px;font:22px/30px Arial,Helvetica Neue,Helvetica,sans-serif;color:#888;font-weight:300;text-align:center;border-radius:50%;border-width:0;background-color:transparent;transition:background-color .25s;box-sizing:border-box;z-index:2}.fancybox-close-small:focus{outline:none}.fancybox-close-small:focus:after{outline:1px dotted #888}.fancybox-close-small:hover:after{color:#555;background:#eee}.fancybox-slide--iframe .fancybox-close-small,.fancybox-slide--image .fancybox-close-small{top:0;right:-40px}.fancybox-slide--iframe .fancybox-close-small:after,.fancybox-slide--image .fancybox-close-small:after{font-size:35px;color:#aaa}.fancybox-slide--iframe .fancybox-close-small:hover:after,.fancybox-slide--image .fancybox-close-small:hover:after{color:#fff;background:transparent}.fancybox-is-scaling .fancybox-close-small,.fancybox-is-zoomable.fancybox-can-drag .fancybox-close-small{display:none}.fancybox-caption-wrap{bottom:0;left:0;right:0;padding:60px 2vw 0;background:linear-gradient(180deg,transparent 0,rgba(0,0,0,.1) 20%,rgba(0,0,0,.2) 40%,rgba(0,0,0,.6) 80%,rgba(0,0,0,.8));pointer-events:none}.fancybox-caption{padding:30px 0;border-top:1px solid hsla(0,0%,100%,.4);font-size:14px;color:#fff;line-height:20px;-webkit-text-size-adjust:none}.fancybox-caption a,.fancybox-caption button,.fancybox-caption select{pointer-events:all;position:relative}.fancybox-caption a{color:#fff;text-decoration:underline}.fancybox-slide>.fancybox-loading{border:6px solid hsla(0,0%,39%,.4);border-top:6px solid hsla(0,0%,100%,.6);border-radius:100%;height:50px;width:50px;-webkit-animation:a .8s infinite linear;animation:a .8s infinite linear;background:transparent;position:absolute;top:50%;left:50%;margin-top:-30px;margin-left:-30px;z-index:99999}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fancybox-animated{transition-timing-function:cubic-bezier(0,0,.25,1)}.fancybox-fx-slide.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);opacity:0}.fancybox-fx-slide.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);opacity:0}.fancybox-fx-slide.fancybox-slide--current{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}.fancybox-fx-fade.fancybox-slide--next,.fancybox-fx-fade.fancybox-slide--previous{opacity:0;transition-timing-function:cubic-bezier(.19,1,.22,1)}.fancybox-fx-fade.fancybox-slide--current{opacity:1}.fancybox-fx-zoom-in-out.fancybox-slide--previous{-webkit-transform:scale3d(1.5,1.5,1.5);transform:scale3d(1.5,1.5,1.5);opacity:0}.fancybox-fx-zoom-in-out.fancybox-slide--next{-webkit-transform:scale3d(.5,.5,.5);transform:scale3d(.5,.5,.5);opacity:0}.fancybox-fx-zoom-in-out.fancybox-slide--current{-webkit-transform:scaleX(1);transform:scaleX(1);opacity:1}.fancybox-fx-rotate.fancybox-slide--previous{-webkit-transform:rotate(-1turn);transform:rotate(-1turn);opacity:0}.fancybox-fx-rotate.fancybox-slide--next{-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:0}.fancybox-fx-rotate.fancybox-slide--current{-webkit-transform:rotate(0deg);transform:rotate(0deg);opacity:1}.fancybox-fx-circular.fancybox-slide--previous{-webkit-transform:scale3d(0,0,0) translate3d(-100%,0,0);transform:scale3d(0,0,0) translate3d(-100%,0,0);opacity:0}.fancybox-fx-circular.fancybox-slide--next{-webkit-transform:scale3d(0,0,0) translate3d(100%,0,0);transform:scale3d(0,0,0) translate3d(100%,0,0);opacity:0}.fancybox-fx-circular.fancybox-slide--current{-webkit-transform:scaleX(1) translateZ(0);transform:scaleX(1) translateZ(0);opacity:1}.fancybox-fx-tube.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0) scale(.1) skew(-10deg);transform:translate3d(-100%,0,0) scale(.1) skew(-10deg)}.fancybox-fx-tube.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0) scale(.1) skew(10deg);transform:translate3d(100%,0,0) scale(.1) skew(10deg)}.fancybox-fx-tube.fancybox-slide--current{-webkit-transform:translateZ(0) scale(1);transform:translateZ(0) scale(1)}.fancybox-share{padding:30px;border-radius:3px;background:#f4f4f4;max-width:90%;text-align:center}.fancybox-share h1{color:#222;margin:0 0 20px;font-size:35px;font-weight:700}.fancybox-share p{margin:0;padding:0}p.fancybox-share__links{margin-right:-10px}.fancybox-share__button{display:inline-block;text-decoration:none;margin:0 10px 10px 0;padding:0 15px;min-width:130px;border:0;border-radius:3px;background:#fff;white-space:nowrap;font-size:14px;font-weight:700;line-height:40px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#fff;transition:all .2s}.fancybox-share__button:hover{text-decoration:none}.fancybox-share__button--fb{background:#3b5998}.fancybox-share__button--fb:hover{background:#344e86}.fancybox-share__button--pt{background:#bd081d}.fancybox-share__button--pt:hover{background:#aa0719}.fancybox-share__button--tw{background:#1da1f2}.fancybox-share__button--tw:hover{background:#0d95e8}.fancybox-share__button svg{position:relative;top:-1px;width:25px;height:25px;margin-right:7px;vertical-align:middle}.fancybox-share__button svg path{fill:#fff}.fancybox-share__input{box-sizing:border-box;width:100%;margin:10px 0 0;padding:10px 15px;background:transparent;color:#5d5b5b;font-size:14px;outline:none;border:0;border-bottom:2px solid #d7d7d7}.fancybox-thumbs{display:none;position:absolute;top:0;bottom:0;right:0;width:212px;margin:0;padding:2px 2px 4px;background:#fff;-webkit-tap-highlight-color:transparent;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;box-sizing:border-box;z-index:99995}.fancybox-thumbs-x{overflow-y:hidden;overflow-x:auto}.fancybox-show-thumbs .fancybox-thumbs{display:block}.fancybox-show-thumbs .fancybox-inner{right:212px}.fancybox-thumbs>ul{list-style:none;position:absolute;position:relative;width:100%;height:100%;margin:0;padding:0;overflow-x:hidden;overflow-y:auto;font-size:0;white-space:nowrap}.fancybox-thumbs-x>ul{overflow:hidden}.fancybox-thumbs-y>ul::-webkit-scrollbar{width:7px}.fancybox-thumbs-y>ul::-webkit-scrollbar-track{background:#fff;border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.fancybox-thumbs-y>ul::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:10px}.fancybox-thumbs>ul>li{float:left;overflow:hidden;padding:0;margin:2px;width:100px;height:75px;max-width:calc(50% - 4px);max-height:calc(100% - 8px);position:relative;cursor:pointer;outline:none;-webkit-tap-highlight-color:transparent;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}li.fancybox-thumbs-loading{background:rgba(0,0,0,.1)}.fancybox-thumbs>ul>li>img{position:absolute;top:0;left:0;max-width:none;max-height:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-thumbs>ul>li:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:4px solid #4ea7f9;z-index:99991;opacity:0;transition:all .2s cubic-bezier(.25,.46,.45,.94)}.fancybox-thumbs>ul>li.fancybox-thumbs-active:before{opacity:1}@media (max-width:800px){.fancybox-thumbs{width:110px}.fancybox-show-thumbs .fancybox-inner{right:110px}.fancybox-thumbs>ul>li{max-width:calc(100% - 10px)}}
1
+ body.compensate-for-scrollbar{overflow:hidden}.fancybox-active{height:auto}.fancybox-is-hidden{left:-9999px;margin:0;position:absolute!important;top:-9999px;visibility:hidden}.fancybox-container{-webkit-backface-visibility:hidden;height:100%;left:0;outline:none;position:fixed;-webkit-tap-highlight-color:transparent;top:0;-ms-touch-action:manipulation;touch-action:manipulation;transform:translateZ(0);width:100%;z-index:99992}.fancybox-container *{box-sizing:border-box}.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-stage{bottom:0;left:0;position:absolute;right:0;top:0}.fancybox-outer{-webkit-overflow-scrolling:touch;overflow-y:auto}.fancybox-bg{background:#1e1e1e;opacity:0;transition-duration:inherit;transition-property:opacity;transition-timing-function:cubic-bezier(.47,0,.74,.71)}.fancybox-is-open .fancybox-bg{opacity:.9;transition-timing-function:cubic-bezier(.22,.61,.36,1)}.fancybox-caption,.fancybox-infobar,.fancybox-navigation .fancybox-button,.fancybox-toolbar{direction:ltr;opacity:0;position:absolute;transition:opacity .25s ease,visibility 0s ease .25s;visibility:hidden;z-index:99997}.fancybox-show-caption .fancybox-caption,.fancybox-show-infobar .fancybox-infobar,.fancybox-show-nav .fancybox-navigation .fancybox-button,.fancybox-show-toolbar .fancybox-toolbar{opacity:1;transition:opacity .25s ease 0s,visibility 0s ease 0s;visibility:visible}.fancybox-infobar{color:#ccc;font-size:13px;-webkit-font-smoothing:subpixel-antialiased;height:44px;left:0;line-height:44px;min-width:44px;mix-blend-mode:difference;padding:0 10px;pointer-events:none;top:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-toolbar{right:0;top:0}.fancybox-stage{direction:ltr;overflow:visible;transform:translateZ(0);z-index:99994}.fancybox-is-open .fancybox-stage{overflow:hidden}.fancybox-slide{-webkit-backface-visibility:hidden;display:none;height:100%;left:0;outline:none;overflow:auto;-webkit-overflow-scrolling:touch;padding:44px;position:absolute;text-align:center;top:0;transition-property:transform,opacity;white-space:normal;width:100%;z-index:99994}.fancybox-slide:before{content:"";display:inline-block;font-size:0;height:100%;vertical-align:middle;width:0}.fancybox-is-sliding .fancybox-slide,.fancybox-slide--current,.fancybox-slide--next,.fancybox-slide--previous{display:block}.fancybox-slide--image{overflow:hidden;padding:44px 0}.fancybox-slide--image:before{display:none}.fancybox-slide--html{padding:6px}.fancybox-content{background:#fff;display:inline-block;margin:0;max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;padding:44px;position:relative;text-align:left;vertical-align:middle}.fancybox-slide--image .fancybox-content{animation-timing-function:cubic-bezier(.5,0,.14,1);-webkit-backface-visibility:hidden;background:transparent;background-repeat:no-repeat;background-size:100% 100%;left:0;max-width:none;overflow:visible;padding:0;position:absolute;top:0;transform-origin:top left;transition-property:transform,opacity;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:99995}.fancybox-can-zoomOut .fancybox-content{cursor:zoom-out}.fancybox-can-zoomIn .fancybox-content{cursor:zoom-in}.fancybox-can-pan .fancybox-content,.fancybox-can-swipe .fancybox-content{cursor:grab}.fancybox-is-grabbing .fancybox-content{cursor:grabbing}.fancybox-container [data-selectable=true]{cursor:text}.fancybox-image,.fancybox-spaceball{background:transparent;border:0;height:100%;left:0;margin:0;max-height:none;max-width:none;padding:0;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.fancybox-spaceball{z-index:1}.fancybox-slide--iframe .fancybox-content,.fancybox-slide--map .fancybox-content,.fancybox-slide--pdf .fancybox-content,.fancybox-slide--video .fancybox-content{height:100%;overflow:visible;padding:0;width:100%}.fancybox-slide--video .fancybox-content{background:#000}.fancybox-slide--map .fancybox-content{background:#e5e3df}.fancybox-slide--iframe .fancybox-content{background:#fff}.fancybox-iframe,.fancybox-video{background:transparent;border:0;display:block;height:100%;margin:0;overflow:hidden;padding:0;width:100%}.fancybox-iframe{left:0;position:absolute;top:0}.fancybox-error{background:#fff;cursor:default;max-width:400px;padding:40px;width:100%}.fancybox-error p{color:#444;font-size:16px;line-height:20px;margin:0;padding:0}.fancybox-button{background:rgba(30,30,30,.6);border:0;border-radius:0;box-shadow:none;cursor:pointer;display:inline-block;height:44px;margin:0;padding:10px;position:relative;transition:color .2s;vertical-align:top;visibility:inherit;width:44px}.fancybox-button,.fancybox-button:link,.fancybox-button:visited{color:#ccc}.fancybox-button:hover{color:#fff}.fancybox-button:focus{outline:none}.fancybox-button.fancybox-focus{outline:1px dotted}.fancybox-button[disabled],.fancybox-button[disabled]:hover{color:#888;cursor:default;outline:none}.fancybox-button div{height:100%}.fancybox-button svg{display:block;height:100%;overflow:visible;position:relative;width:100%}.fancybox-button svg path{fill:currentColor;stroke-width:0}.fancybox-button--fsenter svg:nth-child(2),.fancybox-button--fsexit svg:first-child,.fancybox-button--pause svg:first-child,.fancybox-button--play svg:nth-child(2){display:none}.fancybox-progress{background:#ff5268;height:2px;left:0;position:absolute;right:0;top:0;transform:scaleX(0);transform-origin:0;transition-property:transform;transition-timing-function:linear;z-index:99998}.fancybox-close-small{background:transparent;border:0;border-radius:0;color:#ccc;cursor:pointer;opacity:.8;padding:8px;position:absolute;right:-12px;top:-44px;z-index:401}.fancybox-close-small:hover{color:#fff;opacity:1}.fancybox-slide--html .fancybox-close-small{color:currentColor;padding:10px;right:0;top:0}.fancybox-slide--image.fancybox-is-scaling .fancybox-content{overflow:hidden}.fancybox-is-scaling .fancybox-close-small,.fancybox-is-zoomable.fancybox-can-pan .fancybox-close-small{display:none}.fancybox-navigation .fancybox-button{background-clip:content-box;height:100px;opacity:0;position:absolute;top:calc(50% - 50px);width:70px}.fancybox-navigation .fancybox-button div{padding:7px}.fancybox-navigation .fancybox-button--arrow_left{left:0;left:env(safe-area-inset-left);padding:31px 26px 31px 6px}.fancybox-navigation .fancybox-button--arrow_right{padding:31px 6px 31px 26px;right:0;right:env(safe-area-inset-right)}.fancybox-caption{background:linear-gradient(0deg,rgba(0,0,0,.85) 0,rgba(0,0,0,.3) 50%,rgba(0,0,0,.15) 65%,rgba(0,0,0,.075) 75.5%,rgba(0,0,0,.037) 82.85%,rgba(0,0,0,.019) 88%,transparent);bottom:0;color:#eee;font-size:14px;font-weight:400;left:0;line-height:1.5;padding:75px 44px 25px;pointer-events:none;right:0;text-align:center;z-index:99996}@supports (padding:max(0px)){.fancybox-caption{padding:75px max(44px,env(safe-area-inset-right)) max(25px,env(safe-area-inset-bottom)) max(44px,env(safe-area-inset-left))}}.fancybox-caption--separate{margin-top:-50px}.fancybox-caption__body{max-height:50vh;overflow:auto;pointer-events:all}.fancybox-caption a,.fancybox-caption a:link,.fancybox-caption a:visited{color:#ccc;text-decoration:none}.fancybox-caption a:hover{color:#fff;text-decoration:underline}.fancybox-loading{animation:a 1s linear infinite;background:transparent;border:4px solid #888;border-bottom-color:#fff;border-radius:50%;height:50px;left:50%;margin:-25px 0 0 -25px;opacity:.7;padding:0;position:absolute;top:50%;width:50px;z-index:99999}@keyframes a{to{transform:rotate(1turn)}}.fancybox-animated{transition-timing-function:cubic-bezier(0,0,.25,1)}.fancybox-fx-slide.fancybox-slide--previous{opacity:0;transform:translate3d(-100%,0,0)}.fancybox-fx-slide.fancybox-slide--next{opacity:0;transform:translate3d(100%,0,0)}.fancybox-fx-slide.fancybox-slide--current{opacity:1;transform:translateZ(0)}.fancybox-fx-fade.fancybox-slide--next,.fancybox-fx-fade.fancybox-slide--previous{opacity:0;transition-timing-function:cubic-bezier(.19,1,.22,1)}.fancybox-fx-fade.fancybox-slide--current{opacity:1}.fancybox-fx-zoom-in-out.fancybox-slide--previous{opacity:0;transform:scale3d(1.5,1.5,1.5)}.fancybox-fx-zoom-in-out.fancybox-slide--next{opacity:0;transform:scale3d(.5,.5,.5)}.fancybox-fx-zoom-in-out.fancybox-slide--current{opacity:1;transform:scaleX(1)}.fancybox-fx-rotate.fancybox-slide--previous{opacity:0;transform:rotate(-1turn)}.fancybox-fx-rotate.fancybox-slide--next{opacity:0;transform:rotate(1turn)}.fancybox-fx-rotate.fancybox-slide--current{opacity:1;transform:rotate(0deg)}.fancybox-fx-circular.fancybox-slide--previous{opacity:0;transform:scale3d(0,0,0) translate3d(-100%,0,0)}.fancybox-fx-circular.fancybox-slide--next{opacity:0;transform:scale3d(0,0,0) translate3d(100%,0,0)}.fancybox-fx-circular.fancybox-slide--current{opacity:1;transform:scaleX(1) translateZ(0)}.fancybox-fx-tube.fancybox-slide--previous{transform:translate3d(-100%,0,0) scale(.1) skew(-10deg)}.fancybox-fx-tube.fancybox-slide--next{transform:translate3d(100%,0,0) scale(.1) skew(10deg)}.fancybox-fx-tube.fancybox-slide--current{transform:translateZ(0) scale(1)}@media (max-height:576px){.fancybox-slide{padding-left:6px;padding-right:6px}.fancybox-slide--image{padding:6px 0}.fancybox-close-small{right:-6px}.fancybox-slide--image .fancybox-close-small{background:#4e4e4e;color:#f2f4f6;height:36px;opacity:1;padding:6px;right:0;top:0;width:36px}.fancybox-caption{padding-left:12px;padding-right:12px}@supports (padding:max(0px)){.fancybox-caption{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}}}.fancybox-share{background:#f4f4f4;border-radius:3px;max-width:90%;padding:30px;text-align:center}.fancybox-share h1{color:#222;font-size:35px;font-weight:700;margin:0 0 20px}.fancybox-share p{margin:0;padding:0}.fancybox-share__button{border:0;border-radius:3px;display:inline-block;font-size:14px;font-weight:700;line-height:40px;margin:0 5px 10px;min-width:130px;padding:0 15px;text-decoration:none;transition:all .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap}.fancybox-share__button:link,.fancybox-share__button:visited{color:#fff}.fancybox-share__button:hover{text-decoration:none}.fancybox-share__button--fb{background:#3b5998}.fancybox-share__button--fb:hover{background:#344e86}.fancybox-share__button--pt{background:#bd081d}.fancybox-share__button--pt:hover{background:#aa0719}.fancybox-share__button--tw{background:#1da1f2}.fancybox-share__button--tw:hover{background:#0d95e8}.fancybox-share__button svg{height:25px;margin-right:7px;position:relative;top:-1px;vertical-align:middle;width:25px}.fancybox-share__button svg path{fill:#fff}.fancybox-share__input{background:transparent;border:0;border-bottom:1px solid #d7d7d7;border-radius:0;color:#5d5b5b;font-size:14px;margin:10px 0 0;outline:none;padding:10px 15px;width:100%}.fancybox-thumbs{background:#ddd;bottom:0;display:none;margin:0;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;padding:2px 2px 4px;position:absolute;right:0;-webkit-tap-highlight-color:rgba(0,0,0,0);top:0;width:212px;z-index:99995}.fancybox-thumbs-x{overflow-x:auto;overflow-y:hidden}.fancybox-show-thumbs .fancybox-thumbs{display:block}.fancybox-show-thumbs .fancybox-inner{right:212px}.fancybox-thumbs__list{font-size:0;height:100%;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;position:relative;white-space:nowrap;width:100%}.fancybox-thumbs-x .fancybox-thumbs__list{overflow:hidden}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar{width:7px}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-track{background:#fff;border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.fancybox-thumbs-y .fancybox-thumbs__list::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:10px}.fancybox-thumbs__list a{-webkit-backface-visibility:hidden;backface-visibility:hidden;background-color:rgba(0,0,0,.1);background-position:50%;background-repeat:no-repeat;background-size:cover;cursor:pointer;float:left;height:75px;margin:2px;max-height:calc(100% - 8px);max-width:calc(50% - 4px);outline:none;overflow:hidden;padding:0;position:relative;-webkit-tap-highlight-color:transparent;width:100px}.fancybox-thumbs__list a:before{border:6px solid #ff5268;bottom:0;content:"";left:0;opacity:0;position:absolute;right:0;top:0;transition:all .2s cubic-bezier(.25,.46,.45,.94);z-index:99991}.fancybox-thumbs__list a:focus:before{opacity:.5}.fancybox-thumbs__list a.fancybox-thumbs-active:before{opacity:1}@media (max-width:576px){.fancybox-thumbs{width:110px}.fancybox-show-thumbs .fancybox-inner{right:110px}.fancybox-thumbs__list a{max-width:calc(100% - 10px)}}
assets_libraries/fancybox3/jquery.fancybox.min.js CHANGED
@@ -1,12 +1,13 @@
1
  // ==================================================
2
- // fancyBox v3.2.10
3
  //
4
  // Licensed GPLv3 for open source use
5
  // or fancyBox Commercial License for commercial use
6
  //
7
  // http://fancyapps.com/fancybox/
8
- // Copyright 2017 fancyApps
9
  //
10
  // ==================================================
11
- !function(t,e,n,o){"use strict";function i(t){var e=n(t.currentTarget),o=t.data?t.data.options:{},i=e.attr("data-fancybox")||"",a=0,s=[];t.isDefaultPrevented()||(t.preventDefault(),i?(s=o.selector?n(o.selector):t.data?t.data.items:[],s=s.length?s.filter('[data-fancybox="'+i+'"]'):n('[data-fancybox="'+i+'"]'),a=s.index(e),a<0&&(a=0)):s=[e],n.fancybox.open(s,o,a))}if(n){if(n.fn.fancybox)return void("console"in t&&console.log("fancyBox already initialized"));var a={loop:!1,margin:[44,0],gutter:50,keyboard:!0,arrows:!0,infobar:!0,toolbar:!0,buttons:["slideShow","fullScreen","thumbs","share","close"],idleTime:3,smallBtn:"auto",protect:!1,modal:!1,image:{preload:"auto"},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen allowtransparency="true" src=""></iframe>',preload:!0,css:{},attr:{scrolling:"auto"}},defaultType:"image",animationEffect:"zoom",animationDuration:500,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'<div class="fancybox-container" role="dialog" tabindex="-1"><div class="fancybox-bg"></div><div class="fancybox-inner"><div class="fancybox-infobar"><span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span></div><div class="fancybox-toolbar">{{buttons}}</div><div class="fancybox-navigation">{{arrows}}</div><div class="fancybox-stage"></div><div class="fancybox-caption-wrap"><div class="fancybox-caption"></div></div></div></div>',spinnerTpl:'<div class="fancybox-loading"></div>',errorTpl:'<div class="fancybox-error"><p>{{ERROR}}<p></div>',btnTpl:{download:'<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}"><svg viewBox="0 0 40 40"><path d="M20,23 L20,8 L20,23 L13,16 L20,23 L27,16 L20,23 M26,28 L13,28 L27,28 L14,28" /></svg></a>',zoom:'<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}"><svg viewBox="0 0 40 40"><path d="M 18,17 m-8,0 a 8,8 0 1,0 16,0 a 8,8 0 1,0 -16,0 M25,23 L31,29 L25,23" /></svg></button>',close:'<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}"><svg viewBox="0 0 40 40"><path d="M10,10 L30,30 M30,10 L10,30" /></svg></button>',smallBtn:'<button data-fancybox-close class="fancybox-close-small" title="{{CLOSE}}"></button>',arrowLeft:'<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}"><svg viewBox="0 0 40 40"><path d="M10,20 L30,20 L10,20 L18,28 L10,20 L18,12 L10,20"></path></svg></button>',arrowRight:'<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}"><svg viewBox="0 0 40 40"><path d="M30,20 L10,20 L30,20 L22,28 L30,20 L22,12 L30,20"></path></svg></button>'},parentEl:"body",autoFocus:!1,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:4e3},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"},wheel:"auto",onInit:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeClose:n.noop,afterClose:n.noop,onActivate:n.noop,onDeactivate:n.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{idleTime:!1,margin:0,clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded. <br/> Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"},de:{CLOSE:"Schliessen",NEXT:"Weiter",PREV:"Zurück",ERROR:"Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es später nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder",DOWNLOAD:"Herunterladen",SHARE:"Teilen",ZOOM:"Maßstab"}}},s=n(t),r=n(e),c=0,l=function(t){return t&&t.hasOwnProperty&&t instanceof n},u=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),d=function(){var t,n=e.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in i)if(n.style[t]!==o)return i[t];return"transitionend"}(),f=function(t){return t&&t.length&&t[0].offsetHeight},p=function(t,o,i){var a=this;a.opts=n.extend(!0,{index:i},n.fancybox.defaults,o||{}),n.fancybox.isMobile&&(a.opts=n.extend(!0,{},a.opts,a.opts.mobile)),o&&n.isArray(o.buttons)&&(a.opts.buttons=o.buttons),a.id=a.opts.id||++c,a.group=[],a.currIndex=parseInt(a.opts.index,10)||0,a.prevIndex=null,a.prevPos=null,a.currPos=0,a.firstRun=null,a.createGroup(t),a.group.length&&(a.$lastFocus=n(e.activeElement).blur(),a.slides={},a.init())};n.extend(p.prototype,{init:function(){var i,a,s,c=this,l=c.group[c.currIndex],u=l.opts,d=n.fancybox.scrollbarWidth;c.scrollTop=r.scrollTop(),c.scrollLeft=r.scrollLeft(),n.fancybox.getInstance()||(n("body").addClass("fancybox-active"),/iPad|iPhone|iPod/.test(navigator.userAgent)&&!t.MSStream?"image"!==l.type&&n("body").css("top",n("body").scrollTop()*-1).addClass("fancybox-iosfix"):!n.fancybox.isMobile&&e.body.scrollHeight>t.innerHeight&&(d===o&&(i=n('<div style="width:50px;height:50px;overflow:scroll;" />').appendTo("body"),d=n.fancybox.scrollbarWidth=i[0].offsetWidth-i[0].clientWidth,i.remove()),n("head").append('<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar { margin-right: '+d+"px; }</style>"),n("body").addClass("compensate-for-scrollbar"))),s="",n.each(u.buttons,function(t,e){s+=u.btnTpl[e]||""}),a=n(c.translate(c,u.baseTpl.replace("{{buttons}}",s).replace("{{arrows}}",u.btnTpl.arrowLeft+u.btnTpl.arrowRight))).attr("id","fancybox-container-"+c.id).addClass("fancybox-is-hidden").addClass(u.baseClass).data("FancyBox",c).appendTo(u.parentEl),c.$refs={container:a},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){c.$refs[t]=a.find(".fancybox-"+t)}),c.trigger("onInit"),c.activate(),c.jumpTo(c.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang];return e.replace(/\{\{(\w+)\}\}/g,function(t,e){var i=n[e];return i===o?t:i})},createGroup:function(t){var e=this,i=n.makeArray(t);n.each(i,function(t,i){var a,s,r,c,l,u={},d={};n.isPlainObject(i)?(u=i,d=i.opts||i):"object"===n.type(i)&&n(i).length?(a=n(i),d=a.data(),d=n.extend({},d,d.options||{}),d.$orig=a,u.src=d.src||a.attr("href"),u.type||u.src||(u.type="inline",u.src=i)):u={type:"html",src:i+""},u.opts=n.extend(!0,{},e.opts,d),n.isArray(d.buttons)&&(u.opts.buttons=d.buttons),s=u.type||u.opts.type,c=u.src||"",!s&&c&&(c.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?s="image":c.match(/\.(pdf)((\?|#).*)?$/i)?s="pdf":(r=c.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i))?(s="video",u.opts.videoFormat||(u.opts.videoFormat="video/"+("ogv"===r[1]?"ogg":r[1]))):"#"===c.charAt(0)&&(s="inline")),s?u.type=s:e.trigger("objectNeedsType",u),u.index=e.group.length,u.opts.$orig&&!u.opts.$orig.length&&delete u.opts.$orig,!u.opts.$thumb&&u.opts.$orig&&(u.opts.$thumb=u.opts.$orig.find("img:first")),u.opts.$thumb&&!u.opts.$thumb.length&&delete u.opts.$thumb,"function"===n.type(u.opts.caption)&&(u.opts.caption=u.opts.caption.apply(i,[e,u])),"function"===n.type(e.opts.caption)&&(u.opts.caption=e.opts.caption.apply(i,[e,u])),u.opts.caption instanceof n||(u.opts.caption=u.opts.caption===o?"":u.opts.caption+""),"ajax"===s&&(l=c.split(/\s+/,2),l.length>1&&(u.src=l.shift(),u.opts.filter=l.shift())),"auto"==u.opts.smallBtn&&(n.inArray(s,["html","inline","ajax"])>-1?(u.opts.toolbar=!1,u.opts.smallBtn=!0):u.opts.smallBtn=!1),"pdf"===s&&(u.type="iframe",u.opts.iframe.preload=!1),u.opts.modal&&(u.opts=n.extend(!0,u.opts,{infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),e.group.push(u)})},addEvents:function(){var o=this;o.removeEvents(),o.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),o.close(t)}).on("click.fb-prev touchend.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),o.previous()}).on("click.fb-next touchend.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),o.next()}).on("click.fb","[data-fancybox-zoom]",function(t){o[o.isScaledDown()?"scaleToActual":"scaleToFit"]()}),s.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?u(function(){o.update()}):(o.$refs.stage.hide(),setTimeout(function(){o.$refs.stage.show(),o.update()},600))}),r.on("focusin.fb",function(t){var i=n.fancybox?n.fancybox.getInstance():null;i.isClosing||!i.current||!i.current.opts.trapFocus||n(t.target).hasClass("fancybox-container")||n(t.target).is(e)||i&&"fixed"!==n(t.target).css("position")&&!i.$refs.container.has(t.target).length&&(t.stopPropagation(),i.focus(),s.scrollTop(o.scrollTop).scrollLeft(o.scrollLeft))}),r.on("keydown.fb",function(t){var e=o.current,i=t.keyCode||t.which;if(e&&e.opts.keyboard&&!n(t.target).is("input")&&!n(t.target).is("textarea"))return 8===i||27===i?(t.preventDefault(),void o.close(t)):37===i||38===i?(t.preventDefault(),void o.previous()):39===i||40===i?(t.preventDefault(),void o.next()):void o.trigger("afterKeydown",t,i)}),o.group[o.currIndex].opts.idleTime&&(o.idleSecondsCounter=0,r.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(t){o.idleSecondsCounter=0,o.isIdle&&o.showControls(),o.isIdle=!1}),o.idleInterval=t.setInterval(function(){o.idleSecondsCounter++,o.idleSecondsCounter>=o.group[o.currIndex].opts.idleTime&&!o.isDragging&&(o.isIdle=!0,o.idleSecondsCounter=0,o.hideControls())},1e3))},removeEvents:function(){var e=this;s.off("orientationchange.fb resize.fb"),r.off("focusin.fb keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),e.idleInterval&&(t.clearInterval(e.idleInterval),e.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,e,i){var a,s,r,c,l,u,d,p=this,h=p.group.length;if(!(p.isDragging||p.isClosing||p.isAnimating&&p.firstRun)){if(t=parseInt(t,10),s=p.current?p.current.opts.loop:p.opts.loop,!s&&(t<0||t>=h))return!1;if(a=p.firstRun=null===p.firstRun,!(h<2&&!a&&p.isDragging)){if(c=p.current,p.prevIndex=p.currIndex,p.prevPos=p.currPos,r=p.createSlide(t),h>1&&((s||r.index>0)&&p.createSlide(t-1),(s||r.index<h-1)&&p.createSlide(t+1)),p.current=r,p.currIndex=r.index,p.currPos=r.pos,p.trigger("beforeShow",a),p.updateControls(),u=n.fancybox.getTranslate(r.$slide),r.isMoved=(0!==u.left||0!==u.top)&&!r.$slide.hasClass("fancybox-animated"),r.forcedDuration=o,n.isNumeric(e)?r.forcedDuration=e:e=r.opts[a?"animationDuration":"transitionDuration"],e=parseInt(e,10),a)return r.opts.animationEffect&&e&&p.$refs.container.css("transition-duration",e+"ms"),p.$refs.container.removeClass("fancybox-is-hidden"),f(p.$refs.container),p.$refs.container.addClass("fancybox-is-open"),r.$slide.addClass("fancybox-slide--current"),p.loadSlide(r),void p.preload("image");n.each(p.slides,function(t,e){n.fancybox.stop(e.$slide)}),r.$slide.removeClass("fancybox-slide--next fancybox-slide--previous").addClass("fancybox-slide--current"),r.isMoved?(l=Math.round(r.$slide.width()),n.each(p.slides,function(t,o){var i=o.pos-r.pos;n.fancybox.animate(o.$slide,{top:0,left:i*l+i*o.opts.gutter},e,function(){o.$slide.removeAttr("style").removeClass("fancybox-slide--next fancybox-slide--previous"),o.pos===p.currPos&&(r.isMoved=!1,p.complete())})})):p.$refs.stage.children().removeAttr("style"),r.isLoaded?p.revealContent(r):p.loadSlide(r),p.preload("image"),c.pos!==r.pos&&(d="fancybox-slide--"+(c.pos>r.pos?"next":"previous"),c.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"),c.isComplete=!1,e&&(r.isMoved||r.opts.transitionEffect)&&(r.isMoved?c.$slide.addClass(d):(d="fancybox-animated "+d+" fancybox-fx-"+r.opts.transitionEffect,n.fancybox.animate(c.$slide,d,e,function(){c.$slide.removeClass(d).removeAttr("style")}))))}}},createSlide:function(t){var e,o,i=this;return o=t%i.group.length,o=o<0?i.group.length+o:o,!i.slides[t]&&i.group[o]&&(e=n('<div class="fancybox-slide"></div>').appendTo(i.$refs.stage),i.slides[t]=n.extend(!0,{},i.group[o],{pos:t,$slide:e,isLoaded:!1}),i.updateSlide(i.slides[t])),i.slides[t]},scaleToActual:function(t,e,i){var a,s,r,c,l,u=this,d=u.current,f=d.$content,p=parseInt(d.$slide.width(),10),h=parseInt(d.$slide.height(),10),g=d.width,b=d.height;"image"!=d.type||d.hasError||!f||u.isAnimating||(n.fancybox.stop(f),u.isAnimating=!0,t=t===o?.5*p:t,e=e===o?.5*h:e,a=n.fancybox.getTranslate(f),c=g/a.width,l=b/a.height,s=.5*p-.5*g,r=.5*h-.5*b,g>p&&(s=a.left*c-(t*c-t),s>0&&(s=0),s<p-g&&(s=p-g)),b>h&&(r=a.top*l-(e*l-e),r>0&&(r=0),r<h-b&&(r=h-b)),u.updateCursor(g,b),n.fancybox.animate(f,{top:r,left:s,scaleX:c,scaleY:l},i||330,function(){u.isAnimating=!1}),u.SlideShow&&u.SlideShow.isActive&&u.SlideShow.stop())},scaleToFit:function(t){var e,o=this,i=o.current,a=i.$content;"image"!=i.type||i.hasError||!a||o.isAnimating||(n.fancybox.stop(a),o.isAnimating=!0,e=o.getFitPos(i),o.updateCursor(e.width,e.height),n.fancybox.animate(a,{top:e.top,left:e.left,scaleX:e.width/a.width(),scaleY:e.height/a.height()},t||330,function(){o.isAnimating=!1}))},getFitPos:function(t){var e,o,i,a,s,r=this,c=t.$content,l=t.width,u=t.height,d=t.opts.margin;return!(!c||!c.length||!l&&!u)&&("number"===n.type(d)&&(d=[d,d]),2==d.length&&(d=[d[0],d[1],d[0],d[1]]),e=parseInt(r.$refs.stage.width(),10)-(d[1]+d[3]),o=parseInt(r.$refs.stage.height(),10)-(d[0]+d[2]),i=Math.min(1,e/l,o/u),a=Math.floor(i*l),s=Math.floor(i*u),{top:Math.floor(.5*(o-s))+d[0],left:Math.floor(.5*(e-a))+d[3],width:a,height:s})},update:function(){var t=this;n.each(t.slides,function(e,n){t.updateSlide(n)})},updateSlide:function(t,e){var o=this,i=t&&t.$content;i&&(t.width||t.height)&&(o.isAnimating=!1,n.fancybox.stop(i),n.fancybox.setTranslate(i,o.getFitPos(t)),t.pos===o.currPos&&o.updateCursor()),t.$slide.trigger("refresh"),o.trigger("onUpdate",t)},centerSlide:function(t,e){var i,a,s=this;s.current&&(i=Math.round(t.$slide.width()),a=t.pos-s.current.pos,n.fancybox.animate(t.$slide,{top:0,left:a*i+a*t.opts.gutter,opacity:1},e===o?0:e,null,!1))},updateCursor:function(t,e){var n,i=this,a=i.$refs.container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut");i.current&&!i.isClosing&&(i.isZoomable()?(a.addClass("fancybox-is-zoomable"),n=t!==o&&e!==o?t<i.current.width&&e<i.current.height:i.isScaledDown(),n?a.addClass("fancybox-can-zoomIn"):i.current.opts.touch?a.addClass("fancybox-can-drag"):a.addClass("fancybox-can-zoomOut")):i.current.opts.touch&&a.addClass("fancybox-can-drag"))},isZoomable:function(){var t,e=this,o=e.current;if(o&&!e.isClosing)return!!("image"===o.type&&o.isLoaded&&!o.hasError&&("zoom"===o.opts.clickContent||n.isFunction(o.opts.clickContent)&&"zoom"===o.opts.clickContent(o))&&(t=e.getFitPos(o),o.width>t.width||o.height>t.height))},isScaledDown:function(){var t=this,e=t.current,o=e.$content,i=!1;return o&&(i=n.fancybox.getTranslate(o),i=i.width<e.width||i.height<e.height),i},canPan:function(){var t=this,e=t.current,n=e.$content,o=!1;return n&&(o=t.getFitPos(e),o=Math.abs(n.width()-o.width)>1||Math.abs(n.height()-o.height)>1),o},loadSlide:function(t){var e,o,i,a=this;if(!t.isLoading&&!t.isLoaded){switch(t.isLoading=!0,a.trigger("beforeLoad",t),e=t.type,o=t.$slide,o.off("refresh").trigger("onReset").addClass("fancybox-slide--"+(e||"unknown")).addClass(t.opts.slideClass),e){case"image":a.setImage(t);break;case"iframe":a.setIframe(t);break;case"html":a.setContent(t,t.src||t.content);break;case"inline":n(t.src).length?a.setContent(t,n(t.src)):a.setError(t);break;case"ajax":a.showLoading(t),i=n.ajax(n.extend({},t.opts.ajax.settings,{url:t.src,success:function(e,n){"success"===n&&a.setContent(t,e)},error:function(e,n){e&&"abort"!==n&&a.setError(t)}})),o.one("onReset",function(){i.abort()});break;case"video":a.setContent(t,'<video controls><source src="'+t.src+'" type="'+t.opts.videoFormat+"\">Your browser doesn't support HTML5 video</video>");break;default:a.setError(t)}return!0}},setImage:function(e){var o,i,a,s,r=this,c=e.opts.srcset||e.opts.image.srcset;if(c){a=t.devicePixelRatio||1,s=t.innerWidth*a,i=c.split(",").map(function(t){var e={};return t.trim().split(/\s+/).forEach(function(t,n){var o=parseInt(t.substring(0,t.length-1),10);return 0===n?e.url=t:void(o&&(e.value=o,e.postfix=t[t.length-1]))}),e}),i.sort(function(t,e){return t.value-e.value});for(var l=0;l<i.length;l++){var u=i[l];if("w"===u.postfix&&u.value>=s||"x"===u.postfix&&u.value>=a){o=u;break}}!o&&i.length&&(o=i[i.length-1]),o&&(e.src=o.url,e.width&&e.height&&"w"==o.postfix&&(e.height=e.width/e.height*o.value,e.width=o.value))}e.$content=n('<div class="fancybox-image-wrap"></div>').addClass("fancybox-is-hidden").appendTo(e.$slide),e.opts.preload!==!1&&e.opts.width&&e.opts.height&&(e.opts.thumb||e.opts.$thumb)?(e.width=e.opts.width,e.height=e.opts.height,e.$ghost=n("<img />").one("error",function(){n(this).remove(),e.$ghost=null,r.setBigImage(e)}).one("load",function(){r.afterLoad(e),r.setBigImage(e)}).addClass("fancybox-image").appendTo(e.$content).attr("src",e.opts.thumb||e.opts.$thumb.attr("src"))):r.setBigImage(e)},setBigImage:function(t){var e=this,o=n("<img />");t.$image=o.one("error",function(){e.setError(t)}).one("load",function(){clearTimeout(t.timouts),t.timouts=null,e.isClosing||(t.width=t.opts.width||this.naturalWidth,t.height=t.opts.height||this.naturalHeight,t.opts.image.srcset&&o.attr("sizes","100vw").attr("srcset",t.opts.image.srcset),e.hideLoading(t),t.$ghost?t.timouts=setTimeout(function(){t.timouts=null,t.$ghost.hide()},Math.min(300,Math.max(1e3,t.height/1600))):e.afterLoad(t))}).addClass("fancybox-image").attr("src",t.src).appendTo(t.$content),(o[0].complete||"complete"==o[0].readyState)&&o[0].naturalWidth&&o[0].naturalHeight?o.trigger("load"):o[0].error?o.trigger("error"):t.timouts=setTimeout(function(){o[0].complete||t.hasError||e.showLoading(t)},100)},setIframe:function(t){var e,i=this,a=t.opts.iframe,s=t.$slide;t.$content=n('<div class="fancybox-content'+(a.preload?" fancybox-is-hidden":"")+'"></div>').css(a.css).appendTo(s),e=n(a.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(a.attr).appendTo(t.$content),a.preload?(i.showLoading(t),e.on("load.fb error.fb",function(e){this.isReady=1,t.$slide.trigger("refresh"),i.afterLoad(t)}),s.on("refresh.fb",function(){var n,i,s,r=t.$content,c=a.css.width,l=a.css.height;if(1===e[0].isReady){try{i=e.contents(),s=i.find("body")}catch(t){}s&&s.length&&(c===o&&(n=e[0].contentWindow.document.documentElement.scrollWidth,c=Math.ceil(s.outerWidth(!0)+(r.width()-n)),c+=r.outerWidth()-r.innerWidth()),l===o&&(l=Math.ceil(s.outerHeight(!0)),l+=r.outerHeight()-r.innerHeight()),c&&r.width(c),l&&r.height(l)),r.removeClass("fancybox-is-hidden")}})):this.afterLoad(t),e.attr("src",t.src),t.opts.smallBtn===!0&&t.$content.prepend(i.translate(t,t.opts.btnTpl.smallBtn)),s.one("onReset",function(){try{n(this).find("iframe").hide().attr("src","//about:blank")}catch(t){}n(this).empty(),t.isLoaded=!1})},setContent:function(t,e){var o=this;o.isClosing||(o.hideLoading(t),t.$slide.empty(),l(e)&&e.parent().length?(e.parent(".fancybox-slide--inline").trigger("onReset"),t.$placeholder=n("<div></div>").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===n.type(e)&&(e=n("<div>").append(n.trim(e)).contents(),3===e[0].nodeType&&(e=n("<div>").html(e))),t.opts.filter&&(e=n("<div>").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){n(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1)}),t.$content=n(e).appendTo(t.$slide),this.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.removeClass("fancybox-slide--"+t.type),this.setContent(t,this.translate(t,t.opts.errorTpl))},showLoading:function(t){var e=this;t=t||e.current,t&&!t.$spinner&&(t.$spinner=n(e.opts.spinnerTpl).appendTo(t.$slide))},hideLoading:function(t){var e=this;t=t||e.current,t&&t.$spinner&&(t.$spinner.remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),t.opts.smallBtn&&!t.$smallBtn&&(t.$smallBtn=n(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content.filter("div,form").first())),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('<div class="fancybox-spaceball"></div>').appendTo(t.$content)),e.revealContent(t))},revealContent:function(t){var e,i,a,s,r,c=this,l=t.$slide,u=!1;return e=t.opts[c.firstRun?"animationEffect":"transitionEffect"],a=t.opts[c.firstRun?"animationDuration":"transitionDuration"],a=parseInt(t.forcedDuration===o?a:t.forcedDuration,10),!t.isMoved&&t.pos===c.currPos&&a||(e=!1),"zoom"!==e||t.pos===c.currPos&&a&&"image"===t.type&&!t.hasError&&(u=c.getThumbPos(t))||(e="fade"),"zoom"===e?(r=c.getFitPos(t),r.scaleX=r.width/u.width,r.scaleY=r.height/u.height,delete r.width,delete r.height,s=t.opts.zoomOpacity,"auto"==s&&(s=Math.abs(t.width/t.height-u.width/u.height)>.1),s&&(u.opacity=.1,r.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),u),f(t.$content),void n.fancybox.animate(t.$content,r,a,function(){c.complete()})):(c.updateSlide(t),e?(n.fancybox.stop(l),i="fancybox-animated fancybox-slide--"+(t.pos>=c.prevPos?"next":"previous")+" fancybox-fx-"+e,l.removeAttr("style").removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous").addClass(i),t.$content.removeClass("fancybox-is-hidden"),f(l),void n.fancybox.animate(l,"fancybox-slide--current",a,function(e){l.removeClass(i).removeAttr("style"),t.pos===c.currPos&&c.complete()},!0)):(f(l),t.$content.removeClass("fancybox-is-hidden"),void(t.pos===c.currPos&&c.complete())))},getThumbPos:function(o){var i,a=this,s=!1,r=function(e){for(var o,i=e[0],a=i.getBoundingClientRect(),s=[];null!==i.parentElement;)"hidden"!==n(i.parentElement).css("overflow")&&"auto"!==n(i.parentElement).css("overflow")||s.push(i.parentElement.getBoundingClientRect()),i=i.parentElement;return o=s.every(function(t){var e=Math.min(a.right,t.right)-Math.max(a.left,t.left),n=Math.min(a.bottom,t.bottom)-Math.max(a.top,t.top);return e>0&&n>0}),o&&a.bottom>0&&a.right>0&&a.left<n(t).width()&&a.top<n(t).height()},c=o.opts.$thumb,l=c?c.offset():0;return l&&c[0].ownerDocument===e&&r(c)&&(i=a.$refs.stage.offset(),s={top:l.top-i.top+parseFloat(c.css("border-top-width")||0),left:l.left-i.left+parseFloat(c.css("border-left-width")||0),width:c.width(),height:c.height(),scaleX:1,scaleY:1}),s},complete:function(){var t=this,o=t.current,i={};o.isMoved||!o.isLoaded||o.isComplete||(o.isComplete=!0,o.$slide.siblings().trigger("onReset"),t.preload("inline"),f(o.$slide),o.$slide.addClass("fancybox-slide--complete"),n.each(t.slides,function(e,o){o.pos>=t.currPos-1&&o.pos<=t.currPos+1?i[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.off().remove())}),t.slides=i,t.updateCursor(),t.trigger("afterShow"),o.$slide.find("video,audio").first().trigger("play"),(n(e.activeElement).is("[disabled]")||o.opts.autoFocus&&"image"!=o.type&&"iframe"!==o.type)&&t.focus())},preload:function(t){var e=this,n=e.slides[e.currPos+1],o=e.slides[e.currPos-1];n&&n.type===t&&e.loadSlide(n),o&&o.type===t&&e.loadSlide(o)},focus:function(){var t,e=this.current;this.isClosing||(e&&e.isComplete&&(t=e.$slide.find("input[autofocus]:enabled:visible:first"),t.length||(t=e.$slide.find("button,:input,[tabindex],a").filter(":enabled:visible:first"))),t=t&&t.length?t:this.$refs.container,t.focus())},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.id!==t.id&&!e.isClosing&&(e.trigger("onDeactivate"),e.removeEvents(),e.isVisible=!1)}),t.isVisible=!0,(t.current||t.isIdle)&&(t.update(),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,i,a,s,r,c,l=this,p=l.current,h=function(){l.cleanUp(t)};return!l.isClosing&&(l.isClosing=!0,l.trigger("beforeClose",t)===!1?(l.isClosing=!1,u(function(){l.update()}),!1):(l.removeEvents(),p.timouts&&clearTimeout(p.timouts),a=p.$content,o=p.opts.animationEffect,i=n.isNumeric(e)?e:o?p.opts.animationDuration:0,p.$slide.off(d).removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),p.$slide.siblings().trigger("onReset").remove(),i&&l.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing"),l.hideLoading(p),l.hideControls(),l.updateCursor(),"zoom"!==o||t!==!0&&a&&i&&"image"===p.type&&!p.hasError&&(c=l.getThumbPos(p))||(o="fade"),"zoom"===o?(n.fancybox.stop(a),r=n.fancybox.getTranslate(a),r.width=r.width*r.scaleX,r.height=r.height*r.scaleY,s=p.opts.zoomOpacity,"auto"==s&&(s=Math.abs(p.width/p.height-c.width/c.height)>.1),s&&(c.opacity=0),r.scaleX=r.width/c.width,r.scaleY=r.height/c.height,r.width=c.width,r.height=c.height,n.fancybox.setTranslate(p.$content,r),f(p.$content),n.fancybox.animate(p.$content,c,i,h),!0):(o&&i?t===!0?setTimeout(h,i):n.fancybox.animate(p.$slide.removeClass("fancybox-slide--current"),"fancybox-animated fancybox-slide--previous fancybox-fx-"+o,i,h):h(),!0)))},cleanUp:function(t){var o,i,a=this,r=n("body");a.current.$slide.trigger("onReset"),a.$refs.container.empty().remove(),a.trigger("afterClose",t),a.$lastFocus&&a.current.opts.backFocus&&a.$lastFocus.focus(),a.current=null,o=n.fancybox.getInstance(),o?o.activate():(s.scrollTop(a.scrollTop).scrollLeft(a.scrollLeft),r.removeClass("fancybox-active compensate-for-scrollbar"),r.hasClass("fancybox-iosfix")&&(i=parseInt(e.body.style.top,10),r.removeClass("fancybox-iosfix").css("top","").scrollTop(i*-1)),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,i=Array.prototype.slice.call(arguments,1),a=this,s=e&&e.opts?e:a.current;return s?i.unshift(s):s=a,i.unshift(a),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,i)),o===!1?o:void("afterClose"!==t&&a.$refs?a.$refs.container.trigger(t+".fb",i):r.trigger(t+".fb",i))},updateControls:function(t){var e=this,n=e.current,o=n.index,i=n.opts.caption,a=e.$refs.container,s=e.$refs.caption;n.$slide.trigger("refresh"),e.$caption=i&&i.length?s.html(i):null,e.isHiddenControls||e.isIdle||e.showControls(),a.find("[data-fancybox-count]").html(e.group.length),a.find("[data-fancybox-index]").html(o+1),a.find("[data-fancybox-prev]").prop("disabled",!n.opts.loop&&o<=0),a.find("[data-fancybox-next]").prop("disabled",!n.opts.loop&&o>=e.group.length-1),"image"===n.type?a.find("[data-fancybox-download]").attr("href",n.opts.image.src||n.src).show():a.find("[data-fancybox-download],[data-fancybox-zoom]").hide()},hideControls:function(){this.isHiddenControls=!0,this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav")},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.isHiddenControls=!1,t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal),t.$caption?n.addClass("fancybox-show-caption "):n.removeClass("fancybox-show-caption")},toggleControls:function(){this.isHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.2.10",defaults:a,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof p&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new p(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),t===!0&&this.close())},destroy:function(){this.close(!0),r.off("click.fb-start")},isMobile:e.createTouch!==o&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;if(!t||!t.length)return!1;if(e=t.eq(0).css("transform"),e&&e.indexOf("matrix")!==-1?(e=e.split("(")[1],e=e.split(")")[0],e=e.split(",")):e=[],e.length)e=e.length>10?[e[13],e[12],e[0],e[5]]:[e[5],e[4],e[0],e[3]],e=e.map(parseFloat);else{e=[0,0,1,1];var n=/\.*translate\((.*)px,(.*)px\)/i,o=n.exec(t.eq(0).attr("style"));o&&(e[0]=parseFloat(o[2]),e[1]=parseFloat(o[1]))}return{top:e[0],left:e[1],scaleX:e[2],scaleY:e[3],opacity:parseFloat(t.css("opacity")),width:t.width(),height:t.height()}},setTranslate:function(t,e){var n="",i={};if(t&&e)return e.left===o&&e.top===o||(n=(e.left===o?t.position().left:e.left)+"px, "+(e.top===o?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),e.scaleX!==o&&e.scaleY!==o&&(n=(n.length?n+" ":"")+"scale("+e.scaleX+", "+e.scaleY+")"),n.length&&(i.transform=n),e.opacity!==o&&(i.opacity=e.opacity),e.width!==o&&(i.width=e.width),e.height!==o&&(i.height=e.height),t.css(i)},animate:function(t,e,i,a,s){n.isFunction(i)&&(a=i,i=null),n.isPlainObject(e)||t.removeAttr("style"),t.on(d,function(i){(!i||!i.originalEvent||t.is(i.originalEvent.target)&&"z-index"!=i.originalEvent.propertyName)&&(n.fancybox.stop(t),n.isPlainObject(e)?(e.scaleX!==o&&e.scaleY!==o&&(t.css("transition-duration",""),e.width=Math.round(t.width()*e.scaleX),e.height=Math.round(t.height()*e.scaleY),e.scaleX=1,e.scaleY=1,n.fancybox.setTranslate(t,e)),s===!1&&t.removeAttr("style")):s!==!0&&t.removeClass(e),n.isFunction(a)&&a(i))}),n.isNumeric(i)&&t.css("transition-duration",i+"ms"),n.isPlainObject(e)?n.fancybox.setTranslate(t,e):t.addClass(e),e.scaleX&&t.hasClass("fancybox-image-wrap")&&t.parent().addClass("fancybox-is-scaling"),t.data("timer",setTimeout(function(){t.trigger("transitionend")},i+16))},stop:function(t){clearTimeout(t.data("timer")),t.off("transitionend").css("transition-duration",""),t.hasClass("fancybox-image-wrap")&&t.parent().removeClass("fancybox-is-scaling")}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},i):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},i),this},r.on("click.fb-start","[data-fancybox]",i)}}(window,document,window.jQuery||jQuery),function(t){"use strict";var e=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e},n={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"//www.youtube.com/embed/$4",thumb:"//img.youtube.com/vi/$4/hqdefault.jpg"
12
- },vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1,api:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},metacafe:{matcher:/metacafe.com\/watch\/(\d+)\/(.*)?/,type:"iframe",url:"//www.metacafe.com/embed/$1/?ap=1"},dailymotion:{matcher:/dailymotion.com\/video\/(.*)\/?(.*)/,params:{additionalInfos:0,autoStart:1},type:"iframe",url:"//www.dailymotion.com/embed/video/$1"},vine:{matcher:/vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/,type:"iframe",url:"//vine.co/v/$1/embed/simple"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12])+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}};t(document).on("objectNeedsType.fb",function(o,i,a){var s,r,c,l,u,d,f,p=a.src||"",h=!1;s=t.extend(!0,{},n,a.opts.media),t.each(s,function(n,o){if(c=p.match(o.matcher)){if(h=o.type,d={},o.paramPlace&&c[o.paramPlace]){u=c[o.paramPlace],"?"==u[0]&&(u=u.substring(1)),u=u.split("&");for(var i=0;i<u.length;++i){var s=u[i].split("=",2);2==s.length&&(d[s[0]]=decodeURIComponent(s[1].replace(/\+/g," ")))}}return l=t.extend(!0,{},o.params,a.opts[n],d),p="function"===t.type(o.url)?o.url.call(this,c,l,a):e(o.url,c,l),r="function"===t.type(o.thumb)?o.thumb.call(this,c,l,a):e(o.thumb,c),"vimeo"===n&&(p=p.replace("&%23","#")),!1}}),h?(a.src=p,a.type=h,a.opts.thumb||a.opts.$thumb&&a.opts.$thumb.length||(a.opts.thumb=r),"iframe"===h&&(t.extend(!0,a.opts,{iframe:{preload:!1,attr:{scrolling:"no"}}}),a.contentProvider=f,a.opts.slideClass+=" fancybox-slide--"+("gmap_place"==f||"gmap_search"==f?"map":"video"))):p&&(a.type=a.opts.defaultType)})}(window.jQuery||jQuery),function(t,e,n){"use strict";var o=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),i=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||function(e){t.clearTimeout(e)}}(),a=function(e){var n=[];e=e.originalEvent||e||t.e,e=e.touches&&e.touches.length?e.touches:e.changedTouches&&e.changedTouches.length?e.changedTouches:[e];for(var o in e)e[o].pageX?n.push({x:e[o].pageX,y:e[o].pageY}):e[o].clientX&&n.push({x:e[o].clientX,y:e[o].clientY});return n},s=function(t,e,n){return e&&t?"x"===n?t.x-e.x:"y"===n?t.y-e.y:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)):0},r=function(t){if(t.is('a,area,button,[role="button"],input,label,select,summary,textarea')||n.isFunction(t.get(0).onclick)||t.data("selectable"))return!0;for(var e=0,o=t[0].attributes,i=o.length;e<i;e++)if("data-fancybox-"===o[e].nodeName.substr(0,14))return!0;return!1},c=function(e){var n=t.getComputedStyle(e)["overflow-y"],o=t.getComputedStyle(e)["overflow-x"],i=("scroll"===n||"auto"===n)&&e.scrollHeight>e.clientHeight,a=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return i||a},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},u=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};u.prototype.destroy=function(){this.$container.off(".fb.touch")},u.prototype.ontouchstart=function(o){var i=this,c=n(o.target),u=i.instance,d=u.current,f=d.$content,p="touchstart"==o.type;if(p&&i.$container.off("mousedown.fb.touch"),(!o.originalEvent||2!=o.originalEvent.button)&&c.length&&!r(c)&&!r(c.parent())&&(c.is("img")||!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left))){if(!d||i.instance.isAnimating||i.instance.isClosing)return o.stopPropagation(),void o.preventDefault();if(i.realPoints=i.startPoints=a(o),i.startPoints){if(o.stopPropagation(),i.startEvent=o,i.canTap=!0,i.$target=c,i.$content=f,i.opts=d.opts.touch,i.isPanning=!1,i.isSwiping=!1,i.isZooming=!1,i.isScrolling=!1,i.sliderStartPos=i.sliderLastPos||{top:0,left:0},i.contentStartPos=n.fancybox.getTranslate(i.$content),i.contentLastPos=null,i.startTime=(new Date).getTime(),i.distanceX=i.distanceY=i.distance=0,i.canvasWidth=Math.round(d.$slide[0].clientWidth),i.canvasHeight=Math.round(d.$slide[0].clientHeight),n(e).off(".fb.touch").on(p?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(i,"ontouchend")).on(p?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(i,"ontouchmove")),n.fancybox.isMobile&&e.addEventListener("scroll",i.onscroll,!0),!i.opts&&!u.canPan()||!c.is(i.$stage)&&!i.$stage.find(c).length)return void(c.is("img")&&o.preventDefault());n.fancybox.isMobile&&(l(c)||l(c.parent()))||o.preventDefault(),1===i.startPoints.length&&("image"===d.type&&(i.contentStartPos.width>i.canvasWidth+1||i.contentStartPos.height>i.canvasHeight+1)?(n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.isPanning=!0):i.isSwiping=!0,i.$container.addClass("fancybox-controls--isGrabbing")),2!==i.startPoints.length||u.isAnimating||d.hasError||"image"!==d.type||!d.isLoaded&&!d.$ghost||(i.canTap=!1,i.isSwiping=!1,i.isPanning=!1,i.isZooming=!0,n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.centerPointStartX=.5*(i.startPoints[0].x+i.startPoints[1].x)-n(t).scrollLeft(),i.centerPointStartY=.5*(i.startPoints[0].y+i.startPoints[1].y)-n(t).scrollTop(),i.percentageOfImageAtPinchPointX=(i.centerPointStartX-i.contentStartPos.left)/i.contentStartPos.width,i.percentageOfImageAtPinchPointY=(i.centerPointStartY-i.contentStartPos.top)/i.contentStartPos.height,i.startDistanceBetweenFingers=s(i.startPoints[0],i.startPoints[1]))}}},u.prototype.onscroll=function(t){self.isScrolling=!0},u.prototype.ontouchmove=function(t){var e=this,o=n(t.target);return e.isScrolling||!o.is(e.$stage)&&!e.$stage.find(o).length?void(e.canTap=!1):(e.newPoints=a(t),void((e.opts||e.instance.canPan())&&e.newPoints&&e.newPoints.length&&(e.isSwiping&&e.isSwiping===!0||t.preventDefault(),e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))))},u.prototype.onSwipe=function(e){var a,s=this,r=s.isSwiping,c=s.sliderStartPos.left||0;if(r!==!0)"x"==r&&(s.distanceX>0&&(s.instance.group.length<2||0===s.instance.current.index&&!s.instance.current.opts.loop)?c+=Math.pow(s.distanceX,.8):s.distanceX<0&&(s.instance.group.length<2||s.instance.current.index===s.instance.group.length-1&&!s.instance.current.opts.loop)?c-=Math.pow(-s.distanceX,.8):c+=s.distanceX),s.sliderLastPos={top:"x"==r?0:s.sliderStartPos.top+s.distanceY,left:c},s.requestId&&(i(s.requestId),s.requestId=null),s.requestId=o(function(){s.sliderLastPos&&(n.each(s.instance.slides,function(t,e){var o=e.pos-s.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:s.sliderLastPos.top,left:s.sliderLastPos.left+o*s.canvasWidth+o*e.opts.gutter})}),s.$container.addClass("fancybox-is-sliding"))});else if(Math.abs(s.distance)>10){if(s.canTap=!1,s.instance.group.length<2&&s.opts.vertical?s.isSwiping="y":s.instance.isDragging||s.opts.vertical===!1||"auto"===s.opts.vertical&&n(t).width()>800?s.isSwiping="x":(a=Math.abs(180*Math.atan2(s.distanceY,s.distanceX)/Math.PI),s.isSwiping=a>45&&a<135?"y":"x"),s.canTap=!1,"y"===s.isSwiping&&n.fancybox.isMobile&&(l(s.$target)||l(s.$target.parent())))return void(s.isScrolling=!0);s.instance.isDragging=s.isSwiping,s.startPoints=s.newPoints,n.each(s.instance.slides,function(t,e){n.fancybox.stop(e.$slide),e.$slide.css("transition-duration",""),e.inTransition=!1,e.pos===s.instance.current.pos&&(s.sliderStartPos.left=n.fancybox.getTranslate(e.$slide).left)}),s.instance.SlideShow&&s.instance.SlideShow.isActive&&s.instance.SlideShow.stop()}},u.prototype.onPan=function(){var t=this;return s(t.newPoints[0],t.realPoints[0])<(n.fancybox.isMobile?10:5)?void(t.startPoints=t.newPoints):(t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&(i(t.requestId),t.requestId=null),void(t.requestId=o(function(){n.fancybox.setTranslate(t.$content,t.contentLastPos)})))},u.prototype.limitMovement=function(){var t,e,n,o,i,a,s=this,r=s.canvasWidth,c=s.canvasHeight,l=s.distanceX,u=s.distanceY,d=s.contentStartPos,f=d.left,p=d.top,h=d.width,g=d.height;return i=h>r?f+l:f,a=p+u,t=Math.max(0,.5*r-.5*h),e=Math.max(0,.5*c-.5*g),n=Math.min(r-h,.5*r-.5*h),o=Math.min(c-g,.5*c-.5*g),h>r&&(l>0&&i>t&&(i=t-1+Math.pow(-t+f+l,.8)||0),l<0&&i<n&&(i=n+1-Math.pow(n-f-l,.8)||0)),g>c&&(u>0&&a>e&&(a=e-1+Math.pow(-e+p+u,.8)||0),u<0&&a<o&&(a=o+1-Math.pow(o-p-u,.8)||0)),{top:a,left:i,scaleX:d.scaleX,scaleY:d.scaleY}},u.prototype.limitPosition=function(t,e,n,o){var i=this,a=i.canvasWidth,s=i.canvasHeight;return n>a?(t=t>0?0:t,t=t<a-n?a-n:t):t=Math.max(0,a/2-n/2),o>s?(e=e>0?0:e,e=e<s-o?s-o:e):e=Math.max(0,s/2-o/2),{top:e,left:t}},u.prototype.onZoom=function(){var e=this,a=e.contentStartPos.width,r=e.contentStartPos.height,c=e.contentStartPos.left,l=e.contentStartPos.top,u=s(e.newPoints[0],e.newPoints[1]),d=u/e.startDistanceBetweenFingers,f=Math.floor(a*d),p=Math.floor(r*d),h=(a-f)*e.percentageOfImageAtPinchPointX,g=(r-p)*e.percentageOfImageAtPinchPointY,b=(e.newPoints[0].x+e.newPoints[1].x)/2-n(t).scrollLeft(),m=(e.newPoints[0].y+e.newPoints[1].y)/2-n(t).scrollTop(),y=b-e.centerPointStartX,v=m-e.centerPointStartY,x=c+(h+y),w=l+(g+v),$={top:w,left:x,scaleX:e.contentStartPos.scaleX*d,scaleY:e.contentStartPos.scaleY*d};e.canTap=!1,e.newWidth=f,e.newHeight=p,e.contentLastPos=$,e.requestId&&(i(e.requestId),e.requestId=null),e.requestId=o(function(){n.fancybox.setTranslate(e.$content,e.contentLastPos)})},u.prototype.ontouchend=function(t){var o=this,s=Math.max((new Date).getTime()-o.startTime,1),r=o.isSwiping,c=o.isPanning,l=o.isZooming,u=o.isScrolling;return o.endPoints=a(t),o.$container.removeClass("fancybox-controls--isGrabbing"),n(e).off(".fb.touch"),e.removeEventListener("scroll",o.onscroll,!0),o.requestId&&(i(o.requestId),o.requestId=null),o.isSwiping=!1,o.isPanning=!1,o.isZooming=!1,o.isScrolling=!1,o.instance.isDragging=!1,o.canTap?o.onTap(t):(o.speed=366,o.velocityX=o.distanceX/s*.5,o.velocityY=o.distanceY/s*.5,o.speedX=Math.max(.5*o.speed,Math.min(1.5*o.speed,1/Math.abs(o.velocityX)*o.speed)),void(c?o.endPanning():l?o.endZooming():o.endSwiping(r,u)))},u.prototype.endSwiping=function(t,e){var o=this,i=!1,a=o.instance.group.length;o.sliderLastPos=null,"y"==t&&!e&&Math.abs(o.distanceY)>50?(n.fancybox.animate(o.instance.current.$slide,{top:o.sliderStartPos.top+o.distanceY+150*o.velocityY,opacity:0},150),i=o.instance.close(!0,300)):"x"==t&&o.distanceX>50&&a>1?i=o.instance.previous(o.speedX):"x"==t&&o.distanceX<-50&&a>1&&(i=o.instance.next(o.speedX)),i!==!1||"x"!=t&&"y"!=t||(e||a<2?o.instance.centerSlide(o.instance.current,150):o.instance.jumpTo(o.instance.current.index)),o.$container.removeClass("fancybox-is-sliding")},u.prototype.endPanning=function(){var t,e,o,i=this;i.contentLastPos&&(i.opts.momentum===!1?(t=i.contentLastPos.left,e=i.contentLastPos.top):(t=i.contentLastPos.left+i.velocityX*i.speed,e=i.contentLastPos.top+i.velocityY*i.speed),o=i.limitPosition(t,e,i.contentStartPos.width,i.contentStartPos.height),o.width=i.contentStartPos.width,o.height=i.contentStartPos.height,n.fancybox.animate(i.$content,o,330))},u.prototype.endZooming=function(){var t,e,o,i,a=this,s=a.instance.current,r=a.newWidth,c=a.newHeight;a.contentLastPos&&(t=a.contentLastPos.left,e=a.contentLastPos.top,i={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(a.$content,i),r<a.canvasWidth&&c<a.canvasHeight?a.instance.scaleToFit(150):r>s.width||c>s.height?a.instance.scaleToActual(a.centerPointStartX,a.centerPointStartY,150):(o=a.limitPosition(t,e,r,c),n.fancybox.setTranslate(a.content,n.fancybox.getTranslate(a.$content)),n.fancybox.animate(a.$content,o,150)))},u.prototype.onTap=function(t){var e,o=this,i=n(t.target),s=o.instance,r=s.current,c=t&&a(t)||o.startPoints,l=c[0]?c[0].x-o.$stage.offset().left:0,u=c[0]?c[0].y-o.$stage.offset().top:0,d=function(e){var i=r.opts[e];if(n.isFunction(i)&&(i=i.apply(s,[r,t])),i)switch(i){case"close":s.close(o.startEvent);break;case"toggleControls":s.toggleControls(!0);break;case"next":s.next();break;case"nextOrClose":s.group.length>1?s.next():s.close(o.startEvent);break;case"zoom":"image"==r.type&&(r.isLoaded||r.$ghost)&&(s.canPan()?s.scaleToFit():s.isScaledDown()?s.scaleToActual(l,u):s.group.length<2&&s.close(o.startEvent))}};if((!t.originalEvent||2!=t.originalEvent.button)&&(i.is("img")||!(l>i[0].clientWidth+i.offset().left))){if(i.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))e="Outside";else if(i.is(".fancybox-slide"))e="Slide";else{if(!s.current.$content||!s.current.$content.find(i).addBack().filter(i).length)return;e="Content"}if(o.tapped){if(clearTimeout(o.tapped),o.tapped=null,Math.abs(l-o.tapX)>50||Math.abs(u-o.tapY)>50)return this;d("dblclick"+e)}else o.tapX=l,o.tapY=u,r.opts["dblclick"+e]&&r.opts["dblclick"+e]!==r.opts["click"+e]?o.tapped=setTimeout(function(){o.tapped=null,d("click"+e)},500):d("click"+e);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new u(e))})}(window,document,window.jQuery||jQuery),function(t,e){"use strict";e.extend(!0,e.fancybox.defaults,{btnTpl:{slideShow:'<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}"><svg viewBox="0 0 40 40"><path d="M13,12 L27,20 L13,27 Z" /><path d="M15,10 v19 M23,10 v19" /></svg></button>'},slideShow:{autoStart:!1,speed:3e3}});var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this;t.$button=t.instance.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),(t.instance.group.length<2||!t.instance.group[t.instance.currIndex].opts.slideShow)&&t.$button.hide()},set:function(t){var e=this;e.instance&&e.instance.current&&(t===!0||e.instance.current.opts.loop||e.instance.currIndex<e.instance.group.length-1)?e.timer=setTimeout(function(){e.isActive&&e.instance.jumpTo((e.instance.currIndex+1)%e.instance.group.length)},e.instance.current.opts.slideShow.speed):(e.stop(),e.instance.idleSecondsCounter=0,e.instance.showControls())},clear:function(){var t=this;clearTimeout(t.timer),t.timer=null},start:function(){var t=this,e=t.instance.current;e&&(t.isActive=!0,t.$button.attr("title",e.opts.i18n[e.opts.lang].PLAY_STOP).removeClass("fancybox-button--play").addClass("fancybox-button--pause"),t.set(!0))},stop:function(){var t=this,e=t.instance.current;t.clear(),t.$button.attr("title",e.opts.i18n[e.opts.lang].PLAY_START).removeClass("fancybox-button--pause").addClass("fancybox-button--play"),t.isActive=!1},toggle:function(){var t=this;t.isActive?t.stop():t.start()}}),e(t).on({"onInit.fb":function(t,e){e&&!e.SlideShow&&(e.SlideShow=new n(e))},"beforeShow.fb":function(t,e,n,o){var i=e&&e.SlideShow;o?i&&n.opts.slideShow.autoStart&&i.start():i&&i.isActive&&i.clear()},"afterShow.fb":function(t,e,n){var o=e&&e.SlideShow;o&&o.isActive&&o.set()},"afterKeydown.fb":function(n,o,i,a,s){var r=o&&o.SlideShow;!r||!i.opts.slideShow||80!==s&&32!==s||e(t.activeElement).is("button,a,input")||(a.preventDefault(),r.toggle())},"beforeClose.fb onDeactivate.fb":function(t,e){var n=e&&e.SlideShow;n&&n.stop()}}),e(t).on("visibilitychange",function(){var n=e.fancybox.getInstance(),o=n&&n.SlideShow;o&&o.isActive&&(t.hidden?o.clear():o.set())})}(document,window.jQuery||jQuery),function(t,e){"use strict";var n=function(){var e,n,o,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],a={};for(n=0;n<i.length;n++)if(e=i[n],e&&e[1]in t){for(o=0;o<e.length;o++)a[i[0][o]]=e[o];return a}return!1}();if(!n)return void(e&&e.fancybox&&(e.fancybox.defaults.btnTpl.fullScreen=!1));var o={request:function(e){e=e||t.documentElement,e[n.requestFullscreen](e.ALLOW_KEYBOARD_INPUT)},exit:function(){t[n.exitFullscreen]()},toggle:function(e){e=e||t.documentElement,this.isFullscreen()?this.exit():this.request(e)},isFullscreen:function(){return Boolean(t[n.fullscreenElement])},enabled:function(){return Boolean(t[n.fullscreenEnabled])}};e.extend(!0,e.fancybox.defaults,{btnTpl:{fullScreen:'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fullscreen" title="{{FULL_SCREEN}}"><svg viewBox="0 0 40 40"><path d="M9,12 h22 v16 h-22 v-16 v16 h22 v-16 Z" /></svg></button>'},fullScreen:{autoStart:!1}}),e(t).on({"onInit.fb":function(t,e){var n;e&&e.group[e.currIndex].opts.fullScreen?(n=e.$refs.container,n.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle(n[0])}),e.opts.fullScreen&&e.opts.fullScreen.autoStart===!0&&o.request(n[0]),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle(e.$refs.container[0]))},"beforeClose.fb":function(t){t&&t.FullScreen&&o.exit()}}),e(t).on(n.fullscreenchange,function(){var t=o.isFullscreen(),n=e.fancybox.getInstance();n&&(n.current&&"image"===n.current.type&&n.isAnimating&&(n.current.$content.css("transition","none"),n.isAnimating=!1,n.update(!0,!0,0)),n.trigger("onFullscreenChange",t),n.$refs.container.toggleClass("fancybox-is-fullscreen",t))})}(document,window.jQuery||jQuery),function(t,e){"use strict";e.fancybox.defaults=e.extend(!0,{btnTpl:{thumbs:'<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}"><svg viewBox="0 0 120 120"><path d="M30,30 h14 v14 h-14 Z M50,30 h14 v14 h-14 Z M70,30 h14 v14 h-14 Z M30,50 h14 v14 h-14 Z M50,50 h14 v14 h-14 Z M70,50 h14 v14 h-14 Z M30,70 h14 v14 h-14 Z M50,70 h14 v14 h-14 Z M70,70 h14 v14 h-14 Z" /></svg></button>'},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},e.fancybox.defaults);var n=function(t){this.init(t)};e.extend(n.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e=this;e.instance=t,t.Thumbs=e;var n=t.group[0],o=t.group[1];e.opts=t.group[t.currIndex].opts.thumbs,e.$button=t.$refs.toolbar.find("[data-fancybox-thumbs]"),e.opts&&n&&o&&("image"==n.type||n.opts.thumb||n.opts.$thumb)&&("image"==o.type||o.opts.thumb||o.opts.$thumb)?(e.$button.show().on("click",function(){e.toggle()}),e.isActive=!0):e.$button.hide()},create:function(){var t,n,o=this,i=o.instance,a=o.opts.parentEl;o.$grid=e('<div class="fancybox-thumbs fancybox-thumbs-'+o.opts.axis+'"></div>').appendTo(i.$refs.container.find(a).addBack().filter(a)),t="<ul>",e.each(i.group,function(e,o){n=o.opts.thumb||(o.opts.$thumb?o.opts.$thumb.attr("src"):null),n||"image"!==o.type||(n=o.src),n&&n.length&&(t+='<li data-index="'+e+'" tabindex="0" class="fancybox-thumbs-loading"><img data-src="'+n+'" /></li>')}),t+="</ul>",o.$list=e(t).appendTo(o.$grid).on("click","li",function(){i.jumpTo(e(this).data("index"))}),o.$list.find("img").hide().one("load",function(){var t,n,o,i,a=e(this).parent().removeClass("fancybox-thumbs-loading"),s=a.outerWidth(),r=a.outerHeight();t=this.naturalWidth||this.width,n=this.naturalHeight||this.height,o=t/s,i=n/r,o>=1&&i>=1&&(o>i?(t/=i,n=r):(t=s,n/=o)),e(this).css({width:Math.floor(t),height:Math.floor(n),"margin-top":n>r?Math.floor(.3*r-.3*n):Math.floor(.5*r-.5*n),"margin-left":Math.floor(.5*s-.5*t)}).show()}).each(function(){this.src=e(this).data("src")}),"x"===o.opts.axis&&o.$list.width(parseInt(o.$grid.css("padding-right"))+i.group.length*o.$list.children().eq(0).outerWidth(!0)+"px")},focus:function(t){var e,n,o=this,i=o.$list;o.instance.current&&(e=i.children().removeClass("fancybox-thumbs-active").filter('[data-index="'+o.instance.current.index+'"]').addClass("fancybox-thumbs-active"),n=e.position(),"y"===o.opts.axis&&(n.top<0||n.top>i.height()-e.outerHeight())?i.stop().animate({scrollTop:i.scrollTop()+n.top},t):"x"===o.opts.axis&&(n.left<i.parent().scrollLeft()||n.left>i.parent().scrollLeft()+(i.parent().width()-e.outerWidth()))&&i.parent().stop().animate({scrollLeft:n.left},t))},update:function(){this.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),this.isVisible?(this.$grid||this.create(),this.instance.trigger("onThumbsShow"),this.focus(0)):this.$grid&&this.instance.trigger("onThumbsHide"),this.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){var o;e&&!e.Thumbs&&(o=new n(e),o.isActive&&o.opts.autoStart===!0&&o.show())},"beforeShow.fb":function(t,e,n,o){var i=e&&e.Thumbs;i&&i.isVisible&&i.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,i){var a=e&&e.Thumbs;a&&a.isActive&&71===i&&(o.preventDefault(),a.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&n.opts.hideOnClose!==!1&&n.$grid.hide()}})}(document,window.jQuery),function(t,e){"use strict";function n(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};return String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]})}e.extend(!0,e.fancybox.defaults,{btnTpl:{share:'<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}"><svg viewBox="0 0 40 40"><path d="M6,30 C8,18 19,16 23,16 L23,16 L23,10 L33,20 L23,29 L23,24 C19,24 8,27 6,30 Z"></svg></button>'},share:{tpl:'<div class="fancybox-share"><h1>{{SHARE}}</h1><p class="fancybox-share__links"><a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m287 456v-299c0-21 6-35 35-35h38v-63c-7-1-29-3-55-3-54 0-91 33-91 94v306m143-254h-205v72h196" /></svg><span>Facebook</span></a><a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&description={{descr}}&media={{media}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m265 56c-109 0-164 78-164 144 0 39 15 74 47 87 5 2 10 0 12-5l4-19c2-6 1-8-3-13-9-11-15-25-15-45 0-58 43-110 113-110 62 0 96 38 96 88 0 67-30 122-73 122-24 0-42-19-36-44 6-29 20-60 20-81 0-19-10-35-31-35-25 0-44 26-44 60 0 21 7 36 7 36l-30 125c-8 37-1 83 0 87 0 3 4 4 5 2 2-3 32-39 42-75l16-64c8 16 31 29 56 29 74 0 124-67 124-157 0-69-58-132-146-132z" fill="#fff"/></svg><span>Pinterest</span></a><a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&text={{descr}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" /></svg><span>Twitter</span></a></p><p><input class="fancybox-share__input" type="text" value="{{url_raw}}" /></p></div>'}}),e(t).on("click","[data-fancybox-share]",function(){var t,o,i=e.fancybox.getInstance();i&&(t=i.current.opts.hash===!1?i.current.src:window.location,o=i.current.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===i.current.type?encodeURIComponent(i.current.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,n(t)).replace(/\{\{descr\}\}/g,i.$caption?encodeURIComponent(i.$caption.text()):""),e.fancybox.open({src:i.translate(i,o),type:"html",opts:{animationEffect:"fade",animationDuration:250,afterLoad:function(t,e){e.$content.find(".fancybox-share__links a").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})}}}))})}(document,window.jQuery||jQuery),function(t,e,n){"use strict";function o(){var t=e.location.hash.substr(1),n=t.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,i=n.join("-");return o<1&&(o=1),{hash:t,index:o,gallery:i}}function i(t){var e;""!==t.gallery&&(e=n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1),e.length||(e=n("#"+n.escapeSelector(t.gallery))),e.length&&(s=!1,e.trigger("click")))}function a(t){var e;return!!t&&(e=t.current?t.current.opts:t.opts,e.hash||(e.$orig?e.$orig.data("fancybox"):""))}n.escapeSelector||(n.escapeSelector=function(t){var e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,n=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t};return(t+"").replace(e,n)});var s=!0,r=null,c=null;n(function(){n.fancybox.defaults.hash!==!1&&(n(t).on({"onInit.fb":function(t,e){var n,i;e.group[e.currIndex].opts.hash!==!1&&(n=o(),i=a(e),i&&n.gallery&&i==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,i){var l;i&&i.opts.hash!==!1&&(l=a(o),l&&""!==l&&(e.location.hash.indexOf(l)<0&&(o.opts.origHash=e.location.hash),r=l+(o.group.length>1?"-"+(i.index+1):""),"replaceState"in e.history?(c&&clearTimeout(c),c=setTimeout(function(){e.history[s?"pushState":"replaceState"]({},t.title,e.location.pathname+e.location.search+"#"+r),c=null,s=!1},300)):e.location.hash=r))},"beforeClose.fb":function(o,i,s){var l,u;c&&clearTimeout(c),s.opts.hash!==!1&&(l=a(i),u=i&&i.opts.origHash?i.opts.origHash:"",l&&""!==l&&("replaceState"in history?e.history.replaceState({},t.title,e.location.pathname+e.location.search+u):(e.location.hash=u,n(e).scrollTop(i.scrollTop).scrollLeft(i.scrollLeft))),r=null)}}),n(e).on("hashchange.fb",function(){var t=o();n.fancybox.getInstance()?!r||r===t.gallery+"-"+t.index||1===t.index&&r==t.gallery||(r=null,n.fancybox.close()):""!==t.gallery&&i(t)}),setTimeout(function(){i(o())},50))})}(document,window,window.jQuery||jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var o=e.current,i=(new Date).getTime();e.group.length<1||o.opts.wheel===!1||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,i-n<250||(n=i,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,window.jQuery||jQuery);
 
1
  // ==================================================
2
+ // fancyBox v3.5.7
3
  //
4
  // Licensed GPLv3 for open source use
5
  // or fancyBox Commercial License for commercial use
6
  //
7
  // http://fancyapps.com/fancybox/
8
+ // Copyright 2019 fancyApps
9
  //
10
  // ==================================================
11
+ !function(t,e,n,o){"use strict";function i(t,e){var o,i,a,s=[],r=0;t&&t.isDefaultPrevented()||(t.preventDefault(),e=e||{},t&&t.data&&(e=h(t.data.options,e)),o=e.$target||n(t.currentTarget).trigger("blur"),(a=n.fancybox.getInstance())&&a.$trigger&&a.$trigger.is(o)||(e.selector?s=n(e.selector):(i=o.attr("data-fancybox")||"",i?(s=t.data?t.data.items:[],s=s.length?s.filter('[data-fancybox="'+i+'"]'):n('[data-fancybox="'+i+'"]')):s=[o]),r=n(s).index(o),r<0&&(r=0),a=n.fancybox.open(s,e,r),a.$trigger=o))}if(t.console=t.console||{info:function(t){}},n){if(n.fn.fancybox)return void console.info("fancyBox already initialized");var a={closeExisting:!1,loop:!1,gutter:50,keyboard:!0,preventCaptionOverlap:!0,arrows:!0,infobar:!0,smallBtn:"auto",toolbar:"auto",buttons:["zoom","slideShow","thumbs","close"],idleTime:3,protect:!1,modal:!1,image:{preload:!1},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""></iframe>',preload:!0,css:{},attr:{scrolling:"auto"}},video:{tpl:'<video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}"><source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!</video>',format:"",autoStart:!0},defaultType:"image",animationEffect:"zoom",animationDuration:366,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'<div class="fancybox-container" role="dialog" tabindex="-1"><div class="fancybox-bg"></div><div class="fancybox-inner"><div class="fancybox-infobar"><span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span></div><div class="fancybox-toolbar">{{buttons}}</div><div class="fancybox-navigation">{{arrows}}</div><div class="fancybox-stage"></div><div class="fancybox-caption"><div class="fancybox-caption__body"></div></div></div></div>',spinnerTpl:'<div class="fancybox-loading"></div>',errorTpl:'<div class="fancybox-error"><p>{{ERROR}}</p></div>',btnTpl:{download:'<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg></a>',zoom:'<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg></button>',close:'<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg></button>',arrowLeft:'<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}"><div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div></button>',arrowRight:'<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}"><div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div></button>',smallBtn:'<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg></button>'},parentEl:"body",hideScrollbar:!0,autoFocus:!0,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:3e3},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"},wheel:"auto",onInit:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeClose:n.noop,afterClose:n.noop,onActivate:n.noop,onDeactivate:n.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{preventCaptionOverlap:!1,idleTime:!1,clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded. <br/> Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"},de:{CLOSE:"Schlie&szlig;en",NEXT:"Weiter",PREV:"Zur&uuml;ck",ERROR:"Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es sp&auml;ter nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder",DOWNLOAD:"Herunterladen",SHARE:"Teilen",ZOOM:"Vergr&ouml;&szlig;ern"}}},s=n(t),r=n(e),c=0,l=function(t){return t&&t.hasOwnProperty&&t instanceof n},d=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),u=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||function(e){t.clearTimeout(e)}}(),f=function(){var t,n=e.createElement("fakeelement"),o={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in o)if(void 0!==n.style[t])return o[t];return"transitionend"}(),p=function(t){return t&&t.length&&t[0].offsetHeight},h=function(t,e){var o=n.extend(!0,{},t,e);return n.each(e,function(t,e){n.isArray(e)&&(o[t]=e)}),o},g=function(t){var o,i;return!(!t||t.ownerDocument!==e)&&(n(".fancybox-container").css("pointer-events","none"),o={x:t.getBoundingClientRect().left+t.offsetWidth/2,y:t.getBoundingClientRect().top+t.offsetHeight/2},i=e.elementFromPoint(o.x,o.y)===t,n(".fancybox-container").css("pointer-events",""),i)},b=function(t,e,o){var i=this;i.opts=h({index:o},n.fancybox.defaults),n.isPlainObject(e)&&(i.opts=h(i.opts,e)),n.fancybox.isMobile&&(i.opts=h(i.opts,i.opts.mobile)),i.id=i.opts.id||++c,i.currIndex=parseInt(i.opts.index,10)||0,i.prevIndex=null,i.prevPos=null,i.currPos=0,i.firstRun=!0,i.group=[],i.slides={},i.addContent(t),i.group.length&&i.init()};n.extend(b.prototype,{init:function(){var o,i,a=this,s=a.group[a.currIndex],r=s.opts;r.closeExisting&&n.fancybox.close(!0),n("body").addClass("fancybox-active"),!n.fancybox.getInstance()&&!1!==r.hideScrollbar&&!n.fancybox.isMobile&&e.body.scrollHeight>t.innerHeight&&(n("head").append('<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar{margin-right:'+(t.innerWidth-e.documentElement.clientWidth)+"px;}</style>"),n("body").addClass("compensate-for-scrollbar")),i="",n.each(r.buttons,function(t,e){i+=r.btnTpl[e]||""}),o=n(a.translate(a,r.baseTpl.replace("{{buttons}}",i).replace("{{arrows}}",r.btnTpl.arrowLeft+r.btnTpl.arrowRight))).attr("id","fancybox-container-"+a.id).addClass(r.baseClass).data("FancyBox",a).appendTo(r.parentEl),a.$refs={container:o},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){a.$refs[t]=o.find(".fancybox-"+t)}),a.trigger("onInit"),a.activate(),a.jumpTo(a.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang]||t.opts.i18n.en;return e.replace(/\{\{(\w+)\}\}/g,function(t,e){return void 0===n[e]?t:n[e]})},addContent:function(t){var e,o=this,i=n.makeArray(t);n.each(i,function(t,e){var i,a,s,r,c,l={},d={};n.isPlainObject(e)?(l=e,d=e.opts||e):"object"===n.type(e)&&n(e).length?(i=n(e),d=i.data()||{},d=n.extend(!0,{},d,d.options),d.$orig=i,l.src=o.opts.src||d.src||i.attr("href"),l.type||l.src||(l.type="inline",l.src=e)):l={type:"html",src:e+""},l.opts=n.extend(!0,{},o.opts,d),n.isArray(d.buttons)&&(l.opts.buttons=d.buttons),n.fancybox.isMobile&&l.opts.mobile&&(l.opts=h(l.opts,l.opts.mobile)),a=l.type||l.opts.type,r=l.src||"",!a&&r&&((s=r.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(a="video",l.opts.video.format||(l.opts.video.format="video/"+("ogv"===s[1]?"ogg":s[1]))):r.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?a="image":r.match(/\.(pdf)((\?|#).*)?$/i)?(a="iframe",l=n.extend(!0,l,{contentType:"pdf",opts:{iframe:{preload:!1}}})):"#"===r.charAt(0)&&(a="inline")),a?l.type=a:o.trigger("objectNeedsType",l),l.contentType||(l.contentType=n.inArray(l.type,["html","inline","ajax"])>-1?"html":l.type),l.index=o.group.length,"auto"==l.opts.smallBtn&&(l.opts.smallBtn=n.inArray(l.type,["html","inline","ajax"])>-1),"auto"===l.opts.toolbar&&(l.opts.toolbar=!l.opts.smallBtn),l.$thumb=l.opts.$thumb||null,l.opts.$trigger&&l.index===o.opts.index&&(l.$thumb=l.opts.$trigger.find("img:first"),l.$thumb.length&&(l.opts.$orig=l.opts.$trigger)),l.$thumb&&l.$thumb.length||!l.opts.$orig||(l.$thumb=l.opts.$orig.find("img:first")),l.$thumb&&!l.$thumb.length&&(l.$thumb=null),l.thumb=l.opts.thumb||(l.$thumb?l.$thumb[0].src:null),"function"===n.type(l.opts.caption)&&(l.opts.caption=l.opts.caption.apply(e,[o,l])),"function"===n.type(o.opts.caption)&&(l.opts.caption=o.opts.caption.apply(e,[o,l])),l.opts.caption instanceof n||(l.opts.caption=void 0===l.opts.caption?"":l.opts.caption+""),"ajax"===l.type&&(c=r.split(/\s+/,2),c.length>1&&(l.src=c.shift(),l.opts.filter=c.shift())),l.opts.modal&&(l.opts=n.extend(!0,l.opts,{trapFocus:!0,infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),o.group.push(l)}),Object.keys(o.slides).length&&(o.updateControls(),(e=o.Thumbs)&&e.isActive&&(e.create(),e.focus()))},addEvents:function(){var e=this;e.removeEvents(),e.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),e.close(t)}).on("touchstart.fb-prev click.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),e.previous()}).on("touchstart.fb-next click.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),e.next()}).on("click.fb","[data-fancybox-zoom]",function(t){e[e.isScaledDown()?"scaleToActual":"scaleToFit"]()}),s.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?(e.requestId&&u(e.requestId),e.requestId=d(function(){e.update(t)})):(e.current&&"iframe"===e.current.type&&e.$refs.stage.hide(),setTimeout(function(){e.$refs.stage.show(),e.update(t)},n.fancybox.isMobile?600:250))}),r.on("keydown.fb",function(t){var o=n.fancybox?n.fancybox.getInstance():null,i=o.current,a=t.keyCode||t.which;if(9==a)return void(i.opts.trapFocus&&e.focus(t));if(!(!i.opts.keyboard||t.ctrlKey||t.altKey||t.shiftKey||n(t.target).is("input,textarea,video,audio,select")))return 8===a||27===a?(t.preventDefault(),void e.close(t)):37===a||38===a?(t.preventDefault(),void e.previous()):39===a||40===a?(t.preventDefault(),void e.next()):void e.trigger("afterKeydown",t,a)}),e.group[e.currIndex].opts.idleTime&&(e.idleSecondsCounter=0,r.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(t){e.idleSecondsCounter=0,e.isIdle&&e.showControls(),e.isIdle=!1}),e.idleInterval=t.setInterval(function(){++e.idleSecondsCounter>=e.group[e.currIndex].opts.idleTime&&!e.isDragging&&(e.isIdle=!0,e.idleSecondsCounter=0,e.hideControls())},1e3))},removeEvents:function(){var e=this;s.off("orientationchange.fb resize.fb"),r.off("keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),e.idleInterval&&(t.clearInterval(e.idleInterval),e.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,e){var o,i,a,s,r,c,l,d,u,f=this,h=f.group.length;if(!(f.isDragging||f.isClosing||f.isAnimating&&f.firstRun)){if(t=parseInt(t,10),!(a=f.current?f.current.opts.loop:f.opts.loop)&&(t<0||t>=h))return!1;if(o=f.firstRun=!Object.keys(f.slides).length,r=f.current,f.prevIndex=f.currIndex,f.prevPos=f.currPos,s=f.createSlide(t),h>1&&((a||s.index<h-1)&&f.createSlide(t+1),(a||s.index>0)&&f.createSlide(t-1)),f.current=s,f.currIndex=s.index,f.currPos=s.pos,f.trigger("beforeShow",o),f.updateControls(),s.forcedDuration=void 0,n.isNumeric(e)?s.forcedDuration=e:e=s.opts[o?"animationDuration":"transitionDuration"],e=parseInt(e,10),i=f.isMoved(s),s.$slide.addClass("fancybox-slide--current"),o)return s.opts.animationEffect&&e&&f.$refs.container.css("transition-duration",e+"ms"),f.$refs.container.addClass("fancybox-is-open").trigger("focus"),f.loadSlide(s),void f.preload("image");c=n.fancybox.getTranslate(r.$slide),l=n.fancybox.getTranslate(f.$refs.stage),n.each(f.slides,function(t,e){n.fancybox.stop(e.$slide,!0)}),r.pos!==s.pos&&(r.isComplete=!1),r.$slide.removeClass("fancybox-slide--complete fancybox-slide--current"),i?(u=c.left-(r.pos*c.width+r.pos*r.opts.gutter),n.each(f.slides,function(t,o){o.$slide.removeClass("fancybox-animated").removeClass(function(t,e){return(e.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ")});var i=o.pos*c.width+o.pos*o.opts.gutter;n.fancybox.setTranslate(o.$slide,{top:0,left:i-l.left+u}),o.pos!==s.pos&&o.$slide.addClass("fancybox-slide--"+(o.pos>s.pos?"next":"previous")),p(o.$slide),n.fancybox.animate(o.$slide,{top:0,left:(o.pos-s.pos)*c.width+(o.pos-s.pos)*o.opts.gutter},e,function(){o.$slide.css({transform:"",opacity:""}).removeClass("fancybox-slide--next fancybox-slide--previous"),o.pos===f.currPos&&f.complete()})})):e&&s.opts.transitionEffect&&(d="fancybox-animated fancybox-fx-"+s.opts.transitionEffect,r.$slide.addClass("fancybox-slide--"+(r.pos>s.pos?"next":"previous")),n.fancybox.animate(r.$slide,d,e,function(){r.$slide.removeClass(d).removeClass("fancybox-slide--next fancybox-slide--previous")},!1)),s.isLoaded?f.revealContent(s):f.loadSlide(s),f.preload("image")}},createSlide:function(t){var e,o,i=this;return o=t%i.group.length,o=o<0?i.group.length+o:o,!i.slides[t]&&i.group[o]&&(e=n('<div class="fancybox-slide"></div>').appendTo(i.$refs.stage),i.slides[t]=n.extend(!0,{},i.group[o],{pos:t,$slide:e,isLoaded:!1}),i.updateSlide(i.slides[t])),i.slides[t]},scaleToActual:function(t,e,o){var i,a,s,r,c,l=this,d=l.current,u=d.$content,f=n.fancybox.getTranslate(d.$slide).width,p=n.fancybox.getTranslate(d.$slide).height,h=d.width,g=d.height;l.isAnimating||l.isMoved()||!u||"image"!=d.type||!d.isLoaded||d.hasError||(l.isAnimating=!0,n.fancybox.stop(u),t=void 0===t?.5*f:t,e=void 0===e?.5*p:e,i=n.fancybox.getTranslate(u),i.top-=n.fancybox.getTranslate(d.$slide).top,i.left-=n.fancybox.getTranslate(d.$slide).left,r=h/i.width,c=g/i.height,a=.5*f-.5*h,s=.5*p-.5*g,h>f&&(a=i.left*r-(t*r-t),a>0&&(a=0),a<f-h&&(a=f-h)),g>p&&(s=i.top*c-(e*c-e),s>0&&(s=0),s<p-g&&(s=p-g)),l.updateCursor(h,g),n.fancybox.animate(u,{top:s,left:a,scaleX:r,scaleY:c},o||366,function(){l.isAnimating=!1}),l.SlideShow&&l.SlideShow.isActive&&l.SlideShow.stop())},scaleToFit:function(t){var e,o=this,i=o.current,a=i.$content;o.isAnimating||o.isMoved()||!a||"image"!=i.type||!i.isLoaded||i.hasError||(o.isAnimating=!0,n.fancybox.stop(a),e=o.getFitPos(i),o.updateCursor(e.width,e.height),n.fancybox.animate(a,{top:e.top,left:e.left,scaleX:e.width/a.width(),scaleY:e.height/a.height()},t||366,function(){o.isAnimating=!1}))},getFitPos:function(t){var e,o,i,a,s=this,r=t.$content,c=t.$slide,l=t.width||t.opts.width,d=t.height||t.opts.height,u={};return!!(t.isLoaded&&r&&r.length)&&(e=n.fancybox.getTranslate(s.$refs.stage).width,o=n.fancybox.getTranslate(s.$refs.stage).height,e-=parseFloat(c.css("paddingLeft"))+parseFloat(c.css("paddingRight"))+parseFloat(r.css("marginLeft"))+parseFloat(r.css("marginRight")),o-=parseFloat(c.css("paddingTop"))+parseFloat(c.css("paddingBottom"))+parseFloat(r.css("marginTop"))+parseFloat(r.css("marginBottom")),l&&d||(l=e,d=o),i=Math.min(1,e/l,o/d),l*=i,d*=i,l>e-.5&&(l=e),d>o-.5&&(d=o),"image"===t.type?(u.top=Math.floor(.5*(o-d))+parseFloat(c.css("paddingTop")),u.left=Math.floor(.5*(e-l))+parseFloat(c.css("paddingLeft"))):"video"===t.contentType&&(a=t.opts.width&&t.opts.height?l/d:t.opts.ratio||16/9,d>l/a?d=l/a:l>d*a&&(l=d*a)),u.width=l,u.height=d,u)},update:function(t){var e=this;n.each(e.slides,function(n,o){e.updateSlide(o,t)})},updateSlide:function(t,e){var o=this,i=t&&t.$content,a=t.width||t.opts.width,s=t.height||t.opts.height,r=t.$slide;o.adjustCaption(t),i&&(a||s||"video"===t.contentType)&&!t.hasError&&(n.fancybox.stop(i),n.fancybox.setTranslate(i,o.getFitPos(t)),t.pos===o.currPos&&(o.isAnimating=!1,o.updateCursor())),o.adjustLayout(t),r.length&&(r.trigger("refresh"),t.pos===o.currPos&&o.$refs.toolbar.add(o.$refs.navigation.find(".fancybox-button--arrow_right")).toggleClass("compensate-for-scrollbar",r.get(0).scrollHeight>r.get(0).clientHeight)),o.trigger("onUpdate",t,e)},centerSlide:function(t){var e=this,o=e.current,i=o.$slide;!e.isClosing&&o&&(i.siblings().css({transform:"",opacity:""}),i.parent().children().removeClass("fancybox-slide--previous fancybox-slide--next"),n.fancybox.animate(i,{top:0,left:0,opacity:1},void 0===t?0:t,function(){i.css({transform:"",opacity:""}),o.isComplete||e.complete()},!1))},isMoved:function(t){var e,o,i=t||this.current;return!!i&&(o=n.fancybox.getTranslate(this.$refs.stage),e=n.fancybox.getTranslate(i.$slide),!i.$slide.hasClass("fancybox-animated")&&(Math.abs(e.top-o.top)>.5||Math.abs(e.left-o.left)>.5))},updateCursor:function(t,e){var o,i,a=this,s=a.current,r=a.$refs.container;s&&!a.isClosing&&a.Guestures&&(r.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan"),o=a.canPan(t,e),i=!!o||a.isZoomable(),r.toggleClass("fancybox-is-zoomable",i),n("[data-fancybox-zoom]").prop("disabled",!i),o?r.addClass("fancybox-can-pan"):i&&("zoom"===s.opts.clickContent||n.isFunction(s.opts.clickContent)&&"zoom"==s.opts.clickContent(s))?r.addClass("fancybox-can-zoomIn"):s.opts.touch&&(s.opts.touch.vertical||a.group.length>1)&&"video"!==s.contentType&&r.addClass("fancybox-can-swipe"))},isZoomable:function(){var t,e=this,n=e.current;if(n&&!e.isClosing&&"image"===n.type&&!n.hasError){if(!n.isLoaded)return!0;if((t=e.getFitPos(n))&&(n.width>t.width||n.height>t.height))return!0}return!1},isScaledDown:function(t,e){var o=this,i=!1,a=o.current,s=a.$content;return void 0!==t&&void 0!==e?i=t<a.width&&e<a.height:s&&(i=n.fancybox.getTranslate(s),i=i.width<a.width&&i.height<a.height),i},canPan:function(t,e){var o=this,i=o.current,a=null,s=!1;return"image"===i.type&&(i.isComplete||t&&e)&&!i.hasError&&(s=o.getFitPos(i),void 0!==t&&void 0!==e?a={width:t,height:e}:i.isComplete&&(a=n.fancybox.getTranslate(i.$content)),a&&s&&(s=Math.abs(a.width-s.width)>1.5||Math.abs(a.height-s.height)>1.5)),s},loadSlide:function(t){var e,o,i,a=this;if(!t.isLoading&&!t.isLoaded){if(t.isLoading=!0,!1===a.trigger("beforeLoad",t))return t.isLoading=!1,!1;switch(e=t.type,o=t.$slide,o.off("refresh").trigger("onReset").addClass(t.opts.slideClass),e){case"image":a.setImage(t);break;case"iframe":a.setIframe(t);break;case"html":a.setContent(t,t.src||t.content);break;case"video":a.setContent(t,t.opts.video.tpl.replace(/\{\{src\}\}/gi,t.src).replace("{{format}}",t.opts.videoFormat||t.opts.video.format||"").replace("{{poster}}",t.thumb||""));break;case"inline":n(t.src).length?a.setContent(t,n(t.src)):a.setError(t);break;case"ajax":a.showLoading(t),i=n.ajax(n.extend({},t.opts.ajax.settings,{url:t.src,success:function(e,n){"success"===n&&a.setContent(t,e)},error:function(e,n){e&&"abort"!==n&&a.setError(t)}})),o.one("onReset",function(){i.abort()});break;default:a.setError(t)}return!0}},setImage:function(t){var o,i=this;setTimeout(function(){var e=t.$image;i.isClosing||!t.isLoading||e&&e.length&&e[0].complete||t.hasError||i.showLoading(t)},50),i.checkSrcset(t),t.$content=n('<div class="fancybox-content"></div>').addClass("fancybox-is-hidden").appendTo(t.$slide.addClass("fancybox-slide--image")),!1!==t.opts.preload&&t.opts.width&&t.opts.height&&t.thumb&&(t.width=t.opts.width,t.height=t.opts.height,o=e.createElement("img"),o.onerror=function(){n(this).remove(),t.$ghost=null},o.onload=function(){i.afterLoad(t)},t.$ghost=n(o).addClass("fancybox-image").appendTo(t.$content).attr("src",t.thumb)),i.setBigImage(t)},checkSrcset:function(e){var n,o,i,a,s=e.opts.srcset||e.opts.image.srcset;if(s){i=t.devicePixelRatio||1,a=t.innerWidth*i,o=s.split(",").map(function(t){var e={};return t.trim().split(/\s+/).forEach(function(t,n){var o=parseInt(t.substring(0,t.length-1),10);if(0===n)return e.url=t;o&&(e.value=o,e.postfix=t[t.length-1])}),e}),o.sort(function(t,e){return t.value-e.value});for(var r=0;r<o.length;r++){var c=o[r];if("w"===c.postfix&&c.value>=a||"x"===c.postfix&&c.value>=i){n=c;break}}!n&&o.length&&(n=o[o.length-1]),n&&(e.src=n.url,e.width&&e.height&&"w"==n.postfix&&(e.height=e.width/e.height*n.value,e.width=n.value),e.opts.srcset=s)}},setBigImage:function(t){var o=this,i=e.createElement("img"),a=n(i);t.$image=a.one("error",function(){o.setError(t)}).one("load",function(){var e;t.$ghost||(o.resolveImageSlideSize(t,this.naturalWidth,this.naturalHeight),o.afterLoad(t)),o.isClosing||(t.opts.srcset&&(e=t.opts.sizes,e&&"auto"!==e||(e=(t.width/t.height>1&&s.width()/s.height()>1?"100":Math.round(t.width/t.height*100))+"vw"),a.attr("sizes",e).attr("srcset",t.opts.srcset)),t.$ghost&&setTimeout(function(){t.$ghost&&!o.isClosing&&t.$ghost.hide()},Math.min(300,Math.max(1e3,t.height/1600))),o.hideLoading(t))}).addClass("fancybox-image").attr("src",t.src).appendTo(t.$content),(i.complete||"complete"==i.readyState)&&a.naturalWidth&&a.naturalHeight?a.trigger("load"):i.error&&a.trigger("error")},resolveImageSlideSize:function(t,e,n){var o=parseInt(t.opts.width,10),i=parseInt(t.opts.height,10);t.width=e,t.height=n,o>0&&(t.width=o,t.height=Math.floor(o*n/e)),i>0&&(t.width=Math.floor(i*e/n),t.height=i)},setIframe:function(t){var e,o=this,i=t.opts.iframe,a=t.$slide;t.$content=n('<div class="fancybox-content'+(i.preload?" fancybox-is-hidden":"")+'"></div>').css(i.css).appendTo(a),a.addClass("fancybox-slide--"+t.contentType),t.$iframe=e=n(i.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(i.attr).appendTo(t.$content),i.preload?(o.showLoading(t),e.on("load.fb error.fb",function(e){this.isReady=1,t.$slide.trigger("refresh"),o.afterLoad(t)}),a.on("refresh.fb",function(){var n,o,s=t.$content,r=i.css.width,c=i.css.height;if(1===e[0].isReady){try{n=e.contents(),o=n.find("body")}catch(t){}o&&o.length&&o.children().length&&(a.css("overflow","visible"),s.css({width:"100%","max-width":"100%",height:"9999px"}),void 0===r&&(r=Math.ceil(Math.max(o[0].clientWidth,o.outerWidth(!0)))),s.css("width",r||"").css("max-width",""),void 0===c&&(c=Math.ceil(Math.max(o[0].clientHeight,o.outerHeight(!0)))),s.css("height",c||""),a.css("overflow","auto")),s.removeClass("fancybox-is-hidden")}})):o.afterLoad(t),e.attr("src",t.src),a.one("onReset",function(){try{n(this).find("iframe").hide().unbind().attr("src","//about:blank")}catch(t){}n(this).off("refresh.fb").empty(),t.isLoaded=!1,t.isRevealed=!1})},setContent:function(t,e){var o=this;o.isClosing||(o.hideLoading(t),t.$content&&n.fancybox.stop(t.$content),t.$slide.empty(),l(e)&&e.parent().length?((e.hasClass("fancybox-content")||e.parent().hasClass("fancybox-content"))&&e.parents(".fancybox-slide").trigger("onReset"),t.$placeholder=n("<div>").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===n.type(e)&&(e=n("<div>").append(n.trim(e)).contents()),t.opts.filter&&(e=n("<div>").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){n(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.removeClass("fancybox-content").hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1,t.isRevealed=!1)}),n(e).appendTo(t.$slide),n(e).is("video,audio")&&(n(e).addClass("fancybox-video"),n(e).wrap("<div></div>"),t.contentType="video",t.opts.width=t.opts.width||n(e).attr("width"),t.opts.height=t.opts.height||n(e).attr("height")),t.$content=t.$slide.children().filter("div,form,main,video,audio,article,.fancybox-content").first(),t.$content.siblings().hide(),t.$content.length||(t.$content=t.$slide.wrapInner("<div></div>").children().first()),t.$content.addClass("fancybox-content"),t.$slide.addClass("fancybox-slide--"+t.contentType),o.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.trigger("onReset").removeClass("fancybox-slide--"+t.contentType).addClass("fancybox-slide--error"),t.contentType="html",this.setContent(t,this.translate(t,t.opts.errorTpl)),t.pos===this.currPos&&(this.isAnimating=!1)},showLoading:function(t){var e=this;(t=t||e.current)&&!t.$spinner&&(t.$spinner=n(e.translate(e,e.opts.spinnerTpl)).appendTo(t.$slide).hide().fadeIn("fast"))},hideLoading:function(t){var e=this;(t=t||e.current)&&t.$spinner&&(t.$spinner.stop().remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),!t.opts.smallBtn||t.$smallBtn&&t.$smallBtn.length||(t.$smallBtn=n(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content)),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('<div class="fancybox-spaceball"></div>').appendTo(t.$content)),e.adjustCaption(t),e.adjustLayout(t),t.pos===e.currPos&&e.updateCursor(),e.revealContent(t))},adjustCaption:function(t){var e,n=this,o=t||n.current,i=o.opts.caption,a=o.opts.preventCaptionOverlap,s=n.$refs.caption,r=!1;s.toggleClass("fancybox-caption--separate",a),a&&i&&i.length&&(o.pos!==n.currPos?(e=s.clone().appendTo(s.parent()),e.children().eq(0).empty().html(i),r=e.outerHeight(!0),e.empty().remove()):n.$caption&&(r=n.$caption.outerHeight(!0)),o.$slide.css("padding-bottom",r||""))},adjustLayout:function(t){var e,n,o,i,a=this,s=t||a.current;s.isLoaded&&!0!==s.opts.disableLayoutFix&&(s.$content.css("margin-bottom",""),s.$content.outerHeight()>s.$slide.height()+.5&&(o=s.$slide[0].style["padding-bottom"],i=s.$slide.css("padding-bottom"),parseFloat(i)>0&&(e=s.$slide[0].scrollHeight,s.$slide.css("padding-bottom",0),Math.abs(e-s.$slide[0].scrollHeight)<1&&(n=i),s.$slide.css("padding-bottom",o))),s.$content.css("margin-bottom",n))},revealContent:function(t){var e,o,i,a,s=this,r=t.$slide,c=!1,l=!1,d=s.isMoved(t),u=t.isRevealed;return t.isRevealed=!0,e=t.opts[s.firstRun?"animationEffect":"transitionEffect"],i=t.opts[s.firstRun?"animationDuration":"transitionDuration"],i=parseInt(void 0===t.forcedDuration?i:t.forcedDuration,10),!d&&t.pos===s.currPos&&i||(e=!1),"zoom"===e&&(t.pos===s.currPos&&i&&"image"===t.type&&!t.hasError&&(l=s.getThumbPos(t))?c=s.getFitPos(t):e="fade"),"zoom"===e?(s.isAnimating=!0,c.scaleX=c.width/l.width,c.scaleY=c.height/l.height,a=t.opts.zoomOpacity,"auto"==a&&(a=Math.abs(t.width/t.height-l.width/l.height)>.1),a&&(l.opacity=.1,c.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),l),p(t.$content),void n.fancybox.animate(t.$content,c,i,function(){s.isAnimating=!1,s.complete()})):(s.updateSlide(t),e?(n.fancybox.stop(r),o="fancybox-slide--"+(t.pos>=s.prevPos?"next":"previous")+" fancybox-animated fancybox-fx-"+e,r.addClass(o).removeClass("fancybox-slide--current"),t.$content.removeClass("fancybox-is-hidden"),p(r),"image"!==t.type&&t.$content.hide().show(0),void n.fancybox.animate(r,"fancybox-slide--current",i,function(){r.removeClass(o).css({transform:"",opacity:""}),t.pos===s.currPos&&s.complete()},!0)):(t.$content.removeClass("fancybox-is-hidden"),u||!d||"image"!==t.type||t.hasError||t.$content.hide().fadeIn("fast"),void(t.pos===s.currPos&&s.complete())))},getThumbPos:function(t){var e,o,i,a,s,r=!1,c=t.$thumb;return!(!c||!g(c[0]))&&(e=n.fancybox.getTranslate(c),o=parseFloat(c.css("border-top-width")||0),i=parseFloat(c.css("border-right-width")||0),a=parseFloat(c.css("border-bottom-width")||0),s=parseFloat(c.css("border-left-width")||0),r={top:e.top+o,left:e.left+s,width:e.width-i-s,height:e.height-o-a,scaleX:1,scaleY:1},e.width>0&&e.height>0&&r)},complete:function(){var t,e=this,o=e.current,i={};!e.isMoved()&&o.isLoaded&&(o.isComplete||(o.isComplete=!0,o.$slide.siblings().trigger("onReset"),e.preload("inline"),p(o.$slide),o.$slide.addClass("fancybox-slide--complete"),n.each(e.slides,function(t,o){o.pos>=e.currPos-1&&o.pos<=e.currPos+1?i[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.off().remove())}),e.slides=i),e.isAnimating=!1,e.updateCursor(),e.trigger("afterShow"),o.opts.video.autoStart&&o.$slide.find("video,audio").filter(":visible:first").trigger("play").one("ended",function(){Document.exitFullscreen?Document.exitFullscreen():this.webkitExitFullscreen&&this.webkitExitFullscreen(),e.next()}),o.opts.autoFocus&&"html"===o.contentType&&(t=o.$content.find("input[autofocus]:enabled:visible:first"),t.length?t.trigger("focus"):e.focus(null,!0)),o.$slide.scrollTop(0).scrollLeft(0))},preload:function(t){var e,n,o=this;o.group.length<2||(n=o.slides[o.currPos+1],e=o.slides[o.currPos-1],e&&e.type===t&&o.loadSlide(e),n&&n.type===t&&o.loadSlide(n))},focus:function(t,o){var i,a,s=this,r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"])'].join(",");s.isClosing||(i=!t&&s.current&&s.current.isComplete?s.current.$slide.find("*:visible"+(o?":not(.fancybox-close-small)":"")):s.$refs.container.find("*:visible"),i=i.filter(r).filter(function(){return"hidden"!==n(this).css("visibility")&&!n(this).hasClass("disabled")}),i.length?(a=i.index(e.activeElement),t&&t.shiftKey?(a<0||0==a)&&(t.preventDefault(),i.eq(i.length-1).trigger("focus")):(a<0||a==i.length-1)&&(t&&t.preventDefault(),i.eq(0).trigger("focus"))):s.$refs.container.trigger("focus"))},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.id!==t.id&&!e.isClosing&&(e.trigger("onDeactivate"),e.removeEvents(),e.isVisible=!1)}),t.isVisible=!0,(t.current||t.isIdle)&&(t.update(),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,i,a,s,r,c,l,u=this,f=u.current,h=function(){u.cleanUp(t)};return!u.isClosing&&(u.isClosing=!0,!1===u.trigger("beforeClose",t)?(u.isClosing=!1,d(function(){u.update()}),!1):(u.removeEvents(),a=f.$content,o=f.opts.animationEffect,i=n.isNumeric(e)?e:o?f.opts.animationDuration:0,f.$slide.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),!0!==t?n.fancybox.stop(f.$slide):o=!1,f.$slide.siblings().trigger("onReset").remove(),i&&u.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing").css("transition-duration",i+"ms"),u.hideLoading(f),u.hideControls(!0),u.updateCursor(),"zoom"!==o||a&&i&&"image"===f.type&&!u.isMoved()&&!f.hasError&&(l=u.getThumbPos(f))||(o="fade"),"zoom"===o?(n.fancybox.stop(a),s=n.fancybox.getTranslate(a),c={top:s.top,left:s.left,scaleX:s.width/l.width,scaleY:s.height/l.height,width:l.width,height:l.height},r=f.opts.zoomOpacity,
12
+ "auto"==r&&(r=Math.abs(f.width/f.height-l.width/l.height)>.1),r&&(l.opacity=0),n.fancybox.setTranslate(a,c),p(a),n.fancybox.animate(a,l,i,h),!0):(o&&i?n.fancybox.animate(f.$slide.addClass("fancybox-slide--previous").removeClass("fancybox-slide--current"),"fancybox-animated fancybox-fx-"+o,i,h):!0===t?setTimeout(h,i):h(),!0)))},cleanUp:function(e){var o,i,a,s=this,r=s.current.opts.$orig;s.current.$slide.trigger("onReset"),s.$refs.container.empty().remove(),s.trigger("afterClose",e),s.current.opts.backFocus&&(r&&r.length&&r.is(":visible")||(r=s.$trigger),r&&r.length&&(i=t.scrollX,a=t.scrollY,r.trigger("focus"),n("html, body").scrollTop(a).scrollLeft(i))),s.current=null,o=n.fancybox.getInstance(),o?o.activate():(n("body").removeClass("fancybox-active compensate-for-scrollbar"),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,i=Array.prototype.slice.call(arguments,1),a=this,s=e&&e.opts?e:a.current;if(s?i.unshift(s):s=a,i.unshift(a),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,i)),!1===o)return o;"afterClose"!==t&&a.$refs?a.$refs.container.trigger(t+".fb",i):r.trigger(t+".fb",i)},updateControls:function(){var t=this,o=t.current,i=o.index,a=t.$refs.container,s=t.$refs.caption,r=o.opts.caption;o.$slide.trigger("refresh"),r&&r.length?(t.$caption=s,s.children().eq(0).html(r)):t.$caption=null,t.hasHiddenControls||t.isIdle||t.showControls(),a.find("[data-fancybox-count]").html(t.group.length),a.find("[data-fancybox-index]").html(i+1),a.find("[data-fancybox-prev]").prop("disabled",!o.opts.loop&&i<=0),a.find("[data-fancybox-next]").prop("disabled",!o.opts.loop&&i>=t.group.length-1),"image"===o.type?a.find("[data-fancybox-zoom]").show().end().find("[data-fancybox-download]").attr("href",o.opts.image.src||o.src).show():o.opts.toolbar&&a.find("[data-fancybox-download],[data-fancybox-zoom]").hide(),n(e.activeElement).is(":hidden,[disabled]")&&t.$refs.container.trigger("focus")},hideControls:function(t){var e=this,n=["infobar","toolbar","nav"];!t&&e.current.opts.preventCaptionOverlap||n.push("caption"),this.$refs.container.removeClass(n.map(function(t){return"fancybox-show-"+t}).join(" ")),this.hasHiddenControls=!0},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.hasHiddenControls=!1,t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-caption",!!t.$caption).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal)},toggleControls:function(){this.hasHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.5.7",defaults:a,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof b&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new b(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),!0===t&&this.close(t))},destroy:function(){this.close(!0),r.add("body").off("click.fb-start","**")},isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n)&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;return!(!t||!t.length)&&(e=t[0].getBoundingClientRect(),{top:e.top||0,left:e.left||0,width:e.width,height:e.height,opacity:parseFloat(t.css("opacity"))})},setTranslate:function(t,e){var n="",o={};if(t&&e)return void 0===e.left&&void 0===e.top||(n=(void 0===e.left?t.position().left:e.left)+"px, "+(void 0===e.top?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),void 0!==e.scaleX&&void 0!==e.scaleY?n+=" scale("+e.scaleX+", "+e.scaleY+")":void 0!==e.scaleX&&(n+=" scaleX("+e.scaleX+")"),n.length&&(o.transform=n),void 0!==e.opacity&&(o.opacity=e.opacity),void 0!==e.width&&(o.width=e.width),void 0!==e.height&&(o.height=e.height),t.css(o)},animate:function(t,e,o,i,a){var s,r=this;n.isFunction(o)&&(i=o,o=null),r.stop(t),s=r.getTranslate(t),t.on(f,function(c){(!c||!c.originalEvent||t.is(c.originalEvent.target)&&"z-index"!=c.originalEvent.propertyName)&&(r.stop(t),n.isNumeric(o)&&t.css("transition-duration",""),n.isPlainObject(e)?void 0!==e.scaleX&&void 0!==e.scaleY&&r.setTranslate(t,{top:e.top,left:e.left,width:s.width*e.scaleX,height:s.height*e.scaleY,scaleX:1,scaleY:1}):!0!==a&&t.removeClass(e),n.isFunction(i)&&i(c))}),n.isNumeric(o)&&t.css("transition-duration",o+"ms"),n.isPlainObject(e)?(void 0!==e.scaleX&&void 0!==e.scaleY&&(delete e.width,delete e.height,t.parent().hasClass("fancybox-slide--image")&&t.parent().addClass("fancybox-is-scaling")),n.fancybox.setTranslate(t,e)):t.addClass(e),t.data("timer",setTimeout(function(){t.trigger(f)},o+33))},stop:function(t,e){t&&t.length&&(clearTimeout(t.data("timer")),e&&t.trigger(f),t.off(f).css("transition-duration",""),t.parent().removeClass("fancybox-is-scaling"))}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},i):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},i),this},r.on("click.fb-start","[data-fancybox]",i),r.on("click.fb-start","[data-fancybox-trigger]",function(t){n('[data-fancybox="'+n(this).attr("data-fancybox-trigger")+'"]').eq(n(this).attr("data-fancybox-index")||0).trigger("click.fb-start",{$trigger:n(this)})}),function(){var t=null;r.on("mousedown mouseup focus blur",".fancybox-button",function(e){switch(e.type){case"mousedown":t=n(this);break;case"mouseup":t=null;break;case"focusin":n(".fancybox-button").removeClass("fancybox-focus"),n(this).is(t)||n(this).is("[disabled]")||n(this).addClass("fancybox-focus");break;case"focusout":n(".fancybox-button").removeClass("fancybox-focus")}})}()}}(window,document,jQuery),function(t){"use strict";var e={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"https://www.youtube-nocookie.com/embed/$4",thumb:"https://img.youtube.com/vi/$4/hqdefault.jpg"},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12]+"").replace(/\?/,"&")+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}},n=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e};t(document).on("objectNeedsType.fb",function(o,i,a){var s,r,c,l,d,u,f,p=a.src||"",h=!1;s=t.extend(!0,{},e,a.opts.media),t.each(s,function(e,o){if(c=p.match(o.matcher)){if(h=o.type,f=e,u={},o.paramPlace&&c[o.paramPlace]){d=c[o.paramPlace],"?"==d[0]&&(d=d.substring(1)),d=d.split("&");for(var i=0;i<d.length;++i){var s=d[i].split("=",2);2==s.length&&(u[s[0]]=decodeURIComponent(s[1].replace(/\+/g," ")))}}return l=t.extend(!0,{},o.params,a.opts[e],u),p="function"===t.type(o.url)?o.url.call(this,c,l,a):n(o.url,c,l),r="function"===t.type(o.thumb)?o.thumb.call(this,c,l,a):n(o.thumb,c),"youtube"===e?p=p.replace(/&t=((\d+)m)?(\d+)s/,function(t,e,n,o){return"&start="+((n?60*parseInt(n,10):0)+parseInt(o,10))}):"vimeo"===e&&(p=p.replace("&%23","#")),!1}}),h?(a.opts.thumb||a.opts.$thumb&&a.opts.$thumb.length||(a.opts.thumb=r),"iframe"===h&&(a.opts=t.extend(!0,a.opts,{iframe:{preload:!1,attr:{scrolling:"no"}}})),t.extend(a,{type:h,src:p,origSrc:a.src,contentSource:f,contentType:"image"===h?"image":"gmap_place"==f||"gmap_search"==f?"map":"video"})):p&&(a.type=a.opts.defaultType)});var o={youtube:{src:"https://www.youtube.com/iframe_api",class:"YT",loading:!1,loaded:!1},vimeo:{src:"https://player.vimeo.com/api/player.js",class:"Vimeo",loading:!1,loaded:!1},load:function(t){var e,n=this;if(this[t].loaded)return void setTimeout(function(){n.done(t)});this[t].loading||(this[t].loading=!0,e=document.createElement("script"),e.type="text/javascript",e.src=this[t].src,"youtube"===t?window.onYouTubeIframeAPIReady=function(){n[t].loaded=!0,n.done(t)}:e.onload=function(){n[t].loaded=!0,n.done(t)},document.body.appendChild(e))},done:function(e){var n,o,i;"youtube"===e&&delete window.onYouTubeIframeAPIReady,(n=t.fancybox.getInstance())&&(o=n.current.$content.find("iframe"),"youtube"===e&&void 0!==YT&&YT?i=new YT.Player(o.attr("id"),{events:{onStateChange:function(t){0==t.data&&n.next()}}}):"vimeo"===e&&void 0!==Vimeo&&Vimeo&&(i=new Vimeo.Player(o),i.on("ended",function(){n.next()})))}};t(document).on({"afterShow.fb":function(t,e,n){e.group.length>1&&("youtube"===n.contentSource||"vimeo"===n.contentSource)&&o.load(n.contentSource)}})}(jQuery),function(t,e,n){"use strict";var o=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),i=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||function(e){t.clearTimeout(e)}}(),a=function(e){var n=[];e=e.originalEvent||e||t.e,e=e.touches&&e.touches.length?e.touches:e.changedTouches&&e.changedTouches.length?e.changedTouches:[e];for(var o in e)e[o].pageX?n.push({x:e[o].pageX,y:e[o].pageY}):e[o].clientX&&n.push({x:e[o].clientX,y:e[o].clientY});return n},s=function(t,e,n){return e&&t?"x"===n?t.x-e.x:"y"===n?t.y-e.y:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)):0},r=function(t){if(t.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe')||n.isFunction(t.get(0).onclick)||t.data("selectable"))return!0;for(var e=0,o=t[0].attributes,i=o.length;e<i;e++)if("data-fancybox-"===o[e].nodeName.substr(0,14))return!0;return!1},c=function(e){var n=t.getComputedStyle(e)["overflow-y"],o=t.getComputedStyle(e)["overflow-x"],i=("scroll"===n||"auto"===n)&&e.scrollHeight>e.clientHeight,a=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return i||a},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},d=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};d.prototype.destroy=function(){var t=this;t.$container.off(".fb.touch"),n(e).off(".fb.touch"),t.requestId&&(i(t.requestId),t.requestId=null),t.tapped&&(clearTimeout(t.tapped),t.tapped=null)},d.prototype.ontouchstart=function(o){var i=this,c=n(o.target),d=i.instance,u=d.current,f=u.$slide,p=u.$content,h="touchstart"==o.type;if(h&&i.$container.off("mousedown.fb.touch"),(!o.originalEvent||2!=o.originalEvent.button)&&f.length&&c.length&&!r(c)&&!r(c.parent())&&(c.is("img")||!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left))){if(!u||d.isAnimating||u.$slide.hasClass("fancybox-animated"))return o.stopPropagation(),void o.preventDefault();i.realPoints=i.startPoints=a(o),i.startPoints.length&&(u.touch&&o.stopPropagation(),i.startEvent=o,i.canTap=!0,i.$target=c,i.$content=p,i.opts=u.opts.touch,i.isPanning=!1,i.isSwiping=!1,i.isZooming=!1,i.isScrolling=!1,i.canPan=d.canPan(),i.startTime=(new Date).getTime(),i.distanceX=i.distanceY=i.distance=0,i.canvasWidth=Math.round(f[0].clientWidth),i.canvasHeight=Math.round(f[0].clientHeight),i.contentLastPos=null,i.contentStartPos=n.fancybox.getTranslate(i.$content)||{top:0,left:0},i.sliderStartPos=n.fancybox.getTranslate(f),i.stagePos=n.fancybox.getTranslate(d.$refs.stage),i.sliderStartPos.top-=i.stagePos.top,i.sliderStartPos.left-=i.stagePos.left,i.contentStartPos.top-=i.stagePos.top,i.contentStartPos.left-=i.stagePos.left,n(e).off(".fb.touch").on(h?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(i,"ontouchend")).on(h?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(i,"ontouchmove")),n.fancybox.isMobile&&e.addEventListener("scroll",i.onscroll,!0),((i.opts||i.canPan)&&(c.is(i.$stage)||i.$stage.find(c).length)||(c.is(".fancybox-image")&&o.preventDefault(),n.fancybox.isMobile&&c.parents(".fancybox-caption").length))&&(i.isScrollable=l(c)||l(c.parent()),n.fancybox.isMobile&&i.isScrollable||o.preventDefault(),(1===i.startPoints.length||u.hasError)&&(i.canPan?(n.fancybox.stop(i.$content),i.isPanning=!0):i.isSwiping=!0,i.$container.addClass("fancybox-is-grabbing")),2===i.startPoints.length&&"image"===u.type&&(u.isLoaded||u.$ghost)&&(i.canTap=!1,i.isSwiping=!1,i.isPanning=!1,i.isZooming=!0,n.fancybox.stop(i.$content),i.centerPointStartX=.5*(i.startPoints[0].x+i.startPoints[1].x)-n(t).scrollLeft(),i.centerPointStartY=.5*(i.startPoints[0].y+i.startPoints[1].y)-n(t).scrollTop(),i.percentageOfImageAtPinchPointX=(i.centerPointStartX-i.contentStartPos.left)/i.contentStartPos.width,i.percentageOfImageAtPinchPointY=(i.centerPointStartY-i.contentStartPos.top)/i.contentStartPos.height,i.startDistanceBetweenFingers=s(i.startPoints[0],i.startPoints[1]))))}},d.prototype.onscroll=function(t){var n=this;n.isScrolling=!0,e.removeEventListener("scroll",n.onscroll,!0)},d.prototype.ontouchmove=function(t){var e=this;return void 0!==t.originalEvent.buttons&&0===t.originalEvent.buttons?void e.ontouchend(t):e.isScrolling?void(e.canTap=!1):(e.newPoints=a(t),void((e.opts||e.canPan)&&e.newPoints.length&&e.newPoints.length&&(e.isSwiping&&!0===e.isSwiping||t.preventDefault(),e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))))},d.prototype.onSwipe=function(e){var a,s=this,r=s.instance,c=s.isSwiping,l=s.sliderStartPos.left||0;if(!0!==c)"x"==c&&(s.distanceX>0&&(s.instance.group.length<2||0===s.instance.current.index&&!s.instance.current.opts.loop)?l+=Math.pow(s.distanceX,.8):s.distanceX<0&&(s.instance.group.length<2||s.instance.current.index===s.instance.group.length-1&&!s.instance.current.opts.loop)?l-=Math.pow(-s.distanceX,.8):l+=s.distanceX),s.sliderLastPos={top:"x"==c?0:s.sliderStartPos.top+s.distanceY,left:l},s.requestId&&(i(s.requestId),s.requestId=null),s.requestId=o(function(){s.sliderLastPos&&(n.each(s.instance.slides,function(t,e){var o=e.pos-s.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:s.sliderLastPos.top,left:s.sliderLastPos.left+o*s.canvasWidth+o*e.opts.gutter})}),s.$container.addClass("fancybox-is-sliding"))});else if(Math.abs(s.distance)>10){if(s.canTap=!1,r.group.length<2&&s.opts.vertical?s.isSwiping="y":r.isDragging||!1===s.opts.vertical||"auto"===s.opts.vertical&&n(t).width()>800?s.isSwiping="x":(a=Math.abs(180*Math.atan2(s.distanceY,s.distanceX)/Math.PI),s.isSwiping=a>45&&a<135?"y":"x"),"y"===s.isSwiping&&n.fancybox.isMobile&&s.isScrollable)return void(s.isScrolling=!0);r.isDragging=s.isSwiping,s.startPoints=s.newPoints,n.each(r.slides,function(t,e){var o,i;n.fancybox.stop(e.$slide),o=n.fancybox.getTranslate(e.$slide),i=n.fancybox.getTranslate(r.$refs.stage),e.$slide.css({transform:"",opacity:"","transition-duration":""}).removeClass("fancybox-animated").removeClass(function(t,e){return(e.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ")}),e.pos===r.current.pos&&(s.sliderStartPos.top=o.top-i.top,s.sliderStartPos.left=o.left-i.left),n.fancybox.setTranslate(e.$slide,{top:o.top-i.top,left:o.left-i.left})}),r.SlideShow&&r.SlideShow.isActive&&r.SlideShow.stop()}},d.prototype.onPan=function(){var t=this;if(s(t.newPoints[0],t.realPoints[0])<(n.fancybox.isMobile?10:5))return void(t.startPoints=t.newPoints);t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&i(t.requestId),t.requestId=o(function(){n.fancybox.setTranslate(t.$content,t.contentLastPos)})},d.prototype.limitMovement=function(){var t,e,n,o,i,a,s=this,r=s.canvasWidth,c=s.canvasHeight,l=s.distanceX,d=s.distanceY,u=s.contentStartPos,f=u.left,p=u.top,h=u.width,g=u.height;return i=h>r?f+l:f,a=p+d,t=Math.max(0,.5*r-.5*h),e=Math.max(0,.5*c-.5*g),n=Math.min(r-h,.5*r-.5*h),o=Math.min(c-g,.5*c-.5*g),l>0&&i>t&&(i=t-1+Math.pow(-t+f+l,.8)||0),l<0&&i<n&&(i=n+1-Math.pow(n-f-l,.8)||0),d>0&&a>e&&(a=e-1+Math.pow(-e+p+d,.8)||0),d<0&&a<o&&(a=o+1-Math.pow(o-p-d,.8)||0),{top:a,left:i}},d.prototype.limitPosition=function(t,e,n,o){var i=this,a=i.canvasWidth,s=i.canvasHeight;return n>a?(t=t>0?0:t,t=t<a-n?a-n:t):t=Math.max(0,a/2-n/2),o>s?(e=e>0?0:e,e=e<s-o?s-o:e):e=Math.max(0,s/2-o/2),{top:e,left:t}},d.prototype.onZoom=function(){var e=this,a=e.contentStartPos,r=a.width,c=a.height,l=a.left,d=a.top,u=s(e.newPoints[0],e.newPoints[1]),f=u/e.startDistanceBetweenFingers,p=Math.floor(r*f),h=Math.floor(c*f),g=(r-p)*e.percentageOfImageAtPinchPointX,b=(c-h)*e.percentageOfImageAtPinchPointY,m=(e.newPoints[0].x+e.newPoints[1].x)/2-n(t).scrollLeft(),v=(e.newPoints[0].y+e.newPoints[1].y)/2-n(t).scrollTop(),y=m-e.centerPointStartX,x=v-e.centerPointStartY,w=l+(g+y),$=d+(b+x),S={top:$,left:w,scaleX:f,scaleY:f};e.canTap=!1,e.newWidth=p,e.newHeight=h,e.contentLastPos=S,e.requestId&&i(e.requestId),e.requestId=o(function(){n.fancybox.setTranslate(e.$content,e.contentLastPos)})},d.prototype.ontouchend=function(t){var o=this,s=o.isSwiping,r=o.isPanning,c=o.isZooming,l=o.isScrolling;if(o.endPoints=a(t),o.dMs=Math.max((new Date).getTime()-o.startTime,1),o.$container.removeClass("fancybox-is-grabbing"),n(e).off(".fb.touch"),e.removeEventListener("scroll",o.onscroll,!0),o.requestId&&(i(o.requestId),o.requestId=null),o.isSwiping=!1,o.isPanning=!1,o.isZooming=!1,o.isScrolling=!1,o.instance.isDragging=!1,o.canTap)return o.onTap(t);o.speed=100,o.velocityX=o.distanceX/o.dMs*.5,o.velocityY=o.distanceY/o.dMs*.5,r?o.endPanning():c?o.endZooming():o.endSwiping(s,l)},d.prototype.endSwiping=function(t,e){var o=this,i=!1,a=o.instance.group.length,s=Math.abs(o.distanceX),r="x"==t&&a>1&&(o.dMs>130&&s>10||s>50);o.sliderLastPos=null,"y"==t&&!e&&Math.abs(o.distanceY)>50?(n.fancybox.animate(o.instance.current.$slide,{top:o.sliderStartPos.top+o.distanceY+150*o.velocityY,opacity:0},200),i=o.instance.close(!0,250)):r&&o.distanceX>0?i=o.instance.previous(300):r&&o.distanceX<0&&(i=o.instance.next(300)),!1!==i||"x"!=t&&"y"!=t||o.instance.centerSlide(200),o.$container.removeClass("fancybox-is-sliding")},d.prototype.endPanning=function(){var t,e,o,i=this;i.contentLastPos&&(!1===i.opts.momentum||i.dMs>350?(t=i.contentLastPos.left,e=i.contentLastPos.top):(t=i.contentLastPos.left+500*i.velocityX,e=i.contentLastPos.top+500*i.velocityY),o=i.limitPosition(t,e,i.contentStartPos.width,i.contentStartPos.height),o.width=i.contentStartPos.width,o.height=i.contentStartPos.height,n.fancybox.animate(i.$content,o,366))},d.prototype.endZooming=function(){var t,e,o,i,a=this,s=a.instance.current,r=a.newWidth,c=a.newHeight;a.contentLastPos&&(t=a.contentLastPos.left,e=a.contentLastPos.top,i={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(a.$content,i),r<a.canvasWidth&&c<a.canvasHeight?a.instance.scaleToFit(150):r>s.width||c>s.height?a.instance.scaleToActual(a.centerPointStartX,a.centerPointStartY,150):(o=a.limitPosition(t,e,r,c),n.fancybox.animate(a.$content,o,150)))},d.prototype.onTap=function(e){var o,i=this,s=n(e.target),r=i.instance,c=r.current,l=e&&a(e)||i.startPoints,d=l[0]?l[0].x-n(t).scrollLeft()-i.stagePos.left:0,u=l[0]?l[0].y-n(t).scrollTop()-i.stagePos.top:0,f=function(t){var o=c.opts[t];if(n.isFunction(o)&&(o=o.apply(r,[c,e])),o)switch(o){case"close":r.close(i.startEvent);break;case"toggleControls":r.toggleControls();break;case"next":r.next();break;case"nextOrClose":r.group.length>1?r.next():r.close(i.startEvent);break;case"zoom":"image"==c.type&&(c.isLoaded||c.$ghost)&&(r.canPan()?r.scaleToFit():r.isScaledDown()?r.scaleToActual(d,u):r.group.length<2&&r.close(i.startEvent))}};if((!e.originalEvent||2!=e.originalEvent.button)&&(s.is("img")||!(d>s[0].clientWidth+s.offset().left))){if(s.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))o="Outside";else if(s.is(".fancybox-slide"))o="Slide";else{if(!r.current.$content||!r.current.$content.find(s).addBack().filter(s).length)return;o="Content"}if(i.tapped){if(clearTimeout(i.tapped),i.tapped=null,Math.abs(d-i.tapX)>50||Math.abs(u-i.tapY)>50)return this;f("dblclick"+o)}else i.tapX=d,i.tapY=u,c.opts["dblclick"+o]&&c.opts["dblclick"+o]!==c.opts["click"+o]?i.tapped=setTimeout(function(){i.tapped=null,r.isAnimating||f("click"+o)},500):f("click"+o);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new d(e))}).on("beforeClose.fb",function(t,e){e&&e.Guestures&&e.Guestures.destroy()})}(window,document,jQuery),function(t,e){"use strict";e.extend(!0,e.fancybox.defaults,{btnTpl:{slideShow:'<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 5.4v13.2l11-6.6z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/></svg></button>'},slideShow:{autoStart:!1,speed:3e3,progress:!0}});var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this,n=t.instance,o=n.group[n.currIndex].opts.slideShow;t.$button=n.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),n.group.length<2||!o?t.$button.hide():o.progress&&(t.$progress=e('<div class="fancybox-progress"></div>').appendTo(n.$refs.inner))},set:function(t){var n=this,o=n.instance,i=o.current;i&&(!0===t||i.opts.loop||o.currIndex<o.group.length-1)?n.isActive&&"video"!==i.contentType&&(n.$progress&&e.fancybox.animate(n.$progress.show(),{scaleX:1},i.opts.slideShow.speed),n.timer=setTimeout(function(){o.current.opts.loop||o.current.index!=o.group.length-1?o.next():o.jumpTo(0)},i.opts.slideShow.speed)):(n.stop(),o.idleSecondsCounter=0,o.showControls())},clear:function(){var t=this;clearTimeout(t.timer),t.timer=null,t.$progress&&t.$progress.removeAttr("style").hide()},start:function(){var t=this,e=t.instance.current;e&&(t.$button.attr("title",(e.opts.i18n[e.opts.lang]||e.opts.i18n.en).PLAY_STOP).removeClass("fancybox-button--play").addClass("fancybox-button--pause"),t.isActive=!0,e.isComplete&&t.set(!0),t.instance.trigger("onSlideShowChange",!0))},stop:function(){var t=this,e=t.instance.current;t.clear(),t.$button.attr("title",(e.opts.i18n[e.opts.lang]||e.opts.i18n.en).PLAY_START).removeClass("fancybox-button--pause").addClass("fancybox-button--play"),t.isActive=!1,t.instance.trigger("onSlideShowChange",!1),t.$progress&&t.$progress.removeAttr("style").hide()},toggle:function(){var t=this;t.isActive?t.stop():t.start()}}),e(t).on({"onInit.fb":function(t,e){e&&!e.SlideShow&&(e.SlideShow=new n(e))},"beforeShow.fb":function(t,e,n,o){var i=e&&e.SlideShow;o?i&&n.opts.slideShow.autoStart&&i.start():i&&i.isActive&&i.clear()},"afterShow.fb":function(t,e,n){var o=e&&e.SlideShow;o&&o.isActive&&o.set()},"afterKeydown.fb":function(n,o,i,a,s){var r=o&&o.SlideShow;!r||!i.opts.slideShow||80!==s&&32!==s||e(t.activeElement).is("button,a,input")||(a.preventDefault(),r.toggle())},"beforeClose.fb onDeactivate.fb":function(t,e){var n=e&&e.SlideShow;n&&n.stop()}}),e(t).on("visibilitychange",function(){var n=e.fancybox.getInstance(),o=n&&n.SlideShow;o&&o.isActive&&(t.hidden?o.clear():o.set())})}(document,jQuery),function(t,e){"use strict";var n=function(){for(var e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n={},o=0;o<e.length;o++){var i=e[o];if(i&&i[1]in t){for(var a=0;a<i.length;a++)n[e[0][a]]=i[a];return n}}return!1}();if(n){var o={request:function(e){e=e||t.documentElement,e[n.requestFullscreen](e.ALLOW_KEYBOARD_INPUT)},exit:function(){t[n.exitFullscreen]()},toggle:function(e){e=e||t.documentElement,this.isFullscreen()?this.exit():this.request(e)},isFullscreen:function(){return Boolean(t[n.fullscreenElement])},enabled:function(){return Boolean(t[n.fullscreenEnabled])}};e.extend(!0,e.fancybox.defaults,{btnTpl:{fullScreen:'<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg></button>'},fullScreen:{autoStart:!1}}),e(t).on(n.fullscreenchange,function(){var t=o.isFullscreen(),n=e.fancybox.getInstance();n&&(n.current&&"image"===n.current.type&&n.isAnimating&&(n.isAnimating=!1,n.update(!0,!0,0),n.isComplete||n.complete()),n.trigger("onFullscreenChange",t),n.$refs.container.toggleClass("fancybox-is-fullscreen",t),n.$refs.toolbar.find("[data-fancybox-fullscreen]").toggleClass("fancybox-button--fsenter",!t).toggleClass("fancybox-button--fsexit",t))})}e(t).on({"onInit.fb":function(t,e){var i;if(!n)return void e.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();e&&e.group[e.currIndex].opts.fullScreen?(i=e.$refs.container,i.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle()}),e.opts.fullScreen&&!0===e.opts.fullScreen.autoStart&&o.request(),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle())},"beforeClose.fb":function(t,e){e&&e.FullScreen&&e.$refs.container.hasClass("fancybox-is-fullscreen")&&o.exit()}})}(document,jQuery),function(t,e){"use strict";var n="fancybox-thumbs";e.fancybox.defaults=e.extend(!0,{btnTpl:{thumbs:'<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.59 14.59h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76H5.65V5.65z"/></svg></button>'},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},e.fancybox.defaults);var o=function(t){this.init(t)};e.extend(o.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e=this,n=t.group,o=0;e.instance=t,e.opts=n[t.currIndex].opts.thumbs,t.Thumbs=e,e.$button=t.$refs.toolbar.find("[data-fancybox-thumbs]");for(var i=0,a=n.length;i<a&&(n[i].thumb&&o++,!(o>1));i++);o>1&&e.opts?(e.$button.removeAttr("style").on("click",function(){e.toggle()}),e.isActive=!0):e.$button.hide()},create:function(){var t,o=this,i=o.instance,a=o.opts.parentEl,s=[];o.$grid||(o.$grid=e('<div class="'+n+" "+n+"-"+o.opts.axis+'"></div>').appendTo(i.$refs.container.find(a).addBack().filter(a)),o.$grid.on("click","a",function(){i.jumpTo(e(this).attr("data-index"))})),o.$list||(o.$list=e('<div class="'+n+'__list">').appendTo(o.$grid)),e.each(i.group,function(e,n){t=n.thumb,t||"image"!==n.type||(t=n.src),s.push('<a href="javascript:;" tabindex="0" data-index="'+e+'"'+(t&&t.length?' style="background-image:url('+t+')"':'class="fancybox-thumbs-missing"')+"></a>")}),o.$list[0].innerHTML=s.join(""),"x"===o.opts.axis&&o.$list.width(parseInt(o.$grid.css("padding-right"),10)+i.group.length*o.$list.children().eq(0).outerWidth(!0))},focus:function(t){var e,n,o=this,i=o.$list,a=o.$grid;o.instance.current&&(e=i.children().removeClass("fancybox-thumbs-active").filter('[data-index="'+o.instance.current.index+'"]').addClass("fancybox-thumbs-active"),n=e.position(),"y"===o.opts.axis&&(n.top<0||n.top>i.height()-e.outerHeight())?i.stop().animate({scrollTop:i.scrollTop()+n.top},t):"x"===o.opts.axis&&(n.left<a.scrollLeft()||n.left>a.scrollLeft()+(a.width()-e.outerWidth()))&&i.parent().stop().animate({scrollLeft:n.left},t))},update:function(){var t=this;t.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),t.isVisible?(t.$grid||t.create(),t.instance.trigger("onThumbsShow"),t.focus(0)):t.$grid&&t.instance.trigger("onThumbsHide"),t.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){var n;e&&!e.Thumbs&&(n=new o(e),n.isActive&&!0===n.opts.autoStart&&n.show())},"beforeShow.fb":function(t,e,n,o){var i=e&&e.Thumbs;i&&i.isVisible&&i.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,i){var a=e&&e.Thumbs;a&&a.isActive&&71===i&&(o.preventDefault(),a.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&!1!==n.opts.hideOnClose&&n.$grid.hide()}})}(document,jQuery),function(t,e){"use strict";function n(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};return String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]})}e.extend(!0,e.fancybox.defaults,{btnTpl:{share:'<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.55 19c1.4-8.4 9.1-9.8 11.9-9.8V5l7 7-7 6.3v-3.5c-2.8 0-10.5 2.1-11.9 4.2z"/></svg></button>'},share:{url:function(t,e){return!t.currentHash&&"inline"!==e.type&&"html"!==e.type&&(e.origSrc||e.src)||window.location},
13
+ tpl:'<div class="fancybox-share"><h1>{{SHARE}}</h1><p><a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m287 456v-299c0-21 6-35 35-35h38v-63c-7-1-29-3-55-3-54 0-91 33-91 94v306m143-254h-205v72h196" /></svg><span>Facebook</span></a><a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&text={{descr}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" /></svg><span>Twitter</span></a><a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&description={{descr}}&media={{media}}"><svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m265 56c-109 0-164 78-164 144 0 39 15 74 47 87 5 2 10 0 12-5l4-19c2-6 1-8-3-13-9-11-15-25-15-45 0-58 43-110 113-110 62 0 96 38 96 88 0 67-30 122-73 122-24 0-42-19-36-44 6-29 20-60 20-81 0-19-10-35-31-35-25 0-44 26-44 60 0 21 7 36 7 36l-30 125c-8 37-1 83 0 87 0 3 4 4 5 2 2-3 32-39 42-75l16-64c8 16 31 29 56 29 74 0 124-67 124-157 0-69-58-132-146-132z" fill="#fff"/></svg><span>Pinterest</span></a></p><p><input class="fancybox-share__input" type="text" value="{{url_raw}}" onclick="select()" /></p></div>'}}),e(t).on("click","[data-fancybox-share]",function(){var t,o,i=e.fancybox.getInstance(),a=i.current||null;a&&("function"===e.type(a.opts.share.url)&&(t=a.opts.share.url.apply(a,[i,a])),o=a.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===a.type?encodeURIComponent(a.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,n(t)).replace(/\{\{descr\}\}/g,i.$caption?encodeURIComponent(i.$caption.text()):""),e.fancybox.open({src:i.translate(i,o),type:"html",opts:{touch:!1,animationEffect:!1,afterLoad:function(t,e){i.$refs.container.one("beforeClose.fb",function(){t.close(null,0)}),e.$content.find(".fancybox-share__button").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})},mobile:{autoFocus:!1}}}))})}(document,jQuery),function(t,e,n){"use strict";function o(){var e=t.location.hash.substr(1),n=e.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,i=n.join("-");return{hash:e,index:o<1?1:o,gallery:i}}function i(t){""!==t.gallery&&n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1).focus().trigger("click.fb-start")}function a(t){var e,n;return!!t&&(e=t.current?t.current.opts:t.opts,""!==(n=e.hash||(e.$orig?e.$orig.data("fancybox")||e.$orig.data("fancybox-trigger"):""))&&n)}n.escapeSelector||(n.escapeSelector=function(t){return(t+"").replace(/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t})}),n(function(){!1!==n.fancybox.defaults.hash&&(n(e).on({"onInit.fb":function(t,e){var n,i;!1!==e.group[e.currIndex].opts.hash&&(n=o(),(i=a(e))&&n.gallery&&i==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,i,s){var r;i&&!1!==i.opts.hash&&(r=a(o))&&(o.currentHash=r+(o.group.length>1?"-"+(i.index+1):""),t.location.hash!=="#"+o.currentHash&&(s&&!o.origHash&&(o.origHash=t.location.hash),o.hashTimer&&clearTimeout(o.hashTimer),o.hashTimer=setTimeout(function(){"replaceState"in t.history?(t.history[s?"pushState":"replaceState"]({},e.title,t.location.pathname+t.location.search+"#"+o.currentHash),s&&(o.hasCreatedHistory=!0)):t.location.hash=o.currentHash,o.hashTimer=null},300)))},"beforeClose.fb":function(n,o,i){i&&!1!==i.opts.hash&&(clearTimeout(o.hashTimer),o.currentHash&&o.hasCreatedHistory?t.history.back():o.currentHash&&("replaceState"in t.history?t.history.replaceState({},e.title,t.location.pathname+t.location.search+(o.origHash||"")):t.location.hash=o.origHash),o.currentHash=null)}}),n(t).on("hashchange.fb",function(){var t=o(),e=null;n.each(n(".fancybox-container").get().reverse(),function(t,o){var i=n(o).data("FancyBox");if(i&&i.currentHash)return e=i,!1}),e?e.currentHash===t.gallery+"-"+t.index||1===t.index&&e.currentHash==t.gallery||(e.currentHash=null,e.close()):""!==t.gallery&&i(t)}),setTimeout(function(){n.fancybox.getInstance()||i(o())},50))})}(window,document,jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var o=e.current,i=(new Date).getTime();e.group.length<2||!1===o.opts.wheel||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,i-n<250||(n=i,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,jQuery);
assets_libraries/filters/ue_filters.js CHANGED
@@ -3,18 +3,18 @@ function UEDynamicFilters(){
3
 
4
  var g_objFilters, g_objGrid, g_filtersData, g_urlBase;
5
  var g_urlAjax, g_lastGridAjaxCall, g_cache = {}, g_objBody;
 
6
 
7
  var g_types = {
8
  PAGINATION:"pagination",
9
  LOADMORE:"loadmore",
10
  TERMS_LIST:"terms_list",
11
- CHECKBOX: "checkbox"
12
  };
13
 
14
  var g_vars = {
15
  CLASS_DIV_DEBUG:"uc-div-ajax-debug",
16
  CLASS_GRID:"uc-filterable-grid",
17
- handleTrashold:null,
18
  DEBUG_AJAX_OPTIONS: false,
19
  CLASS_CLICKED:"uc-clicked",
20
  CLASS_HIDDEN: "uc-filter-hidden",
@@ -182,6 +182,9 @@ function UEDynamicFilters(){
182
  return(objGrids);
183
  }
184
 
 
 
 
185
  /**
186
  * get closest grid to some object
187
  */
@@ -201,51 +204,26 @@ function UEDynamicFilters(){
201
  var objSection = objSource.parents("section");
202
 
203
  var objGrid = objSection.find("."+ g_vars.CLASS_GRID);
204
-
205
  if(objGrid.length == 1)
206
  return(objGrid);
207
 
208
  //get closest by offset
209
- var type = getFilterType(objSource);
210
 
211
- switch(type){
212
- case g_types.LOADMORE:
213
- case g_types.PAGINATION:
214
- var objSingleGrid = getClosestByOffset(objGrid, objSource, true);
215
 
216
- return(objSingleGrid);
217
-
218
- break;
219
- }
220
-
221
-
222
- //get by next or prev section
223
-
224
- var objPrevSection = objSection;
225
- var objNextSection = objSection;
226
-
227
- //get from previous section
228
- do{
229
- objPrevSection = objPrevSection.prev();
230
- objNextSection = objNextSection.next();
231
-
232
- objGrid = objPrevSection.find("."+ g_vars.CLASS_GRID);
233
- if(objGrid.length == 1)
234
- return(objGrid);
235
-
236
- objGrid = objNextSection.find("."+ g_vars.CLASS_GRID);
237
- if(objGrid.length == 1)
238
- return(objGrid);
239
-
240
- }while(objNextSection.length != 0 && objNextSection != 0);
241
 
242
  //return first grid in the list
243
 
244
  var objFirstGrid = jQuery(objGrids[0]);
 
245
  return(objFirstGrid);
246
  }
247
 
248
 
 
249
  /**
250
  * add filter object to grid
251
  */
@@ -334,6 +312,81 @@ function UEDynamicFilters(){
334
  return(widgetID);
335
  }
336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
 
338
  /**
339
  * get element layout data
@@ -354,7 +407,11 @@ function UEDynamicFilters(){
354
 
355
  if(!widgetID)
356
  throw new Error("widget id not found");
357
-
 
 
 
 
358
  //get layout id
359
  var objLayout = objWidget.parents(".elementor");
360
 
@@ -368,6 +425,11 @@ function UEDynamicFilters(){
368
  output["widgetid"] = widgetID;
369
  output["layoutid"] = layoutID;
370
 
 
 
 
 
 
371
  return(output);
372
  }
373
 
@@ -426,8 +488,7 @@ function UEDynamicFilters(){
426
 
427
  if(filterType)
428
  return(filterType);
429
-
430
- trace(objFilter);
431
  throw new Error("wrong filter type");
432
 
433
  return(null);
@@ -508,7 +569,7 @@ function UEDynamicFilters(){
508
  /**
509
  * get pagination selected url or null if is current
510
  */
511
- function getPaginationSelectedUrl(objPagination){
512
 
513
  var objCurrentLink = objPagination.find("a.current");
514
 
@@ -520,11 +581,24 @@ function UEDynamicFilters(){
520
  if(!url)
521
  return(null);
522
 
523
- return(url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  }
525
 
526
 
527
-
528
  /**
529
  * on ajax pagination click
530
  */
@@ -536,10 +610,40 @@ function UEDynamicFilters(){
536
 
537
  var objLinkCurrent = objPagination.find(".current");
538
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
539
  objLinkCurrent.removeClass("current");
540
 
541
  objLink.addClass("current");
542
-
543
  var objGrid = objPagination.data("grid");
544
 
545
  if(!objGrid || objGrid.length == 0)
@@ -549,13 +653,13 @@ function UEDynamicFilters(){
549
 
550
  objPagination.addClass(g_vars.CLASS_CLICKED);
551
 
552
-
553
  refreshAjaxGrid(objGrid);
554
 
555
  event.preventDefault();
556
  return(false);
557
  }
558
 
 
559
  function ________LOAD_MORE_______________(){}
560
 
561
 
@@ -628,76 +732,6 @@ function UEDynamicFilters(){
628
 
629
  }
630
 
631
- function ________CHECKBOX_______________(){}
632
-
633
- /**
634
- * init checkbox filter - uncheck all checkboxes if checked by cache
635
- */
636
- function initCheckboxFilter(){
637
-
638
- var objChecks = jQuery(".ue-filter-checkbox__check");
639
-
640
- objChecks.each(function(index, check){
641
-
642
- var objCheck = jQuery(check);
643
-
644
- var hasAttr = objCheck.attr("checked");
645
-
646
- if(!hasAttr)
647
- objCheck.prop("checked",false);
648
-
649
- });
650
-
651
- }
652
-
653
-
654
- /**
655
- * add checkbox terms to terms list
656
- */
657
- function addCheckboxTerms(objFilter, arrTerms){
658
-
659
- var objChecks = jQuery(".ue-filter-checkbox__check");
660
-
661
- jQuery.each(objChecks, function(index, check){
662
-
663
- var objCheck = jQuery(check);
664
-
665
- var isChecked = objCheck.is(":checked");
666
-
667
- if(isChecked == false)
668
- return(true);
669
-
670
- var slug = objCheck.data("slug");
671
- var taxonomy = objCheck.data("taxonomy");
672
-
673
- var objTerm = {
674
- "slug": slug,
675
- "taxonomy": taxonomy
676
- };
677
-
678
- arrTerms.push(objTerm);
679
-
680
- });
681
-
682
- return(arrTerms);
683
- }
684
-
685
-
686
- /**
687
- * on checkbox change
688
- */
689
- function onCheckboxChange(){
690
-
691
- var objLink = jQuery(this);
692
- var objCheckboxFilter = objLink.parents(".uc-grid-filter");
693
- setNoRefreshFilter(objCheckboxFilter);
694
-
695
- //refresh grid
696
- var objGrid = objCheckboxFilter.data("grid");
697
-
698
- refreshAjaxGrid(objGrid);
699
-
700
- }
701
 
702
 
703
  function ________TERMS_LIST_______________(){}
@@ -775,6 +809,23 @@ function UEDynamicFilters(){
775
 
776
  return(objTerm);
777
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
778
 
779
  function ________INIT_FILTERS_______________(){}
780
 
@@ -1020,7 +1071,7 @@ function UEDynamicFilters(){
1020
  * set html grid from ajax response
1021
  */
1022
  function operateAjax_setHtmlGrid(response, objGrid, isLoadMore){
1023
-
1024
  if(objGrid.length == 0)
1025
  return(false);
1026
 
@@ -1062,6 +1113,18 @@ function UEDynamicFilters(){
1062
  objEmptyMessage.hide();
1063
  }
1064
 
 
 
 
 
 
 
 
 
 
 
 
 
1065
  //if custom refresh - just save the new html in data
1066
  if(isCustomRefresh == true){
1067
 
@@ -1087,6 +1150,34 @@ function UEDynamicFilters(){
1087
 
1088
  }
1089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1090
 
1091
  }
1092
 
@@ -1180,19 +1271,21 @@ function UEDynamicFilters(){
1180
  /**
1181
  * operate the response
1182
  */
1183
- function operateAjaxRefreshResponse(response, objGrid, objFilters, isLoadMore){
1184
 
1185
  operateAjax_setHtmlGrid(response, objGrid, isLoadMore);
1186
-
1187
  operateAjax_setHtmlWidgets(response, objFilters);
1188
 
 
 
1189
  objGrid.trigger(g_vars.EVENT_AJAX_REFRESHED);
1190
  g_objBody.trigger(g_vars.EVENT_AJAX_REFRESHED_BODY, [objGrid]);
1191
 
1192
  //trigger body as well
1193
 
1194
  //scroll to top
1195
- if(isLoadMore == false){
1196
 
1197
  setTimeout(function(){
1198
 
@@ -1340,10 +1433,11 @@ function UEDynamicFilters(){
1340
 
1341
  var ajaxtype = "get";
1342
 
1343
- if(objData){
1344
  ajaxData["data"] = objData;
1345
  ajaxtype = "post";
1346
  }
 
1347
 
1348
  var ajaxOptions = {
1349
  type:ajaxtype,
@@ -1480,6 +1574,8 @@ function UEDynamicFilters(){
1480
 
1481
  jQuery.each(objElements,function(index, objElement){
1482
 
 
 
1483
  if(isShow == true){
1484
 
1485
  showAjaxLoader(objElement);
@@ -1509,7 +1605,7 @@ function UEDynamicFilters(){
1509
  return(false);
1510
 
1511
  var objAjaxOptions = getGridAjaxOptions(objFilters, objGrid, isFiltersInit);
1512
-
1513
  if(!objAjaxOptions){
1514
 
1515
  trace("ajax options are null");
@@ -1529,13 +1625,50 @@ function UEDynamicFilters(){
1529
  //set the url params
1530
  var behave = objGrid.data("filterbehave");
1531
 
1532
- var isSetUrl = (behave == "mixed");
1533
 
1534
  if(isFiltersInit == false && isSetUrl === true){
1535
 
1536
- history.replaceState({}, null, urlReplace);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1537
  }
1538
 
 
 
 
 
 
 
 
 
 
 
 
1539
  var objEmptyMessage = getGridEmptyMessage(objGrid);
1540
 
1541
  //set the loaders
@@ -1550,18 +1683,20 @@ function UEDynamicFilters(){
1550
 
1551
  var objFiltersToReload = objFilters.filter(function(objFilter){
1552
 
1553
- return objFilter.hasClass("uc-ajax-refresh-soon");
1554
  });
1555
 
1556
-
1557
  showMultipleAjaxLoaders(objFiltersToReload, true);
1558
 
1559
- //ajax reload
 
1560
 
 
 
1561
  g_lastGridAjaxCall = objGrid;
1562
 
1563
  ajaxRequest(ajaxUrl,null,null, function(response){
1564
-
1565
  if(isLoadMore !== true){
1566
  hideAjaxLoader(objGrid);
1567
 
@@ -1571,12 +1706,16 @@ function UEDynamicFilters(){
1571
 
1572
  showMultipleAjaxLoaders(objFilters, false);
1573
 
 
 
 
1574
  operateAjaxRefreshResponse(response, objGrid, objFilters, isLoadMore);
1575
 
1576
  });
 
 
1577
  }
1578
 
1579
-
1580
  function ________RUN_______________(){}
1581
 
1582
 
@@ -1584,7 +1723,7 @@ function UEDynamicFilters(){
1584
  * get grid ajax options
1585
  */
1586
  function getGridAjaxOptions(objFilters, objGrid, isFiltersInitMode){
1587
-
1588
  if(!objFilters)
1589
  return(null);
1590
 
@@ -1602,6 +1741,7 @@ function UEDynamicFilters(){
1602
  var objTaxIDs = {};
1603
  var strSelectedTerms = "";
1604
 
 
1605
  //add widget id of the filter to refresh
1606
 
1607
  //get ajax options
@@ -1621,9 +1761,16 @@ function UEDynamicFilters(){
1621
  var isClicked = objFilter.hasClass(g_vars.CLASS_CLICKED);
1622
  if(isClicked == true){
1623
 
1624
- var urlPagination = getPaginationSelectedUrl(objFilter);
 
 
1625
 
1626
- if(urlPagination)
 
 
 
 
 
1627
  urlAjax = urlPagination;
1628
 
1629
  objFilter.removeClass(g_vars.CLASS_CLICKED);
@@ -1674,11 +1821,6 @@ function UEDynamicFilters(){
1674
  if(modeReplace === true)
1675
  isReplaceMode = true;
1676
 
1677
- break;
1678
- case g_types.CHECKBOX:
1679
-
1680
- arrTerms = addCheckboxTerms(objFilter, arrTerms);
1681
-
1682
  break;
1683
  default:
1684
  throw new Error("Unknown filter type: "+type);
@@ -1728,7 +1870,7 @@ function UEDynamicFilters(){
1728
 
1729
  strRefreshIDs += filterWidgetID;
1730
 
1731
- objFilter.addClass("uc-ajax-refresh-soon");
1732
  }
1733
 
1734
 
@@ -1760,6 +1902,7 @@ function UEDynamicFilters(){
1760
  urlAddition_filtersTest += "testtermids="+strTaxIDs;
1761
  }
1762
 
 
1763
 
1764
  if(urlAjax == null)
1765
  return(null);
@@ -1769,15 +1912,24 @@ function UEDynamicFilters(){
1769
  var widgetID = dataLayout["widgetid"];
1770
  var layoutID = dataLayout["layoutid"];
1771
 
 
 
 
1772
  var urlAddition = "ucfrontajaxaction=getfiltersdata&layoutid="+layoutID+"&elid="+widgetID;
1773
-
1774
  urlAjax = addUrlParam(urlAjax, urlAddition);
1775
 
 
 
 
1776
  if(urlAddition_filtersTest)
1777
  urlAjax = addUrlParam(urlAjax, urlAddition_filtersTest);
1778
 
1779
- if(page)
1780
  urlAjax += "&ucpage="+page;
 
 
 
1781
 
1782
  if(offset)
1783
  urlAjax += "&ucoffset="+offset;
@@ -1835,7 +1987,7 @@ function UEDynamicFilters(){
1835
  if(g_objGrid.length > 1){
1836
  g_objGrid = null;
1837
  }
1838
-
1839
  }
1840
 
1841
 
@@ -1844,10 +1996,11 @@ function UEDynamicFilters(){
1844
  * init the globals
1845
  */
1846
  function initGlobals(){
1847
-
1848
- if(typeof g_strFiltersData != "undefined"){
1849
- g_filtersData = JSON.parse(g_strFiltersData);
1850
- }
 
1851
 
1852
  if(jQuery.isEmptyObject(g_filtersData)){
1853
 
@@ -1879,7 +2032,7 @@ function UEDynamicFilters(){
1879
  function initFilter(objFilter){
1880
 
1881
  var objGrid = getClosestGrid(objFilter);
1882
-
1883
  var error = "Filter Parent not found! Please put the posts element on the page, and turn on 'Enable Post Filtering' option on it";
1884
 
1885
  if(!objGrid){
@@ -1914,11 +2067,16 @@ function UEDynamicFilters(){
1914
  //init the events
1915
  var objParent = objFilters.parents(".elementor");
1916
 
 
 
 
1917
  for(var type in arrTypes){
1918
 
1919
  switch(type){
1920
  case g_types.PAGINATION:
1921
- objParent.on("click",".uc-filter-pagination a", onAjaxPaginationLinkClick);
 
 
1922
  break;
1923
  case g_types.LOADMORE:
1924
 
@@ -1930,12 +2088,10 @@ function UEDynamicFilters(){
1930
  objParent.on("click",".ue_taxonomy a.ue_taxonomy_item", onTermsLinkClick);
1931
 
1932
  break;
1933
- case g_types.CHECKBOX:
1934
 
1935
- initCheckboxFilter();
1936
 
1937
- objParent.on("change",".ue-filter-checkbox__check", onCheckboxChange);
1938
-
1939
  break;
1940
  default:
1941
  trace("init by type - unrecognized type: "+type);
@@ -2000,6 +2156,120 @@ function UEDynamicFilters(){
2000
 
2001
  }
2002
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2003
 
2004
  /**
2005
  * init
@@ -2010,18 +2280,43 @@ function UEDynamicFilters(){
2010
 
2011
  var success = initGlobals();
2012
 
2013
- if(success == false)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2014
  return(false);
 
2015
 
 
 
 
 
2016
  //init the grid object
2017
  initGridObject();
2018
-
2019
  initFilters();
2020
 
2021
  ajaxInitFilters();
2022
-
 
 
 
 
 
2023
  }
2024
 
 
2025
  /**
2026
  * is element in viewport
2027
  */
3
 
4
  var g_objFilters, g_objGrid, g_filtersData, g_urlBase;
5
  var g_urlAjax, g_lastGridAjaxCall, g_cache = {}, g_objBody;
6
+ var g_remote = null, g_lastSyncGrids;
7
 
8
  var g_types = {
9
  PAGINATION:"pagination",
10
  LOADMORE:"loadmore",
11
  TERMS_LIST:"terms_list",
12
+ SEARCH: "search"
13
  };
14
 
15
  var g_vars = {
16
  CLASS_DIV_DEBUG:"uc-div-ajax-debug",
17
  CLASS_GRID:"uc-filterable-grid",
 
18
  DEBUG_AJAX_OPTIONS: false,
19
  CLASS_CLICKED:"uc-clicked",
20
  CLASS_HIDDEN: "uc-filter-hidden",
182
  return(objGrids);
183
  }
184
 
185
+ /**
186
+ * get closest grid to some object
187
+ */
188
  /**
189
  * get closest grid to some object
190
  */
204
  var objSection = objSource.parents("section");
205
 
206
  var objGrid = objSection.find("."+ g_vars.CLASS_GRID);
207
+
208
  if(objGrid.length == 1)
209
  return(objGrid);
210
 
211
  //get closest by offset
 
212
 
213
+ var objSingleGrid = getClosestByOffset(objGrid, objSource, true);
 
 
 
214
 
215
+ if(objSingleGrid.length == 1)
216
+ return(objSingleGrid);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
 
218
  //return first grid in the list
219
 
220
  var objFirstGrid = jQuery(objGrids[0]);
221
+
222
  return(objFirstGrid);
223
  }
224
 
225
 
226
+
227
  /**
228
  * add filter object to grid
229
  */
312
  return(widgetID);
313
  }
314
 
315
+ /**
316
+ * get the grid widget object from elementor element id
317
+ */
318
+ function getGridFromElementorElementID(elementID){
319
+
320
+ var objElement = g_objBody.find(".elementor-widget[data-id='"+elementID+"']");
321
+
322
+ if(objElement.length == 0)
323
+ return(null);
324
+
325
+ var objGrid = objElement.find("."+g_vars.CLASS_GRID);
326
+
327
+ if(objGrid.length != 1)
328
+ return(null);
329
+
330
+ return(objGrid);
331
+ }
332
+
333
+
334
+
335
+ /**
336
+ * get synced widget IDs
337
+ */
338
+ function getSyncedWidgetData(objElement){
339
+
340
+ if(!g_remote)
341
+ return(false);
342
+
343
+ var arrSyncedGrids = g_remote.getSyncedElements(objElement);
344
+
345
+ if(!arrSyncedGrids)
346
+ return(false);
347
+
348
+ var arrWidgetIDs = [];
349
+
350
+ var objGrids = null;
351
+
352
+ for(var index in arrSyncedGrids){
353
+
354
+ var objGrid = arrSyncedGrids[index];
355
+
356
+ if(objGrid.hasClass(g_vars.CLASS_GRID) == false){
357
+
358
+ var message = "Please enable ajax on all synced widgets";
359
+ var message2 = "Please enable ajax on this synced widget";
360
+
361
+ showElementError(objGrid, message2);
362
+
363
+ showAjaxError(message);
364
+ throw new Error(message);
365
+ return(false);
366
+ }
367
+
368
+ var objWidgetID = getElementWidgetID(objGrid);
369
+
370
+ //add to jquery collection
371
+
372
+ if(!objGrids)
373
+ objGrids = objGrid;
374
+ else
375
+ objGrids.add(objGrid);
376
+
377
+ arrWidgetIDs.push(objWidgetID);
378
+ }
379
+
380
+
381
+ var strWidgetIDs = arrWidgetIDs.toString();
382
+
383
+ var objOutput = {};
384
+ objOutput["ids"] = strWidgetIDs;
385
+ objOutput["grids"] = objGrids;
386
+
387
+ return(objOutput);
388
+ }
389
+
390
 
391
  /**
392
  * get element layout data
407
 
408
  if(!widgetID)
409
  throw new Error("widget id not found");
410
+
411
+ //get synced grids
412
+
413
+ var objSyncedData = getSyncedWidgetData(objElement);
414
+
415
  //get layout id
416
  var objLayout = objWidget.parents(".elementor");
417
 
425
  output["widgetid"] = widgetID;
426
  output["layoutid"] = layoutID;
427
 
428
+ if(objSyncedData){
429
+ output["synced_widgetids"] = objSyncedData["ids"];
430
+ output["synced_grids"] = objSyncedData["grids"];
431
+ }
432
+
433
  return(output);
434
  }
435
 
488
 
489
  if(filterType)
490
  return(filterType);
491
+
 
492
  throw new Error("wrong filter type");
493
 
494
  return(null);
569
  /**
570
  * get pagination selected url or null if is current
571
  */
572
+ function getPaginationSelectedData(objPagination){
573
 
574
  var objCurrentLink = objPagination.find("a.current");
575
 
581
  if(!url)
582
  return(null);
583
 
584
+ var numPage = objCurrentLink.text();
585
+
586
+ if(jQuery.isNumeric(numPage) == false)
587
+ numPage = null;
588
+
589
+ numPage = Number(numPage);
590
+
591
+ if(numPage === 1)
592
+ numPage = null;
593
+
594
+ var output = {};
595
+ output["url"] = url;
596
+ output["page"] = numPage;
597
+
598
+ return(output);
599
  }
600
 
601
 
 
602
  /**
603
  * on ajax pagination click
604
  */
610
 
611
  var objLinkCurrent = objPagination.find(".current");
612
 
613
+
614
+ //on next button click
615
+
616
+ if(objLink.hasClass("next")){
617
+
618
+ var nextLink = objLinkCurrent.next();
619
+
620
+ var objNextLink = jQuery(nextLink);
621
+
622
+ objNextLink.trigger("click");
623
+
624
+
625
+ return(false);
626
+ }
627
+
628
+
629
+ //on prev button click
630
+
631
+ if(objLink.hasClass("prev")){
632
+
633
+ var prevLink = objLinkCurrent.prev();
634
+
635
+ var objPrevLink = jQuery(prevLink);
636
+
637
+ objPrevLink.trigger("click");
638
+
639
+ return(false);
640
+ }
641
+
642
+
643
  objLinkCurrent.removeClass("current");
644
 
645
  objLink.addClass("current");
646
+
647
  var objGrid = objPagination.data("grid");
648
 
649
  if(!objGrid || objGrid.length == 0)
653
 
654
  objPagination.addClass(g_vars.CLASS_CLICKED);
655
 
 
656
  refreshAjaxGrid(objGrid);
657
 
658
  event.preventDefault();
659
  return(false);
660
  }
661
 
662
+
663
  function ________LOAD_MORE_______________(){}
664
 
665
 
732
 
733
  }
734
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
735
 
736
 
737
  function ________TERMS_LIST_______________(){}
809
 
810
  return(objTerm);
811
  }
812
+
813
+ function ________GENERAL_FILTER_______________(){}
814
+
815
+
816
+ /**
817
+ * on general filter change
818
+ */
819
+ function onFilterChange(){
820
+
821
+ trace("filter change");
822
+
823
+ var objFilter = jQuery(this);
824
+
825
+ trace(objFilter);
826
+
827
+
828
+ }
829
 
830
  function ________INIT_FILTERS_______________(){}
831
 
1071
  * set html grid from ajax response
1072
  */
1073
  function operateAjax_setHtmlGrid(response, objGrid, isLoadMore){
1074
+
1075
  if(objGrid.length == 0)
1076
  return(false);
1077
 
1113
  objEmptyMessage.hide();
1114
  }
1115
 
1116
+ var queryData = getVal(response, "query_data");
1117
+
1118
+ objGrid.removeAttr("querydata");
1119
+
1120
+ if(queryData){
1121
+
1122
+ var jsonData = JSON.stringify(queryData);
1123
+ objGrid.attr("querydata", jsonData);
1124
+
1125
+ objGrid.data("querydata", queryData);
1126
+ }
1127
+
1128
  //if custom refresh - just save the new html in data
1129
  if(isCustomRefresh == true){
1130
 
1150
 
1151
  }
1152
 
1153
+ }
1154
+
1155
+
1156
+ /**
1157
+ * refresh synced grids
1158
+ */
1159
+ function operateAjax_setHtmlSyngGrids(response, objGrid, isLoadMore){
1160
+
1161
+ var objSyncWidgetsResponse = getVal(response, "html_sync_widgets");
1162
+
1163
+ if(!objSyncWidgetsResponse)
1164
+ return(false);
1165
+
1166
+ jQuery.each(objSyncWidgetsResponse, function(elementID, response){
1167
+
1168
+ var objGridWidget = getGridFromElementorElementID(elementID);
1169
+
1170
+ if(!objGridWidget)
1171
+ return(true);
1172
+
1173
+ objGridWidget.removeClass(g_vars.CLASS_REFRESH_SOON);
1174
+
1175
+ operateAjax_setHtmlGrid(response, objGridWidget, isLoadMore);
1176
+
1177
+ objGrid.trigger(g_vars.EVENT_AJAX_REFRESHED);
1178
+ g_objBody.trigger(g_vars.EVENT_AJAX_REFRESHED_BODY, [objGridWidget]);
1179
+
1180
+ });
1181
 
1182
  }
1183
 
1271
  /**
1272
  * operate the response
1273
  */
1274
+ function operateAjaxRefreshResponse(response, objGrid, objFilters, isLoadMore, isNoScroll){
1275
 
1276
  operateAjax_setHtmlGrid(response, objGrid, isLoadMore);
1277
+
1278
  operateAjax_setHtmlWidgets(response, objFilters);
1279
 
1280
+ operateAjax_setHtmlSyngGrids(response, objGrid, isLoadMore);
1281
+
1282
  objGrid.trigger(g_vars.EVENT_AJAX_REFRESHED);
1283
  g_objBody.trigger(g_vars.EVENT_AJAX_REFRESHED_BODY, [objGrid]);
1284
 
1285
  //trigger body as well
1286
 
1287
  //scroll to top
1288
+ if(isLoadMore == false && isNoScroll !== true){
1289
 
1290
  setTimeout(function(){
1291
 
1433
 
1434
  var ajaxtype = "get";
1435
 
1436
+ if(jQuery.isEmptyObject(objData) == false){
1437
  ajaxData["data"] = objData;
1438
  ajaxtype = "post";
1439
  }
1440
+
1441
 
1442
  var ajaxOptions = {
1443
  type:ajaxtype,
1574
 
1575
  jQuery.each(objElements,function(index, objElement){
1576
 
1577
+ objElement = jQuery(objElement);
1578
+
1579
  if(isShow == true){
1580
 
1581
  showAjaxLoader(objElement);
1605
  return(false);
1606
 
1607
  var objAjaxOptions = getGridAjaxOptions(objFilters, objGrid, isFiltersInit);
1608
+
1609
  if(!objAjaxOptions){
1610
 
1611
  trace("ajax options are null");
1625
  //set the url params
1626
  var behave = objGrid.data("filterbehave");
1627
 
1628
+ var isSetUrl = (behave == "mixed" || behave == "mixed_back");
1629
 
1630
  if(isFiltersInit == false && isSetUrl === true){
1631
 
1632
+ if(behave == "mixed_back"){
1633
+
1634
+ //save state for back button
1635
+
1636
+ var gridID = objGrid.attr("id");
1637
+
1638
+ //save initial state
1639
+ var isStateEmpty = jQuery.isEmptyObject(history.state);
1640
+
1641
+ if(isStateEmpty){
1642
+
1643
+ var ajaxUrlInitial = objGrid.data("initajaxurl");
1644
+
1645
+ history.replaceState({"ucaction":"change", "ajaxurl":ajaxUrlInitial, "gridid":gridID}, null, urlReplace);
1646
+
1647
+ trace("replace");
1648
+
1649
+ }
1650
+
1651
+ //push new state
1652
+ trace("push");
1653
+
1654
+ history.pushState({"ucaction":"change", "ajaxurl":ajaxUrl, "gridid":gridID}, null, urlReplace); //with back
1655
+
1656
+ }
1657
+ else
1658
+ history.replaceState({}, null, urlReplace); //without back
1659
  }
1660
 
1661
+
1662
+ doGridAjaxRequest(ajaxUrl, objGrid, objFilters, isLoadMore, isFiltersInit);
1663
+
1664
+ }
1665
+
1666
+
1667
+ /**
1668
+ * do the actual grid ajax request
1669
+ */
1670
+ function doGridAjaxRequest(ajaxUrl, objGrid, objFilters, isLoadMore, isFiltersInit){
1671
+
1672
  var objEmptyMessage = getGridEmptyMessage(objGrid);
1673
 
1674
  //set the loaders
1683
 
1684
  var objFiltersToReload = objFilters.filter(function(objFilter){
1685
 
1686
+ return objFilter.hasClass(g_vars.CLASS_REFRESH_SOON);
1687
  });
1688
 
 
1689
  showMultipleAjaxLoaders(objFiltersToReload, true);
1690
 
1691
+ if(g_lastSyncGrids)
1692
+ showMultipleAjaxLoaders(g_lastSyncGrids, true);
1693
 
1694
+
1695
+ //ajax reload
1696
  g_lastGridAjaxCall = objGrid;
1697
 
1698
  ajaxRequest(ajaxUrl,null,null, function(response){
1699
+
1700
  if(isLoadMore !== true){
1701
  hideAjaxLoader(objGrid);
1702
 
1706
 
1707
  showMultipleAjaxLoaders(objFilters, false);
1708
 
1709
+ if(g_lastSyncGrids)
1710
+ showMultipleAjaxLoaders(g_lastSyncGrids, false);
1711
+
1712
  operateAjaxRefreshResponse(response, objGrid, objFilters, isLoadMore);
1713
 
1714
  });
1715
+
1716
+
1717
  }
1718
 
 
1719
  function ________RUN_______________(){}
1720
 
1721
 
1723
  * get grid ajax options
1724
  */
1725
  function getGridAjaxOptions(objFilters, objGrid, isFiltersInitMode){
1726
+
1727
  if(!objFilters)
1728
  return(null);
1729
 
1741
  var objTaxIDs = {};
1742
  var strSelectedTerms = "";
1743
 
1744
+
1745
  //add widget id of the filter to refresh
1746
 
1747
  //get ajax options
1761
  var isClicked = objFilter.hasClass(g_vars.CLASS_CLICKED);
1762
  if(isClicked == true){
1763
 
1764
+ var paginationData = getPaginationSelectedData(objFilter);
1765
+
1766
+ var urlPagination = getVal(paginationData, "url");
1767
 
1768
+ var paginationPage = getVal(paginationData, "page");
1769
+
1770
+ if(paginationPage)
1771
+ page = paginationPage;
1772
+ else
1773
+ if(urlPagination)
1774
  urlAjax = urlPagination;
1775
 
1776
  objFilter.removeClass(g_vars.CLASS_CLICKED);
1821
  if(modeReplace === true)
1822
  isReplaceMode = true;
1823
 
 
 
 
 
 
1824
  break;
1825
  default:
1826
  throw new Error("Unknown filter type: "+type);
1870
 
1871
  strRefreshIDs += filterWidgetID;
1872
 
1873
+ objFilter.addClass(g_vars.CLASS_REFRESH_SOON);
1874
  }
1875
 
1876
 
1902
  urlAddition_filtersTest += "testtermids="+strTaxIDs;
1903
  }
1904
 
1905
+ g_lastSyncGrids = null;
1906
 
1907
  if(urlAjax == null)
1908
  return(null);
1912
  var widgetID = dataLayout["widgetid"];
1913
  var layoutID = dataLayout["layoutid"];
1914
 
1915
+ var syncedWidgetIDs = getVal(dataLayout,"synced_widgetids");
1916
+ g_lastSyncGrids = getVal(dataLayout,"synced_grids");
1917
+
1918
  var urlAddition = "ucfrontajaxaction=getfiltersdata&layoutid="+layoutID+"&elid="+widgetID;
1919
+
1920
  urlAjax = addUrlParam(urlAjax, urlAddition);
1921
 
1922
+ if(syncedWidgetIDs)
1923
+ urlAjax += "&syncelids="+syncedWidgetIDs;
1924
+
1925
  if(urlAddition_filtersTest)
1926
  urlAjax = addUrlParam(urlAjax, urlAddition_filtersTest);
1927
 
1928
+ if(page){
1929
  urlAjax += "&ucpage="+page;
1930
+
1931
+ urlReplace = addUrlParam(urlReplace, "ucpage="+page);
1932
+ }
1933
 
1934
  if(offset)
1935
  urlAjax += "&ucoffset="+offset;
1987
  if(g_objGrid.length > 1){
1988
  g_objGrid = null;
1989
  }
1990
+
1991
  }
1992
 
1993
 
1996
  * init the globals
1997
  */
1998
  function initGlobals(){
1999
+
2000
+ if(typeof g_strFiltersData === "undefined")
2001
+ return(false);
2002
+
2003
+ g_filtersData = JSON.parse(g_strFiltersData);
2004
 
2005
  if(jQuery.isEmptyObject(g_filtersData)){
2006
 
2032
  function initFilter(objFilter){
2033
 
2034
  var objGrid = getClosestGrid(objFilter);
2035
+
2036
  var error = "Filter Parent not found! Please put the posts element on the page, and turn on 'Enable Post Filtering' option on it";
2037
 
2038
  if(!objGrid){
2067
  //init the events
2068
  var objParent = objFilters.parents(".elementor");
2069
 
2070
+ if(objParent.length > 1)
2071
+ objParent = jQuery(objParent[0]);
2072
+
2073
  for(var type in arrTypes){
2074
 
2075
  switch(type){
2076
  case g_types.PAGINATION:
2077
+
2078
+ objParent.on("click",".uc-filter-pagination a", onAjaxPaginationLinkClick);
2079
+
2080
  break;
2081
  case g_types.LOADMORE:
2082
 
2088
  objParent.on("click",".ue_taxonomy a.ue_taxonomy_item", onTermsLinkClick);
2089
 
2090
  break;
2091
+ case g_types.SEARCH:
2092
 
2093
+ objParent.on("filter_change",".uc-search-filter__input", onFilterChange);
2094
 
 
 
2095
  break;
2096
  default:
2097
  trace("init by type - unrecognized type: "+type);
2156
 
2157
  }
2158
 
2159
+ /**
2160
+ * do history
2161
+ */
2162
+ function changeToHistoryState(state){
2163
+
2164
+ var ajaxUrl = getVal(state, "ajaxurl");
2165
+
2166
+ var gridID = getVal(state, "gridid");
2167
+
2168
+ if(!gridID)
2169
+ return(false);
2170
+
2171
+ if(!ajaxUrl)
2172
+ return(false);
2173
+
2174
+ var objGrid = jQuery("#"+gridID);
2175
+
2176
+ var objFilters = objGrid.data("filters");
2177
+
2178
+ if(!objFilters)
2179
+ return(false);
2180
+
2181
+ var responseFromCache = getResponseFromAjaxCache(ajaxUrl);
2182
+
2183
+ if(!responseFromCache){
2184
+
2185
+ //do ajax request
2186
+
2187
+ doGridAjaxRequest(ajaxUrl, objGrid, objFilters);
2188
+
2189
+ return(false);
2190
+ }
2191
+
2192
+ //get data from cache
2193
+
2194
+ operateAjaxRefreshResponse(responseFromCache, objGrid, objFilters, false, true);
2195
+
2196
+ }
2197
+
2198
+
2199
+ /**
2200
+ * on pop state, if it's a grid state, set the grid
2201
+ */
2202
+ function onPopState(){
2203
+
2204
+ if(!history.state)
2205
+ return(true);
2206
+
2207
+ trace("on pop");
2208
+ trace(history.state);
2209
+
2210
+ var action = getVal(history.state, "ucaction");
2211
+
2212
+ if(!action)
2213
+ return(true);
2214
+
2215
+ switch(action){
2216
+ case "change":
2217
+
2218
+ changeToHistoryState(history.state);
2219
+
2220
+ break;
2221
+ default:
2222
+ throw new Error("Wrong history action: " + action);
2223
+ break;
2224
+ }
2225
+
2226
+ }
2227
+
2228
+ /**
2229
+ * init events
2230
+ */
2231
+ function initEvents(){
2232
+
2233
+ addEventListener('popstate', onPopState);
2234
+
2235
+
2236
+ }
2237
+
2238
+ /**
2239
+ * set init state ajax url for each grid (for go back)
2240
+ */
2241
+ function initOriginGridAjaxUrls(){
2242
+
2243
+ var objGrids = getAllGrids();
2244
+
2245
+ jQuery.each(objGrids, function(index, grid){
2246
+
2247
+ var objGrid = jQuery(grid);
2248
+
2249
+ var behave = objGrid.data("filterbehave");
2250
+
2251
+ if(behave != "mixed_back")
2252
+ return(true);
2253
+
2254
+ //get all grid filters
2255
+ var objFilters = objGrid.data("filters");
2256
+
2257
+ if(!objFilters)
2258
+ return(false);
2259
+
2260
+ if(objFilters.length == 0)
2261
+ return(false);
2262
+
2263
+ var objAjaxOptions = getGridAjaxOptions(objFilters, objGrid);
2264
+
2265
+ var ajaxUrlInit = getVal(objAjaxOptions, "ajax_url");
2266
+
2267
+ objGrid.data("initajaxurl", ajaxUrlInit);
2268
+
2269
+ });
2270
+
2271
+
2272
+ }
2273
 
2274
  /**
2275
  * init
2280
 
2281
  var success = initGlobals();
2282
 
2283
+ //run again on fail 3 times
2284
+ if(success == false){
2285
+
2286
+ if(typeof window.ueFiltersTimeoutCounter != "undefined")
2287
+ window.ueFiltersTimeoutCounter++;
2288
+ else
2289
+ window.ueFiltersTimeoutCounter = 0;
2290
+
2291
+ if(window.ueFiltersTimeoutCounter == 3){
2292
+ trace("Failed to init filters");
2293
+ return(false);
2294
+ }
2295
+
2296
+ setTimeout(init, 200);
2297
+
2298
  return(false);
2299
+ }
2300
 
2301
+ //init remote object if exists
2302
+ if(typeof UERemoteConnection == "function")
2303
+ g_remote = window.ueRemoteConnection;
2304
+
2305
  //init the grid object
2306
  initGridObject();
2307
+
2308
  initFilters();
2309
 
2310
  ajaxInitFilters();
2311
+
2312
+ //set initial ajax url
2313
+ initOriginGridAjaxUrls();
2314
+
2315
+ initEvents();
2316
+
2317
  }
2318
 
2319
+
2320
  /**
2321
  * is element in viewport
2322
  */
assets_libraries/lity/lity.js CHANGED
@@ -120,6 +120,7 @@
120
  }
121
 
122
  function transferHash(originalUrl, newUrl) {
 
123
  var pos = originalUrl.indexOf('#');
124
 
125
  if (-1 === pos) {
@@ -293,7 +294,16 @@
293
  }
294
 
295
  function iframeHandler(target) {
296
- return '<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="' + target + '"/></div>';
 
 
 
 
 
 
 
 
 
297
  }
298
 
299
  function winHeight() {
@@ -460,7 +470,15 @@
460
  return {handler: handler, content: content || ''};
461
  }
462
 
 
 
 
 
 
 
 
463
  function Lity(target, options, opener, activeElement) {
 
464
  var self = this;
465
  var result;
466
  var isReady = false;
120
  }
121
 
122
  function transferHash(originalUrl, newUrl) {
123
+
124
  var pos = originalUrl.indexOf('#');
125
 
126
  if (-1 === pos) {
294
  }
295
 
296
  function iframeHandler(target) {
297
+
298
+ var isVimeo = target && (target.indexOf("https://player.vimeo.com/") === 0);
299
+
300
+ var addHtml = "";
301
+ if(isVimeo == true)
302
+ addHtml = "allow=\"autoplay; fullscreen; picture-in-picture\"";
303
+
304
+ var htmlFrame = '<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen '+addHtml+' src="' + target + '"/></div>';
305
+
306
+ return(htmlFrame);
307
  }
308
 
309
  function winHeight() {
470
  return {handler: handler, content: content || ''};
471
  }
472
 
473
+
474
+ function trace(str){
475
+
476
+ console.log(str);
477
+
478
+ }
479
+
480
  function Lity(target, options, opener, activeElement) {
481
+
482
  var self = this;
483
  var result;
484
  var isReady = false;
assets_libraries/lity/lity.min.js CHANGED
@@ -1,5 +1,3 @@
1
  /*! Lity - v2.2.2 - 2017-07-17
2
  * http://sorgalla.com/lity/
3
- * Copyright (c) 2015-2017 Jan Sorgalla; Licensed MIT */
4
-
5
- !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return b(a,c)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=b(a,require("jquery")):a.lity=b(a,a.jQuery||a.Zepto)}("undefined"!=typeof window?window:this,function(a,b){"use strict";function c(a){var b=B();return N&&a.length?(a.one(N,b.resolve),setTimeout(b.resolve,500)):b.resolve(),b.promise()}function d(a,c,d){if(1===arguments.length)return b.extend({},a);if("string"==typeof c){if(void 0===d)return void 0===a[c]?null:a[c];a[c]=d}else b.extend(a,c);return this}function e(a){for(var b,c=decodeURI(a.split("#")[0]).split("&"),d={},e=0,f=c.length;e<f;e++)c[e]&&(b=c[e].split("="),d[b[0]]=b[1]);return d}function f(a,c){return a+(a.indexOf("?")>-1?"&":"?")+b.param(c)}function g(a,b){var c=a.indexOf("#");return-1===c?b:(c>0&&(a=a.substr(c)),b+a)}function h(a){return b('<span class="lity-error"/>').append(a)}function i(a,c){var d=c.opener()&&c.opener().data("lity-desc")||"Image with no description",e=b('<img src="'+a+'" alt="'+d+'"/>'),f=B(),g=function(){f.reject(h("Failed loading image"))};return e.on("load",function(){if(0===this.naturalWidth)return g();f.resolve(e)}).on("error",g),f.promise()}function j(a,c){var d,e,f;try{d=b(a)}catch(a){return!1}return!!d.length&&(e=b('<i style="display:none !important"/>'),f=d.hasClass("lity-hide"),c.element().one("lity:remove",function(){e.before(d).remove(),f&&!d.closest(".lity-content").length&&d.addClass("lity-hide")}),d.removeClass("lity-hide").after(e))}function k(a){var c=J.exec(a);return!!c&&o(g(a,f("https://www.youtube"+(c[2]||"")+".com/embed/"+c[4],b.extend({autoplay:1},e(c[5]||"")))))}function l(a){var c=K.exec(a);return!!c&&o(g(a,f("https://player.vimeo.com/video/"+c[3],b.extend({autoplay:1},e(c[4]||"")))))}function m(a){var c=M.exec(a);return!!c&&(0!==a.indexOf("http")&&(a="https:"+a),o(g(a,f("https://www.facebook.com/plugins/video.php?href="+a,b.extend({autoplay:1},e(c[4]||""))))))}function n(a){var b=L.exec(a);return!!b&&o(g(a,f("https://www.google."+b[3]+"/maps?"+b[6],{output:b[6].indexOf("layer=c")>0?"svembed":"embed"})))}function o(a){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+a+'"/></div>'}function p(){return z.documentElement.clientHeight?z.documentElement.clientHeight:Math.round(A.height())}function q(a){var b=v();b&&(27===a.keyCode&&b.options("esc")&&b.close(),9===a.keyCode&&r(a,b))}function r(a,b){var c=b.element().find(G),d=c.index(z.activeElement);a.shiftKey&&d<=0?(c.get(c.length-1).focus(),a.preventDefault()):a.shiftKey||d!==c.length-1||(c.get(0).focus(),a.preventDefault())}function s(){b.each(D,function(a,b){b.resize()})}function t(a){1===D.unshift(a)&&(C.addClass("lity-active"),A.on({resize:s,keydown:q})),b("body > *").not(a.element()).addClass("lity-hidden").each(function(){var a=b(this);void 0===a.data(F)&&a.data(F,a.attr(E)||null)}).attr(E,"true")}function u(a){var c;a.element().attr(E,"true"),1===D.length&&(C.removeClass("lity-active"),A.off({resize:s,keydown:q})),D=b.grep(D,function(b){return a!==b}),c=D.length?D[0].element():b(".lity-hidden"),c.removeClass("lity-hidden").each(function(){var a=b(this),c=a.data(F);c?a.attr(E,c):a.removeAttr(E),a.removeData(F)})}function v(){return 0===D.length?null:D[0]}function w(a,c,d,e){var f,g="inline",h=b.extend({},d);return e&&h[e]?(f=h[e](a,c),g=e):(b.each(["inline","iframe"],function(a,b){delete h[b],h[b]=d[b]}),b.each(h,function(b,d){return!d||(!(!d.test||d.test(a,c))||(f=d(a,c),!1!==f?(g=b,!1):void 0))})),{handler:g,content:f||""}}function x(a,e,f,g){function h(a){k=b(a).css("max-height",p()+"px"),j.find(".lity-loader").each(function(){var a=b(this);c(a).always(function(){a.remove()})}),j.removeClass("lity-loading").find(".lity-content").empty().append(k),m=!0,k.trigger("lity:ready",[l])}var i,j,k,l=this,m=!1,n=!1;e=b.extend({},H,e),j=b(e.template),l.element=function(){return j},l.opener=function(){return f},l.options=b.proxy(d,l,e),l.handlers=b.proxy(d,l,e.handlers),l.resize=function(){m&&!n&&k.css("max-height",p()+"px").trigger("lity:resize",[l])},l.close=function(){if(m&&!n){n=!0,u(l);var a=B();if(g&&(z.activeElement===j[0]||b.contains(j[0],z.activeElement)))try{g.focus()}catch(a){}return k.trigger("lity:close",[l]),j.removeClass("lity-opened").addClass("lity-closed"),c(k.add(j)).always(function(){k.trigger("lity:remove",[l]),j.remove(),j=void 0,a.resolve()}),a.promise()}},i=w(a,l,e.handlers,e.handler),j.attr(E,"false").addClass("lity-loading lity-opened lity-"+i.handler).appendTo("body").focus().on("click","[data-lity-close]",function(a){b(a.target).is("[data-lity-close]")&&l.close()}).trigger("lity:open",[l]),t(l),b.when(i.content).always(h)}function y(a,c,d){a.preventDefault?(a.preventDefault(),d=b(this),a=d.data("lity-target")||d.attr("href")||d.attr("src")):d=b(d);var e=new x(a,b.extend({},d.data("lity-options")||d.data("lity"),c),d,z.activeElement);if(!a.preventDefault)return e}var z=a.document,A=b(a),B=b.Deferred,C=b("html"),D=[],E="aria-hidden",F="lity-"+E,G='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',H={esc:!0,handler:null,handlers:{image:i,inline:j,youtube:k,vimeo:l,googlemaps:n,facebookvideo:m,iframe:o},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'},I=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,J=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,K=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,L=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,M=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,N=function(){var a=z.createElement("div"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return b[c];return!1}();return i.test=function(a){return I.test(a)},y.version="2.2.2",y.options=b.proxy(d,y,H),y.handlers=b.proxy(d,y,H.handlers),y.current=v,b(z).on("click.lity","[data-lity]",y),y});
1
  /*! Lity - v2.2.2 - 2017-07-17
2
  * http://sorgalla.com/lity/
3
+ * Copyright (c) 2015-2017 Jan Sorgalla; Licensed MIT */ !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function($){return b(a,$)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=b(a,require("jquery")):a.lity=b(a,a.jQuery||a.Zepto)}("undefined"!=typeof window?window:this,function(b,$){"use strict";var e=b.document,i=$(b),j=$.Deferred,k=$("html"),l=[],f="aria-hidden",m="lity-"+f,c={esc:!0,handler:null,handlers:{image:g,inline:function(c,d){var a,b,e;try{a=$(c)}catch(f){return!1}return!!a.length&&(b=$('<i style="display:none !important"/>'),e=a.hasClass("lity-hide"),d.element().one("lity:remove",function(){b.before(a).remove(),e&&!a.closest(".lity-content").length&&a.addClass("lity-hide")}),a.removeClass("lity-hide").after(b))},youtube:function(b){var a=o.exec(b);return!!a&&x(w(b,v("https://www.youtube"+(a[2]||"")+".com/embed/"+a[4],$.extend({autoplay:1},u(a[5]||"")))))},vimeo:function(b){var a=p.exec(b);return!!a&&x(w(b,v("https://player.vimeo.com/video/"+a[3],$.extend({autoplay:1},u(a[4]||"")))))},googlemaps:function(b){var a=q.exec(b);return!!a&&x(w(b,v("https://www.google."+a[3]+"/maps?"+a[6],{output:a[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(a){var b=r.exec(a);return!!b&&(0!==a.indexOf("http")&&(a="https:"+a),x(w(a,v("https://www.facebook.com/plugins/video.php?href="+a,$.extend({autoplay:1},u(b[4]||""))))))},iframe:x},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'},n=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,o=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,p=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,q=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,r=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,s=function(){var c=e.createElement("div"),a={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var b in a)if(void 0!==c.style[b])return a[b];return!1}();function t(b){var a=j();return s&&b.length?(b.one(s,a.resolve),setTimeout(a.resolve,500)):a.resolve(),a.promise()}function d(a,b,c){if(1===arguments.length)return $.extend({},a);if("string"==typeof b){if(void 0===c)return void 0===a[b]?null:a[b];a[b]=c}else $.extend(a,b);return this}function u(e){for(var c,b=decodeURI(e.split("#")[0]).split("&"),d={},a=0,f=b.length;a<f;a++)b[a]&&(d[(c=b[a].split("="))[0]]=c[1]);return d}function v(a,b){return a+(a.indexOf("?")> -1?"&":"?")+$.param(b)}function w(a,c){var b=a.indexOf("#");return -1===b?c:(b>0&&(a=a.substr(b)),c+a)}function g(b,a){var c=$('<img src="'+b+'" alt="'+(a.opener()&&a.opener().data("lity-desc")||"Image with no description")+'"/>'),d=j(),e=function(){var a;d.reject((a="Failed loading image",$('<span class="lity-error"/>').append(a)))};return c.on("load",function(){if(0===this.naturalWidth)return e();d.resolve(c)}).on("error",e),d.promise()}function x(a){var c=a&&0===a.indexOf("https://player.vimeo.com/"),b="";return!0==c&&(b='allow="autoplay; fullscreen; picture-in-picture"'),'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen '+b+' src="'+a+'"/></div>'}function y(){return e.documentElement.clientHeight?e.documentElement.clientHeight:Math.round(i.height())}function z(b){var a=h();a&&(27===b.keyCode&&a.options("esc")&&a.close(),9===b.keyCode&&A(b,a))}function A(b,d){var a=d.element().find('a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])'),c=a.index(e.activeElement);b.shiftKey&&c<=0?(a.get(a.length-1).focus(),b.preventDefault()):b.shiftKey||c!==a.length-1||(a.get(0).focus(),b.preventDefault())}function B(){$.each(l,function(b,a){a.resize()})}function h(){return 0===l.length?null:l[0]}function C(w,b,x,A){var n,q,C,r,s,u,g,v,o,h,p,a=this,D=!1,E=!1;b=$.extend({},c,b),q=$(b.template),a.element=function(){return q},a.opener=function(){return x},a.options=$.proxy(d,a,b),a.handlers=$.proxy(d,a,b.handlers),a.resize=function(){D&&!E&&C.css("max-height",y()+"px").trigger("lity:resize",[a])},a.close=function(){if(D&&!E){E=!0,(c=a).element().attr(f,"true"),1===l.length&&(k.removeClass("lity-active"),i.off({resize:B,keydown:z})),((l=$.grep(l,function(a){return c!==a})).length?l[0].element():$(".lity-hidden")).removeClass("lity-hidden").each(function(){var a=$(this),b=a.data(m);b?a.attr(f,b):a.removeAttr(f),a.removeData(m)});var c,b=j();if(A&&(e.activeElement===q[0]||$.contains(q[0],e.activeElement)))try{A.focus()}catch(d){}return C.trigger("lity:close",[a]),q.removeClass("lity-opened").addClass("lity-closed"),t(C.add(q)).always(function(){C.trigger("lity:remove",[a]),q.remove(),q=void 0,b.resolve()}),b.promise()}},n=(r=w,s=a,u=b.handlers,g=b.handler,o="inline",h=$.extend({},u),g&&h[g]?(v=h[g](r,s),o=g):($.each(["inline","iframe"],function(b,a){delete h[a],h[a]=u[a]}),$.each(h,function(b,a){return!(a&&(!a.test||a.test(r,s)))||(!1!==(v=a(r,s))?(o=b,!1):void 0)})),{handler:o,content:v||""}),q.attr(f,"false").addClass("lity-loading lity-opened lity-"+n.handler).appendTo("body").focus().on("click","[data-lity-close]",function(b){$(b.target).is("[data-lity-close]")&&a.close()}).trigger("lity:open",[a]),p=a,1===l.unshift(p)&&(k.addClass("lity-active"),i.on({resize:B,keydown:z})),$("body > *").not(p.element()).addClass("lity-hidden").each(function(){var a=$(this);void 0===a.data(m)&&a.data(m,a.attr(f)||null)}).attr(f,"true"),$.when(n.content).always(function(b){C=$(b).css("max-height",y()+"px"),q.find(".lity-loader").each(function(){var a=$(this);t(a).always(function(){a.remove()})}),q.removeClass("lity-loading").find(".lity-content").empty().append(C),D=!0,C.trigger("lity:ready",[a])})}function a(b,c,a){b.preventDefault?(b.preventDefault(),b=(a=$(this)).data("lity-target")||a.attr("href")||a.attr("src")):a=$(a);var d=new C(b,$.extend({},a.data("lity-options")||a.data("lity"),c),a,e.activeElement);if(!b.preventDefault)return d}return g.test=function(a){return n.test(a)},a.version="2.2.2",a.options=$.proxy(d,a,c),a.handlers=$.proxy(d,a,c.handlers),a.current=h,$(e).on("click.lity","[data-lity]",a),a})
 
 
assets_libraries/owl-carousel-new/owl.carousel.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * Owl Carousel v2.3.6 - UE5
3
  * Copyright 2013-2018 David Deutsch
4
  * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
  */
@@ -17,6 +17,29 @@
17
  */
18
  ;(function($, window, document, undefined) {
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Creates a carousel.
22
  * @class The Owl Carousel.
@@ -145,6 +168,36 @@
145
  direction: null
146
  };
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  /**
149
  * Current state information and their tags.
150
  * @type {Object}
@@ -221,6 +274,8 @@
221
 
222
  info: false,
223
 
 
 
224
  nestedItemSelector: false,
225
  itemElement: 'div',
226
  stageElement: 'div',
@@ -235,7 +290,10 @@
235
  stageClass: 'owl-stage',
236
  stageOuterClass: 'owl-stage-outer',
237
  grabClass: 'owl-grab',
238
- shuffle: false
 
 
 
239
  };
240
 
241
  /**
@@ -272,8 +330,10 @@
272
  */
273
  Owl.Workers = [ {
274
  filter: [ 'width', 'settings' ],
275
- run: function() {
276
  this._width = this.$element.width();
 
 
277
  }
278
  }, {
279
  filter: [ 'width', 'items', 'settings' ],
@@ -304,7 +364,50 @@
304
  }, {
305
  filter: [ 'width', 'items', 'settings' ],
306
  run: function(cache) {
307
- var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  merge = null,
309
  iterator = this._items.length,
310
  grid = !this.settings.autoWidth,
@@ -315,6 +418,7 @@
315
  width: width
316
  };
317
 
 
318
  while (iterator--) {
319
  merge = this._mergers[iterator];
320
  merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
@@ -322,9 +426,11 @@
322
  cache.items.merge = merge > 1 || cache.items.merge;
323
 
324
  widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
 
325
  }
326
 
327
  this._widths = widths;
 
328
  }
329
  }, {
330
  filter: [ 'items', 'settings' ],
@@ -356,7 +462,7 @@
356
  $(prepend).addClass('cloned').prependTo(this.$stage);
357
  }
358
  }, {
359
- filter: [ 'width', 'items', 'settings' ],
360
  run: function() {
361
  var rtl = this.settings.rtl ? 1 : -1,
362
  size = this._clones.length + this._items.length,
@@ -368,18 +474,46 @@
368
  while (++iterator < size) {
369
  previous = coordinates[iterator - 1] || 0;
370
  current = this._widths[this.relative(iterator)] + this.settings.margin;
371
- coordinates.push(previous + current * rtl);
 
 
 
 
 
 
 
 
 
 
 
 
372
  }
373
 
 
 
 
 
374
  this._coordinates = coordinates;
375
  }
376
  }, {
377
  filter: [ 'width', 'items', 'settings' ],
378
- run: function() {
 
379
  var padding = this.settings.stagePadding,
380
- coordinates = this._coordinates,
 
 
 
 
 
381
 
382
- none = {
 
 
 
 
 
 
383
  'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])),
384
  'padding-left': '',
385
  'padding-right': ''
@@ -398,21 +532,62 @@
398
  'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding,
399
  'padding-left': '',
400
  'padding-right': padding || ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  };
402
-
403
- var paddingType = this.settings.paddingType;
404
 
405
- if(!paddingType)
406
- paddingType = "none";
 
 
 
 
407
 
408
  if(paddingType == 'none'){
 
409
  this.$stage.css(none);
 
 
410
  }else if(paddingType == 'both'){
411
  this.$stage.css(both);
 
 
 
 
 
412
  }else if(paddingType == 'left'){
413
  this.$stage.css(left);
 
 
 
 
 
414
  }else if(paddingType == 'right'){
415
  this.$stage.css(right);
 
 
 
 
 
416
  }
417
 
418
  }
@@ -458,7 +633,7 @@
458
  begin = this.coordinates(this.current()) + padding,
459
  end = begin + this.width() * rtl,
460
  inner, outer, matches = [], i, n;
461
-
462
  if(this.settings.paddingType == 'left' || this.settings.paddingType == 'right'){
463
  padding = this.settings.stagePadding;
464
  }
@@ -488,7 +663,7 @@
488
  if(!this.settings.setActiveClass){
489
  return;
490
  }
491
-
492
  if (this.settings.setActiveClass) {
493
  var $setClass = true;
494
 
@@ -568,7 +743,7 @@
568
  // invalidate width
569
  this.invalidate('width');
570
  }
571
-
572
 
573
  this.$element
574
  .removeClass(this.options.loadingClass)
@@ -584,7 +759,7 @@
584
  this.trigger('initialize');
585
 
586
  this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
587
-
588
 
589
  if(this.settings.shuffle){
590
  var carousel = this.$element;
@@ -728,19 +903,47 @@
728
  * @returns {Number} - The width of the view in pixel.
729
  */
730
  Owl.prototype.width = function(dimension) {
731
- dimension = dimension || Owl.Width.Default;
 
 
 
 
732
  switch (dimension) {
733
  case Owl.Width.Inner:
734
  case Owl.Width.Outer:
735
- return this._width;
 
 
 
736
  default:
737
- if(this.settings.paddingType == 'left' || this.settings.paddingType == 'right'){
738
- return this._width - this.settings.stagePadding + this.settings.margin;
739
- }else{
740
- return this._width - this.settings.stagePadding * 2 + this.settings.margin;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
741
  }
742
 
743
  }
 
 
 
 
744
  };
745
 
746
  /**
@@ -748,6 +951,14 @@
748
  * @public
749
  */
750
  Owl.prototype.refresh = function() {
 
 
 
 
 
 
 
 
751
  this.enter('refreshing');
752
  this.trigger('refresh');
753
 
@@ -779,18 +990,33 @@
779
  * @protected
780
  */
781
  Owl.prototype.onResize = function() {
 
 
782
  if (!this._items.length) {
 
 
 
783
  return false;
784
  }
785
 
 
786
  if (this._width === this.$element.width()) {
 
 
 
787
  return false;
788
  }
 
789
 
790
  if (!this.isVisible()) {
 
 
 
791
  return false;
792
  }
793
 
 
 
794
  this.enter('resizing');
795
 
796
  if (this.trigger('resize').isDefaultPrevented()) {
@@ -799,8 +1025,12 @@
799
  }
800
 
801
  this.invalidate('width');
802
-
 
 
 
803
  this.refresh();
 
804
 
805
  this.leave('resizing');
806
  this.trigger('resized');
@@ -813,6 +1043,7 @@
813
  * @protected
814
  */
815
  Owl.prototype.registerEventHandlers = function() {
 
816
  if ($.support.transition) {
817
  this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
818
  }
@@ -1028,22 +1259,30 @@
1028
  this.trigger('translate');
1029
  }
1030
 
1031
- if ($.support.transform3d && $.support.transition) {
 
 
 
 
 
1032
  this.$stage.css({
1033
- transform: 'translate3d(' + (coordinate-1) + 'px,0px,0px)', // this line is modified (added '-1') in order to fix "one pixel problem"
1034
  transition: (this.speed() / 1000) + 's' + (
1035
  this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
1036
  )
1037
  });
1038
- } else if (animate) {
1039
  this.$stage.animate({
1040
  left: coordinate + 'px'
1041
  }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
1042
- } else {
1043
  this.$stage.css({
1044
  left: coordinate + 'px'
1045
  });
1046
  }
 
 
 
1047
  };
1048
 
1049
  /**
@@ -1530,6 +1769,64 @@
1530
  }, this));
1531
  };
1532
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1533
  /**
1534
  * Destroys the carousel.
1535
  * @public
@@ -2688,7 +2985,7 @@
2688
  * @author Bartosz Wojciechowski
2689
  * @author Artus Kolanowski
2690
  * @author David Deutsch
2691
- * @author Tom De CaluwГ©
2692
  * @license The MIT License (MIT)
2693
  */
2694
  ;(function($, window, document, undefined) {
@@ -3122,7 +3419,7 @@
3122
  this._controls.$absolute.on('click', 'button', $.proxy(function(e) {
3123
  var index = $(e.target).parent().is(this._controls.$absolute)
3124
  ? $(e.target).index() : $(e.target).parent().index();
3125
- console.log($(e.target).index());
3126
  e.preventDefault();
3127
 
3128
  this.to(index, settings.dotsSpeed);
1
  /**
2
+ * Owl Carousel v2.3.7 - UE7
3
  * Copyright 2013-2018 David Deutsch
4
  * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
  */
17
  */
18
  ;(function($, window, document, undefined) {
19
 
20
+ //console log some text
21
+ if(typeof trace == "undefined"){
22
+ function trace(str){
23
+ console.log(str);
24
+ }
25
+ }
26
+
27
+ //set the debug output
28
+ var g_debug = false;
29
+
30
+
31
+ /**
32
+ * debug function
33
+ */
34
+ function debug(str){
35
+
36
+ if(g_debug == false)
37
+ return(false);
38
+
39
+ trace(str);
40
+ }
41
+
42
+
43
  /**
44
  * Creates a carousel.
45
  * @class The Owl Carousel.
168
  direction: null
169
  };
170
 
171
+ /**
172
+ * get item width
173
+ */
174
+ this.getItemWidth = function(){
175
+
176
+ //caclulate item width
177
+ switch(this.settings.paddingType){
178
+ case "left":
179
+ case "right":
180
+ var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin;
181
+ break;
182
+
183
+ break;
184
+ case "both":
185
+ var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin;
186
+ break;
187
+ default: //no stage padding
188
+ var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin;
189
+ break;
190
+ }
191
+
192
+
193
+ if(this.settings.item_size_gap)
194
+ width += this.settings.item_size_gap;
195
+
196
+
197
+
198
+ return(width);
199
+ }
200
+
201
  /**
202
  * Current state information and their tags.
203
  * @type {Object}
274
 
275
  info: false,
276
 
277
+ scrollToHead: false,
278
+ scrollToHeadOffset: 0,
279
  nestedItemSelector: false,
280
  itemElement: 'div',
281
  stageElement: 'div',
290
  stageClass: 'owl-stage',
291
  stageOuterClass: 'owl-stage-outer',
292
  grabClass: 'owl-grab',
293
+ shuffle: false,
294
+ item_size_gap:0, //size gap that should fix the 1px bug
295
+ pixel_gap_fix:false,
296
+ debug:false
297
  };
298
 
299
  /**
330
  */
331
  Owl.Workers = [ {
332
  filter: [ 'width', 'settings' ],
333
+ run: function() { //set total width
334
  this._width = this.$element.width();
335
+
336
+ debug("set total width this._width: "+this._width);
337
  }
338
  }, {
339
  filter: [ 'width', 'items', 'settings' ],
364
  }, {
365
  filter: [ 'width', 'items', 'settings' ],
366
  run: function(cache) {
367
+
368
+ if(this.settings.debug === true)
369
+ g_debug = true;
370
+
371
+ debug("run!");
372
+
373
+ //set 1px gap
374
+ if(this.settings.items == 1 && this.settings.pixel_gap_fix == true){
375
+
376
+ this.settings.item_size_gap = 1;
377
+
378
+ debug("set items size gap: 1");
379
+ }
380
+
381
+ debug("settings - stage padding type: "+this.settings.paddingType);
382
+ debug("settings - stage padding: "+this.settings.stagePadding);
383
+
384
+ if( (!this.settings.paddingType || this.settings.paddingType == "none") && this.settings.stagePadding){
385
+ this.settings.paddingType = "both";
386
+
387
+ debug("set stage padding type - both");
388
+ }
389
+
390
+ var width = this.getItemWidth();
391
+
392
+ debug("Item width: " + width);
393
+
394
+ //update the stage padding to half of the item width
395
+
396
+ if(this.settings.stagePadding > width){
397
+
398
+ this.settings.stagePadding = 0;
399
+
400
+ var newWidth = this.getItemWidth();
401
+
402
+ this.settings.stagePadding = Math.floor(newWidth*0.5);
403
+
404
+ var width = this.getItemWidth();
405
+
406
+ debug("set new stagePadding: "+this.settings.stagePadding+" and item width: "+width);
407
+
408
+ }
409
+
410
+
411
  merge = null,
412
  iterator = this._items.length,
413
  grid = !this.settings.autoWidth,
418
  width: width
419
  };
420
 
421
+
422
  while (iterator--) {
423
  merge = this._mergers[iterator];
424
  merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
426
  cache.items.merge = merge > 1 || cache.items.merge;
427
 
428
  widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
429
+
430
  }
431
 
432
  this._widths = widths;
433
+
434
  }
435
  }, {
436
  filter: [ 'items', 'settings' ],
462
  $(prepend).addClass('cloned').prependTo(this.$stage);
463
  }
464
  }, {
465
+ filter: [ 'width', 'items', 'settings' ], //set coordinates
466
  run: function() {
467
  var rtl = this.settings.rtl ? 1 : -1,
468
  size = this._clones.length + this._items.length,
474
  while (++iterator < size) {
475
  previous = coordinates[iterator - 1] || 0;
476
  current = this._widths[this.relative(iterator)] + this.settings.margin;
477
+
478
+ var coordinate = previous + current * rtl;
479
+
480
+ coordinates.push(coordinate);
481
+ }
482
+
483
+ //fix the 1px bug
484
+ if(this.settings.item_size_gap){
485
+
486
+ for(var index in coordinates){
487
+ coordinates[index] -= this.settings.item_size_gap;
488
+ }
489
+
490
  }
491
 
492
+ debug("Set coordinates");
493
+ debug(coordinates);
494
+
495
+
496
  this._coordinates = coordinates;
497
  }
498
  }, {
499
  filter: [ 'width', 'items', 'settings' ],
500
+ run: function() { //set the stage widths
501
+
502
  var padding = this.settings.stagePadding,
503
+ coordinates = this._coordinates;
504
+
505
+ var paddingType = this.settings.paddingType;
506
+ var parentOuterStage = this.$stage.parent();
507
+ var parentOuterStageWidth = parentOuterStage.width();
508
+ //var parentOuterStageWidth = this.$element.width();
509
 
510
+ debug("parent Outer Stage Width: " + parentOuterStage.width());
511
+ debug("element width this.$element.width(): "+ this.$element.width());
512
+
513
+
514
+ //set stage css
515
+
516
+ var none = {
517
  'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])),
518
  'padding-left': '',
519
  'padding-right': ''
532
  'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding,
533
  'padding-left': '',
534
  'padding-right': padding || ''
535
+ };
536
+
537
+ //old way with transform
538
+
539
+ /*
540
+ bothOuter = {
541
+ 'width': parentOuterStageWidth + padding * 2,
542
+ 'transform': 'translate(-' + padding + 'px, 0)',
543
+ },
544
+ noneOuter = {
545
+ 'width': '',
546
+ 'transform': 'translate(0, 0)',
547
+ },
548
+ leftOuter = {
549
+ 'width': parentOuterStageWidth + padding,
550
+ 'transform': 'translate(-' + padding + 'px, 0)',
551
+ },
552
+ rightOuter = {
553
+ 'width': parentOuterStageWidth + padding,
554
+ 'transform': 'translate(0, 0)',
555
  };
556
+ */
 
557
 
558
+ var cssOuter = {
559
+ width: parentOuterStageWidth
560
+ };
561
+
562
+ debug("set outer stage css");
563
+ debug(cssOuter);
564
 
565
  if(paddingType == 'none'){
566
+
567
  this.$stage.css(none);
568
+ parentOuterStage.width(cssOuter);
569
+
570
  }else if(paddingType == 'both'){
571
  this.$stage.css(both);
572
+ parentOuterStage.css(cssOuter);
573
+
574
+ debug("Set stage width css (both)");
575
+ debug(both);
576
+
577
  }else if(paddingType == 'left'){
578
  this.$stage.css(left);
579
+ parentOuterStage.css(cssOuter);
580
+
581
+ debug("Set stage width css (left)");
582
+ debug(left);
583
+
584
  }else if(paddingType == 'right'){
585
  this.$stage.css(right);
586
+ parentOuterStage.css(cssOuter);
587
+
588
+ debug("Set stage width css (right)");
589
+ debug(right);
590
+
591
  }
592
 
593
  }
633
  begin = this.coordinates(this.current()) + padding,
634
  end = begin + this.width() * rtl,
635
  inner, outer, matches = [], i, n;
636
+
637
  if(this.settings.paddingType == 'left' || this.settings.paddingType == 'right'){
638
  padding = this.settings.stagePadding;
639
  }
663
  if(!this.settings.setActiveClass){
664
  return;
665
  }
666
+
667
  if (this.settings.setActiveClass) {
668
  var $setClass = true;
669
 
743
  // invalidate width
744
  this.invalidate('width');
745
  }
746
+
747
 
748
  this.$element
749
  .removeClass(this.options.loadingClass)
759
  this.trigger('initialize');
760
 
761
  this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
762
+
763
 
764
  if(this.settings.shuffle){
765
  var carousel = this.$element;
903
  * @returns {Number} - The width of the view in pixel.
904
  */
905
  Owl.prototype.width = function(dimension) {
906
+
907
+ dimension = dimension || Owl.Width.Default;
908
+
909
+ var calcWidth;
910
+
911
  switch (dimension) {
912
  case Owl.Width.Inner:
913
  case Owl.Width.Outer:
914
+ calcWidth = this._width;
915
+
916
+ debug("calc width for dimention: "+dimension);
917
+
918
  default:
919
+
920
+ switch(this.settings.paddingType){
921
+ case "left":
922
+ case "right":
923
+ debug("calc width with stagePadding: "+this.settings.paddingType);
924
+
925
+ calcWidth = this._width - this.settings.stagePadding + this.settings.margin;
926
+
927
+ break;
928
+ case "both":
929
+ debug("calc width with stagePadding: "+this.settings.paddingType);
930
+
931
+ calcWidth = this._width - this.settings.stagePadding*2 + this.settings.margin;
932
+ break;
933
+ default:
934
+
935
+ calcWidth = this._width + this.settings.margin;
936
+
937
+ debug("calc width without stagePadding for dimention: "+dimension);
938
+
939
+ break;
940
  }
941
 
942
  }
943
+
944
+ debug("carousel width (no stagepadding and margins): "+calcWidth);
945
+
946
+ return(calcWidth);
947
  };
948
 
949
  /**
951
  * @public
952
  */
953
  Owl.prototype.refresh = function() {
954
+
955
+ debug("---------------------refresh carousel-----------------------");
956
+
957
+ debug("window width: "+window.innerWidth);
958
+ debug("element width: "+this.$element.width());
959
+ debug("stage width: "+this.$stage.width());
960
+
961
+
962
  this.enter('refreshing');
963
  this.trigger('refresh');
964
 
990
  * @protected
991
  */
992
  Owl.prototype.onResize = function() {
993
+ debug("---------------------resize carousel-----------------------");
994
+
995
  if (!this._items.length) {
996
+
997
+ debug("same length");
998
+
999
  return false;
1000
  }
1001
 
1002
+ /*
1003
  if (this._width === this.$element.width()) {
1004
+
1005
+ debug("same size");
1006
+
1007
  return false;
1008
  }
1009
+ */
1010
 
1011
  if (!this.isVisible()) {
1012
+
1013
+ debug("not visible");
1014
+
1015
  return false;
1016
  }
1017
 
1018
+ debug("resizing");
1019
+
1020
  this.enter('resizing');
1021
 
1022
  if (this.trigger('resize').isDefaultPrevented()) {
1025
  }
1026
 
1027
  this.invalidate('width');
1028
+
1029
+ //reset outer stage width
1030
+ this.$stage.parent().css({'width': ''});
1031
+
1032
  this.refresh();
1033
+ this.update();
1034
 
1035
  this.leave('resizing');
1036
  this.trigger('resized');
1043
  * @protected
1044
  */
1045
  Owl.prototype.registerEventHandlers = function() {
1046
+
1047
  if ($.support.transition) {
1048
  this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
1049
  }
1259
  this.trigger('translate');
1260
  }
1261
 
1262
+ if ($.support.transition) {
1263
+
1264
+ var tranformValue = coordinate;
1265
+
1266
+ debug("Go to coordinate: "+coordinate);
1267
+
1268
  this.$stage.css({
1269
+ transform: 'translateX(' + (coordinate) + 'px)',
1270
  transition: (this.speed() / 1000) + 's' + (
1271
  this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
1272
  )
1273
  });
1274
+ }else if (animate) {
1275
  this.$stage.animate({
1276
  left: coordinate + 'px'
1277
  }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
1278
+ }else {
1279
  this.$stage.css({
1280
  left: coordinate + 'px'
1281
  });
1282
  }
1283
+
1284
+ this.scrollToHead();
1285
+
1286
  };
1287
 
1288
  /**
1769
  }, this));
1770
  };
1771
 
1772
+ /**
1773
+ * checks if Carousel is in viewport
1774
+ *
1775
+ */
1776
+ Owl.prototype.isElementInViewport = function(element) {
1777
+
1778
+ var elementTop = element.offset().top;
1779
+ var elementBottom = elementTop + element.outerHeight();
1780
+
1781
+ var viewportTop = jQuery(window).scrollTop();
1782
+ var viewportBottom = viewportTop + jQuery(window).height();
1783
+
1784
+ var isInViwport = elementBottom > viewportTop && elementTop < viewportBottom;
1785
+
1786
+ return(isInViwport);
1787
+ }
1788
+
1789
+
1790
+ /**
1791
+ * animate html, body
1792
+ */
1793
+ Owl.prototype.scrollToTop = function(elementOffsetTop, offsetNumber){
1794
+
1795
+ jQuery('html, body').animate({
1796
+ scrollTop: elementOffsetTop + offsetNumber
1797
+ }, 400);
1798
+ }
1799
+
1800
+
1801
+
1802
+ /**
1803
+ * scroll to head
1804
+ */
1805
+ Owl.prototype.scrollToHead = function(){
1806
+
1807
+ if(this.settings.scrollToHead == false)
1808
+ return(false);
1809
+
1810
+ if(this.settings.autoplay == true)
1811
+ return(false);
1812
+
1813
+ if(this.is('initializing'))
1814
+ return(false);
1815
+
1816
+ if(this.is('resizing'))
1817
+ return(false);
1818
+
1819
+ var carousel = this.$element;
1820
+
1821
+ if(this.isElementInViewport(carousel) == true)
1822
+ return(false);
1823
+
1824
+ var carouselOffsetTop = this.$element.offset().top;
1825
+ var offset = this.settings.scrollToHeadOffset;
1826
+
1827
+ this.scrollToTop(carouselOffsetTop, offset);
1828
+ }
1829
+
1830
  /**
1831
  * Destroys the carousel.
1832
  * @public
2985
  * @author Bartosz Wojciechowski
2986
  * @author Artus Kolanowski
2987
  * @author David Deutsch
2988
+ * @author Tom De CaluwГ©
2989
  * @license The MIT License (MIT)
2990
  */
2991
  ;(function($, window, document, undefined) {
3419
  this._controls.$absolute.on('click', 'button', $.proxy(function(e) {
3420
  var index = $(e.target).parent().is(this._controls.$absolute)
3421
  ? $(e.target).index() : $(e.target).parent().index();
3422
+
3423
  e.preventDefault();
3424
 
3425
  this.to(index, settings.dotsSpeed);
assets_libraries/owl-carousel-new/owl.carousel.min.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * Owl Carousel v2.3.6 - UE5
3
  * Copyright 2013-2018 David Deutsch
4
  * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
  */
@@ -15,4 +15,5 @@
15
  * @todo Test Zepto
16
  * @todo stagePadding calculate wrong active classes
17
  */
18
- !function(t,e,i,s){function n(e,i){this.settings=null,this.options=t.extend({},n.Defaults,i),this.$element=t(e),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},t.each(["onResize","onThrottledResize"],t.proxy(function(e,i){this._handlers[i]=t.proxy(this[i],this)},this)),t.each(n.Plugins,t.proxy(function(t,e){this._plugins[t.charAt(0).toLowerCase()+t.slice(1)]=new e(this)},this)),t.each(n.Workers,t.proxy(function(e,i){this._pipe.push({filter:i.filter,run:t.proxy(i.run,this)})},this)),this.setup(),this.initialize()}n.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,setActiveClass:!0,setActiveClassOnMobile:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,paddingType:"none",stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:e,fallbackEasing:"swing",slideTransition:"",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab",shuffle:!1},n.Width={Default:"default",Inner:"inner",Outer:"outer"},n.Type={Event:"event",State:"state"},n.Plugins={},n.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(t){t.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(t){var e=this.settings.margin||"",i=!this.settings.autoWidth,s=this.settings.rtl,n={width:"auto","margin-left":s?e:"","margin-right":s?"":e};!i&&this.$stage.children().css(n),t.css=n}},{filter:["width","items","settings"],run:function(t){var e=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,i=null,s=this._items.length,n=!this.settings.autoWidth,o=[];for(t.items={merge:!1,width:e};s--;)i=this._mergers[s],i=this.settings.mergeFit&&Math.min(i,this.settings.items)||i,t.items.merge=i>1||t.items.merge,o[s]=n?e*i:this._items[s].width();this._widths=o}},{filter:["items","settings"],run:function(){var e=[],i=this._items,s=this.settings,n=Math.max(2*s.items,4),o=2*Math.ceil(i.length/2),r=s.loop&&i.length?s.rewind?n:Math.max(n,o):0,a="",h="";for(r/=2;r>0;)e.push(this.normalize(e.length/2,!0)),a+=i[e[e.length-1]][0].outerHTML,e.push(this.normalize(i.length-1-(e.length-1)/2,!0)),h=i[e[e.length-1]][0].outerHTML+h,r-=1;this._clones=e,t(a).addClass("cloned").appendTo(this.$stage),t(h).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var t=this.settings.rtl?1:-1,e=this._clones.length+this._items.length,i=-1,s=0,n=0,o=[];++i<e;)s=o[i-1]||0,n=this._widths[this.relative(i)]+this.settings.margin,o.push(s+n*t);this._coordinates=o}},{filter:["width","items","settings"],run:function(){var t=this.settings.stagePadding,e=this._coordinates,i={width:Math.ceil(Math.abs(e[e.length-1])),"padding-left":"","padding-right":""},s={width:Math.ceil(Math.abs(e[e.length-1]))+2*t,"padding-left":t||"","padding-right":t||""},n={width:Math.ceil(Math.abs(e[e.length-1]))+t,"padding-left":t||"","padding-right":""},o={width:Math.ceil(Math.abs(e[e.length-1]))+t,"padding-left":"","padding-right":t||""},r=this.settings.paddingType;r||(r="none"),"none"==r?this.$stage.css(i):"both"==r?this.$stage.css(s):"left"==r?this.$stage.css(n):"right"==r&&this.$stage.css(o)}},{filter:["width","items","settings"],run:function(t){var e=this._coordinates.length,i=!this.settings.autoWidth,s=this.$stage.children();if(i&&t.items.merge)for(;e--;)t.css.width=this._widths[this.relative(e)],s.eq(e).css(t.css);else i&&(t.css.width=t.items.width,s.css(t.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(t){t.current=t.current?this.$stage.children().index(t.current):0,t.current=Math.max(this.minimum(),Math.min(this.maximum(),t.current)),this.reset(t.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var t,e,i,s,n=this.settings.rtl?1:-1,o=2*this.settings.stagePadding,r=this.coordinates(this.current())+o,a=r+this.width()*n,h=[];for("left"!=this.settings.paddingType&&"right"!=this.settings.paddingType||(o=this.settings.stagePadding),i=0,s=this._coordinates.length;i<s;i++)t=this._coordinates[i-1]||0,e=Math.abs(this._coordinates[i])+o*n,(this.op(t,"<=",r)&&this.op(t,">",a)||this.op(e,"<",r)&&this.op(e,">",a))&&h.push(i);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+h.join("), :eq(")+")").addClass("active"),this.$stage.children(".center").removeClass("center"),this.settings.center&&this.$stage.children().eq(this.current()).addClass("center")}},{filter:["width","position","items","settings"],run:function(){if(this.settings.setActiveClass&&this.settings.setActiveClass){var t=!0;this.settings.setActiveClassOnMobile?1==this.$stage.children(".active").length&&(t=!0):this.settings.setActiveClassOnMobile||1==this.$stage.children(".active").length&&(t=!1),1==t?this.$stage.children().eq(this.current()).addClass("uc-active-item").siblings().removeClass("uc-active-item"):0==t&&this.$stage.children().removeClass("uc-active-item")}}}],n.prototype.initializeStage=function(){this.$stage=this.$element.find("."+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=t("<"+this.settings.stageElement+">",{class:this.settings.stageClass}).wrap(t("<div/>",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},n.prototype.initializeItems=function(){var e=this.$element.find(".owl-item");if(e.length)return this._items=e.get().map(function(e){return t(e)}),this._mergers=this._items.map(function(){return 1}),void this.refresh();this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},n.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.shuffle){var t=this.$element;t.children().sort(function(){return Math.round(Math.random())-.5}).each(function(){t.append(this)})}var e,i,s;this.settings.autoWidth&&!this.is("pre-loading")&&(e=this.$element.find("img"),i=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:void 0,s=this.$element.children(i).width(),e.length&&s<=0&&this.preloadAutoWidthImages(e));this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},n.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(":visible")},n.prototype.setup=function(){var e=this.viewport(),i=this.options.responsive,s=-1,n=null;i?(t.each(i,function(t){t<=e&&t>s&&(s=Number(t))}),"function"==typeof(n=t.extend({},this.options,i[s])).stagePadding&&(n.stagePadding=n.stagePadding()),delete n.responsive,n.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+s))):n=t.extend({},this.options),this.trigger("change",{property:{name:"settings",value:n}}),this._breakpoint=s,this.settings=n,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},n.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},n.prototype.prepare=function(e){var i=this.trigger("prepare",{content:e});return i.data||(i.data=t("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(e)),this.trigger("prepared",{content:i.data}),i.data},n.prototype.update=function(){for(var e=0,i=this._pipe.length,s=t.proxy(function(t){return this[t]},this._invalidated),n={};e<i;)(this._invalidated.all||t.grep(this._pipe[e].filter,s).length>0)&&this._pipe[e].run(n),e++;this._invalidated={},!this.is("valid")&&this.enter("valid")},n.prototype.width=function(t){switch(t=t||n.Width.Default){case n.Width.Inner:case n.Width.Outer:return this._width;default:return"left"==this.settings.paddingType||"right"==this.settings.paddingType?this._width-this.settings.stagePadding+this.settings.margin:this._width-2*this.settings.stagePadding+this.settings.margin}},n.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},n.prototype.onThrottledResize=function(){e.clearTimeout(this.resizeTimer),this.resizeTimer=e.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},n.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.isVisible()&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},n.prototype.registerEventHandlers=function(){t.support.transition&&this.$stage.on(t.support.transition.end+".owl.core",t.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&&this.on(e,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",t.proxy(this.onDragEnd,this)))},n.prototype.onDragStart=function(e){var s=null;3!==e.which&&(t.support.transform?s={x:(s=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","))[16===s.length?12:4],y:s[16===s.length?13:5]}:(s=this.$stage.position(),s={x:this.settings.rtl?s.left+this.$stage.width()-this.width()+this.settings.margin:s.left,y:s.top}),this.is("animating")&&(t.support.transform?this.animate(s.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===e.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=t(e.target),this._drag.stage.start=s,this._drag.stage.current=s,this._drag.pointer=this.pointer(e),t(i).on("mouseup.owl.core touchend.owl.core",t.proxy(this.onDragEnd,this)),t(i).one("mousemove.owl.core touchmove.owl.core",t.proxy(function(e){var s=this.difference(this._drag.pointer,this.pointer(e));t(i).on("mousemove.owl.core touchmove.owl.core",t.proxy(this.onDragMove,this)),Math.abs(s.x)<Math.abs(s.y)&&this.is("valid")||(e.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},n.prototype.onDragMove=function(t){var e=null,i=null,s=null,n=this.difference(this._drag.pointer,this.pointer(t)),o=this.difference(this._drag.stage.start,n);this.is("dragging")&&(t.preventDefault(),this.settings.loop?(e=this.coordinates(this.minimum()),i=this.coordinates(this.maximum()+1)-e,o.x=((o.x-e)%i+i)%i+e):(e=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),i=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),s=this.settings.pullDrag?-1*n.x/5:0,o.x=Math.max(Math.min(o.x,e+s),i+s)),this._drag.stage.current=o,this.animate(o.x))},n.prototype.onDragEnd=function(e){var s=this.difference(this._drag.pointer,this.pointer(e)),n=this._drag.stage.current,o=s.x>0^this.settings.rtl?"left":"right";t(i).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==s.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(n.x,0!==s.x?o:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=o,(Math.abs(s.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},n.prototype.closest=function(e,i){var s=-1,n=this.width(),o=this.coordinates();return this.settings.freeDrag||t.each(o,t.proxy(function(t,r){return"left"===i&&e>r-30&&e<r+30?s=t:"right"===i&&e>r-n-30&&e<r-n+30?s=t+1:this.op(e,"<",r)&&this.op(e,">",void 0!==o[t+1]?o[t+1]:r-n)&&(s="left"===i?t+1:t),-1===s},this)),this.settings.loop||(this.op(e,">",o[this.minimum()])?s=e=this.minimum():this.op(e,"<",o[this.maximum()])&&(s=e=this.maximum())),s},n.prototype.animate=function(e){var i=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),i&&(this.enter("animating"),this.trigger("translate")),t.support.transform3d&&t.support.transition?this.$stage.css({transform:"translate3d("+(e-1)+"px,0px,0px)",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")}):i?this.$stage.animate({left:e+"px"},this.speed(),this.settings.fallbackEasing,t.proxy(this.onTransitionEnd,this)):this.$stage.css({left:e+"px"})},n.prototype.is=function(t){return this._states.current[t]&&this._states.current[t]>0},n.prototype.current=function(t){if(void 0===t)return this._current;if(0!==this._items.length){if(t=this.normalize(t),this._current!==t){var e=this.trigger("change",{property:{name:"position",value:t}});void 0!==e.data&&(t=this.normalize(e.data)),this._current=t,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current}},n.prototype.invalidate=function(e){return"string"===t.type(e)&&(this._invalidated[e]=!0,this.is("valid")&&this.leave("valid")),t.map(this._invalidated,function(t,e){return e})},n.prototype.reset=function(t){void 0!==(t=this.normalize(t))&&(this._speed=0,this._current=t,this.suppress(["translate","translated"]),this.animate(this.coordinates(t)),this.release(["translate","translated"]))},n.prototype.normalize=function(t,e){var i=this._items.length,s=e?0:this._clones.length;return!this.isNumeric(t)||i<1?t=void 0:(t<0||t>=i+s)&&(t=((t-s/2)%i+i)%i+s/2),t},n.prototype.relative=function(t){return t-=this._clones.length/2,this.normalize(t,!0)},n.prototype.maximum=function(t){var e,i,s,n=this.settings,o=this._coordinates.length;if(n.loop)o=this._clones.length/2+this._items.length-1;else if(n.autoWidth||n.merge){if(e=this._items.length)for(i=this._items[--e].width(),s=this.$element.width();e--&&!((i+=this._items[e].width()+this.settings.margin)>s););o=e+1}else o=n.center?this._items.length-1:this._items.length-n.items;return t&&(o-=this._clones.length/2),Math.max(o,0)},n.prototype.minimum=function(t){return t?0:this._clones.length/2},n.prototype.items=function(t){return void 0===t?this._items.slice():(t=this.normalize(t,!0),this._items[t])},n.prototype.mergers=function(t){return void 0===t?this._mergers.slice():(t=this.normalize(t,!0),this._mergers[t])},n.prototype.clones=function(e){var i=this._clones.length/2,s=i+this._items.length,n=function(t){return t%2==0?s+t/2:i-(t+1)/2};return void 0===e?t.map(this._clones,function(t,e){return n(e)}):t.map(this._clones,function(t,i){return t===e?n(i):null})},n.prototype.speed=function(t){return void 0!==t&&(this._speed=t),this._speed},n.prototype.coordinates=function(e){var i,s=1,n=e-1;return void 0===e?t.map(this._coordinates,t.proxy(function(t,e){return this.coordinates(e)},this)):(this.settings.center?(this.settings.rtl&&(s=-1,n=e+1),i=this._coordinates[e],i+=(this.width()-i+(this._coordinates[n]||0))/2*s):i=this._coordinates[n]||0,i=Math.ceil(i))},n.prototype.duration=function(t,e,i){return 0===i?0:Math.min(Math.max(Math.abs(e-t),1),6)*Math.abs(i||this.settings.smartSpeed)},n.prototype.to=function(t,e){var i=this.current(),s=null,n=t-this.relative(i),o=(n>0)-(n<0),r=this._items.length,a=this.minimum(),h=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(n)>r/2&&(n+=-1*o*r),(s=(((t=i+n)-a)%r+r)%r+a)!==t&&s-n<=h&&s-n>0&&(i=s-n,t=s,this.reset(i))):t=this.settings.rewind?(t%(h+=1)+h)%h:Math.max(a,Math.min(h,t)),this.speed(this.duration(i,t,e)),this.current(t),this.isVisible()&&this.update()},n.prototype.next=function(t){t=t||!1,this.to(this.relative(this.current())+1,t)},n.prototype.prev=function(t){t=t||!1,this.to(this.relative(this.current())-1,t)},n.prototype.onTransitionEnd=function(t){if(void 0!==t&&(t.stopPropagation(),(t.target||t.srcElement||t.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},n.prototype.viewport=function(){var s;return this.options.responsiveBaseElement!==e?s=t(this.options.responsiveBaseElement).width():e.innerWidth?s=e.innerWidth:i.documentElement&&i.documentElement.clientWidth?s=i.documentElement.clientWidth:console.warn("Can not detect viewport width."),s},n.prototype.replace=function(e){this.$stage.empty(),this._items=[],e&&(e=e instanceof jQuery?e:t(e)),this.settings.nestedItemSelector&&(e=e.find("."+this.settings.nestedItemSelector)),e.filter(function(){return 1===this.nodeType}).each(t.proxy(function(t,e){e=this.prepare(e),this.$stage.append(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},n.prototype.add=function(e,i){var s=this.relative(this._current);i=void 0===i?this._items.length:this.normalize(i,!0),e=e instanceof jQuery?e:t(e),this.trigger("add",{content:e,position:i}),e=this.prepare(e),0===this._items.length||i===this._items.length?(0===this._items.length&&this.$stage.append(e),0!==this._items.length&&this._items[i-1].after(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[i].before(e),this._items.splice(i,0,e),this._mergers.splice(i,0,1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[s]&&this.reset(this._items[s].index()),this.invalidate("items"),this.trigger("added",{content:e,position:i})},n.prototype.remove=function(t){void 0!==(t=this.normalize(t,!0))&&(this.trigger("remove",{content:this._items[t],position:t}),this._items[t].remove(),this._items.splice(t,1),this._mergers.splice(t,1),this.invalidate("items"),this.trigger("removed",{content:null,position:t}))},n.prototype.preloadAutoWidthImages=function(e){e.each(t.proxy(function(e,i){this.enter("pre-loading"),i=t(i),t(new Image).one("load",t.proxy(function(t){i.attr("src",t.target.src),i.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",i.attr("src")||i.attr("data-src")||i.attr("data-src-retina"))},this))},n.prototype.destroy=function(){for(var s in this.$element.off(".owl.core"),this.$stage.off(".owl.core"),t(i).off(".owl.core"),!1!==this.settings.responsive&&(e.clearTimeout(this.resizeTimer),this.off(e,"resize",this._handlers.onThrottledResize)),this._plugins)this._plugins[s].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},n.prototype.op=function(t,e,i){var s=this.settings.rtl;switch(e){case"<":return s?t>i:t<i;case">":return s?t<i:t>i;case">=":return s?t<=i:t>=i;case"<=":return s?t>=i:t<=i}},n.prototype.on=function(t,e,i,s){t.addEventListener?t.addEventListener(e,i,s):t.attachEvent&&t.attachEvent("on"+e,i)},n.prototype.off=function(t,e,i,s){t.removeEventListener?t.removeEventListener(e,i,s):t.detachEvent&&t.detachEvent("on"+e,i)},n.prototype.trigger=function(e,i,s,o,r){var a={item:{count:this._items.length,index:this.current()}},h=t.camelCase(t.grep(["on",e,s],function(t){return t}).join("-").toLowerCase()),l=t.Event([e,"owl",s||"carousel"].join(".").toLowerCase(),t.extend({relatedTarget:this},a,i));return this._supress[e]||(t.each(this._plugins,function(t,e){e.onTrigger&&e.onTrigger(l)}),this.register({type:n.Type.Event,name:e}),this.$element.trigger(l),this.settings&&"function"==typeof this.settings[h]&&this.settings[h].call(this,l)),l},n.prototype.enter=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){void 0===this._states.current[e]&&(this._states.current[e]=0),this._states.current[e]++},this))},n.prototype.leave=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){this._states.current[e]--},this))},n.prototype.register=function(e){if(e.type===n.Type.Event){if(t.event.special[e.name]||(t.event.special[e.name]={}),!t.event.special[e.name].owl){var i=t.event.special[e.name]._default;t.event.special[e.name]._default=function(t){return!i||!i.apply||t.namespace&&-1!==t.namespace.indexOf("owl")?t.namespace&&t.namespace.indexOf("owl")>-1:i.apply(this,arguments)},t.event.special[e.name].owl=!0}}else e.type===n.Type.State&&(this._states.tags[e.name]?this._states.tags[e.name]=this._states.tags[e.name].concat(e.tags):this._states.tags[e.name]=e.tags,this._states.tags[e.name]=t.grep(this._states.tags[e.name],t.proxy(function(i,s){return t.inArray(i,this._states.tags[e.name])===s},this)))},n.prototype.suppress=function(e){t.each(e,t.proxy(function(t,e){this._supress[e]=!0},this))},n.prototype.release=function(e){t.each(e,t.proxy(function(t,e){delete this._supress[e]},this))},n.prototype.pointer=function(t){var i={x:null,y:null};return(t=(t=t.originalEvent||t||e.event).touches&&t.touches.length?t.touches[0]:t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t).pageX?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i},n.prototype.isNumeric=function(t){return!isNaN(parseFloat(t))},n.prototype.difference=function(t,e){return{x:t.x-e.x,y:t.y-e.y}},t.fn.owlCarousel=function(e){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var s=t(this),o=s.data("owl.carousel");o||(o=new n(this,"object"==typeof e&&e),s.data("owl.carousel",o),t.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(e,i){o.register({type:n.Type.Event,name:i}),o.$element.on(i+".owl.carousel.core",t.proxy(function(t){t.namespace&&t.relatedTarget!==this&&(this.suppress([i]),o[i].apply(this,[].slice.call(arguments,1)),this.release([i]))},o))})),"string"==typeof e&&"_"!==e.charAt(0)&&o[e].apply(o,i)})},t.fn.owlCarousel.Constructor=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={autoRefresh:!0,autoRefreshInterval:500},n.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=e.setInterval(t.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},n.prototype.refresh=function(){this._core.isVisible()!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},n.prototype.destroy=function(){var t,i;for(t in e.clearInterval(this._interval),this._handlers)this._core.$element.off(t,this._handlers[t]);for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoRefresh=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":t.proxy(function(e){if(e.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(e.property&&"position"==e.property.name||"initialized"==e.type)){var i=this._core.settings,s=i.center&&Math.ceil(i.items/2)||i.items,n=i.center&&-1*s||0,o=(e.property&&void 0!==e.property.value?e.property.value:this._core.current())+n,r=this._core.clones().length,a=t.proxy(function(t,e){this.load(e)},this);for(i.lazyLoadEager>0&&(s+=i.lazyLoadEager,i.loop&&(o-=i.lazyLoadEager,s++));n++<s;)this.load(r/2+this._core.relative(o)),r&&t.each(this._core.clones(this._core.relative(o)),a),o++}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={lazyLoad:!1,lazyLoadEager:0},n.prototype.load=function(i){var s=this._core.$stage.children().eq(i),n=s&&s.find(".owl-lazy");!n||t.inArray(s.get(0),this._loaded)>-1||(n.each(t.proxy(function(i,s){var n,o=t(s),r=e.devicePixelRatio>1&&o.attr("data-src-retina")||o.attr("data-src")||o.attr("data-srcset");this._core.trigger("load",{element:o,url:r},"lazy"),o.is("img")?o.one("load.owl.lazy",t.proxy(function(){o.css("opacity",1),this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("src",r):o.is("source")?o.one("load.owl.lazy",t.proxy(function(){this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("srcset",r):((n=new Image).onload=t.proxy(function(){o.css({"background-image":'url("'+r+'")',opacity:"1"}),this._core.trigger("loaded",{element:o,url:r},"lazy")},this),n.src=r)},this)),this._loaded.push(s.get(0)))},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this._core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Lazy=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(i){this._core=i,this._previousHeight=null,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&"position"===t.property.name&&this.update()},this),"loaded.owl.lazy":t.proxy(function(t){t.namespace&&this._core.settings.autoHeight&&t.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var s=this;t(e).on("load",function(){s._core.settings.autoHeight&&s.update()}),t(e).resize(function(){s._core.settings.autoHeight&&(null!=s._intervalId&&clearTimeout(s._intervalId),s._intervalId=setTimeout(function(){s.update()},250))})};n.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},n.prototype.update=function(){var e=this._core._current,i=e+this._core.settings.items,s=this._core.settings.lazyLoad,n=this._core.$stage.children().toArray().slice(e,i),o=[],r=0;t.each(n,function(e,i){o.push(t(i).height())}),(r=Math.max.apply(null,o))<=1&&s&&this._previousHeight&&(r=this._previousHeight),this._previousHeight=r,this._core.$stage.parent().height(r).addClass(this._core.settings.autoHeightClass)},n.prototype.destroy=function(){var t,e;for(t in this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoHeight=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.video&&this.isInFullScreen()&&t.preventDefault()},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&"position"===t.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find(".owl-video");i.length&&(i.css("display","none"),this.fetch(i,t(e.content)))}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",t.proxy(function(t){this.play(t)},this))};n.Defaults={video:!1,videoHeight:!1,videoWidth:!1},n.prototype.fetch=function(t,e){var i=t.attr("data-vimeo-id")?"vimeo":t.attr("data-vzaar-id")?"vzaar":"youtube",s=t.attr("data-vimeo-id")||t.attr("data-youtube-id")||t.attr("data-vzaar-id"),n=t.attr("data-width")||this._core.settings.videoWidth,o=t.attr("data-height")||this._core.settings.videoHeight,r=t.attr("href");if(!r)throw new Error("Missing video URL.");if((s=r.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/))[3].indexOf("youtu")>-1)i="youtube";else if(s[3].indexOf("vimeo")>-1)i="vimeo";else{if(!(s[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");i="vzaar"}s=s[6],this._videos[r]={type:i,id:s,width:n,height:o},e.attr("data-video",r),this.thumbnail(t,this._videos[r])},n.prototype.thumbnail=function(e,i){var s,n,o=i.width&&i.height?"width:"+i.width+"px;height:"+i.height+"px;":"",r=e.find("img"),a="src",h="",l=this._core.settings,c=function(i){'<div class="owl-video-play-icon"></div>',s=l.lazyLoad?t("<div/>",{class:"owl-video-tn "+h,srcType:i}):t("<div/>",{class:"owl-video-tn",style:"opacity:1;background-image:url("+i+")"}),e.after(s),e.after('<div class="owl-video-play-icon"></div>')};if(e.wrap(t("<div/>",{class:"owl-video-wrapper",style:o})),this._core.settings.lazyLoad&&(a="data-src",h="owl-lazy"),r.length)return c(r.attr(a)),r.remove(),!1;"youtube"===i.type?(n="//img.youtube.com/vi/"+i.id+"/hqdefault.jpg",c(n)):"vimeo"===i.type?t.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){n=t[0].thumbnail_large,c(n)}}):"vzaar"===i.type&&t.ajax({type:"GET",url:"//vzaar.com/api/videos/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){n=t.framegrab_url,c(n)}})},n.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},n.prototype.play=function(e){var i,s=t(e.target).closest("."+this._core.settings.itemClass),n=this._videos[s.attr("data-video")],o=n.width||"100%",r=n.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),s=this._core.items(this._core.relative(s.index())),this._core.reset(s.index()),(i=t('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>')).attr("height",r),i.attr("width",o),"youtube"===n.type?i.attr("src","//www.youtube.com/embed/"+n.id+"?autoplay=1&rel=0&v="+n.id):"vimeo"===n.type?i.attr("src","//player.vimeo.com/video/"+n.id+"?autoplay=1"):"vzaar"===n.type&&i.attr("src","//view.vzaar.com/"+n.id+"/player?autoplay=true"),t(i).wrap('<div class="owl-video-frame" />').insertAfter(s.find(".owl-video")),this._playing=s.addClass("owl-video-playing"))},n.prototype.isInFullScreen=function(){var e=i.fullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement;return e&&t(e).parent().hasClass("owl-video-frame")},n.prototype.destroy=function(){var t,e;for(t in this._core.$element.off("click.owl.video"),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Video=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this.core=e,this.core.options=t.extend({},n.Defaults,this.core.options),this.swapping=!0,this.previous=void 0,this.next=void 0,this.handlers={"change.owl.carousel":t.proxy(function(t){t.namespace&&"position"==t.property.name&&(this.previous=this.core.current(),this.next=t.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":t.proxy(function(t){t.namespace&&(this.swapping="translated"==t.type)},this),"translate.owl.carousel":t.proxy(function(t){t.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};n.Defaults={animateOut:!1,animateIn:!1},n.prototype.swap=function(){if(1===this.core.settings.items&&t.support.animation&&t.support.transition){this.core.speed(0);var e,i=t.proxy(this.clear,this),s=this.core.$stage.children().eq(this.previous),n=this.core.$stage.children().eq(this.next),o=this.core.settings.animateIn,r=this.core.settings.animateOut;this.core.current()!==this.previous&&(r&&(e=this.core.coordinates(this.previous)-this.core.coordinates(this.next),s.one(t.support.animation.end,i).css({left:e+"px"}).addClass("animated owl-animated-out").addClass(r)),o&&n.one(t.support.animation.end,i).addClass("animated owl-animated-in").addClass(o))}},n.prototype.clear=function(e){t(e.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this.core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Animate=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={"changed.owl.carousel":t.proxy(function(t){t.namespace&&"settings"===t.property.name?this._core.settings.autoplay?this.play():this.stop():t.namespace&&"position"===t.property.name&&this._paused&&(this._time=0)},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":t.proxy(function(t,e,i){t.namespace&&this.play(e,i)},this),"stop.owl.autoplay":t.proxy(function(t){t.namespace&&this.stop()},this),"mouseover.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=t.extend({},n.Defaults,this._core.options)};n.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},n.prototype._next=function(s){this._call=e.setTimeout(t.proxy(this._next,this,s),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is("interacting")||i.hidden||this._core.next(s||this._core.settings.autoplaySpeed)},n.prototype.read=function(){return(new Date).getTime()-this._time},n.prototype.play=function(i,s){var n;this._core.is("rotating")||this._core.enter("rotating"),i=i||this._core.settings.autoplayTimeout,n=Math.min(this._time%(this._timeout||i),i),this._paused?(this._time=this.read(),this._paused=!1):e.clearTimeout(this._call),this._time+=this.read()%i-n,this._timeout=i,this._call=e.setTimeout(t.proxy(this._next,this,s),i-n)},n.prototype.stop=function(){this._core.is("rotating")&&(this._time=0,this._paused=!0,e.clearTimeout(this._call),this._core.leave("rotating"))},n.prototype.pause=function(){this._core.is("rotating")&&!this._paused&&(this._time=this.read(),this._paused=!0,e.clearTimeout(this._call))},n.prototype.destroy=function(){var t,e;for(t in this.stop(),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&&(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.autoplay=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(e){this._core=e,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":t.proxy(function(e){e.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+t(e.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,0,this._templates.pop())},this),"remove.owl.carousel":t.proxy(function(t){t.namespace&&this._core.settings.dotsData&&this._templates.splice(t.position,1)},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&&"position"==t.property.name&&this.draw()},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers)};n.Defaults={nav:!1,navText:['<span aria-label="Previous">&#x2039;</span>','<span aria-label="Next">&#x203a;</span>'],navSpeed:!1,navElement:'button type="button" role="presentation"',navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,changeItemOnClick:!1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},n.prototype.initialize=function(){var e,i=this._core.settings;if(this._controls.$relative=(i.navContainer?t(i.navContainer):t("<div>").addClass(i.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=t("<"+i.navElement+' value="previous item" title="previous item">').addClass(i.navClass[0]).html(i.navText[0]).prependTo(this._controls.$relative).on("click",t.proxy(function(t){this.prev(i.navSpeed)},this)),this._controls.$next=t("<"+i.navElement+' value="next item" title="next item">').addClass(i.navClass[1]).html(i.navText[1]).appendTo(this._controls.$relative).on("click",t.proxy(function(t){this.next(i.navSpeed)},this)),i.changeItemOnClick){var s=this._core.$stage.children(),n=this._core.clones().length/2;s.on("click",t.proxy(function(e){var s=t(e.currentTarget).index();this.to(s-n,i.navSpeed,!0)},this))}for(e in i.dotsData||(this._templates=[t('<button role="button">').addClass(i.dotClass).append(t("<span>")).prop("outerHTML")]),this._controls.$absolute=(i.dotsContainer?t(i.dotsContainer):t("<div>").addClass(i.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","button",t.proxy(function(e){var s=t(e.target).parent().is(this._controls.$absolute)?t(e.target).index():t(e.target).parent().index();console.log(t(e.target).index()),e.preventDefault(),this.to(s,i.dotsSpeed)},this)),this._overrides)this._core[e]=t.proxy(this[e],this)},n.prototype.destroy=function(){var t,e,i,s,n;for(t in n=this._core.settings,this._handlers)this.$element.off(t,this._handlers[t]);for(e in this._controls)"$relative"===e&&n.navContainer?this._controls[e].html(""):this._controls[e].remove();for(s in this.overides)this._core[s]=this._overrides[s];for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},n.prototype.update=function(){var t,e,i=this._core.clones().length/2,s=i+this._core.items().length,n=this._core.maximum(!0),o=this._core.settings,r=o.center||o.autoWidth||o.dotsData?1:o.dotsEach||o.items;if("page"!==o.slideBy&&(o.slideBy=Math.min(o.slideBy,o.items)),o.dots||"page"==o.slideBy)for(this._pages=[],t=i,e=0,0;t<s;t++){if(e>=r||0===e){if(this._pages.push({start:Math.min(n,t-i),end:t-i+r-1}),Math.min(n,t-i)===n)break;e=0,0}e+=this._core.mergers(this._core.relative(t))}},n.prototype.draw=function(){var e,i=this._core.settings,s=this._core.items().length<=i.items,n=this._core.relative(this._core.current()),o=i.loop||i.rewind;this._controls.$relative.toggleClass("disabled",!i.nav||s),i.nav&&(this._controls.$previous.toggleClass("disabled",!o&&n<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!o&&n>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!i.dots||s),i.dots&&(e=this._pages.length-this._controls.$absolute.children().length,i.dotsData&&0!==e?this._controls.$absolute.html(this._templates.join("")):e>0?this._controls.$absolute.append(new Array(e+1).join(this._templates[0])):e<0&&this._controls.$absolute.children().slice(e).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(t.inArray(this.current(),this._pages)).addClass("active"))},n.prototype.onTrigger=function(e){var i=this._core.settings;e.page={index:t.inArray(this.current(),this._pages),count:this._pages.length,size:i&&(i.center||i.autoWidth||i.dotsData?1:i.dotsEach||i.items)}},n.prototype.current=function(){var e=this._core.relative(this._core.current());return t.grep(this._pages,t.proxy(function(t,i){return t.start<=e&&t.end>=e},this)).pop()},n.prototype.getPosition=function(e){var i,s,n=this._core.settings;return"page"==n.slideBy?(i=t.inArray(this.current(),this._pages),s=this._pages.length,e?++i:--i,i=this._pages[(i%s+s)%s].start):(i=this._core.relative(this._core.current()),s=this._core.items().length,e?i+=n.slideBy:i-=n.slideBy),i},n.prototype.next=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!0),e)},n.prototype.prev=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!1),e)},n.prototype.to=function(e,i,s){var n;!s&&this._pages.length?(n=this._pages.length,t.proxy(this._overrides.to,this._core)(this._pages[(e%n+n)%n].start,i)):t.proxy(this._overrides.to,this._core)(e,i)},t.fn.owlCarousel.Constructor.Plugins.Navigation=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(i){this._core=i,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":t.proxy(function(i){i.namespace&&"URLHash"===this._core.settings.startPosition&&t(e).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!i)return;this._hashes[i]=e.content}},this),"changed.owl.carousel":t.proxy(function(i){if(i.namespace&&"position"===i.property.name){var s=this._core.items(this._core.relative(this._core.current())),n=t.map(this._hashes,function(t,e){return t===s?e:null}).join();if(!n||e.location.hash.slice(1)===n)return;e.location.hash=n}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers),t(e).on("hashchange.owl.navigation",t.proxy(function(t){var i=e.location.hash.substring(1),s=this._core.$stage.children(),n=this._hashes[i]&&s.index(this._hashes[i]);void 0!==n&&n!==this._core.current()&&this._core.to(this._core.relative(n),!1,!0)},this))};n.Defaults={URLhashListener:!1},n.prototype.destroy=function(){var i,s;for(i in t(e).off("hashchange.owl.navigation"),this._handlers)this._core.$element.off(i,this._handlers[i]);for(s in Object.getOwnPropertyNames(this))"function"!=typeof this[s]&&(this[s]=null)},t.fn.owlCarousel.Constructor.Plugins.Hash=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=t("<support>").get(0).style,o="Webkit Moz O ms".split(" "),r={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},a=function(){return!!c("transform")},h=function(){return!!c("perspective")},l=function(){return!!c("animation")};function c(e,i){var r=!1,a=e.charAt(0).toUpperCase()+e.slice(1);return t.each((e+" "+o.join(a+" ")+a).split(" "),function(t,e){if(n[e]!==s)return r=!i||e,!1}),r}function p(t){return c(t,!0)}(function(){return!!c("transition")})()&&(t.support.transition=new String(p("transition")),t.support.transition.end=r.transition.end[t.support.transition]),l()&&(t.support.animation=new String(p("animation")),t.support.animation.end=r.animation.end[t.support.animation]),a()&&(t.support.transform=new String(p("transform")),t.support.transform3d=h())}(window.Zepto||window.jQuery,window,document);
 
1
  /**
2
+ * Owl Carousel v2.3.7 - UE8
3
  * Copyright 2013-2018 David Deutsch
4
  * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
5
  */
15
  * @todo Test Zepto
16
  * @todo stagePadding calculate wrong active classes
17
  */
18
+
19
+ !function($,b,c,d){if(void 0===e)function e(a){console.log(a)}var f=!1;function g(a){if(!1==f)return!1;e(a)}function a(b,c){this.settings=null,this.options=$.extend({},a.Defaults,c),this.$element=$(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this.getItemWidth=function(){this.settings.paddingType;var a=(this.width()/this.settings.items).toFixed(3)-this.settings.margin;return this.settings.item_size_gap&&(a+=this.settings.item_size_gap),a},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},$.each(["onResize","onThrottledResize"],$.proxy(function(b,a){this._handlers[a]=$.proxy(this[a],this)},this)),$.each(a.Plugins,$.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),$.each(a.Workers,$.proxy(function(b,a){this._pipe.push({filter:a.filter,run:$.proxy(a.run,this)})},this)),this.setup(),this.initialize()}a.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,setActiveClass:!0,setActiveClassOnMobile:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,paddingType:"none",stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",slideTransition:"",info:!1,scrollToHead:!1,scrollToHeadOffset:0,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab",shuffle:!1,item_size_gap:0,pixel_gap_fix:!1,debug:!1},a.Width={Default:"default",Inner:"inner",Outer:"outer"},a.Type={Event:"event",State:"state"},a.Plugins={},a.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width(),g("set total width this._width: "+this._width)}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(d){var a=this.settings.margin||"",e=!this.settings.autoWidth,b=this.settings.rtl,c={width:"auto","margin-left":b?a:"","margin-right":b?"":a};e||this.$stage.children().css(c),d.css=c}},{filter:["width","items","settings"],run:function(b){!0===this.settings.debug&&(f=!0),g("run!"),1==this.settings.items&& !0==this.settings.pixel_gap_fix&&(this.settings.item_size_gap=1,g("set items size gap: 1")),g("settings - stage padding type: "+this.settings.paddingType),g("settings - stage padding: "+this.settings.stagePadding),(!this.settings.paddingType||"none"==this.settings.paddingType)&&this.settings.stagePadding&&(this.settings.paddingType="both",g("set stage padding type - both"));var a=this.getItemWidth();if(g("Item width: "+a),this.settings.stagePadding>a){this.settings.stagePadding=0;var c=this.getItemWidth();this.settings.stagePadding=Math.floor(.5*c);var a=this.getItemWidth();g("set new stagePadding: "+this.settings.stagePadding+" and item width: "+a)}for(merge=null,iterator=this._items.length,grid=!this.settings.autoWidth,widths=[],b.items={merge:!1,width:a};iterator--;)merge=this._mergers[iterator],merge=this.settings.mergeFit&&Math.min(merge,this.settings.items)||merge,b.items.merge=merge>1||b.items.merge,widths[iterator]=grid?a*merge:this._items[iterator].width();this._widths=widths}},{filter:["items","settings"],run:function(){var a=[],b=this._items,c=this.settings,f=Math.max(2*c.items,4),h=2*Math.ceil(b.length/2),d=c.loop&&b.length?c.rewind?f:Math.max(f,h):0,g="",e="";for(d/=2;d>0;)a.push(this.normalize(a.length/2,!0)),g+=b[a[a.length-1]][0].outerHTML,a.push(this.normalize(b.length-1-(a.length-1)/2,!0)),e=b[a[a.length-1]][0].outerHTML+e,d-=1;this._clones=a,$(g).addClass("cloned").appendTo(this.$stage),$(e).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var c=this.settings.rtl?1:-1,d=this._clones.length+this._items.length,b=-1,h=0,a=[];++b<d;){var e=(a[b-1]||0)+(this._widths[this.relative(b)]+this.settings.margin)*c;a.push(e)}if(this.settings.item_size_gap)for(var f in a)a[f]-=this.settings.item_size_gap;g("Set coordinates"),g(a),this._coordinates=a}},{filter:["width","items","settings"],run:function(){var b=this.settings.stagePadding,a=this._coordinates,e=this.settings.paddingType,c=this.$stage.parent(),j=c.width();g("parent Outer Stage Width: "+c.width()),g("element width this.$element.width(): "+this.$element.width());var k={width:Math.ceil(Math.abs(a[a.length-1])),"padding-left":"","padding-right":""},f={width:Math.ceil(Math.abs(a[a.length-1]))+2*b,"padding-left":b||"","padding-right":b||""},h={width:Math.ceil(Math.abs(a[a.length-1]))+b,"padding-left":b||"","padding-right":""},i={width:Math.ceil(Math.abs(a[a.length-1]))+b,"padding-left":"","padding-right":b||""},d={width:j};g("set outer stage css"),g(d),"none"==e?(this.$stage.css(k),c.width(d)):"both"==e?(this.$stage.css(f),c.css(d),g("Set stage width css (both)"),g(f)):"left"==e?(this.$stage.css(h),c.css(d),g("Set stage width css (left)"),g(h)):"right"==e&&(this.$stage.css(i),c.css(d),g("Set stage width css (right)"),g(i))}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var b,c,a,f,g=this.settings.rtl?1:-1,d=2*this.settings.stagePadding,e=this.coordinates(this.current())+d,h=e+this.width()*g,i=[];for(("left"==this.settings.paddingType||"right"==this.settings.paddingType)&&(d=this.settings.stagePadding),a=0,f=this._coordinates.length;a<f;a++)b=this._coordinates[a-1]||0,c=Math.abs(this._coordinates[a])+d*g,(this.op(b,"<=",e)&&this.op(b,">",h)||this.op(c,"<",e)&&this.op(c,">",h))&&i.push(a);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass("active"),this.$stage.children(".center").removeClass("center"),this.settings.center&&this.$stage.children().eq(this.current()).addClass("center")}},{filter:["width","position","items","settings"],run:function(){if(this.settings.setActiveClass&&this.settings.setActiveClass){var a=!0;this.settings.setActiveClassOnMobile?1==this.$stage.children(".active").length&&(a=!0):this.settings.setActiveClassOnMobile||1!=this.$stage.children(".active").length||(a=!1),!0==a?this.$stage.children().eq(this.current()).addClass("uc-active-item").siblings().removeClass("uc-active-item"):!1==a&&this.$stage.children().removeClass("uc-active-item")}}}],a.prototype.initializeStage=function(){this.$stage=this.$element.find("."+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=$("<"+this.settings.stageElement+">",{class:this.settings.stageClass}).wrap($("<div/>",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},a.prototype.initializeItems=function(){var a=this.$element.find(".owl-item");if(a.length){this._items=a.get().map(function(a){return $(a)}),this._mergers=this._items.map(function(){return 1}),this.refresh();return}this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},a.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.shuffle){var a,b,c,e=this.$element;e.children().sort(function(){return Math.round(Math.random())-.5}).each(function(){e.append(this)})}this.settings.autoWidth&&!this.is("pre-loading")&&(a=this.$element.find("img"),b=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,c=this.$element.children(b).width(),a.length&&c<=0&&this.preloadAutoWidthImages(a)),this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},a.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(":visible")},a.prototype.setup=function(){var d=this.viewport(),b=this.options.responsive,c=-1,a=null;b?($.each(b,function(a){a<=d&&a>c&&(c=Number(a))}),"function"==typeof(a=$.extend({},this.options,b[c])).stagePadding&&(a.stagePadding=a.stagePadding()),delete a.responsive,a.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+c))):a=$.extend({},this.options),this.trigger("change",{property:{name:"settings",value:a}}),this._breakpoint=c,this.settings=a,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},a.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},a.prototype.prepare=function(b){var a=this.trigger("prepare",{content:b});return a.data||(a.data=$("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(b)),this.trigger("prepared",{content:a.data}),a.data},a.prototype.update=function(){for(var a=0,b=this._pipe.length,c=$.proxy(function(a){return this[a]},this._invalidated),d={};a<b;)(this._invalidated.all||$.grep(this._pipe[a].filter,c).length>0)&&this._pipe[a].run(d),a++;this._invalidated={},this.is("valid")||this.enter("valid")},a.prototype.width=function(c){var b;switch(c=c||a.Width.Default){case a.Width.Inner:case a.Width.Outer:b=this._width,g("calc width for dimention: "+c);default:switch(this.settings.paddingType){case"left":case"right":g("calc width with stagePadding: "+this.settings.paddingType),b=this._width-this.settings.stagePadding+this.settings.margin;break;case"both":g("calc width with stagePadding: "+this.settings.paddingType),b=this._width-2*this.settings.stagePadding+this.settings.margin;break;default:b=this._width+this.settings.margin,g("calc width without stagePadding for dimention: "+c)}}return g("carousel width (no stagepadding and margins): "+b),b},a.prototype.refresh=function(){g("---------------------refresh carousel-----------------------"),g("window width: "+b.innerWidth),g("element width: "+this.$element.width()),g("stage width: "+this.$stage.width()),this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},a.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},a.prototype.onResize=function(){return(g("---------------------resize carousel-----------------------"),this._items.length)?this.isVisible()?(g("resizing"),this.enter("resizing"),this.trigger("resize").isDefaultPrevented())?(this.leave("resizing"),!1):void(this.invalidate("width"),this.$stage.parent().css({width:""}),this.refresh(),this.update(),this.leave("resizing"),this.trigger("resized")):(g("not visible"),!1):(g("same length"),!1)},a.prototype.registerEventHandlers=function(){$.support.transition&&this.$stage.on($.support.transition.end+".owl.core",$.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&&this.on(b,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",$.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",$.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",$.proxy(this.onDragEnd,this)))},a.prototype.onDragStart=function(b){var a=null;3!==b.which&&($.support.transform?a={x:(a=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","))[16===a.length?12:4],y:a[16===a.length?13:5]}:(a=this.$stage.position(),a={x:this.settings.rtl?a.left+this.$stage.width()-this.width()+this.settings.margin:a.left,y:a.top}),this.is("animating")&&($.support.transform?this.animate(a.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===b.type),this.speed(0),this._drag.time=new Date().getTime(),this._drag.target=$(b.target),this._drag.stage.start=a,this._drag.stage.current=a,this._drag.pointer=this.pointer(b),$(c).on("mouseup.owl.core touchend.owl.core",$.proxy(this.onDragEnd,this)),$(c).one("mousemove.owl.core touchmove.owl.core",$.proxy(function(a){var b=this.difference(this._drag.pointer,this.pointer(a));$(c).on("mousemove.owl.core touchmove.owl.core",$.proxy(this.onDragMove,this)),Math.abs(b.x)<Math.abs(b.y)&&this.is("valid")||(a.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},a.prototype.onDragMove=function(e){var a=null,b=null,d=null,f=this.difference(this._drag.pointer,this.pointer(e)),c=this.difference(this._drag.stage.start,f);this.is("dragging")&&(e.preventDefault(),this.settings.loop?(a=this.coordinates(this.minimum()),b=this.coordinates(this.maximum()+1)-a,c.x=((c.x-a)%b+b)%b+a):(a=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),b=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),d=this.settings.pullDrag?-1*f.x/5:0,c.x=Math.max(Math.min(c.x,a+d),b+d)),this._drag.stage.current=c,this.animate(c.x))},a.prototype.onDragEnd=function(d){var a=this.difference(this._drag.pointer,this.pointer(d)),e=this._drag.stage.current,b=a.x>0^this.settings.rtl?"left":"right";$(c).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==a.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==a.x?b:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=b,(Math.abs(a.x)>3||new Date().getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},a.prototype.closest=function(a,e){var b=-1,f=this.width(),c=this.coordinates();return this.settings.freeDrag||$.each(c,$.proxy(function(g,h){return"left"===e&&a>h-30&&a<h+30?b=g:"right"===e&&a>h-f-30&&a<h-f+30?b=g+1:this.op(a,"<",h)&&this.op(a,">",d!==c[g+1]?c[g+1]:h-f)&&(b="left"===e?g+1:g),-1===b},this)),!this.settings.loop&&(this.op(a,">",c[this.minimum()])?b=a=this.minimum():this.op(a,"<",c[this.maximum()])&&(b=a=this.maximum())),b},a.prototype.animate=function(a){var b=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),b&&(this.enter("animating"),this.trigger("translate")),$.support.transition?(g("Go to coordinate: "+a),this.$stage.css({transform:"translateX("+a+"px)",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")})):b?this.$stage.animate({left:a+"px"},this.speed(),this.settings.fallbackEasing,$.proxy(this.onTransitionEnd,this)):this.$stage.css({left:a+"px"}),this.scrollToHead()},a.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},a.prototype.current=function(a){if(a===d)return this._current;if(0!==this._items.length){if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});d!==b.data&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current}},a.prototype.invalidate=function(a){return"string"===$.type(a)&&(this._invalidated[a]=!0,this.is("valid")&&this.leave("valid")),$.map(this._invalidated,function(b,a){return a})},a.prototype.reset=function(a){d!==(a=this.normalize(a))&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},a.prototype.normalize=function(a,e){var b=this._items.length,c=e?0:this._clones.length;return!this.isNumeric(a)||b<1?a=d:(a<0||a>=b+c)&&(a=((a-c/2)%b+b)%b+c/2),a},a.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},a.prototype.maximum=function(f){var a,d,e,b=this.settings,c=this._coordinates.length;if(b.loop)c=this._clones.length/2+this._items.length-1;else if(b.autoWidth||b.merge){if(a=this._items.length)for(d=this._items[--a].width(),e=this.$element.width();(a--)&&!((d+=this._items[a].width()+this.settings.margin)>e););c=a+1}else c=b.center?this._items.length-1:this._items.length-b.items;return f&&(c-=this._clones.length/2),Math.max(c,0)},a.prototype.minimum=function(a){return a?0:this._clones.length/2},a.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},a.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},a.prototype.clones=function(a){var b=this._clones.length/2,c=b+this._items.length,e=function(a){return a%2==0?c+a/2:b-(a+1)/2};return a===d?$.map(this._clones,function(b,a){return e(a)}):$.map(this._clones,function(b,c){return b===a?e(c):null})},a.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},a.prototype.coordinates=function(b){var a,e=1,c=b-1;return b===d?$.map(this._coordinates,$.proxy(function(b,a){return this.coordinates(a)},this)):(this.settings.center?(this.settings.rtl&&(e=-1,c=b+1),a=this._coordinates[b],a+=(this.width()-a+(this._coordinates[c]||0))/2*e):a=this._coordinates[c]||0,a=Math.ceil(a))},a.prototype.duration=function(b,c,a){return 0===a?0:Math.min(Math.max(Math.abs(c-b),1),6)*Math.abs(a||this.settings.smartSpeed)},a.prototype.to=function(a,h){var d=this.current(),e=null,b=a-this.relative(d),f=this._items.length,g=this.minimum(),c=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(b)>f/2&&(b+=-1*((b>0)-(b<0))*f),(e=(((a=d+b)-g)%f+f)%f+g)!==a&&e-b<=c&&e-b>0&&(d=e-b,a=e,this.reset(d))):this.settings.rewind?(c+=1,a=(a%c+c)%c):a=Math.max(g,Math.min(c,a)),this.speed(this.duration(d,a,h)),this.current(a),this.isVisible()&&this.update()},a.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},a.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},a.prototype.onTransitionEnd=function(a){if(a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},a.prototype.viewport=function(){var a;return this.options.responsiveBaseElement!==b?a=$(this.options.responsiveBaseElement).width():b.innerWidth?a=b.innerWidth:c.documentElement&&c.documentElement.clientWidth?a=c.documentElement.clientWidth:console.warn("Can not detect viewport width."),a},a.prototype.replace=function(a){this.$stage.empty(),this._items=[],a&&(a=a instanceof jQuery?a:$(a)),this.settings.nestedItemSelector&&(a=a.find("."+this.settings.nestedItemSelector)),a.filter(function(){return 1===this.nodeType}).each($.proxy(function(b,a){a=this.prepare(a),this.$stage.append(a),this._items.push(a),this._mergers.push(1*a.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},a.prototype.add=function(a,b){var c=this.relative(this._current);b=b===d?this._items.length:this.normalize(b,!0),a=a instanceof jQuery?a:$(a),this.trigger("add",{content:a,position:b}),a=this.prepare(a),0===this._items.length||b===this._items.length?(0===this._items.length&&this.$stage.append(a),0!==this._items.length&&this._items[b-1].after(a),this._items.push(a),this._mergers.push(1*a.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[b].before(a),this._items.splice(b,0,a),this._mergers.splice(b,0,1*a.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[c]&&this.reset(this._items[c].index()),this.invalidate("items"),this.trigger("added",{content:a,position:b})},a.prototype.remove=function(a){d!==(a=this.normalize(a,!0))&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},a.prototype.preloadAutoWidthImages=function(a){a.each($.proxy(function(b,a){this.enter("pre-loading"),a=$(a),$(new Image).one("load",$.proxy(function(b){a.attr("src",b.target.src),a.css("opacity",1),this.leave("pre-loading"),this.is("pre-loading")||this.is("initializing")||this.refresh()},this)).attr("src",a.attr("src")||a.attr("data-src")||a.attr("data-src-retina"))},this))},a.prototype.isElementInViewport=function(a){var c=a.offset().top,e=c+a.outerHeight(),d=jQuery(b).scrollTop(),f=d+jQuery(b).height();return e>d&&c<f},a.prototype.scrollToTop=function(a,b){jQuery("html, body").animate({scrollTop:a+b},400)},a.prototype.scrollToHead=function(){if(!1==this.settings.scrollToHead|| !0==this.settings.autoplay||this.is("initializing")||this.is("resizing"))return!1;var a=this.$element;if(!0==this.isElementInViewport(a))return!1;var b=this.$element.offset().top,c=this.settings.scrollToHeadOffset;this.scrollToTop(b,c)},a.prototype.destroy=function(){for(var a in this.$element.off(".owl.core"),this.$stage.off(".owl.core"),$(c).off(".owl.core"),!1!==this.settings.responsive&&(b.clearTimeout(this.resizeTimer),this.off(b,"resize",this._handlers.onThrottledResize)),this._plugins)this._plugins[a].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},a.prototype.op=function(a,d,b){var c=this.settings.rtl;switch(d){case"<":return c?a>b:a<b;case">":return c?a<b:a>b;case">=":return c?a<=b:a>=b;case"<=":return c?a>=b:a<=b}},a.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},a.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},a.prototype.trigger=function(b,f,d,h,i){var g={item:{count:this._items.length,index:this.current()}},e=$.camelCase($.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),c=$.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),$.extend({relatedTarget:this},g,f));return!this._supress[b]&&($.each(this._plugins,function(b,a){a.onTrigger&&a.onTrigger(c)}),this.register({type:a.Type.Event,name:b}),this.$element.trigger(c),this.settings&&"function"==typeof this.settings[e]&&this.settings[e].call(this,c)),c},a.prototype.enter=function(a){$.each([a].concat(this._states.tags[a]||[]),$.proxy(function(b,a){d===this._states.current[a]&&(this._states.current[a]=0),this._states.current[a]++},this))},a.prototype.leave=function(a){$.each([a].concat(this._states.tags[a]||[]),$.proxy(function(b,a){this._states.current[a]--},this))},a.prototype.register=function(b){if(b.type===a.Type.Event){if($.event.special[b.name]||($.event.special[b.name]={}),!$.event.special[b.name].owl){var c=$.event.special[b.name]._default;$.event.special[b.name]._default=function(a){return c&&c.apply&&(!a.namespace|| -1===a.namespace.indexOf("owl"))?c.apply(this,arguments):a.namespace&&a.namespace.indexOf("owl")> -1},$.event.special[b.name].owl=!0}}else b.type===a.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=$.grep(this._states.tags[b.name],$.proxy(function(a,c){return $.inArray(a,this._states.tags[b.name])===c},this)))},a.prototype.suppress=function(a){$.each(a,$.proxy(function(b,a){this._supress[a]=!0},this))},a.prototype.release=function(a){$.each(a,$.proxy(function(b,a){delete this._supress[a]},this))},a.prototype.pointer=function(a){var c={x:null,y:null};return(a=(a=a.originalEvent||a||b.event).touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a).pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},a.prototype.isNumeric=function(a){return!isNaN(parseFloat(a))},a.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},$.fn.owlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=$(this),d=e.data("owl.carousel");d||(d=new a(this,"object"==typeof b&&b),e.data("owl.carousel",d),$.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(c,b){d.register({type:a.Type.Event,name:b}),d.$element.on(b+".owl.carousel.core",$.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([b]),d[b].apply(this,[].slice.call(arguments,1)),this.release([b]))},d))})),"string"==typeof b&&"_"!==b.charAt(0)&&d[b].apply(d,c)})},$.fn.owlCarousel.Constructor=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){var a=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=$.extend({},a.Defaults,this._core.options),this._core.$element.on(this._handlers)};a.Defaults={autoRefresh:!0,autoRefreshInterval:500},a.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=b.setInterval($.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},a.prototype.refresh=function(){this._core.isVisible()!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},a.prototype.destroy=function(){var a,c;for(a in b.clearInterval(this._interval),this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},$.fn.owlCarousel.Constructor.Plugins.AutoRefresh=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){var a=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":$.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type)){var a=this._core.settings,c=a.center&&Math.ceil(a.items/2)||a.items,e=a.center&& -1*c||0,d=(b.property&& void 0!==b.property.value?b.property.value:this._core.current())+e,f=this._core.clones().length,g=$.proxy(function(b,a){this.load(a)},this);for(a.lazyLoadEager>0&&(c+=a.lazyLoadEager,a.loop&&(d-=a.lazyLoadEager,c++));(e++)<c;)this.load(f/2+this._core.relative(d)),f&&$.each(this._core.clones(this._core.relative(d)),g),d++}},this)},this._core.options=$.extend({},a.Defaults,this._core.options),this._core.$element.on(this._handlers)};a.Defaults={lazyLoad:!1,lazyLoadEager:0},a.prototype.load=function(d){var a=this._core.$stage.children().eq(d),c=a&&a.find(".owl-lazy");!c||$.inArray(a.get(0),this._loaded)> -1||(c.each($.proxy(function(f,e){var d,a=$(e),c=b.devicePixelRatio>1&&a.attr("data-src-retina")||a.attr("data-src")||a.attr("data-srcset");this._core.trigger("load",{element:a,url:c},"lazy"),a.is("img")?a.one("load.owl.lazy",$.proxy(function(){a.css("opacity",1),this._core.trigger("loaded",{element:a,url:c},"lazy")},this)).attr("src",c):a.is("source")?a.one("load.owl.lazy",$.proxy(function(){this._core.trigger("loaded",{element:a,url:c},"lazy")},this)).attr("srcset",c):((d=new Image).onload=$.proxy(function(){a.css({"background-image":'url("'+c+'")',opacity:"1"}),this._core.trigger("loaded",{element:a,url:c},"lazy")},this),d.src=c)},this)),this._loaded.push(a.get(0)))},a.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},$.fn.owlCarousel.Constructor.Plugins.Lazy=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){var a=function(c){this._core=c,this._previousHeight=null,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&"position"===a.property.name&&this.update()},this),"loaded.owl.lazy":$.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=$.extend({},a.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var d=this;$(b).on("load",function(){d._core.settings.autoHeight&&d.update()}),$(b).resize(function(){d._core.settings.autoHeight&&(null!=d._intervalId&&clearTimeout(d._intervalId),d._intervalId=setTimeout(function(){d.update()},250))})};a.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},a.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.settings.lazyLoad,e=this._core.$stage.children().toArray().slice(b,c),f=[],a=0;$.each(e,function(b,a){f.push($(a).height())}),(a=Math.max.apply(null,f))<=1&&d&&this._previousHeight&&(a=this._previousHeight),this._previousHeight=a,this._core.$stage.parent().height(a).addClass(this._core.settings.autoHeightClass)},a.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},$.fn.owlCarousel.Constructor.Plugins.AutoHeight=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){var a=function(b){this._core=b,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":$.proxy(function(a){a.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),"refreshed.owl.carousel":$.proxy(function(a){a.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":$.proxy(function(a){a.namespace&&"position"===a.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":$.proxy(function(a){if(a.namespace){var b=$(a.content).find(".owl-video");b.length&&(b.css("display","none"),this.fetch(b,$(a.content)))}},this)},this._core.options=$.extend({},a.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",$.proxy(function(a){this.play(a)},this))};a.Defaults={video:!1,videoHeight:!1,videoWidth:!1},a.prototype.fetch=function(a,e){var d=a.attr("data-vimeo-id")?"vimeo":a.attr("data-vzaar-id")?"vzaar":"youtube",b=a.attr("data-vimeo-id")||a.attr("data-youtube-id")||a.attr("data-vzaar-id"),f=a.attr("data-width")||this._core.settings.videoWidth,g=a.attr("data-height")||this._core.settings.videoHeight,c=a.attr("href");if(c){if((b=c.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/))[3].indexOf("youtu")> -1)d="youtube";else if(b[3].indexOf("vimeo")> -1)d="vimeo";else if(b[3].indexOf("vzaar")> -1)d="vzaar";else throw new Error("Video URL not supported.");b=b[6]}else throw new Error("Missing video URL.");this._videos[c]={type:d,id:b,width:f,height:g},e.attr("data-video",c),this.thumbnail(a,this._videos[c])},a.prototype.thumbnail=function(c,a){var i,j,f,g=a.width&&a.height?"width:"+a.width+"px;height:"+a.height+"px;":"",b=c.find("img"),d="src",h="",k=this._core.settings,e=function(a){j='<div class="owl-video-play-icon"></div>',i=k.lazyLoad?$("<div/>",{class:"owl-video-tn "+h,srcType:a}):$("<div/>",{class:"owl-video-tn",style:"opacity:1;background-image:url("+a+")"}),c.after(i),c.after(j)};if(c.wrap($("<div/>",{class:"owl-video-wrapper",style:g})),this._core.settings.lazyLoad&&(d="data-src",h="owl-lazy"),b.length)return e(b.attr(d)),b.remove(),!1;"youtube"===a.type?e(f="//img.youtube.com/vi/"+a.id+"/hqdefault.jpg"):"vimeo"===a.type?$.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+a.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){e(f=a[0].thumbnail_large)}}):"vzaar"===a.type&&$.ajax({type:"GET",url:"//vzaar.com/api/videos/"+a.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){e(f=a.framegrab_url)}})},a.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},a.prototype.play=function(d){var b,c=$(d.target).closest("."+this._core.settings.itemClass),a=this._videos[c.attr("data-video")],e=a.width||"100%",f=a.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),c=this._core.items(this._core.relative(c.index())),this._core.reset(c.index()),(b=$('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>')).attr("height",f),b.attr("width",e),"youtube"===a.type?b.attr("src","//www.youtube.com/embed/"+a.id+"?autoplay=1&rel=0&v="+a.id):"vimeo"===a.type?b.attr("src","//player.vimeo.com/video/"+a.id+"?autoplay=1"):"vzaar"===a.type&&b.attr("src","//view.vzaar.com/"+a.id+"/player?autoplay=true"),$(b).wrap('<div class="owl-video-frame" />').insertAfter(c.find(".owl-video")),this._playing=c.addClass("owl-video-playing"))},a.prototype.isInFullScreen=function(){var a=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return a&&$(a).parent().hasClass("owl-video-frame")},a.prototype.destroy=function(){var a,b;for(a in this._core.$element.off("click.owl.video"),this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},$.fn.owlCarousel.Constructor.Plugins.Video=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){var a=function(b){this.core=b,this.core.options=$.extend({},a.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":$.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":$.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":$.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};a.Defaults={animateOut:!1,animateIn:!1},a.prototype.swap=function(){if(1===this.core.settings.items&&$.support.animation&&$.support.transition){this.core.speed(0);var a,b=$.proxy(this.clear,this),e=this.core.$stage.children().eq(this.previous),f=this.core.$stage.children().eq(this.next),c=this.core.settings.animateIn,d=this.core.settings.animateOut;this.core.current()!==this.previous&&(d&&(a=this.core.coordinates(this.previous)-this.core.coordinates(this.next),e.one($.support.animation.end,b).css({left:a+"px"}).addClass("animated owl-animated-out").addClass(d)),c&&f.one($.support.animation.end,b).addClass("animated owl-animated-in").addClass(c))}},a.prototype.clear=function(a){$(a.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},a.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},$.fn.owlCarousel.Constructor.Plugins.Animate=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){var a=function(b){this._core=b,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={"changed.owl.carousel":$.proxy(function(a){a.namespace&&"settings"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&"position"===a.property.name&&this._paused&&(this._time=0)},this),"initialized.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":$.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":$.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":$.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":$.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":$.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":$.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=$.extend({},a.Defaults,this._core.options)};a.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},a.prototype._next=function(a){this._call=b.setTimeout($.proxy(this._next,this,a),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is("interacting")||c.hidden||this._core.next(a||this._core.settings.autoplaySpeed)},a.prototype.read=function(){return new Date().getTime()-this._time},a.prototype.play=function(a,d){var c;this._core.is("rotating")||this._core.enter("rotating"),a=a||this._core.settings.autoplayTimeout,c=Math.min(this._time%(this._timeout||a),a),this._paused?(this._time=this.read(),this._paused=!1):b.clearTimeout(this._call),this._time+=this.read()%a-c,this._timeout=a,this._call=b.setTimeout($.proxy(this._next,this,d),a-c)},a.prototype.stop=function(){this._core.is("rotating")&&(this._time=0,this._paused=!0,b.clearTimeout(this._call),this._core.leave("rotating"))},a.prototype.pause=function(){this._core.is("rotating")&&!this._paused&&(this._time=this.read(),this._paused=!0,b.clearTimeout(this._call))},a.prototype.destroy=function(){var a,b;for(a in this.stop(),this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},$.fn.owlCarousel.Constructor.Plugins.autoplay=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){"use strict";var a=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+$(a.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":$.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":$.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":$.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":$.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=$.extend({},a.Defaults,this._core.options),this.$element.on(this._handlers)};a.Defaults={nav:!1,navText:['<span aria-label="Previous">&#x2039;</span>','<span aria-label="Next">&#x203a;</span>'],navSpeed:!1,navElement:'button type="button" role="presentation"',navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,changeItemOnClick:!1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},a.prototype.initialize=function(){var b,a=this._core.settings;if(this._controls.$relative=(a.navContainer?$(a.navContainer):$("<div>").addClass(a.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=$("<"+a.navElement+' value="previous item" title="previous item">').addClass(a.navClass[0]).html(a.navText[0]).prependTo(this._controls.$relative).on("click",$.proxy(function(b){this.prev(a.navSpeed)},this)),this._controls.$next=$("<"+a.navElement+' value="next item" title="next item">').addClass(a.navClass[1]).html(a.navText[1]).appendTo(this._controls.$relative).on("click",$.proxy(function(b){this.next(a.navSpeed)},this)),a.changeItemOnClick){var c=this._core.$stage.children(),d=this._core.clones().length/2;c.on("click",$.proxy(function(b){var c=$(b.currentTarget).index();this.to(c-d,a.navSpeed,!0)},this))}for(b in a.dotsData||(this._templates=[$('<button role="button">').addClass(a.dotClass).append($("<span>")).prop("outerHTML")]),this._controls.$absolute=(a.dotsContainer?$(a.dotsContainer):$("<div>").addClass(a.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","button",$.proxy(function(b){var c=$(b.target).parent().is(this._controls.$absolute)?$(b.target).index():$(b.target).parent().index();b.preventDefault(),this.to(c,a.dotsSpeed)},this)),this._overrides)this._core[b]=$.proxy(this[b],this)},a.prototype.destroy=function(){var b,a,c,d,e;for(b in e=this._core.settings,this._handlers)this.$element.off(b,this._handlers[b]);for(a in this._controls)"$relative"===a&&e.navContainer?this._controls[a].html(""):this._controls[a].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.prototype.update=function(){var b,c,d=this._core.clones().length/2,g=d+this._core.items().length,e=this._core.maximum(!0),a=this._core.settings,f=a.center||a.autoWidth||a.dotsData?1:a.dotsEach||a.items;if("page"!==a.slideBy&&(a.slideBy=Math.min(a.slideBy,a.items)),a.dots||"page"==a.slideBy)for(this._pages=[],b=d,c=0;b<g;b++){if(c>=f||0===c){if(this._pages.push({start:Math.min(e,b-d),end:b-d+f-1}),Math.min(e,b-d)===e)break;c=0}c+=this._core.mergers(this._core.relative(b))}},a.prototype.draw=function(){var b,a=this._core.settings,c=this._core.items().length<=a.items,d=this._core.relative(this._core.current()),e=a.loop||a.rewind;this._controls.$relative.toggleClass("disabled",!a.nav||c),a.nav&&(this._controls.$previous.toggleClass("disabled",!e&&d<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!e&&d>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!a.dots||c),a.dots&&(b=this._pages.length-this._controls.$absolute.children().length,a.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b<0&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq($.inArray(this.current(),this._pages)).addClass("active"))},a.prototype.onTrigger=function(b){var a=this._core.settings;b.page={index:$.inArray(this.current(),this._pages),count:this._pages.length,size:a&&(a.center||a.autoWidth||a.dotsData?1:a.dotsEach||a.items)}},a.prototype.current=function(){var a=this._core.relative(this._core.current());return $.grep(this._pages,$.proxy(function(b,c){return b.start<=a&&b.end>=a},this)).pop()},a.prototype.getPosition=function(d){var a,b,c=this._core.settings;return"page"==c.slideBy?(a=$.inArray(this.current(),this._pages),b=this._pages.length,d?++a:--a,a=this._pages[(a%b+b)%b].start):(a=this._core.relative(this._core.current()),b=this._core.items().length,d?a+=c.slideBy:a-=c.slideBy),a},a.prototype.next=function(a){$.proxy(this._overrides.to,this._core)(this.getPosition(!0),a)},a.prototype.prev=function(a){$.proxy(this._overrides.to,this._core)(this.getPosition(!1),a)},a.prototype.to=function(b,c,d){var a;!d&&this._pages.length?(a=this._pages.length,$.proxy(this._overrides.to,this._core)(this._pages[(b%a+a)%a].start,c)):$.proxy(this._overrides.to,this._core)(b,c)},$.fn.owlCarousel.Constructor.Plugins.Navigation=a}(window.Zepto||window.jQuery,window,document),function($,b,c,d){"use strict";var a=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":$.proxy(function(a){a.namespace&&"URLHash"===this._core.settings.startPosition&&$(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":$.proxy(function(a){if(a.namespace){var b=$(a.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");b&&(this._hashes[b]=a.content)}},this),"changed.owl.carousel":$.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),a=$.map(this._hashes,function(a,b){return a===d?b:null}).join();a&&b.location.hash.slice(1)!==a&&(b.location.hash=a)}},this)},this._core.options=$.extend({},a.Defaults,this._core.options),this.$element.on(this._handlers),$(b).on("hashchange.owl.navigation",$.proxy(function(e){var c=b.location.hash.substring(1),d=this._core.$stage.children(),a=this._hashes[c]&&d.index(this._hashes[c]);void 0!==a&&a!==this._core.current()&&this._core.to(this._core.relative(a),!1,!0)},this))};a.Defaults={URLhashListener:!1},a.prototype.destroy=function(){var a,c;for(a in $(b).off("hashchange.owl.navigation"),this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},$.fn.owlCarousel.Constructor.Plugins.Hash=a}(window.Zepto||window.jQuery,window,document),function($,d,e,f){var g=$("<support>").get(0).style,h="Webkit Moz O ms".split(" "),c={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},a={csstransforms:function(){return!!i("transform")},csstransforms3d:function(){return!!i("perspective")},csstransitions:function(){return!!i("transition")},cssanimations:function(){return!!i("animation")}};function i(a,d){var c=!1,b=a.charAt(0).toUpperCase()+a.slice(1);return $.each((a+" "+h.join(b+" ")+b).split(" "),function(b,a){if(void 0!==g[a])return c=!d||a,!1}),c}function b(a){return i(a,!0)}a.csstransitions()&&($.support.transition=new String(b("transition")),$.support.transition.end=c.transition.end[$.support.transition]),a.cssanimations()&&($.support.animation=new String(b("animation")),$.support.animation.end=c.animation.end[$.support.animation]),a.csstransforms()&&($.support.transform=new String(b("transform")),$.support.transform3d=a.csstransforms3d())}(window.Zepto||window.jQuery,window,document)
assets_libraries/remote/ue-remote-controls.js CHANGED
@@ -36,20 +36,7 @@ function UERemoteGeneralAPI(){
36
  */
37
  function getVal(obj, name, defaultValue){
38
 
39
- if(!defaultValue)
40
- var defaultValue = "";
41
-
42
- var val = "";
43
-
44
- if(!obj || typeof obj != "object")
45
- val = defaultValue;
46
- else if(obj.hasOwnProperty(name) == false){
47
- val = defaultValue;
48
- }else{
49
- val = obj[name];
50
- }
51
-
52
- return(val);
53
  }
54
 
55
 
@@ -179,9 +166,17 @@ function UERemoteGeneralAPI(){
179
  function changeItem(mixed){
180
 
181
  var numItem = getItemNum(mixed);
182
-
183
  var objItem = getItem(numItem);
184
 
 
 
 
 
 
 
 
 
185
  if(!g_vars.selector_item_trigger){
186
 
187
  objItem.trigger(g_vars.trigger_event);
@@ -286,11 +281,17 @@ this.onEvent = function(name, func){
286
  * listen to class change
287
  */
288
  function initEvents_listenClassChange(){
289
-
290
  var objItems = getObjItems();
291
 
292
  jQuery.each(objItems, function(index, item){
293
-
 
 
 
 
 
 
294
  var observer = new MutationObserver(function(records){
295
 
296
  runWithTrashold(function(){
@@ -304,6 +305,9 @@ this.onEvent = function(name, func){
304
  var config = { attributes: true};
305
 
306
  observer.observe(item, config);
 
 
 
307
  });
308
 
309
 
@@ -323,6 +327,10 @@ this.onEvent = function(name, func){
323
  //activate first item
324
 
325
  var objFirstItem = getItem(0);
 
 
 
 
326
  objFirstItem.addClass(g_vars.class_active);
327
 
328
  objItems.on(g_vars.trigger_event, function(event){
@@ -363,6 +371,14 @@ this.onEvent = function(name, func){
363
  return(g_objParent);
364
  }
365
 
 
 
 
 
 
 
 
 
366
 
367
  /**
368
  * init by classes
@@ -413,7 +429,7 @@ this.onEvent = function(name, func){
413
  return(false);
414
 
415
  g_vars.is_editor = isEditor;
416
-
417
  g_objParent = objParent;
418
 
419
  var connectType = getVal(options, "connect_type");
@@ -422,6 +438,12 @@ this.onEvent = function(name, func){
422
 
423
  g_options = options;
424
 
 
 
 
 
 
 
425
  if(isEditor == true)
426
  g_vars.trigger_event = "ucclick";
427
 
@@ -436,8 +458,11 @@ this.onEvent = function(name, func){
436
  setTimeout(initEvents, 1000);
437
  else
438
  initEvents();
439
- }
440
 
 
 
 
 
441
 
442
  return(true);
443
  }
@@ -532,6 +557,14 @@ function UERemoteGalleryAPI(){
532
  return(g_objParent);
533
  }
534
 
 
 
 
 
 
 
 
 
535
 
536
 
537
  /**
@@ -611,11 +644,17 @@ function UERemoteCarouselAPI(){
611
 
612
 
613
  switch(action){
 
 
 
 
 
 
614
  case "play":
615
 
616
  g_owlCarousel.trigger('play.owl.autoplay');
617
  g_owlCarousel.trigger('next.owl.carousel');
618
-
619
  break;
620
  case "pause":
621
 
@@ -703,7 +742,6 @@ function UERemoteCarouselAPI(){
703
  }
704
 
705
 
706
-
707
  /*
708
  events
709
  */
@@ -723,7 +761,7 @@ function UERemoteCarouselAPI(){
723
 
724
  break;
725
  case "change":
726
-
727
  g_owlCarousel.on("changed.owl.carousel", func);
728
 
729
  break;
@@ -749,6 +787,13 @@ function UERemoteCarouselAPI(){
749
  }
750
  }
751
 
 
 
 
 
 
 
 
752
 
753
  /**
754
  * get the element
@@ -895,11 +940,11 @@ function UESyncObject(){
895
  function onItemChange(objAPI){
896
 
897
  var numCurrent = objAPI.doAction("get_num_current");
898
-
899
  var objElement = objAPI.getElement();
900
 
901
  mapAPIs(function(api){
902
-
903
  api.doAction("change_item", numCurrent);
904
 
905
  }, objElement);
@@ -1023,6 +1068,7 @@ function UESyncObject(){
1023
 
1024
  validate(objAPI);
1025
 
 
1026
  //debug
1027
  var objElement = objAPI.getElement();
1028
 
@@ -1036,7 +1082,6 @@ function UESyncObject(){
1036
 
1037
  });
1038
 
1039
-
1040
  if(g_vars.is_editor == true && g_vars.is_editor_func_started == false){
1041
 
1042
  setInterval(onEditorCheck, 700);
@@ -1046,19 +1091,47 @@ function UESyncObject(){
1046
 
1047
  }
1048
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1049
 
1050
  }
1051
 
1052
  /**
1053
  * ---------------------------------------------------
1054
- * remote carousel api class
1055
  */
1056
  function UERemoteWidgets(){
1057
 
1058
  var g_objParent, g_objWidget, g_parentID;
1059
- var g_api, g_objSync;
1060
  var t = this;
1061
-
1062
  var g_vars = {
1063
  is_inited:false,
1064
  funcOnInit:null,
@@ -1094,23 +1167,11 @@ function UERemoteWidgets(){
1094
  */
1095
  function getVal(obj, name, defaultValue){
1096
 
1097
- if(!defaultValue)
1098
- var defaultValue = "";
1099
-
1100
- var val = "";
1101
-
1102
- if(!obj || typeof obj != "object")
1103
- val = defaultValue;
1104
- else if(obj.hasOwnProperty(name) == false){
1105
- val = defaultValue;
1106
- }else{
1107
- val = obj[name];
1108
- }
1109
-
1110
- return(val);
1111
  }
1112
 
1113
 
 
1114
  function _______INIT_________(){}
1115
 
1116
  /**
@@ -1124,7 +1185,12 @@ function UERemoteWidgets(){
1124
 
1125
  g_vars.widget_id = widgetID;
1126
 
1127
- g_parentID = g_objWidget.data("parentid");
 
 
 
 
 
1128
 
1129
  if(!g_parentID)
1130
  throw new Error("Parent controlled ID not set");
@@ -1291,7 +1357,7 @@ function UERemoteWidgets(){
1291
 
1292
  if(!g_parentID)
1293
  throw new Error("Parent controller ID not found");
1294
-
1295
  if(!g_objParent || g_objParent.length == 0){
1296
 
1297
  if(g_parentID == "auto"){
@@ -1321,8 +1387,8 @@ function UERemoteWidgets(){
1321
  trace(g_objParent);
1322
  }
1323
 
1324
- if(g_objParent.length == 0)
1325
- throw new Error("Parent widget with remote name:'"+g_parentID+"' not found");
1326
  }
1327
 
1328
  }
@@ -1350,7 +1416,7 @@ function UERemoteWidgets(){
1350
  * init api variable
1351
  */
1352
  function initAPI(){
1353
-
1354
  //set type and related objects
1355
  if(!g_api){
1356
 
@@ -1437,7 +1503,7 @@ function UERemoteWidgets(){
1437
  * set action, bind to some object
1438
  * objElement can be jQuery object or selector
1439
  */
1440
- this.setAction = function(action, objElement){
1441
 
1442
  if(g_vars.is_inited == false)
1443
  throw new Error("Widget not inited");
@@ -1458,9 +1524,10 @@ function UERemoteWidgets(){
1458
  //avoid double action
1459
  var linkedAction = objElement.data("uc-action");
1460
 
1461
- if(linkedAction)
1462
- return(false);
1463
-
 
1464
  objElement.data("uc-action", action);
1465
 
1466
  objElement.on("click",function(){
@@ -1508,7 +1575,7 @@ function UERemoteWidgets(){
1508
  var objParent = getWidgetContainer(g_objWidget);
1509
 
1510
  //don't hide if no message
1511
-
1512
  var objError = objParent.find('.uc-remote-error');
1513
 
1514
  if(objError.length == 0)
@@ -1646,6 +1713,9 @@ function UERemoteWidgets(){
1646
  */
1647
  function displayErrorMessage(message){
1648
 
 
 
 
1649
  if(g_vars.is_parent_mode == false){
1650
 
1651
  if(g_objWidget && g_objWidget.length)
@@ -1842,13 +1912,24 @@ function UERemoteWidgets(){
1842
  switch(action){
1843
  case "prev":
1844
  case "next":
 
 
 
 
 
 
 
 
 
 
 
1845
  changeItemByAction(action);
1846
  return(false);
1847
  break;
1848
  }
1849
 
1850
  var response = g_api.doAction(action, arg1, arg2);
1851
-
1852
  return(response);
1853
  }
1854
 
@@ -2079,26 +2160,7 @@ function UERemoteWidgets(){
2079
  }
2080
 
2081
  }
2082
-
2083
- /**
2084
- * get the sync object, if not exists, create one
2085
- */
2086
- function getSyncObject(syncID){
2087
-
2088
- var syncRealID = "uc_sync_"+syncID;
2089
-
2090
- var objSync = getVal(window, syncRealID);
2091
-
2092
- if(objSync)
2093
- return(objSync);
2094
-
2095
- var objSync = new UESyncObject();
2096
-
2097
- window[syncRealID] = objSync;
2098
-
2099
- return(objSync);
2100
- }
2101
-
2102
 
2103
  /**
2104
  * start sync
@@ -2110,8 +2172,8 @@ function UERemoteWidgets(){
2110
  if(!syncID)
2111
  return(false);
2112
 
2113
- var objSync = getSyncObject(syncID);
2114
-
2115
  var isEditorMode = isInsideEditor();
2116
 
2117
  objSync.setOptions(syncID, isEditorMode);
@@ -2213,12 +2275,101 @@ function UERemoteWidgets(){
2213
 
2214
  }
2215
 
2216
- jQuery("body").on("uc-remote-parent-init",function(event, objParent, optionsAPI){
 
 
 
 
 
 
 
 
 
 
2217
 
2218
- var objRemote = new UERemoteWidgets();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2220
  objRemote.onParentInit(objParent, optionsAPI);
2221
 
2222
  });
2223
 
 
 
2224
 
36
  */
37
  function getVal(obj, name, defaultValue){
38
 
39
+ return window.ueRemoteConnection.getVal(obj, name, defaultValue);
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
 
166
  function changeItem(mixed){
167
 
168
  var numItem = getItemNum(mixed);
169
+
170
  var objItem = getItem(numItem);
171
 
172
+ if(objItem == null)
173
+ return(false);
174
+
175
+ var numCurrent = getNumCurrent();
176
+
177
+ if(numCurrent == numItem)
178
+ return(false);
179
+
180
  if(!g_vars.selector_item_trigger){
181
 
182
  objItem.trigger(g_vars.trigger_event);
281
  * listen to class change
282
  */
283
  function initEvents_listenClassChange(){
284
+
285
  var objItems = getObjItems();
286
 
287
  jQuery.each(objItems, function(index, item){
288
+
289
+ var objItem = jQuery(item);
290
+
291
+ var isSetObserver = objItem.data("uc_set_observer");
292
+ if(isSetObserver === true)
293
+ return(true);
294
+
295
  var observer = new MutationObserver(function(records){
296
 
297
  runWithTrashold(function(){
305
  var config = { attributes: true};
306
 
307
  observer.observe(item, config);
308
+
309
+ objItem.data("uc_set_observer", true);
310
+
311
  });
312
 
313
 
327
  //activate first item
328
 
329
  var objFirstItem = getItem(0);
330
+
331
+ if(objFirstItem == null)
332
+ return(false);
333
+
334
  objFirstItem.addClass(g_vars.class_active);
335
 
336
  objItems.on(g_vars.trigger_event, function(event){
371
  return(g_objParent);
372
  }
373
 
374
+ /**
375
+ * get api type
376
+ */
377
+ this.getAPIType = function(){
378
+
379
+ return("general");
380
+ }
381
+
382
 
383
  /**
384
  * init by classes
429
  return(false);
430
 
431
  g_vars.is_editor = isEditor;
432
+
433
  g_objParent = objParent;
434
 
435
  var connectType = getVal(options, "connect_type");
438
 
439
  g_options = options;
440
 
441
+ if(g_vars.enableDebug == true){
442
+ trace("init general api");
443
+ trace(objParent);
444
+ trace(options);
445
+ }
446
+
447
  if(isEditor == true)
448
  g_vars.trigger_event = "ucclick";
449
 
458
  setTimeout(initEvents, 1000);
459
  else
460
  initEvents();
 
461
 
462
+ g_objParent.on("uc_ajax_refreshed", initEvents);
463
+
464
+ }
465
+
466
 
467
  return(true);
468
  }
557
  return(g_objParent);
558
  }
559
 
560
+
561
+ /**
562
+ * get api type
563
+ */
564
+ this.getAPIType = function(){
565
+
566
+ return("gallery");
567
+ }
568
 
569
 
570
  /**
644
 
645
 
646
  switch(action){
647
+ case "next":
648
+ g_owlCarousel.trigger('next.owl.carousel');
649
+ break;
650
+ case "prev":
651
+ g_owlCarousel.trigger('prev.owl.carousel');
652
+ break;
653
  case "play":
654
 
655
  g_owlCarousel.trigger('play.owl.autoplay');
656
  g_owlCarousel.trigger('next.owl.carousel');
657
+
658
  break;
659
  case "pause":
660
 
742
  }
743
 
744
 
 
745
  /*
746
  events
747
  */
761
 
762
  break;
763
  case "change":
764
+
765
  g_owlCarousel.on("changed.owl.carousel", func);
766
 
767
  break;
787
  }
788
  }
789
 
790
+ /**
791
+ * get api type
792
+ */
793
+ this.getAPIType = function(){
794
+
795
+ return("carousel");
796
+ }
797
 
798
  /**
799
  * get the element
940
  function onItemChange(objAPI){
941
 
942
  var numCurrent = objAPI.doAction("get_num_current");
943
+
944
  var objElement = objAPI.getElement();
945
 
946
  mapAPIs(function(api){
947
+
948
  api.doAction("change_item", numCurrent);
949
 
950
  }, objElement);
1068
 
1069
  validate(objAPI);
1070
 
1071
+
1072
  //debug
1073
  var objElement = objAPI.getElement();
1074
 
1082
 
1083
  });
1084
 
 
1085
  if(g_vars.is_editor == true && g_vars.is_editor_func_started == false){
1086
 
1087
  setInterval(onEditorCheck, 700);
1091
 
1092
  }
1093
 
1094
+ /**
1095
+ * get all elements
1096
+ */
1097
+ this.getElements = function(exceptID){
1098
+
1099
+ if(!g_objApis)
1100
+ return(null);
1101
+
1102
+ var arrElements = [];
1103
+
1104
+ //check with first existing api number of items
1105
+ for(var elID in g_objApis){
1106
+
1107
+ if(exceptID && exceptID == elID)
1108
+ continue;
1109
+
1110
+ var objApi = g_objApis[elID];
1111
+
1112
+ var objElement = objApi.getElement();
1113
+
1114
+ arrElements.push(objElement);
1115
+ }
1116
+
1117
+ if(arrElements.length == 0)
1118
+ return(null);
1119
+
1120
+ return(arrElements);
1121
+ }
1122
 
1123
  }
1124
 
1125
  /**
1126
  * ---------------------------------------------------
1127
+ * remote widget api class
1128
  */
1129
  function UERemoteWidgets(){
1130
 
1131
  var g_objParent, g_objWidget, g_parentID;
1132
+ var g_api, g_objSync, g_remoteConnection = window.ueRemoteConnection;
1133
  var t = this;
1134
+
1135
  var g_vars = {
1136
  is_inited:false,
1137
  funcOnInit:null,
1167
  */
1168
  function getVal(obj, name, defaultValue){
1169
 
1170
+ return window.ueRemoteConnection.getVal(obj, name, defaultValue);
 
 
 
 
 
 
 
 
 
 
 
 
 
1171
  }
1172
 
1173
 
1174
+
1175
  function _______INIT_________(){}
1176
 
1177
  /**
1185
 
1186
  g_vars.widget_id = widgetID;
1187
 
1188
+ var forceID = getVal(g_vars.init_options, "force_parentid");
1189
+
1190
+ if(forceID)
1191
+ g_parentID = forceID;
1192
+ else
1193
+ g_parentID = g_objWidget.data("parentid");
1194
 
1195
  if(!g_parentID)
1196
  throw new Error("Parent controlled ID not set");
1357
 
1358
  if(!g_parentID)
1359
  throw new Error("Parent controller ID not found");
1360
+
1361
  if(!g_objParent || g_objParent.length == 0){
1362
 
1363
  if(g_parentID == "auto"){
1387
  trace(g_objParent);
1388
  }
1389
 
1390
+ if(!g_objParent || g_objParent.length == 0)
1391
+ throw new Error("Parent widget with remote name: '"+g_parentID+"' not found");
1392
  }
1393
 
1394
  }
1416
  * init api variable
1417
  */
1418
  function initAPI(){
1419
+
1420
  //set type and related objects
1421
  if(!g_api){
1422
 
1503
  * set action, bind to some object
1504
  * objElement can be jQuery object or selector
1505
  */
1506
+ this.setAction = function(action, objElement, allowMultiple){
1507
 
1508
  if(g_vars.is_inited == false)
1509
  throw new Error("Widget not inited");
1524
  //avoid double action
1525
  var linkedAction = objElement.data("uc-action");
1526
 
1527
+ if(allowMultiple !== true)
1528
+ if(linkedAction)
1529
+ return(false);
1530
+
1531
  objElement.data("uc-action", action);
1532
 
1533
  objElement.on("click",function(){
1575
  var objParent = getWidgetContainer(g_objWidget);
1576
 
1577
  //don't hide if no message
1578
+
1579
  var objError = objParent.find('.uc-remote-error');
1580
 
1581
  if(objError.length == 0)
1713
  */
1714
  function displayErrorMessage(message){
1715
 
1716
+ //trace(message);
1717
+ //console.trace();
1718
+
1719
  if(g_vars.is_parent_mode == false){
1720
 
1721
  if(g_objWidget && g_objWidget.length)
1912
  switch(action){
1913
  case "prev":
1914
  case "next":
1915
+
1916
+ var apiType = g_api.getAPIType();
1917
+
1918
+ if(apiType == "carousel"){
1919
+
1920
+ g_api.doAction(action);
1921
+
1922
+ return(false);
1923
+ }
1924
+
1925
+
1926
  changeItemByAction(action);
1927
  return(false);
1928
  break;
1929
  }
1930
 
1931
  var response = g_api.doAction(action, arg1, arg2);
1932
+
1933
  return(response);
1934
  }
1935
 
2160
  }
2161
 
2162
  }
2163
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2164
 
2165
  /**
2166
  * start sync
2172
  if(!syncID)
2173
  return(false);
2174
 
2175
+ var objSync = g_remoteConnection.getSyncObject(syncID);
2176
+
2177
  var isEditorMode = isInsideEditor();
2178
 
2179
  objSync.setOptions(syncID, isEditorMode);
2275
 
2276
  }
2277
 
2278
+ /**
2279
+ * remote connection class - for interacting with outside
2280
+ */
2281
+ function UERemoteConnection(){
2282
+
2283
+ var t = this;
2284
+
2285
+ /**
2286
+ * get object property
2287
+ */
2288
+ this.getVal = function(obj, name, defaultValue){
2289
 
2290
+ if(!defaultValue)
2291
+ var defaultValue = "";
2292
+
2293
+ var val = "";
2294
+
2295
+ if(!obj || typeof obj != "object")
2296
+ val = defaultValue;
2297
+ else if(obj.hasOwnProperty(name) == false){
2298
+ val = defaultValue;
2299
+ }else{
2300
+ val = obj[name];
2301
+ }
2302
+
2303
+ return(val);
2304
+ }
2305
+
2306
+
2307
+ /**
2308
+ * get the sync object, if not exists, create one
2309
+ */
2310
+ this.getSyncObject = function(syncID){
2311
+
2312
+ var syncRealID = "uc_sync_"+syncID;
2313
+
2314
+ var objSync = t.getVal(window, syncRealID);
2315
+
2316
+ if(objSync)
2317
+ return(objSync);
2318
+
2319
+ var objSync = new UESyncObject();
2320
+
2321
+ window[syncRealID] = objSync;
2322
+
2323
+ return(objSync);
2324
+ }
2325
+
2326
+
2327
+ /**
2328
+ * get object synced other objets id's
2329
+ */
2330
+ this.getSyncedElements = function(objElement){
2331
 
2332
+ if(!objElement)
2333
+ return(null);
2334
+
2335
+ if(objElement.length == 0)
2336
+ return(null);
2337
+
2338
+ if(objElement.hasClass("uc-remote-parent") == false)
2339
+ return(null);
2340
+
2341
+ var isSync = objElement.data("sync");
2342
+
2343
+ if(isSync !== true)
2344
+ return(null);
2345
+
2346
+ var syncID = objElement.data("syncid");
2347
+
2348
+ if(!syncID)
2349
+ return(null);
2350
+
2351
+ var objSync = t.getSyncObject(syncID);
2352
+
2353
+ var currentID = objElement.attr("id");
2354
+
2355
+ var arrElements = objSync.getElements(currentID);
2356
+
2357
+ return(arrElements);
2358
+ }
2359
+
2360
+ }
2361
+
2362
+
2363
+ //body init
2364
+
2365
+ jQuery("body").on("uc-remote-parent-init",function(event, objParent, optionsAPI){
2366
+
2367
+ var objRemote = new UERemoteWidgets();
2368
+
2369
  objRemote.onParentInit(objParent, optionsAPI);
2370
 
2371
  });
2372
 
2373
+ window.ueRemoteConnection = new UERemoteConnection();
2374
+
2375
 
assets_libraries/unitegallery/css/unite-gallery.css CHANGED
@@ -799,6 +799,7 @@ img.ug-sepia-effect{
799
 
800
 
801
  .ug-lightbox .ug-lightbox-overlay{
 
802
  z-index:1;
803
  width:100%;
804
  height:100%;
@@ -840,7 +841,7 @@ img.ug-sepia-effect{
840
  background-repeat:no-repeat;
841
  background-image:url('../images/lightbox-icon-close.png');
842
  background-position:0px 0px;
843
- z-index:4;
844
  cursor:pointer;
845
  }
846
 
@@ -970,24 +971,19 @@ img.ug-sepia-effect{
970
 
971
  .ug-arrow-left.ug-skin-default,
972
  .ug-arrow-right.ug-skin-default{
973
- width:15px;
974
- height:30px;
975
- background-image:url('../skins/default/slider_arrow_left.png');
976
- background-position:0px 0px;
977
- }
978
-
979
- .ug-arrow-right.ug-skin-default{
980
- background-image:url('../skins/default/slider_arrow_right.png');
981
  }
982
 
983
  .ug-arrow-left.ug-skin-default.ug-arrow-hover,
984
  .ug-arrow-right.ug-skin-default.ug-arrow-hover{
985
- background-position:0px -30px;
986
  }
987
 
988
  .ug-arrow-left.ug-skin-default.ug-arrow-disabled,
989
  .ug-arrow-right.ug-skin-default.ug-arrow-disabled{
990
- background-position:0px -60px;
991
  }
992
 
993
  /* --- bullets -- */
799
 
800
 
801
  .ug-lightbox .ug-lightbox-overlay{
802
+ position:absolute;
803
  z-index:1;
804
  width:100%;
805
  height:100%;
841
  background-repeat:no-repeat;
842
  background-image:url('../images/lightbox-icon-close.png');
843
  background-position:0px 0px;
844
+ z-index:9999999;
845
  cursor:pointer;
846
  }
847
 
971
 
972
  .ug-arrow-left.ug-skin-default,
973
  .ug-arrow-right.ug-skin-default{
974
+ width:32px;
975
+ height:32px;
976
+ opacity:0.8;
 
 
 
 
 
977
  }
978
 
979
  .ug-arrow-left.ug-skin-default.ug-arrow-hover,
980
  .ug-arrow-right.ug-skin-default.ug-arrow-hover{
981
+ opacity:1;
982
  }
983
 
984
  .ug-arrow-left.ug-skin-default.ug-arrow-disabled,
985
  .ug-arrow-right.ug-skin-default.ug-arrow-disabled{
986
+ opacity:0.4;
987
  }
988
 
989
  /* --- bullets -- */
assets_libraries/unitegallery/js/unitegallery.js CHANGED
@@ -1,4 +1,4 @@
1
- //Unite Gallery, Version: 1.7.57, released 21 March 2022
2
 
3
  //------ ug-common-libraries.js------
4
 
@@ -2626,6 +2626,9 @@ function UGFunctions(){
2626
  */
2627
  this.stripTags = function(html){
2628
 
 
 
 
2629
  var text = html.replace(/(<([^>]+)>)/ig,"");
2630
 
2631
  return(text);
@@ -12889,12 +12892,12 @@ function UGSlider(){
12889
 
12890
  slider_arrow_left_align_hor:"left", //left, center, right - left arrow horizonal align
12891
  slider_arrow_left_align_vert:"middle", //top, middle, bottom - left arrow vertical align
12892
- slider_arrow_left_offset_hor:20, //left arrow horizontal offset
12893
  slider_arrow_left_offset_vert:0, //left arrow vertical offset
12894
 
12895
  slider_arrow_right_align_hor:"right", //left, center, right - right arrow horizontal algin
12896
  slider_arrow_right_align_vert:"middle", //top, middle, bottom - right arrow vertical align
12897
- slider_arrow_right_offset_hor:20, //right arrow horizontal offset
12898
  slider_arrow_right_offset_vert:0, //right arrow vertical offset
12899
 
12900
  slider_enable_progress_indicator: true, //enable progress indicator element
@@ -13141,11 +13144,16 @@ function UGSlider(){
13141
  html += "</div>"; //end inner
13142
 
13143
  //----------------
13144
-
13145
  //add arrows
13146
  if(g_options.slider_enable_arrows == true){
13147
- html += "<div class='ug-slider-control ug-arrow-left ug-skin-"+g_options.slider_arrows_skin+"'></div>";
13148
- html += "<div class='ug-slider-control ug-arrow-right ug-skin-"+g_options.slider_arrows_skin+"'></div>";
 
 
 
 
 
13149
  }
13150
 
13151
  //add play button
@@ -13829,7 +13837,6 @@ function UGSlider(){
13829
 
13830
  }
13831
 
13832
- trace("video top: "+top);
13833
 
13834
  g_objVideoPlayer.setPosition(left, top);
13835
  }
@@ -18580,8 +18587,8 @@ function UGHtml5MediaAPI(){
18580
  if(data.posterImage)
18581
  htmlPoster = "poster='"+data.posterImage+"'";
18582
 
18583
- var html = "<video id='"+htmlID+"' width='"+width+"' height='"+height+"' controls='controls' preload='none' "+htmlAutoplay+" "+htmlPoster+">";
18584
-
18585
  if(data.mp4 != "")
18586
  html += "<source type='video/mp4' src='"+data.mp4+"' />";
18587
 
@@ -18600,6 +18607,12 @@ function UGHtml5MediaAPI(){
18600
 
18601
  jQuery("#"+divID).html(html);
18602
 
 
 
 
 
 
 
18603
  new MediaElement(htmlID, {
18604
  enablePluginDebug: false,
18605
  flashName: urlFlash,
@@ -19868,6 +19881,7 @@ function UniteGalleryMain(){
19868
  var g_options = {
19869
  gallery_width:900, //gallery width
19870
  gallery_height:500, //gallery height
 
19871
 
19872
  gallery_min_width: 150, //gallery minimal width when resizing
19873
  gallery_min_height: 100, //gallery minimal height when resizing
@@ -20323,6 +20337,10 @@ function UniteGalleryMain(){
20323
  if(g_temp.isFreestyleMode == false){
20324
 
20325
  var galleryHeight = g_functions.getCssSizeParam(g_options.gallery_height);
 
 
 
 
20326
  objCss["height"] = galleryHeight;
20327
 
20328
  }else{
@@ -20363,13 +20381,19 @@ function UniteGalleryMain(){
20363
  var srcLazy = objChild.data("lazy-src");
20364
  if(srcLazy)
20365
  objChild.attr("src", srcLazy);
20366
-
20367
  //handle link wrapper
20368
  var itemLink = "";
20369
  if(tagname == "a"){
20370
  itemLink = objChild.attr("href");
20371
- objChild = objChild.children("img:first-child");
20372
- var tagname = objChild.prop("tagName").toLowerCase();
 
 
 
 
 
 
20373
  }
20374
 
20375
  var itemType = objChild.data("type");
@@ -22110,6 +22134,9 @@ function UniteGalleryMain(){
22110
  */
22111
  this.isMobileMode = function(){
22112
 
 
 
 
22113
  if(g_objWrapper.hasClass("ug-under-480"))
22114
  return(true);
22115
 
@@ -22124,7 +22151,6 @@ function UniteGalleryMain(){
22124
 
22125
  var windowWidth = jQuery(window).width();
22126
 
22127
-
22128
  if(!windowWidth)
22129
  return(true);
22130
 
1
+ //Unite Gallery, Version: 1.7.61, released 26 July 2022
2
 
3
  //------ ug-common-libraries.js------
4
 
2626
  */
2627
  this.stripTags = function(html){
2628
 
2629
+ if(typeof html != "string")
2630
+ return(html);
2631
+
2632
  var text = html.replace(/(<([^>]+)>)/ig,"");
2633
 
2634
  return(text);
12892
 
12893
  slider_arrow_left_align_hor:"left", //left, center, right - left arrow horizonal align
12894
  slider_arrow_left_align_vert:"middle", //top, middle, bottom - left arrow vertical align
12895
+ slider_arrow_left_offset_hor:10, //left arrow horizontal offset
12896
  slider_arrow_left_offset_vert:0, //left arrow vertical offset
12897
 
12898
  slider_arrow_right_align_hor:"right", //left, center, right - right arrow horizontal algin
12899
  slider_arrow_right_align_vert:"middle", //top, middle, bottom - right arrow vertical align
12900
+ slider_arrow_right_offset_hor:10, //right arrow horizontal offset
12901
  slider_arrow_right_offset_vert:0, //right arrow vertical offset
12902
 
12903
  slider_enable_progress_indicator: true, //enable progress indicator element
13144
  html += "</div>"; //end inner
13145
 
13146
  //----------------
13147
+
13148
  //add arrows
13149
  if(g_options.slider_enable_arrows == true){
13150
+
13151
+ var svgArrowLeft = '<svg x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g stroke-width="1" transform="translate(0.5, 0.5)"><polyline fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="square" stroke-miterlimit="10" points="21,2 11,16 21,30 " stroke-linejoin="miter"></polyline></g></svg>';
13152
+
13153
+ var svgArrowRight = '<svg x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g stroke-width="1" transform="translate(0.5, 0.5)"><polyline fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="square" stroke-miterlimit="10" points="11,2 21,16 11,30 " stroke-linejoin="miter"></polyline></g></svg>';
13154
+
13155
+ html += "<div class='ug-slider-control ug-arrow-left ug-skin-"+g_options.slider_arrows_skin+"'>"+svgArrowLeft+"</div>";
13156
+ html += "<div class='ug-slider-control ug-arrow-right ug-skin-"+g_options.slider_arrows_skin+"'>"+svgArrowRight+"</div>";
13157
  }
13158
 
13159
  //add play button
13837
 
13838
  }
13839
 
 
13840
 
13841
  g_objVideoPlayer.setPosition(left, top);
13842
  }
18587
  if(data.posterImage)
18588
  htmlPoster = "poster='"+data.posterImage+"'";
18589
 
18590
+ var html = "<video id='"+htmlID+"' width='"+width+"' height='"+height+"' controls='controls' controlsList='nodownload' preload='none' "+htmlAutoplay+" "+htmlPoster+">";
18591
+
18592
  if(data.mp4 != "")
18593
  html += "<source type='video/mp4' src='"+data.mp4+"' />";
18594
 
18607
 
18608
  jQuery("#"+divID).html(html);
18609
 
18610
+ var objVideo = jQuery("#"+htmlID);
18611
+
18612
+ objVideo.on("contextmenu",function(){
18613
+ return(false);
18614
+ });
18615
+
18616
  new MediaElement(htmlID, {
18617
  enablePluginDebug: false,
18618
  flashName: urlFlash,
19881
  var g_options = {
19882
  gallery_width:900, //gallery width
19883
  gallery_height:500, //gallery height
19884
+ gallery_height_mobile:null, //gallery height
19885
 
19886
  gallery_min_width: 150, //gallery minimal width when resizing
19887
  gallery_min_height: 100, //gallery minimal height when resizing
20337
  if(g_temp.isFreestyleMode == false){
20338
 
20339
  var galleryHeight = g_functions.getCssSizeParam(g_options.gallery_height);
20340
+
20341
+ if(t.isMobileMode() == true && g_options.gallery_height_mobile)
20342
+ galleryHeight = g_functions.getCssSizeParam(g_options.gallery_height_mobile);
20343
+
20344
  objCss["height"] = galleryHeight;
20345
 
20346
  }else{
20381
  var srcLazy = objChild.data("lazy-src");
20382
  if(srcLazy)
20383
  objChild.attr("src", srcLazy);
20384
+
20385
  //handle link wrapper
20386
  var itemLink = "";
20387
  if(tagname == "a"){
20388
  itemLink = objChild.attr("href");
20389
+
20390
+ var objChildren = objChild.children();
20391
+ objChild = objChild.find("img");
20392
+
20393
+ if(objChild.length == 0)
20394
+ return(null);
20395
+
20396
+ tagname = "img";
20397
  }
20398
 
20399
  var itemType = objChild.data("type");
22134
  */
22135
  this.isMobileMode = function(){
22136
 
22137
+ if(g_objWrapper.hasClass("ug-under-780"))
22138
+ return(true);
22139
+
22140
  if(g_objWrapper.hasClass("ug-under-480"))
22141
  return(true);
22142
 
22151
 
22152
  var windowWidth = jQuery(window).width();
22153
 
 
22154
  if(!windowWidth)
22155
  return(true);
22156
 
assets_libraries/unitegallery/js/unitegallery.min.js CHANGED
@@ -1,3 +1,3 @@
1
- //Unite Gallery, Version: 1.7.57, released 21 March 2022
2
 
3
- function debugLine(e,t,i){!0===e&&(e="true"),!1===e&&(e="false");var n=e;if("object"==typeof e)for(name in n="",e){var r=e[name];n+=" "+name+": "+r}if(1!=t||i||(n+=" "+Math.random()),1==i){var o=jQuery("#debug_line");o.width(200),o.height()>=500&&o.html(""),n=o.html()+"<br> -------------- <br>"+n}jQuery("#debug_line").show().html(n)}function debugSide(e){var t="";for(name in e){var i=e[name];t+=name+" : "+i+"<br>"}jQuery("#debug_side").show().html(t)}function trace(e){"undefined"!=typeof console&&console.log(e)}function UGFunctions(){var e=null,t=this,i={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};function n(e,t,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent?t.attachEvent("on"+e,i):t[e]=i}this.debugVar="",this.getvalopt={FORCE_BOOLEAN:"force_boolean",FORCE_NUMERIC:"force_numeric",TRIM:"trim"},this.z__________GENERAL___________=function(){},this.getVal=function(e,i,n,r){if(!n)n="";var o="";switch(o=e&&"object"==typeof e?0==e.hasOwnProperty(i)?n:e[i]:n,r){case t.getvalopt.FORCE_BOOLEAN:o=t.strToBool(o);break;case t.getvalopt.TRIM:o=String(o),o=jQuery.trim(o);break;case t.getvalopt.FORCE_NUMERIC:"string"==typeof(o=jQuery.trim(o))&&(o.replace("px",""),o=Number(o))}return o},this.z__________FULL_SCREEN___________=function(){},this.toFullscreen=function(e,t){if(e.requestFullscreen)e.requestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},this.exitFullscreen=function(){if(0==t.isFullScreen())return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},this.addFullScreenChangeEvent=function(e){document.webkitCancelFullScreen?n("webkitfullscreenchange",document,e):document.msExitFullscreen?n("MSFullscreenChange",document,e):document.mozCancelFullScreen?n("mozfullscreenchange",document,e):n("fullscreenchange",document,e)},this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange"),jQuery(document).unbind("mozfullscreenchange"),jQuery(document).unbind("webkitfullscreenchange"),jQuery(document).unbind("MSFullscreenChange")},this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},this.isFullScreen=function(){var e=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;return e=!!e},this.z__________GET_PROPS___________=function(){},this.getBrowserPrefix=function(){if(null!==e)return e;var t=["webkit","Moz","ms","O"],i=document.createElement("div");for(var n in t){var r=t[n];if(r+"Transform"in i.style)return r=r.toLowerCase(),e=r,r}return e="",""},this.getImageInsideParentDataByImage=function(e,i,n){var r=e.parent(),o=t.getImageOriginalSize(e);return t.getImageInsideParentData(r,o.width,o.height,i,n)},this.getImageInsideParentData=function(e,t,i,n,r,o,a){if(!r)r={};var s={};if(void 0===o)o=e.width();if(void 0===a)a=e.height();r.padding_left&&(o-=r.padding_left),r.padding_right&&(o-=r.padding_right),r.padding_top&&(a-=r.padding_top),r.padding_bottom&&(a-=r.padding_bottom);var l=null,u="100%",d=null,_=null,g="display:block;margin:0px auto;";if(t>0&&i>0){if("down"==n&&t<o&&i<a)_=(o-(l=t))/2,d=(a-(u=i))/2;else if("fill"==n){(l=(u=a)*(c=t/i))<o?(u=(l=o)/c,_=0,d=Math.round((u-a)/2*-1)):(d=0,_=Math.round((l-o)/2*-1))}else{var c;d=0,_=(o-(l=(u=a)*(c=t/i)))/2,"fitvert"!=n&&l>o&&(_=0,d=(a-(u=(l=o)/c))/2)}l=Math.floor(l),u=Math.floor(u),d=Math.floor(d),_=Math.floor(_),g="position:absolute;"}return r.padding_top&&(d+=r.padding_top),r.padding_left&&(_+=r.padding_left),s.imageWidth=l,s.imageHeight=u,s.imageTop=d,s.imageLeft=_,s.imageRight=_+l,s.imageBottom=0==d||"100%"==u?null:d+u,s.style=g,s},this.getElementCenterPosition=function(e,i){var n=e.parent(),r=t.getElementSize(e),o=t.getElementSize(n),a=o.width,s=o.height;i&&void 0!==i.padding_top&&(s-=i.padding_top),i&&void 0!==i.padding_bottom&&(s-=i.padding_bottom),i&&void 0!==i.padding_left&&(a-=i.padding_left),i&&void 0!==i.padding_right&&(a-=i.padding_right);var l={};return l.left=Math.round((a-r.width)/2),l.top=Math.round((s-r.height)/2),i&&void 0!==i.padding_top&&(l.top+=i.padding_top),i&&void 0!==i.padding_left&&(l.left+=i.padding_left),l},this.getElementCenterPoint=function(e,i){if(!i)i=!1;var n=t.getElementSize(e),r={};return r.x=n.width/2,r.y=n.height/2,1==i&&(r.x+=n.left,r.y+=n.top),r.x=Math.round(r.x),r.y=Math.round(r.y),r},this.getMousePosition=function(e,t){var i={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};if(e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(i.pageX=e.originalEvent.touches[0].pageX,i.pageY=e.originalEvent.touches[0].pageY,i.clientX=e.originalEvent.touches[0].clientX,i.clientY=e.originalEvent.touches[0].clientY),t){var n=t.offset();i.mouseX=i.pageX-n.left,i.mouseY=i.pageY-n.top}return i},this.getMouseElementPoint=function(e,i){var n={x:e.pageX,y:e.pageY};return t.getElementLocalPoint(n,i)},this.getElementLocalPoint=function(e,t){var i={},n=t.offset();return i.x=Math.round(e.x-n.left),i.y=Math.round(e.y-n.top),i},this.getImageOriginalSize=function(e,t,i){if(void 0!==t&&void 0!==i)return{width:t,height:i};var n=e[0];if(void 0===n)throw new Error("getImageOriginalSize error - Image not found");var r={};if(void 0===n.naturalWidth){if("number"==typeof e.data("naturalWidth"))return(r={}).width=e.data("naturalWidth"),r.height=e.data("naturalHeight"),r;var o=new Image;return o.src=n.src,o.complete?(r.width=o.width,r.height=o.height,e.data("naturalWidth",r.width),e.data("naturalHeight",r.height),r):{width:0,height:0}}return r.width=n.naturalWidth,r.height=n.naturalHeight,r},this.getimageRatio=function(e){var i=t.getImageOriginalSize(e);return t.getElementSize(e).width/i.width},this.isImageFitParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width<=r.width&&n.height<=r.height},this.getElementSize=function(e){if(void 0===e)throw new Error("Can't get size, empty element");var t=e.position();return t.height=e.outerHeight(),t.width=e.outerWidth(),t.left=Math.round(t.left),t.top=Math.round(t.top),t.right=t.left+t.width,t.bottom=t.top+t.height,t},this.isElementBiggerThenParent=function(e){var i=e.parent(),n=t.getElementSize(e),r=t.getElementSize(i);return n.width>r.width||n.height>r.height},this.isPointInsideElement=function(e,t){return 0!=(e.x>=0&&e.x<t.width)&&0!=(e.y>=0&&e.y<t.height)},this.getElementRelativePos=function(e,i,n,r){if(!r)r=e.parent();if("number"==typeof e)var o={width:e,height:e};else o=t.getElementSize(e);var a=t.getElementSize(r);switch(i){case"top":case"left":i=0,n&&(i+=n);break;case"center":i=Math.round((a.width-o.width)/2),n&&(i+=n);break;case"right":i=a.width-o.width,n&&(i-=n);break;case"middle":i=Math.round((a.height-o.height)/2),n&&(i+=n);break;case"bottom":i=a.height-o.height,n&&(i-=n)}return i},this.getScreenVisibleSize=function(){document.body.clientWidth,document.body.clientHeight,jQuery(document).scrollTop();var e=jQuery(document),t=e.scrollLeft(),i=e.scrollTop();t=Math.round(t);var n=(i=Math.round(i))+window.innerHeight,r=t+window.innerWidth;return{top:i,left:t,height:n-i,width:r-t,right:r,bottom:n}},this.isElementsIntersect=function(e,t){return!(e.right<t.left)&&(!(e.left>t.right)&&(!(e.bottom<t.top)&&!(e.top>t.bottom)))},this.isElementInsideScreen=function(e){var i=t.getElementSize(e),n=t.getScreenVisibleSize();return t.isElementsIntersect(n,i)},this.z_________SET_ELEMENT_PROPS_______=function(){},this.zoomImageInsideParent=function(e,i,n,r,o,a,s){if(!n)n=1.2;if(!o)o="fit";var l,u,d,_,g=n,c=e.parent(),h=t.getElementSize(e),p=t.getImageOriginalSize(e),m=!1,f=0,b=0,v=0,y=0;if(r){var I=t.getMouseElementPoint(r,e);m=t.isPointInsideElement(I,h),v=I.x,y=I.y}else m=!1;if(0==m){var w=t.getElementCenterPoint(e);v=w.x,y=w.y}if(1==i)l=h.height*g,u=h.width*g,0!=v&&(f=-(v*g-v)),0!=y&&(b=-(y*g-y));else{if(l=h.height/g,(u=h.width/g)<t.getImageInsideParentData(c,p.width,p.height,o,s).imageWidth)return t.scaleImageFitParent(e,p.width,p.height,o,s),!0;1==m&&(0!=v&&(f=-(v/g-v)),0!=y&&(b=-(y/g-y)))}if(a){var E=1;if(0!=p.width&&(E=u/p.width),E>a)return!1}if(t.setElementSize(e,u,l),0==i&&0==m){var T=t.getElementCenterPosition(e);d=T.left,_=T.top}else d=h.left+f,_=h.top+b;return t.placeElement(e,d,_),!0},this.placeElement=function(e,i,n,r,o,a){if(0==jQuery.isNumeric(i)||0==jQuery.isNumeric(n)){if(!a)a=e.parent();var s=t.getElementSize(e),l=t.getElementSize(a)}if(0==jQuery.isNumeric(i))switch(i){case"left":i=0,r&&(i+=r);break;case"center":i=Math.round((l.width-s.width)/2),r&&(i+=r);break;case"right":i=l.width-s.width,r&&(i-=r)}if(0==jQuery.isNumeric(n))switch(n){case"top":n=0,o&&(n+=o);break;case"middle":case"center":n=Math.round((l.height-s.height)/2),o&&(n+=o);break;case"bottom":n=l.height-s.height,o&&(n-=o)}var u={position:"absolute",margin:"0px"};null!==i&&(u.left=i),null!==n&&(u.top=n),e.css(u)},this.placeElementInParentCenter=function(e){t.placeElement(e,"center","middle")},this.setElementSizeAndPosition=function(e,t,i,n,r){var o={width:n+"px",height:r+"px",left:t+"px",top:i+"px",position:"absolute",margin:"0px"};e.css(o)},this.setElementSize=function(e,t,i){var n={width:t+"px"};null!=i&&(n.height=i+"px"),e.css(n)},this.cloneElementSizeAndPos=function(e,i,n,r,o){var a=e.position();if(null==a)throw new Error("Can't get size, empty element");!0===n?(a.height=e.outerHeight(),a.width=e.outerWidth()):(a.height=e.height(),a.width=e.width()),a.left=Math.round(a.left),a.top=Math.round(a.top),r&&(a.left+=r),o&&(a.top+=o),t.setElementSizeAndPosition(i,a.left,a.top,a.width,a.height)},this.placeImageInsideParent=function(e,i,n,r,o,a){var s=t.getImageInsideParentData(i,n,r,o,a),l="<img";return null!==s.imageWidth&&(l+=" width = '"+s.imageWidth+"'",s.style+="width:"+s.imageWidth+";"),null!=s.imageHeight&&("100%"==s.imageHeight?(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+";"):(l+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+"px;")),null!==s.imageTop&&(s.style+="top:"+s.imageTop+"px;"),null!==s.imageLeft&&(s.style+="left:"+s.imageLeft+"px;"),e=t.escapeDoubleSlash(e),l+=" style='"+s.style+"'",l+=' src="'+e+'"',l+=">",i.html(l),i.children("img")},this.scaleImageCoverParent=function(e,i,n){if("number"==typeof i)var r=i,o=n;else r=i.outerWidth(),o=i.outerHeight();var a=t.getImageOriginalSize(e),s=a.width/a.height,l=o,u=l*s,d=0,_=0;u<r?(l=(u=r)/s,_=0,d=Math.round((l-o)/2*-1)):(d=0,_=Math.round((u-r)/2*-1)),u=Math.round(u),l=Math.round(l),e.css({width:u+"px",height:l+"px",left:_+"px",top:d+"px"})},this.scaleImageFitParent=function(e,i,n,r,o){var a=e.parent(),s=t.getImageInsideParentData(a,i,n,r,o),l=!1,u={};return null!==s.imageWidth&&(l=!0,e.removeAttr("width"),u.width=s.imageWidth+"px"),null!=s.imageHeight&&(l=!0,e.removeAttr("height"),u.height=s.imageHeight+"px"),null!==s.imageTop&&(l=!0,u.top=s.imageTop+"px"),null!==s.imageLeft&&(l=!0,u.left=s.imageLeft+"px"),1==l&&(u.position="absolute",u.margin="0px 0px",e.css(u)),s},this.scaleImageByHeight=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i*a);i=Math.round(i),t.setElementSize(e,s,i)},this.scaleImageByWidth=function(e,i,n,r){var o=t.getImageOriginalSize(e,n,r),a=o.width/o.height,s=Math.round(i/a);i=Math.round(i),t.setElementSize(e,i,s)},this.scaleImageExactSizeInParent=function(e,i,n,r,o,a){var s=e.parent(),l=t.getElementSize(s);l.width<r&&(r=l.width),l.height<o&&(o=l.height);var u,d=t.getImageInsideParentData(null,i,n,a,null,r,o),_=r,g=o,c=d.imageLeft,h=d.imageLeft,p=d.imageTop,m=d.imageTop,f=Math.round((l.width-r)/2),b=Math.round((l.height-o)/2);0!=(u=r-(d.imageWidth+c+h))&&(h+=u),0!=(u=o-(d.imageHeight+p+m))&&(m+=u),e.removeAttr("width"),e.removeAttr("height");var v={position:"absolute",margin:"0px 0px"};v.width=_+"px",v.height=g+"px",v.left=f+"px",v.top=b+"px",v["padding-left"]=c+"px",v["padding-top"]=p+"px",v["padding-right"]=h+"px",v["padding-bottom"]=m+"px",e.css(v);var y={};return y.imageWidth=_,y.imageHeight=g,y},this.showElement=function(e,t,i){e.show().fadeTo(0,1),t&&t.show().fadeTo(0,1),i&&i.show().fadeTo(0,1)},this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){},this.disableButton=function(e,i){if(!i)i="ug-button-disabled";0==t.isButtonDisabled(e,i)&&e.addClass(i)},this.convertCustomPrefixOptions=function(e,t,i){if(!t)return e;var n={};return jQuery.each(e,function(e,r){if(0===e.indexOf(t+"_"+i+"_")){var o=e.replace(t+"_"+i+"_",i+"_");n[o]=r}else n[e]=r}),n},this.enableButton=function(e,i){if(!i)i="ug-button-disabled";1==t.isButtonDisabled(e,i)&&e.removeClass(i)},this.isButtonDisabled=function(e,t){if(!t)t="ug-button-disabled";return!!e.hasClass(t)},this.z_________MATH_FUNCTIONS_______=function(){},this.normalizeSetting=function(e,t,i,n,r,o){if(!o)o=!1;return r=e+(t-e)*((r-i)/(n-i)),1==o&&(r<e&&(r=e),r>t&&(r=t)),r},this.getNormalizedValue=function(e,t,i,n,r){return r=e+(n-i)*((r-e)/(t-e))},this.getDistance=function(e,t,i,n){return Math.round(Math.sqrt(Math.abs((i-e)*(i-e)+(n-t)*(n-t))))},this.getMiddlePoint=function(e,t,i,n){var r={};return r.x=e+Math.round((i-e)/2),r.y=t+Math.round((n-t)/2),r},this.getNumItemsInSpace=function(e,t,i){return Math.floor((e+i)/(t+i))},this.getNumItemsInSpaceRound=function(e,t,i){return Math.round((e+i)/(t+i))},this.getSpaceByNumItems=function(e,t,i){return e*t+(e-1)*i},this.getItemSizeInSpace=function(e,t,i){return Math.floor((e-(t-1)*i)/t)},this.getColX=function(e,t,i){return e*(t+i)},this.getColByIndex=function(e,t){return t%e},this.getColRowByIndex=function(e,t){var i=Math.floor(e/t);return{col:Math.floor(e%t),row:i}},this.getIndexByRowCol=function(e,t,i){return e<0?-1:t<0?-1:e*i+t},this.getPrevRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row-1,n.col,i)},this.getNextRowSameColIndex=function(e,i){var n=t.getColRowByIndex(e,i);return t.getIndexByRowCol(n.row+1,n.col,i)},this.z_________DATA_FUNCTIONS_______=function(){},this.setGlobalData=function(e,t){jQuery.data(document.body,e,t)},this.getGlobalData=function(e){return jQuery.data(document.body,e)},this.z_________EVENT_DATA_FUNCTIONS_______=function(){},this.handleScrollTop=function(e){if(0==t.isTouchDevice())return null;var n=t.getStoredEventData(e);if(null===n.scrollDir&&(Math.abs(n.diffMouseX)>15?n.scrollDir="hor":Math.abs(n.diffMouseY)>15&&Math.abs(n.diffMouseY)>Math.abs(n.diffMouseX)&&(n.scrollDir="vert",n.scrollStartY=n.lastMouseClientY,n.scrollOrigin=jQuery(document).scrollTop(),i.dataCache[e].scrollStartY=n.lastMouseClientY,i.dataCache[e].scrollOrigin=n.scrollOrigin),i.dataCache[e].scrollDir=n.scrollDir),"vert"!==n.scrollDir)return n.scrollDir;jQuery(document).scrollTop();var r=n.scrollOrigin-(n.lastMouseClientY-n.scrollStartY);return r>=0&&jQuery(document).scrollTop(r),n.scrollDir},this.wasVerticalScroll=function(e){return"vert"===t.getStoredEventData(e).scrollDir},this.storeEventData=function(e,n,r){var o=t.getMousePosition(e),a=jQuery.now(),s={startTime:a,lastTime:a,startMouseX:o.pageX,startMouseY:o.pageY,lastMouseX:o.pageX,lastMouseY:o.pageY,startMouseClientY:o.clientY,lastMouseClientY:o.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};r&&(s=jQuery.extend(s,r)),i.dataCache[n]=s},this.updateStoredEventData=function(e,n,r){if(!i.dataCache[n])throw new Error("updateEventData error: must have stored cache object");var o=i.dataCache[n],a=t.getMousePosition(e);o.lastTime=jQuery.now(),void 0!==a.pageX&&(o.lastMouseX=a.pageX,o.lastMouseY=a.pageY,o.lastMouseClientY=a.clientY),r&&(o=jQuery.extend(o,r)),i.dataCache[n]=o},this.getStoredEventData=function(e,t){if(!i.dataCache[e])throw new Error("updateEventData error: must have stored cache object");var n=i.dataCache[e];return n.diffMouseX=n.lastMouseX-n.startMouseX,n.diffMouseY=n.lastMouseY-n.startMouseY,n.diffMouseClientY=n.lastMouseClientY-n.startMouseClientY,n.diffTime=n.lastTime-n.startTime,!0===t?(n.startMousePos=n.lastMouseY,n.lastMousePos=n.lastMouseY,n.diffMousePos=n.diffMouseY):(n.startMousePos=n.lastMouseX,n.lastMousePos=n.lastMouseX,n.diffMousePos=n.diffMouseX),n},this.isApproveStoredEventClick=function(e,n){if(!i.dataCache[e])return!0;var r=t.getStoredEventData(e,n),o=Math.abs(r.diffMousePos);return!(r.diffTime>400)&&!(o>30)},this.clearStoredEventData=function(e){i.dataCache[e]=null},this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){},this.isCanvasExists=function(){return"function"==typeof jQuery('<canvas width="500" height="500" > </canvas>')[0].getContext},this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth},this.isTouchDevice=function(){if(-1!==i.isTouchDevice)return i.isTouchDevice;try{document.createEvent("TouchEvent"),i.isTouchDevice=!0}catch(e){i.isTouchDevice=!1}return i.isTouchDevice},this.isRgbaSupported=function(){if(-1!==i.isRgbaSupported)return i.isRgbaSupported;var e=document.getElementsByTagName("script")[0],t=e.style.color;try{e.style.color="rgba(1,5,13,0.44)"}catch(e){}var n=e.style.color!=t;return e.style.color=t,i.isRgbaSupported=n,n},this.z_________GENERAL_FUNCTIONS_______=function(){},this.checkMinJqueryVersion=function(e){for(var t=jQuery.fn.jquery.split("."),i=e.split("."),n=0,r=t.length;n<r;n++){var o=parseInt(t[n]),a=parseInt(i[n]);if(void 0===i[n])return!0;if(a>o)return!1;if(o>a)return!0}return!0},this.getCssSizeParam=function(e){return jQuery.isNumeric(e)?e+"px":e},this.convertHexToRGB=function(e,t){var i=e.replace("#","");return i===e?e:(r=parseInt(i.substring(0,2),16),g=parseInt(i.substring(2,4),16),b=parseInt(i.substring(4,6),16),result="rgba("+r+","+g+","+b+","+t+")",result)},this.timestampToString=function(e){var t=new Date(e),i=t.getDate()+"/"+t.getMonth();return i+=" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+":"+t.getMilliseconds()},this.getArrTouches=function(e){var t=[];return e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length>0&&(t=e.originalEvent.touches),t},this.getArrTouchPositions=function(e){for(var t=[],i=0;i<e.length;i++){var n={pageX:e[i].pageX,pageY:e[i].pageY};t.push(n)}return t},this.startTimeDebug=function(){i.starTime=jQuery.now()},this.showTimeDebug=function(){debugLine({"Time Passed":jQuery.now()-i.starTime},!0)},this.initProgressIndicator=function(e,i,n){switch("bar"!=e&&0==t.isCanvasExists()&&(e="bar"),e){case"bar":(r=new UGProgressBar).putHidden(n,i);break;default:case"pie":(r=new UGProgressPie).putHidden(n,i);break;case"pie2":var r;i.type_fill=!0,(r=new UGProgressPie).putHidden(n,i)}return r},this.setButtonMobileReady=function(e){e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover")}),e.on("mousedown touchend",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1})},this.registerTheme=function(e){i.arrThemes.push(e)},this.getArrThemes=function(){return i.arrThemes},this.isThemeRegistered=function(e){return-1!==jQuery.inArray(e,i.arrThemes)},this.getFirstRegisteredTheme=function(){return 0==i.arrThemes.length?"":i.arrThemes[0]},this.isTimePassed=function(e,t){if(!t)t=100;var n=jQuery.now();0==i.timeCache.hasOwnProperty(e)?lastTime=0:lastTime=i.timeCache[e];var r=n-lastTime;return i.timeCache[e]=n,!(r<=t)},this.whenContiniousEventOver=function(e,t,n){if(!n)n=300;1==i.timeCache.hasOwnProperty(e)&&null!=i.timeCache[e]&&(clearTimeout(i.timeCache[e]),i.timeCache[e]=null),i.timeCache[e]=setTimeout(t,n)},this.validateClickTouchstartEvent=function(e){var t=!0,n=jQuery.now()-i.lastEventTime;return"click"==e&&"touchstart"==i.lastEventType&&n<1e3&&(t=!1),i.lastEventTime=jQuery.now(),i.lastEventType=e,t},this.addClassOnHover=function(e,t){if(!t)t="ug-button-hover";e.hover(function(){jQuery(this).addClass(t)},function(){jQuery(this).removeClass(t)})},this.destroyButton=function(e){e.off("mouseenter"),e.off("mouseleave"),e.off("click"),e.off("touchstart"),e.off("touchend"),e.off("mousedown"),e.off("tap")},this.setButtonOnClick=function(e,i){t.setButtonMobileReady(e),e.on("click touchstart",function(e){if(objThis=jQuery(this),e.stopPropagation(),e.stopImmediatePropagation(),0==t.validateClickTouchstartEvent(e.type))return!0;i(objThis,e)})},this.setButtonOnTap=function(e,n){e.on("tap",n),0==t.isTouchDevice()?e.on("click",function(e){var i=jQuery(this);if(0==t.validateClickTouchstartEvent(e.type))return!0;i.trigger("tap")}):(e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover"),i.lastTouchStartElement=jQuery(this),i.lastEventTime=jQuery.now()}),e.on("touchend",function(e){var t=jQuery(this);return 0==t.is(i.lastTouchStartElement)||(!i.lastEventTime||(jQuery.now()-i.lastEventTime>i.touchThreshold||void t.trigger("tap")))}))},this.loadJs=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("script");i.src=e;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)},this.loadCss=function(e,t){!0===t&&(e=location.protocol+"//"+e);var i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)},this.addEvent=function(e,t,i){void 0!==e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)},this.checkImagesLoaded=function(e,t,i){var n=0,r=e.length;if(0==r&&t)return t(),!1;function o(e,o){n++,"function"==typeof i&&setTimeout(function(){i(e,o)}),n==r&&"function"==typeof t&&setTimeout(function(){t()})}setTimeout(function(){for(var t=0;t<r;t++){var i=e[t];if(void 0!==i.naturalWidth&&0!==i.naturalWidth)o(e[t],!1);else{var n=jQuery("<img/>");n.data("index",t),n.on("load",function(){var t=jQuery(this).data("index");o(e[t],!1)}),n.on("error",function(){var t=jQuery(this).data("index");o(e[t],!0)}),n.attr("src",i.src)}}})},this.waitForWidth=function(e,t){var n=e.width();if(0!=n)return t(),!1;i.handle=setInterval(function(){0!=(n=e.width())&&(clearInterval(i.handle),t())},300)},this.arrayShuffle=function(e){if("object"!=typeof e)return e;for(var t,i,n=e.length;n;t=parseInt(Math.random()*n),i=e[--n],e[n]=e[t],e[t]=i);return e},this.getObjectLength=function(e){var t=0;for(var i in e)t++;return t},this.normalizePercent=function(e){return e<0&&(e=0),e>1&&(e=1),e},this.stripTags=function(e){return e.replace(/(<([^>]+)>)/gi,"")},this.escapeDoubleSlash=function(e){return e.replace('"','"')},this.htmlentitles=function(e){return jQuery("<div/>").text(e).html()},this.z_________END_GENERAL_FUNCTIONS_______=function(){}}!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var a=t||window.event,s=l.call(arguments,1),u=0,d=0,_=0,g=0;if((t=e.event.fix(a)).type="mousewheel","detail"in a&&(_=-1*a.detail),"wheelDelta"in a&&(_=a.wheelDelta),"wheelDeltaY"in a&&(_=a.wheelDeltaY),"wheelDeltaX"in a&&(d=-1*a.wheelDeltaX),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(d=-1*_,_=0),u=0===_?d:_,"deltaY"in a&&(u=_=-1*a.deltaY),"deltaX"in a&&(d=a.deltaX,0===_&&(u=-1*d)),0!==_||0!==d){if(1===a.deltaMode){var c=e.data(this,"mousewheel-line-height");u*=c,_*=c,d*=c}else if(2===a.deltaMode){var h=e.data(this,"mousewheel-page-height");u*=h,_*=h,d*=h}return g=Math.max(Math.abs(_),Math.abs(d)),(!o||o>g)&&(o=g,n(a,g)&&(o/=40)),n(a,g)&&(u/=40,d/=40,_/=40),u=Math[u>=1?"floor":"ceil"](u/o),d=Math[d>=1?"floor":"ceil"](d/o),_=Math[_>=1?"floor":"ceil"](_/o),t.deltaX=d,t.deltaY=_,t.deltaFactor=o,t.deltaMode=0,s.unshift(t,u,d,_),r&&clearTimeout(r),r=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){o=null}function n(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}var r,o,a=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var u=a.length;u;)e.event.fixHooks[a[--u]]=e.event.mouseHooks;var d=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",d.getLineHeight(this)),e.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=s.length;e;)this.removeEventListener(s[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e(t)}):"object"==typeof module&&"object"==typeof module.exports?exports=e(require("jquery")):e(jQuery)}(function(e){e.easing.jswing=e.easing.swing;var t=Math.pow,i=Math.sqrt,n=Math.sin,r=Math.cos,o=Math.PI,a=1.70158,s=1.525*a,l=2*o/3,u=2*o/4.5;function d(e){var t=7.5625,i=2.75;return e<1/i?t*e*e:e<2/i?t*(e-=1.5/i)*e+.75:e<2.5/i?t*(e-=2.25/i)*e+.9375:t*(e-=2.625/i)*e+.984375}e.extend(e.easing,{def:"easeOutQuad",swing:function(t){return e.easing[e.easing.def](t)},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-t(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-t(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-t(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-t(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-t(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-t(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-t(-2*e+2,5)/2},easeInSine:function(e){return 1-r(e*o/2)},easeOutSine:function(e){return n(e*o/2)},easeInOutSine:function(e){return-(r(o*e)-1)/2},easeInExpo:function(e){return 0===e?0:t(2,10*e-10)},easeOutExpo:function(e){return 1===e?1:1-t(2,-10*e)},easeInOutExpo:function(e){return 0===e?0:1===e?1:e<.5?t(2,20*e-10)/2:(2-t(2,-20*e+10))/2},easeInCirc:function(e){return 1-i(1-t(e,2))},easeOutCirc:function(e){return i(1-t(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-i(1-t(2*e,2)))/2:(i(1-t(-2*e+2,2))+1)/2},easeInElastic:function(e){return 0===e?0:1===e?1:-t(2,10*e-10)*n((10*e-10.75)*l)},easeOutElastic:function(e){return 0===e?0:1===e?1:t(2,-10*e)*n((10*e-.75)*l)+1},easeInOutElastic:function(e){return 0===e?0:1===e?1:e<.5?-t(2,20*e-10)*n((20*e-11.125)*u)/2:t(2,-20*e+10)*n((20*e-11.125)*u)/2+1},easeInBack:function(e){return 2.70158*e*e*e-a*e*e},easeOutBack:function(e){return 1+2.70158*t(e-1,3)+a*t(e-1,2)},easeInOutBack:function(e){return e<.5?t(2*e,2)*(7.189819*e-s)/2:(t(2*e-2,2)*((s+1)*(2*e-2)+s)+2)/2},easeInBounce:function(e){return 1-d(1-e)},easeOutBounce:d,easeInOutBounce:function(e){return e<.5?(1-d(1-2*e))/2:(1+d(2*e-1))/2}})}),function(e,t){if(void 0===e.cssHooks)return!1;function i(e,t,i){var n=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:0>e?0:n.max<e?n.max:e)}function n(t){var i=l(),n=i._rgba=[];return t=t.toLowerCase(),c(s,function(e,r){var o,a=r.re.exec(t),s=a&&r.parse(a),l=r.space||"rgba";return s?(o=i[l](s),i[u[l].cache]=o[u[l].cache],n=i._rgba=o._rgba,!1):void 0}),n.length?("0,0,0,0"===n.join()&&e.extend(n,o.transparent),i):o[t]}function r(e,t,i){return 1>6*(i=(i+1)%1)?e+(t-e)*i*6:1>2*i?t:2>3*i?e+(t-e)*(2/3-i)*6:e}var o,a=/^([\-+])=\s*(\d+\.?\d*)/,s=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,n,r){return new e.Color.fn.parse(t,i,n,r)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},_=l.support={},g=e("<p>")[0],c=e.each;g.style.cssText="background-color:rgba(1,1,1,.5)",_.rgba=g.style.backgroundColor.indexOf("rgba")>-1,c(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(r,a,s,d){if(r===t)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=e(r).css(a),a=t);var _=this,g=e.type(r),h=this._rgba=[];return a!==t&&(r=[r,a,s,d],g="array"),"string"===g?this.parse(n(r)||o._default):"array"===g?(c(u.rgba.props,function(e,t){h[t.idx]=i(r[t.idx],t)}),this):"object"===g?(c(u,r instanceof l?function(e,t){r[t.cache]&&(_[t.cache]=r[t.cache].slice())}:function(t,n){var o=n.cache;c(n.props,function(e,t){if(!_[o]&&n.to){if("alpha"===e||null==r[e])return;_[o]=n.to(_._rgba)}_[o][t.idx]=i(r[e],t,!0)}),_[o]&&e.inArray(null,_[o].slice(0,3))<0&&(_[o][3]=1,n.from&&(_._rgba=n.from(_[o])))}),this):void 0},is:function(e){var t=l(e),i=!0,n=this;return c(u,function(e,r){var o,a=t[r.cache];return a&&(o=n[r.cache]||r.to&&r.to(n._rgba)||[],c(r.props,function(e,t){return null!=a[t.idx]?i=a[t.idx]===o[t.idx]:void 0})),i}),i},_space:function(){var e=[],t=this;return c(u,function(i,n){t[n.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var n=l(e),r=n._space(),o=u[r],a=0===this.alpha()?l("transparent"):this,s=a[o.cache]||o.to(a._rgba),_=s.slice();return n=n[o.cache],c(o.props,function(e,r){var o=r.idx,a=s[o],l=n[o],u=d[r.type]||{};null!==l&&(null===a?_[o]=l:(u.mod&&(l-a>u.mod/2?a+=u.mod:a-l>u.mod/2&&(a-=u.mod)),_[o]=i((l-a)*t+a,r)))}),this[r](_)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),n=i.pop(),r=l(t)._rgba;return l(e.map(i,function(e,t){return(1-n)*r[t]+n*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),n=i.pop();return t&&i.push(~~(255*n)),"#"+e.map(i,function(e){return 1===(e=(e||0).toString(16)).length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,n=e[0]/255,r=e[1]/255,o=e[2]/255,a=e[3],s=Math.max(n,r,o),l=Math.min(n,r,o),u=s-l,d=s+l,_=.5*d;return t=l===s?0:n===s?60*(r-o)/u+360:r===s?60*(o-n)/u+120:60*(n-r)/u+240,i=0===u?0:.5>=_?u/d:u/(2-d),[Math.round(t)%360,i,_,null==a?1:a]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],o=e[3],a=.5>=n?n*(1+i):n+i-n*i,s=2*n-a;return[Math.round(255*r(s,a,t+1/3)),Math.round(255*r(s,a,t)),Math.round(255*r(s,a,t-1/3)),o]},c(u,function(n,r){var o=r.props,s=r.cache,u=r.to,d=r.from;l.fn[n]=function(n){if(u&&!this[s]&&(this[s]=u(this._rgba)),n===t)return this[s].slice();var r,a=e.type(n),_="array"===a||"object"===a?n:arguments,g=this[s].slice();return c(o,function(e,t){var n=_["object"===a?e:t.idx];null==n&&(n=g[t.idx]),g[t.idx]=i(n,t)}),d?((r=l(d(g)))[s]=g,r):l(g)},c(o,function(t,i){l.fn[t]||(l.fn[t]=function(r){var o,s=e.type(r),l="alpha"===t?this._hsla?"hsla":"rgba":n,u=this[l](),d=u[i.idx];return"undefined"===s?d:("function"===s&&(r=r.call(this,d),s=e.type(r)),null==r&&i.empty?this:("string"===s&&((o=a.exec(r))&&(r=d+parseFloat(o[2])*("+"===o[1]?1:-1))),u[i.idx]=r,this[l](u)))})})}),l.hook=function(t){var i=t.split(" ");c(i,function(t,i){e.cssHooks[i]={set:function(t,r){var o,a,s="";if("transparent"!==r&&("string"!==e.type(r)||(o=n(r)))){if(r=l(o||r),!_.rgba&&1!==r._rgba[3]){for(a="backgroundColor"===i?t.parentNode:t;(""===s||"transparent"===s)&&a&&a.style;)try{s=e.css(a,"backgroundColor"),a=a.parentNode}catch(e){}r=r.blend(s&&"transparent"!==s?s:"_default")}r=r.toRgbaString()}try{t.style[i]=r}catch(e){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),e.cssHooks.borderColor={expand:function(e){var t={};return c(["Top","Right","Bottom","Left"],function(i,n){t["border"+n+"Color"]=e}),t}},o=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(e){e.mlp={x:0,y:0},e(function t(){try{var i=this===document?e(this):e(this).contents()}catch(e){return!1}i.mousemove(function(t){e.mlp={x:t.pageX,y:t.pageY}}),i.find("iframe").on("load",t)}),e.fn.ismouseover=function(){var t=!1;return this.eq(0).each(function(){var i=e(this).is("iframe")?e(this).contents().find("body"):e(this),n=i.offset();t=n.left<=e.mlp.x&&n.left+i.outerWidth()>e.mlp.x&&n.top<=e.mlp.y&&n.top+i.outerHeight()>e.mlp.y}),t}}(jQuery);var g_ugFunctions=new UGFunctions;function UGThumbsGeneral(){var e,t,i,n,r=this,o=jQuery(r),a=new UniteGalleryMain,s=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"},this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"};var l={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!1,thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},u={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},d="thumb_size_change";function _(e,t){var r=i[e],o="";0==u.customThumbs&&(o=" ug-thumb-generated");var a="<div class='ug-thumb-wrapper"+o+"' "+("style='z-index:"+(r.index+1)+";'")+"></div>";if(1==l.thumb_wrapper_as_link){var s=r.link;""==r.link&&(s="javascript:void(0)");var d="";1==l.thumb_link_newpage&&r.link&&(d=" target='_blank'");a="<a href='"+s+"'"+d+" class='ug-thumb-wrapper"+o+"'></a>"}var _=jQuery(a),g=r.objThumbImage;if(0==u.customThumbs){if(1==l.thumb_show_loader&&g){var c="ug-thumb-loader-dark";"bright"==l.thumb_loader_type&&(c="ug-thumb-loader-bright"),_.append("<div class='ug-thumb-loader "+c+"'></div>"),_.append("<div class='ug-thumb-error' style='display:none'></div>")}if(g){if(g.addClass("ug-thumb-image"),1==l.thumb_image_overlay_effect){var h=g.clone().appendTo(_);h.addClass("ug-thumb-image-overlay "+t).removeClass("ug-thumb-image"),h.fadeTo(0,0),r.objImageOverlay=h}_.append(g)}}return u.isEffectBorder&&_.append("<div class='ug-thumb-border-overlay'></div>"),u.isEffectOverlay&&_.append("<div class='ug-thumb-overlay'></div>"),n.append(_),u.customThumbs&&u.funcSetCustomThumbHtml(_,r),i[e].objThumbWrapper=_,_}function g(e,t,i,r){var o={width:e+"px",height:t+"px"},a={width:e-u.thumbInnerReduce+"px",height:t-u.thumbInnerReduce+"px"},s=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";i?(!0!==r&&i.css(o),i.find(s).css(a)):(n.children(".ug-thumb-wrapper").css(o),n.find(s).css(a))}function c(e,t,i,n){if(!n)n=!1;a.isFakeFullscreen()&&(n=!0);var r=e.children(".ug-thumb-border-overlay"),o={};o["border-width"]=t+"px",0!=t&&(o["border-color"]=i),n&&!0===n?(r.css(o),0==t?r.hide():r.show()):(0==t?r.stop().fadeOut(l.thumb_transition_duration):r.show().stop().fadeIn(l.thumb_transition_duration),function(e,t){e.stop(!0).animate(t,{duration:l.thumb_transition_duration,easing:l.thumb_transition_easing,queue:!1})}(r,o))}function h(e,t,i){var n=e.children(".ug-thumb-overlay"),r=l.thumb_transition_duration;i&&!0===i&&(r=0),t?n.stop(!0).fadeTo(r,u.colorOverlayOpacity):n.stop(!0).fadeTo(r,0)}function p(e,t,i){var n=e.children("img.ug-thumb-image"),r=e.children("img.ug-thumb-image-overlay"),o=l.thumb_transition_duration;i&&!0===i&&(o=0),t?r.stop(!0).fadeTo(o,1):(n.fadeTo(0,1),r.stop(!0).fadeTo(o,0))}function m(e,t){(u.isEffectBorder&&c(e,l.thumb_selected_border_width,l.thumb_selected_border_color,t),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!1,t),o.trigger(r.events.SETSELECTEDSTYLE,e)}function f(e){1==v(e)?m(e,!0):r.setThumbNormalStyle(e,!0,"redraw")}function b(e,t,i){if(1==l.thumb_fixed_size)s.scaleImageCoverParent(t,e);else{"height"==l.thumb_resize_by?s.scaleImageByHeight(t,l.thumb_height):s.scaleImageByWidth(t,l.thumb_width);var n=s.getElementSize(t);s.placeElement(t,0,0),g(n.width,n.height,e)}e.children(".ug-thumb-loader").hide(),t.show(),0==l.thumb_image_overlay_effect?t.fadeTo(0,1):(1==l.thumb_image_overlay_effect&&function(e){var t=e.siblings(".ug-thumb-image-overlay");if(0==t.length)return!1;var i=s.getElementSize(e),n={width:i.width+"px",height:i.height+"px",left:i.left+"px",top:i.top+"px"};t.css(n),0==u.customThumbs&&t.fadeTo(0,1)}(t),t.fadeTo(0,0),f(e)),o.trigger(r.events.AFTERPLACEIMAGE,e)}function v(e){return!!e.hasClass("ug-thumb-selected")}function y(e,t){t=jQuery(t);r.getItemByThumb(t);var i=s.getElementSize(t);g(i.width,i.height,t,!0),f(t)}function I(e,t){if(!t)t=!1;var i=jQuery(e),n=i.parents(".ug-thumb-wrapper");return 0!=n.parent().length&&(objItem=r.getItemByThumb(n),(1!=objItem.isLoaded||!1!==t)&&(r.triggerImageLoadedEvent(n,i),void(1==u.customThumbs?o.trigger(r.events.PLACEIMAGE,[n,i]):b(n,i,objItem))))}function w(e,t,i){objItem=r.getItemByThumb(t),objItem.isLoaded=!0,objItem.isThumbImageLoaded=!0;var n=s.getImageOriginalSize(i);objItem.thumbWidth=n.width,objItem.thumbHeight=n.height,objItem.thumbRatioByWidth=n.width/n.height,objItem.thumbRatioByHeight=n.height/n.width,t.addClass("ug-thumb-ratio-set")}this.init=function(n,r){e=n.getObjects(),a=n,jQuery(n),t=e.g_objWrapper,i=e.g_arrItems,l=jQuery.extend(l,r),u.isEffectBorder=l.thumb_border_effect,u.isEffectOverlay=l.thumb_color_overlay_effect,u.isEffectImage=l.thumb_image_overlay_effect},this._____________EXTERNAL_SETTERS__________=function(){},this.setHtmlThumbs=function(e,t){if(n=e,1==u.isEffectImage)var i=function(){var e="",t=l.thumb_image_overlay_type.split(",");for(var i in t){var n=t[i];switch(n){case"bw":e+=" ug-bw-effect";break;case"blur":e+=" ug-blur-effect";break;case"sepia":e+=" ug-sepia-effect"}}return e}();if(!0!==t)for(var o=a.getNumItems(),s=0;s<o;s++)_(s,i);else{r.getThumbs().removeClass(u.classNewThumb);var d=a.getNewAddedItemsIndexes();jQuery.each(d,function(e,t){_(t,i).addClass(u.classNewThumb)})}},this.setThumbNormalStyle=function(e,t,i){(1==u.customThumbs&&e.removeClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_border_width,l.thumb_border_color,t),u.isEffectOverlay)&&h(e,1!=l.thumb_overlay_reverse,t);u.isEffectImage&&p(e,!0,t),o.trigger(r.events.SETNORMALSTYLE,e)},this.setThumbOverStyle=function(e){(1==u.customThumbs&&e.addClass("ug-thumb-over"),u.isEffectBorder&&c(e,l.thumb_over_border_width,l.thumb_over_border_color),u.isEffectOverlay)&&h(e,1==l.thumb_overlay_reverse);1==u.isEffectImage&&p(e,!1),o.trigger(r.events.SETOVERSTYLE,e)},this.setHtmlProperties=function(e){if(!e)e=r.getThumbs();if(0==u.customThumbs){1==l.thumb_fixed_size&&g(l.thumb_width,l.thumb_height,e),function(e){if(l.thumb_round_corners_radius<=0)return!1;var t={"border-radius":l.thumb_round_corners_radius+"px"};e?(e.css(t),e.find(".ug-thumb-border-overlay").css(t)):n.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(t)}(e)}if(e.each(function(){f(jQuery(this))}),u.isEffectOverlay&&l.thumb_overlay_color){var t={};if(s.isRgbaSupported()){var i=s.convertHexToRGB(l.thumb_overlay_color,l.thumb_overlay_opacity);t["background-color"]=i}else t["background-color"]=l.thumb_overlay_color,u.colorOverlayOpacity=l.thumb_overlay_opacity;e.find(".ug-thumb-overlay").css(t)}},this.setThumbSelected=function(e){if(1==u.customThumbs&&e.removeClass("ug-thumb-over"),1==v(e))return!0;e.addClass("ug-thumb-selected"),m(e)},this.setThumbUnselected=function(e){e.removeClass("ug-thumb-selected"),r.setThumbNormalStyle(e,!1,"set unselected")},this.setOptions=function(e){l=jQuery.extend(l,e)},this.setThumbInnerReduce=function(e){u.thumbInnerReduce=e},this.setCustomThumbs=function(e,t,i){if(u.customThumbs=!0,"function"!=typeof e)throw new Error("The argument should be function");u.funcSetCustomThumbHtml=e,-1==jQuery.inArray("overlay",t)&&(u.isEffectOverlay=!1),-1==jQuery.inArray("border",t)&&(u.isEffectBorder=!1),u.isEffectImage=!1,i&&!1===i.allow_onresize&&(u.allowOnResize=!1)},this._____________EXTERNAL_GETTERS__________=function(){},this.getOptions=function(){return l},this.getNumThumbs=function(){return i.length},this.getThumbImage=function(e){return e.find(".ug-thumb-image")},this.getThumbByIndex=function(e){var t=r.getThumbs();if(e>=t.length||e<0)throw new Error("Wrong thumb index");return jQuery(t[e])},this.getThumbs=function(e){switch(e){default:case r.type.GET_THUMBS_ALL:var t=n.children(".ug-thumb-wrapper");break;case r.type.GET_THUMBS_NO_RATIO:t=n.children(".ug-thumb-wrapper").not(".ug-thumb-ratio-set");break;case r.type.GET_THUMBS_RATIO:t=n.children(".ug-thumb-wrapper.ug-thumb-ratio-set");break;case r.type.GET_THUMBS_NEW:t=n.children("."+u.classNewThumb)}return t},this.getItemByThumb=function(e){var t=e.data("index");return void 0===t&&(t=e.index()),i[t]},this.isThumbLoaded=function(e){return r.getItemByThumb(e).isLoaded},this.getGlobalThumbSize=function(){return{width:l.thumb_width,height:l.thumb_height}},this._____________EXTERNAL_OTHERS__________=function(){},this.initEvents=function(){1==u.allowOnResize&&t.on(d,y),o.on(r.events.THUMB_IMAGE_LOADED,w),n.on("touchstart",".ug-thumb-wrapper",function(){u.touchEnabled=!0,n.off("mouseenter").off("mouseleave")}),n.on("mouseenter",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return objThumbs.off("mouseenter").off("mouseleave"),!0;0==v(e)&&r.setThumbOverStyle(e)}(jQuery(this))}),n.on("mouseleave",".ug-thumb-wrapper",function(e){!function(e){if(1==u.touchEnabled)return!0;0==v(e)&&r.setThumbNormalStyle(e,!1)}(jQuery(this))})},this.destroy=function(){n.off("touchstart",".ug-thumb-wrapper"),t.off(d),n.off("mouseenter",".ug-thumb-wrapper"),n.off("mouseleave",".ug-thumb-wrapper"),o.off(r.events.THUMB_IMAGE_LOADED)},this.loadThumbsImages=function(){var e=n.find(".ug-thumb-image");s.checkImagesLoaded(e,null,function(e,t){0==t?I(e,!0):function(e){var t=r.getItemByThumb(e);if(t.isLoaded=!0,t.isThumbImageLoaded=!1,1==u.customThumbs)return o.trigger(r.events.IMAGELOADERROR,e),!0;e.children(".ug-thumb-loader").hide(),e.children(".ug-thumb-error").show()}(jQuery(e).parent())})},this.triggerImageLoadedEvent=function(e,t){o.trigger(r.events.THUMB_IMAGE_LOADED,[e,t])},this.hideThumbs=function(){n.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){var e,t,n,r,o,a,s,l,u=this,d=new UniteGalleryMain,_=new UGFunctions,g=!1,c=new UGThumbsGeneral,h=(_=new UGFunctions,{strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0}),p={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},m={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0};this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};var f={strip_thumbs_align:"top",thumb_resize_by:"width"};function b(){var e=c.getOptions();p.isNotFixedThumbs=!1===e.thumb_fixed_size,g=h.strip_vertical_type}function v(){var t,i,n,r,_;c.setHtmlProperties(),t=a.children(".ug-thumb-wrapper"),i=jQuery(t[0]),n=i.outerWidth(),r=i.outerHeight(),_=c.getOptions(),0==g?(m.thumbSize=n,1==_.thumb_fixed_size?m.thumbSecondSize=r:m.thumbSecondSize=_.thumb_height,y(o.width()),m.stripInnerSize=a.width()):(m.thumbSize=r,1==_.thumb_fixed_size?m.thumbSecondSize=n:m.thumbSecondSize=_.thumb_width,y(o.height()),m.stripInnerSize=a.height()),function(){if(0==g){var e=m.thumbSecondSize,t={};t.height=e+"px";var i={};i.height=e+"px"}else{var n=m.thumbSecondSize,t={};t.width=n+"px";var i={};i.width=n+"px"}o.css(t),a.css(i)}(),I(),0==p.isRunOnce&&(1==h.strip_control_touch&&(l=new UGTouchThumbsControl).init(u),1==h.strip_control_avia&&(s=new UGAviaControl).init(u),P(),c.loadThumbsImages(),c.initEvents(),o.find(".ug-thumb-wrapper").on("click touchend",function(e){!function(e){if(u.isTouchMotionActive()){var t=l.isSignificantPassed();if(1==t)return!0}var i=c.getItemByThumb(e);d.selectItem(i)}(jQuery(this))}),e.on(d.events.ITEM_CHANGE,j),p.isNotFixedThumbs&&jQuery(c).on(c.events.AFTERPLACEIMAGE,x)),p.isRunOnce=!0}function y(e){m.stripSize=e,m.stripActiveSize=0==g?m.stripSize-h.strip_padding_left-h.strip_padding_right:m.stripSize-h.strip_padding_top-h.strip_padding_bottom,m.stripActiveSize<0&&(m.stripActiveSize=0)}function I(){var e,t=a.children(".ug-thumb-wrapper"),n=0,r=0;for(0==g&&(r=h.strip_padding_top),i=0;i<t.length;i++){var o=jQuery(t[i]);if(1==p.isNotFixedThumbs){if(objItem=c.getItemByThumb(o),0==objItem.isLoaded)continue;o.show()}_.placeElement(o,n,r),0==g?n+=o.outerWidth()+h.strip_space_between_thumbs:r+=o.outerHeight()+h.strip_space_between_thumbs}if(0==g)var s=n-h.strip_space_between_thumbs;else s=r-h.strip_space_between_thumbs;e=s,0==g?a.width(e):a.height(e),m.stripInnerSize=e,P(),jQuery(u).trigger(u.events.INNER_SIZE_CHANGE)}function w(e){var t=u.getInnerStripPos()+e;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function E(e){var t=-1*A(e).min;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function T(e){var t=-1*A(e).max+m.stripSize;t=u.fixInnerStripLimits(t),u.positionInnerStrip(t,!0)}function S(e){if(0==C())return!1;var t,i,n=(t={},i=u.getInnerStripPos(),t.minPosThumbs=-1*i+1,t.maxPosThumbs=-1*i+m.stripSize-1,t),r=A(e);if(r.min<n.minPosThumbs){var o=e.prev();o.length?E(o):E(e)}else if(r.max>n.maxPosThumbs){var a=e.next();a.length?T(a):T(e)}}function P(){1==C()?(s&&s.enable(),l&&l.enable()):(s&&s.disable(),l&&l.disable())}function x(){clearTimeout(p.handle),p.handle=setTimeout(function(){I()},50)}function j(){var e=d.getSelectedItem();c.setThumbSelected(e.objThumbWrapper),S(e.objThumbWrapper)}function C(){return m.stripInnerSize>m.stripActiveSize}function A(e){var t={},i=e.position();return 0==g?(t.min=i.left,t.max=i.left+m.thumbSize):(t.min=i.top,t.max=i.top+m.thumbSize),t}this.setHtml=function(e){if(!e){e=n;null!=h.parent_container&&(e=h.parent_container)}e.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"),o=e.children(".ug-thumbs-strip"),a=o.children(".ug-thumbs-strip-inner"),c.setHtmlThumbs(a),1==p.isNotFixedThumbs&&c.hideThumbs()},this.destroy=function(){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.off(d.events.ITEM_CHANGE),jQuery(c).off(c.events.AFTERPLACEIMAGE),l&&l.destroy(),s&&s.destroy(),c.destroy()},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(i,o){!function(i,o){t=i.getObjects(),(d=i).attachThumbsPanel("strip",u),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,h=jQuery.extend(h,o),1==(g=h.strip_vertical_type)&&(h=jQuery.extend(h,f),h=jQuery.extend(h,o),o.thumb_resize_by="width"),c.init(i,o),b()}(i,o)},this.run=function(){v()},this.positionInnerStrip=function(e,t){if(void 0===t)t=!1;if(0==g)var i={left:e+"px"};else i={top:e+"px"};0==t?(a.css(i),u.triggerStripMoveEvent()):(u.triggerStripMoveEvent(),a.stop(!0).animate(i,{duration:h.strip_scroll_to_thumb_duration,easing:h.strip_scroll_to_thumb_easing,queue:!1,progress:function(){u.triggerStripMoveEvent()},always:function(){u.triggerStripMoveEvent()}}))},this.triggerStripMoveEvent=function(){jQuery(u).trigger(u.events.STRIP_MOVE)},this.isTouchMotionActive=function(){return!!l&&l.isTouchActive()},this.isItemThumbVisible=function(e){var t=e.objThumbWrapper,i=t.position(),n=-1*u.getInnerStripPos();if(0==g)var r=n+m.stripSize,o=i.left,a=i.left+t.width();else r=n+m.stripSize,o=i.top,a=i.top+t.height();var s=!1;return a>=n&&o<=r&&(s=!0),s},this.getInnerStripPos=function(){return 0==g?a.position().left:a.position().top},this.getInnerStripLimits=function(){var e={};return e.maxPos=0==g?h.strip_padding_left:h.strip_padding_top,e.minPos=-(m.stripInnerSize-m.stripActiveSize),e},this.fixInnerStripLimits=function(e){var t=u.getInnerStripLimits();return e>t.maxPos&&(e=t.maxPos),e<t.minPos&&(e=t.minPos),e},this.scrollForeward=function(){w(-m.stripSize)},this.scrollBack=function(){w(m.stripSize)},this.________EXTERNAL_SETTERS___________=function(){},this.setOptions=function(e){h=jQuery.extend(h,e),c.setOptions(e),b()},this.setSizeVertical=function(e){if(0==g)throw new Error("setSizeVertical error, the strip size is not vertical");var t=m.thumbSecondSize,i={};i.width=t+"px",i.height=e+"px",o.css(i),y(e);var n={};n.width=t+"px",n.left="0px",n.top="0px",a.css(n),p.is_placed=!0,P()},this.setSizeHorizontal=function(e){if(1==g)throw new Error("setSizeHorizontal error, the strip size is not horizontal");var t=m.thumbSecondSize+h.strip_padding_top+h.strip_padding_bottom,i={};i.width=e+"px",i.height=t+"px",o.css(i),y(e);var n=h.strip_padding_left,r={};r.height=t+"px",r.left=n+"px",r.top="0px",a.css(r),p.is_placed=!0,P()},this.setPosition=function(e,t,i,n){_.placeElement(o,e,t,i,n)},this.resize=function(e){0==g?(o.width(e),m.stripActiveSize=e-h.strip_padding_left-h.strip_padding_right):(o.height(e),m.stripActiveSize=e-h.strip_padding_top-h.strip_padding_bottom),y(e),P(),function(){if(0==C())return!1;var e=u.getInnerStripPos(),t=u.fixInnerStripLimits(e);e!=t&&u.positionInnerStrip(t,!0)}(),function(){if(C())return!1;0==g?_.placeElement(a,h.strip_thumbs_align,0):_.placeElement(a,0,h.strip_thumbs_align)}(),function(){var e=d.getSelectedItem();if(null==e)return!0;var t=e.objThumbWrapper;t&&S(t)}(),s&&s.onResize()},this.setThumbUnselected=function(e){c.setThumbUnselected(e)},this.setCustomThumbs=function(e){c.setCustomThumbs(e)},this.________EXTERNAL_GETTERS___________=function(){},this.getObjects=function(){var t=c.getOptions(),i=jQuery.extend(h,t);return{g_gallery:d,g_objGallery:e,g_objWrapper:n,g_arrItems:r,g_objStrip:o,g_objStripInner:a,g_aviaControl:s,g_touchThumbsControl:l,isVertical:g,g_options:i,g_thumbs:c}},this.getObjThumbs=function(){return c},this.getSelectedThumb=function(){var e=d.getSelectedItemIndex();return-1==e?null:c.getThumbByIndex(e)},this.getSizeAndPosition=function(){return _.getElementSize(o)},this.getHeight=function(){return o.outerHeight()},this.getWidth=function(){return o.outerWidth()},this.getSizes=function(){return m},this.isVertical=function(){return g},this.isPlaced=function(){return p.is_placed},this.isMoveEnabled=function(){return C()}}function UGTouchThumbsControl(){var e,t,i,n,r,o,a=new UGFunctions,s={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},l={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};function u(){var e=jQuery.now(),t={};return t.passedTime=l.lastTime-l.startTime,t.lastActiveTime=e-l.buttonReleaseTime,t.passedDistance=l.lastPos-l.startPos,t.passedDistanceAbs=Math.abs(t.passedDistance),t}function d(e){return 0==o?a.getMousePosition(e).pageX:a.getMousePosition(e).pageY}function _(){var e=jQuery.now();e-l.lastTime>=s.touch_portion_time&&(l.lastDeltaTime=e-l.lastTime,l.lastDeltaTime>s.touch_portion_time&&(l.lastDeltaTime=s.touch_portion_time),l.lastDeltaPos=l.lastPos-l.lastPortionPos,l.lastPortionPos=l.lastPos,l.lastTime=e)}function g(){l.lastPos=e.getInnerStripPos(),e.triggerStripMoveEvent()}function c(t){if(0==l.loop_active)return!0;if(t){d(t);!function(){var t=s.thumb_touch_slowFactor,i=s.minDeltaTime,r=s.minPath,a=e.getInnerStripPos(),u=jQuery.now()-l.lastTime,d=a-l.lastPortionPos;u<i&&l.lastDeltaTime>0&&(u=l.lastDeltaTime,d=l.lastDeltaPos+d),u<i&&(u=i);var _=0;u>0&&(_=d/u);var c=_*_/(2*t)*(d>0?1:-1);Math.abs(c)<=r&&(c=0);var h=e.getInnerStripPos(),p=h+c,m=e.fixInnerStripLimits(p),f=e.getInnerStripLimits(),b=s.limitsBreakAddition,v=!1,y=m;if(p>f.maxPos&&(v=!0,m=b,p<b&&(m=p)),p<f.minPos){v=!0;var I=f.minPos-b;m=I,p>I&&(m=p)}var w=m-h,E=Math.abs(Math.round(_/t));if(0!=c&&(E=E*w/c),h!=m){var T={left:m+"px"};1==o&&(T={top:m+"px"}),n.animate(T,{duration:E,easing:s.animationEasing,queue:!0,progress:g})}if(1==v){var S=s.returnAnimateSpeed,P={left:y+"px"};1==o&&(P={top:y+"px"}),n.animate(P,{duration:S,easing:s.returnAnimationEasing,queue:!0,progress:g})}}()}l.loop_active=!1,l.handle=clearInterval(l.handle)}function h(e){return 0==l.isControlEnabled||(l.buttonReleaseTime=jQuery.now(),0==l.touch_active?(c(e),!0):(e.preventDefault(),l.touch_active=!1,c(e),void i.removeClass("ug-dragging")))}function p(t){if(0==l.isControlEnabled)return!0;t.preventDefault(),l.touch_active=!0;var r=d(t);n.stop(!0),function(t){var i=e.getInnerStripPos();l.mousePos=t,l.innerPos=i,l.lastPortionPos=i,l.lastDeltaTime=0,l.lastDeltaPos=0,l.startTime=jQuery.now(),l.startPos=l.innerPos,l.lastTime=l.startTime,l.lastPos=l.startPos,l.speed=0}(r),function(){if(1==l.loop_active)return!0;l.loop_active=!0,l.handle=setInterval(_,10)}(),i.addClass("ug-dragging")}function m(t){if(0==l.isControlEnabled)return!0;if(0==l.touch_active)return!0;if(t.preventDefault(),0==t.buttons)return l.touch_active=!1,c(t),!0;var i=d(t);l.lastPos=e.getInnerStripPos(),function(t){var i=l.mousePos-t,n=l.innerPos-i,r=e.getInnerStripLimits();if(n>r.maxPos){var o=n-r.maxPos;n=r.maxPos+o/3}n<r.minPos&&(o=r.minPos-n,n=r.minPos-o/3);e.positionInnerStrip(n)}(i),_()}this.enable=function(){l.isControlEnabled=!0},this.disable=function(){l.isControlEnabled=!1},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,t.g_objGallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,s.thumb_touch_slowFactor=a.normalizeSetting(5e-5,.01,1,100,r.strip_thumb_touch_sensetivity,!0),i.bind("mousedown touchstart",p),jQuery(window).add("body").bind("mouseup touchend",h),jQuery("body").bind("mousemove touchmove",m)},this.isSignificantPassed=function(){var e=u();return e.passedTime>300||e.passedDistanceAbs>30},this.isTouchActive=function(){return 1==l.touch_active||(1==n.is(":animated")||u().lastActiveTime<50)},this.destroy=function(){i.unbind("mousedown"),i.unbind("touchstart"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){var e,t,i,n,r,o,a,s=new UniteGalleryMain,l=this,u=new UGFunctions;function d(t,n){switch(e.orientation){case"right":case"left":var r={left:t+"px"};break;case"top":case"bottom":r={top:t+"px"}}i.stop(!0).animate(r,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){n&&n()}})}function _(t){switch(e.orientation){case"right":case"left":u.placeElement(i,t,null);break;case"top":case"bottom":u.placeElement(i,null,t)}}function g(){r.trigger(t.events.FINISH_MOVE)}this.init=function(i,o,l,u,d){e=o,t=l,s=i,n=u,r=d,a=jQuery(s)},this.setHtml=function(r){if(i=r,"strip"==e.panelType)var a=n.strippanel_enable_handle;else a=n.gridpanel_enable_handle;if(1==a&&((o=new UGPanelHandle).init(t,i,n,e.panelType,s),o.setHtml()),!0===e.isDisabledAtStart){i.append("<div class='ug-overlay-disabled'></div>"),setTimeout(function(){i.children(".ug-overlay-disabled").hide()},e.disabledAtStartTimeout)}},this.placeElements=function(){o&&o.placeHandle()},this.initEvents=function(){o&&(o.initEvents(),a.on(s.events.SLIDER_ACTION_START,function(){o.hideHandle()}),a.on(s.events.SLIDER_ACTION_END,function(){o.showHandle()}))},this.destroy=function(){o&&(o.destroy(),a.off(s.events.SLIDER_ACTION_START),a.off(s.events.SLIDER_ACTION_END))},this.openPanel=function(n){if(!n)n=!1;return!i.is(":animated")&&(0!=e.isClosed&&(e.isClosed=!1,r.trigger(t.events.OPEN_PANEL),void(!1===n?d(e.originalPos,g):(_(e.originalPos),g()))))},this.closePanel=function(n){if(!n)n=!1;if(i.is(":animated"))return!1;if(1==e.isClosed)return!1;var o=l.getClosedPanelDest();e.isClosed=!0,r.trigger(t.events.CLOSE_PANEL),!1===n?d(o,g):(_(o),g())},this.setClosedState=function(i){e.originalPos=i,r.trigger(t.events.CLOSE_PANEL),e.isClosed=!0},this.setOpenedState=function(i){r.trigger(t.events.OPEN_PANEL),e.isClosed=!1},this.getClosedPanelDest=function(){var t,n=u.getElementSize(i);switch(e.orientation){case"left":e.originalPos=n.left,t=-e.panelWidth;break;case"right":e.originalPos=n.left,t=s.getSize().width;break;case"top":e.originalPos=n.top,t=-e.panelHeight;break;case"bottom":e.originalPos=n.top,t=s.getSize().height}return t},this.isPanelClosed=function(){return e.isClosed},this.setDisabledAtStart=function(t){if(t<=0)return!1;e.isDisabledAtStart=!0,e.disabledAtStartTimeout=t}}function UGPanelHandle(){var e,t,i,n=new UGFunctions,r={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0};function o(){i.removeClass("ug-button-hover")}function a(e){if(e.stopPropagation(),e.stopImmediatePropagation(),0==n.validateClickTouchstartEvent(e.type))return!0;t.isPanelClosed()?t.openPanel():t.closePanel()}this.init=function(i,n,o,a,s){switch(t=i,e=n,a){case"grid":r.panel_handle_align=o.gridpanel_handle_align,r.panel_handle_offset=o.gridpanel_handle_offset,r.panel_handle_skin=o.gridpanel_handle_skin;break;case"strip":r.panel_handle_align=o.strippanel_handle_align,r.panel_handle_offset=o.strippanel_handle_offset,r.panel_handle_skin=o.strippanel_handle_skin;break;default:throw new Error("Panel handle error: wrong panel type: "+a)}var l=s.getOptions().gallery_skin;""==r.panel_handle_skin&&(r.panel_handle_skin=l)},this.setHtml=function(){var n="ug-panel-handle-tip";switch(t.getOrientation()){case"right":n+=" ug-handle-tip-left";break;case"left":n+=" ug-handle-tip-right";break;case"bottom":n+=" ug-handle-tip-top";break;case"top":n+=" ug-handle-tip-bottom"}e.append("<div class='"+n+" ug-skin-"+r.panel_handle_skin+"'></div>"),i=e.children(".ug-panel-handle-tip")},this.initEvents=function(){n.addClassOnHover(i),i.bind("click touchstart",a),jQuery(t).on(t.events.OPEN_PANEL,function(){o(),i.removeClass("ug-button-closed")}),jQuery(t).on(t.events.CLOSE_PANEL,function(){o(),i.addClass("ug-button-closed")})},this.destroy=function(){n.destroyButton(i),jQuery(t).off(t.events.OPEN_PANEL),jQuery(t).off(t.events.CLOSE_PANEL)},this.placeHandle=function(){var e=n.getElementSize(i);!function(){switch(t.getOrientation()){case"right":case"left":"top"!=r.panel_handle_align&&"bottom"!=r.panel_handle_align&&(r.panel_handle_align="top");break;case"bottom":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="left");break;case"top":"left"!=r.panel_handle_align&&"right"!=r.panel_handle_align&&(r.panel_handle_align="right")}}();var o=t.getOrientation();switch(o){case"left":n.placeElement(i,"right",r.panel_handle_align,-e.width);break;case"right":n.placeElement(i,-e.width,r.panel_handle_align,0,r.panel_handle_offset);break;case"top":n.placeElement(i,r.panel_handle_align,"bottom",r.panel_handle_offset,-e.height);break;case"bottom":n.placeElement(i,r.panel_handle_align,"top",r.panel_handle_offset,-e.height);break;default:throw new Error("Wrong panel orientation: "+o)}},this.hideHandle=function(){1==i.is(":visible")&&i.hide()},this.showHandle=function(){0==i.is(":visible")&&i.show()}}function UGStripPanel(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGThumbsStrip,d=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var _={strippanel_vertical_type:!1,strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},g={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},c={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},h={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0};function p(){if(1==h.isFirstRun&&0==function(){if(0==_.strippanel_vertical_type){if(0==h.panelWidth)throw new Error("Strip panel error: The width not set, please set width")}else if(0==h.panelHeight)throw new Error("Strip panel error: The height not set, please set height");if(null==h.orientation)throw new Error("Wrong orientation, please set panel orientation before run");return!0}())return!1;u.run(),f(),b(),function(){if(1==h.isEventsInited)return!1;if(h.isEventsInited=!0,n)if(l.addClassOnHover(n,"ug-button-hover"),l.addClassOnHover(r,"ug-button-hover"),l.setButtonOnClick(r,y),l.setButtonOnClick(n,v),"advance_item"!=_.strippanel_buttons_role)jQuery(u).on(u.events.STRIP_MOVE,w),jQuery(u).on(u.events.INNER_SIZE_CHANGE,I),e.on(s.events.SIZE_CHANGE,I);else{var t=s.getOptions();0==t.gallery_carousel&&jQuery(s).on(s.events.ITEM_CHANGE,E)}d.initEvents()}(),h.isFirstRun=!1,I()}function m(e){if(!e)e=t;if(e.append("<div class='ug-strip-panel'></div>"),i=e.children(".ug-strip-panel"),1==_.strippanel_enable_buttons){var o="ug-strip-arrow-left",a="ug-strip-arrow-right";1==_.strippanel_vertical_type&&(o="ug-strip-arrow-up",a="ug-strip-arrow-down"),i.append("<div class='ug-strip-arrow "+o+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>"),i.append("<div class='ug-strip-arrow "+a+" ug-skin-"+_.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>")}d.setHtml(i),u.setHtml(i),1==_.strippanel_enable_buttons&&(r=i.children("."+o),n=i.children("."+a)),""!=_.strippanel_background_color&&i.css("background-color",_.strippanel_background_color)}function f(){0==_.strippanel_vertical_type?function(){var e=u.getHeight(),t=h.panelWidth;if(n){r.height(e),n.height(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_top+_.strippanel_padding_bottom;i.width(t),i.height(s),h.panelHeight=s;var d=t-_.strippanel_padding_left-_.strippanel_padding_right;n&&(d=d-2*n.outerWidth()-2*_.strippanel_padding_buttons),u.resize(d)}():function(){var e=u.getWidth(),t=h.panelHeight;if(n){r.width(e),n.width(e);var o=r.children(".ug-strip-arrow-tip");l.placeElement(o,"center","middle");var a=n.children(".ug-strip-arrow-tip");l.placeElement(a,"center","middle")}var s=e+_.strippanel_padding_left+_.strippanel_padding_right;i.width(s),i.height(t),h.panelWidth=s;var d=t-_.strippanel_padding_top-_.strippanel_padding_bottom;n&&(d=d-2*n.outerHeight()-2*_.strippanel_padding_buttons),u.resize(d)}()}function b(){0==_.strippanel_vertical_type?function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"right","top",_.strippanel_padding_right,_.strippanel_padding_top));var e=_.strippanel_padding_left;n&&(e+=n.outerWidth()+_.strippanel_padding_buttons),u.setPosition(e,_.strippanel_padding_top)}():function(){n&&(l.placeElement(r,"left","top",_.strippanel_padding_left,_.strippanel_padding_top),l.placeElement(n,"left","bottom",_.strippanel_padding_left,_.strippanel_padding_bottom));var e=_.strippanel_padding_top;n&&(e+=n.outerHeight()+_.strippanel_padding_buttons),u.setPosition(_.strippanel_padding_left,e)}(),d.placeElements()}function v(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.nextItem():u.scrollForeward()}function y(e){if(l.isButtonDisabled(e))return!0;"advance_item"==_.strippanel_buttons_role?s.prevItem():u.scrollBack()}function I(){if(!n)return!0;if(0==u.isMoveEnabled())return l.disableButton(r),l.disableButton(n),!0;var e=u.getInnerStripLimits(),t=u.getInnerStripPos();t>=e.maxPos?l.disableButton(r):l.enableButton(r),t<=e.minPos?l.disableButton(n):l.enableButton(n)}function w(){I()}function E(){s.isLastItem()?l.disableButton(n):l.enableButton(n),s.isFirstItem()?l.disableButton(r):l.enableButton(r)}this.destroy=function(){n&&(l.destroyButton(n),l.destroyButton(r),jQuery(u).off(u.events.STRIP_MOVE),jQuery(s).off(s.events.ITEM_CHANGE),jQuery(s).off(s.events.SIZE_CHANGE)),d.destroy(),u.destroy()},this.getOrientation=function(){return h.orientation},this.setOrientation=function(e){h.orientation=e},this.init=function(i,n){!function(i,n){s=i,e=jQuery(s);var r=!1;1==(_=jQuery.extend(_,n)).strippanel_vertical_type&&(_=jQuery.extend(_,g),r=!0),0==_.strippanel_enable_buttons&&(_=jQuery.extend(_,c),r=!0),1==r&&(_=jQuery.extend(_,n));var l=s.getOptions().gallery_skin;""==_.strippanel_buttons_skin&&(_.strippanel_buttons_skin=l),t=s.getElement(),d.init(s,h,o,_,a),(u=new UGThumbsStrip).init(s,_)}(i,n)},this.run=function(){p()},this.setHtml=function(e){m(e)},this.getElement=function(){return i},this.getSize=function(){return l.getElementSize(i)},this.setWidth=function(e){h.panelWidth=e},this.setHeight=function(e){h.panelHeight=e},this.resize=function(e){o.setWidth(e),f(),b()},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return d.isPanelClosed()},this.getClosedPanelDest=function(){return d.getClosedPanelDest()},this.openPanel=function(e){d.openPanel(e)},this.closePanel=function(e){d.closePanel(e)},this.setOpenedState=function(e){d.setOpenedState(e)},this.setClosedState=function(e){d.setClosedState(e)},this.setCustomThumbs=function(e){u.setCustomThumbs(e)},this.setDisabledAtStart=function(e){d.setDisabledAtStart(e)}}function UGGridPanel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGThumbsGrid,u=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var d={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!1,gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},_={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},g={gridpanel_grid_align:"center"},c={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};function h(){if(null==c.orientation)throw new Error("Wrong orientation, please set panel orientation before run")}function p(){h(),"center"==d.gridpanel_grid_align&&(d.gridpanel_grid_align="middle"),l.run(),function(){var e=!1;if(1==d.gridpanel_arrows_always_on)e=!0;else{var t=l.getNumPanes();t>1&&(e=!0)}1==e?(i.show().fadeTo(0,1),n.show().fadeTo(0,1),c.arrowsVisible=!0):(i.hide(),n.hide(),c.arrowsVisible=!1)}(),function(){var e=l.getSize();1==c.isHorType?c.panelHeight=e.height+d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom:c.panelWidth=e.width+d.gridpanel_padding_border_left+d.gridpanel_padding_border_right;s.setElementSize(t,c.panelWidth,c.panelHeight)}(),function(){0==c.isHorType?1==d.gridpanel_vertical_scroll?1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"top":e=d.gridpanel_padding_border_top+a.height+d.gridpanel_arrows_padding_vert;break;case"middle":e="middle";break;case"bottom":e=c.panelHeight-u.height-a.height-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert}var _=f(),g=l.getElement();s.placeElement(g,_,e);var u=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":t=(u.top-a.height)/2,r=u.bottom+(c.panelHeight-u.bottom-a.height)/2,o=0;break;case"grid":t=u.top-a.height-d.gridpanel_arrows_padding_vert_vert,r=u.bottom+d.gridpanel_arrows_padding_vert,o=0;break;case"border":case"borders":t=d.gridpanel_padding_border_top,r="bottom",o=d.gridpanel_padding_border_bottom}s.placeElement(n,"center",t),s.placeElement(i,"center",r,0,o)}():b():1==c.arrowsVisible?function(){var e,t,r,o=s.getElementSize(n),a=l.getSize(),u=d.gridpanel_padding_border_top;switch(d.gridpanel_grid_align){case"middle":switch(d.gridpanel_arrows_align_vert){default:var _=a.height+d.gridpanel_arrows_padding_vert+o.height;u=(c.panelHeight-_)/2;break;case"border":case"borders":var g=c.panelHeight-o.height-d.gridpanel_padding_border_bottom;u=(g-a.height)/2}break;case"bottom":var _=a.height+o.height+d.gridpanel_arrows_padding_vert;u=c.panelHeight-_-d.gridpanel_padding_border_bottom}var h=l.getElement(),p=f();s.placeElement(h,p,u);var a=l.getSize();switch(d.gridpanel_arrows_align_vert){default:case"center":case"middle":e=a.bottom+(c.panelHeight-a.bottom-o.height)/2,r=0;break;case"grid":e=a.bottom+d.gridpanel_arrows_padding_vert,r=0;break;case"border":case"borders":e="bottom",r=d.gridpanel_padding_border_bottom}t=-o.width/2-d.gridpanel_space_between_arrows/2,s.placeElement(n,"center",e,t,r);var m=Math.abs(t);s.placeElement(i,"center",e,m,r)}():b():1==c.arrowsVisible?function(){var e,t,r,o,a=s.getElementSize(n),u=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left+d.gridpanel_arrows_padding_hor+a.width;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-u.width-a.width-d.gridpanel_padding_border_right-d.gridpanel_arrows_padding_hor}var _=l.getElement();switch(s.placeElement(_,e,d.gridpanel_padding_border_top),u=l.getSize(),d.gridpanel_arrows_align_vert){default:case"center":case"middle":o=(u.height-a.height)/2+u.top;break;case"top":o=d.gridpanel_padding_border_top+d.gridpanel_arrows_padding_vert;break;case"bottom":o=c.panelHeight-d.gridpanel_padding_border_bottom-d.gridpanel_arrows_padding_vert-a.height}switch(d.gridpanel_arrows_align_hor){default:case"borders":t=d.gridpanel_padding_border_left,r=c.panelWidth-d.gridpanel_padding_border_right-a.width;break;case"grid":t=u.left-d.gridpanel_arrows_padding_hor-a.width,r=u.right+d.gridpanel_arrows_padding_hor;break;case"center":t=(u.left-a.width)/2,r=u.right+(c.panelWidth-u.right-a.width)/2}s.placeElement(n,t,o),s.placeElement(i,r,o)}():function(){var e,t=l.getSize();switch(d.gridpanel_grid_align){default:case"left":e=d.gridpanel_padding_border_left;break;case"middle":case"center":e="center";break;case"right":e=c.panelWidth-t.width-d.gridpanel_padding_border_right}var i=l.getElement();s.placeElement(i,e,d.gridpanel_padding_border_top)}();u.placeElements()}(),function(){if(1==c.isEventsInited)return!1;c.isEventsInited=!0,n&&(s.addClassOnHover(n),l.attachPrevPaneButton(n));i&&(s.addClassOnHover(i),l.attachNextPaneButton(i));u.initEvents()}()}function m(){e.append("<div class='ug-grid-panel'></div>"),t=e.children(".ug-grid-panel"),c.isHorType?(t.append("<div class='grid-arrow grid-arrow-left-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right-hortype ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left-hortype"),i=t.children(".grid-arrow-right-hortype")):0==d.gridpanel_vertical_scroll?(t.append("<div class='grid-arrow grid-arrow-left ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-right ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-left"),i=t.children(".grid-arrow-right")):(t.append("<div class='grid-arrow grid-arrow-up ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),t.append("<div class='grid-arrow grid-arrow-down ug-skin-"+d.gridpanel_arrows_skin+"'></div>"),n=t.children(".grid-arrow-up"),i=t.children(".grid-arrow-down")),u.setHtml(t),n.fadeTo(0,0),i.fadeTo(0,0),l.setHtml(t),""!=d.gridpanel_background_color&&t.css("background-color",d.gridpanel_background_color)}function f(){return d.gridpanel_padding_border_left}function b(){var e=d.gridpanel_grid_align,t=0;switch(e){case"top":t=d.gridpanel_padding_border_top;break;case"bottom":t=d.gridpanel_padding_border_bottom}var i=f(),n=l.getElement();s.placeElement(n,i,e,0,t)}this.destroy=function(){n&&s.destroyButton(n),i&&s.destroyButton(i),u.destroy(),l.destroy()},this.getOrientation=function(){return c.orientation},this.setOrientation=function(e){switch(c.orientation=e,e){case"right":case"left":c.isHorType=!1;break;case"top":case"bottom":c.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+e)}},this.setHeight=function(e){if(1==c.isHorType)throw new Error("setHeight is not appliable to this orientatio ("+c.orientation+"). Please use setWidth");c.panelHeight=e;var t,n,r=(t=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByHeight(n)?n:(t=s.getElementSize(i).height+d.gridpanel_arrows_padding_vert,1==d.gridpanel_vertical_scroll&&(t*=2),t+=d.gridpanel_padding_border_top+d.gridpanel_padding_border_bottom,n=c.panelHeight-t));l.setMaxHeight(r)},this.setWidth=function(e){if(0==c.isHorType)throw new Error("setWidth is not appliable to this orientatio ("+c.orientation+"). Please use setHeight");c.panelWidth=e;var t,n,r=(t=d.gridpanel_padding_border_left+d.gridpanel_padding_border_right,n=c.panelWidth-t,0==d.gridpanel_arrows_always_on&&1==l.getNumPanesEstimationByWidth(n)?n:(t+=2*(s.getElementSize(i).width+d.gridpanel_arrows_padding_hor),n=c.panelWidth-t));l.setMaxWidth(r)},this.init=function(t,i){!function(t,i){a=t,h(),i&&i.vertical_scroll&&(d.gridpanel_vertical_scroll=i.vertical_scroll),d=jQuery.extend(d,i),1==c.isHorType?(d=jQuery.extend(d,g),d=jQuery.extend(d,i)):1==d.gridpanel_vertical_scroll&&(d=jQuery.extend(d,_),(d=jQuery.extend(d,i)).grid_panes_direction="bottom");var n=a.getOptions().gallery_skin;""==d.gridpanel_arrows_skin&&(d.gridpanel_arrows_skin=n);var s=t.getObjects();e=s.g_objWrapper,u.init(a,c,r,d,o),(l=new UGThumbsGrid).init(a,d)}(t,i)},this.setHtml=function(){m()},this.run=function(){p()},this.getElement=function(){return t},this.getSize=function(){return s.getElementSize(t)},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return u.isPanelClosed()},this.getClosedPanelDest=function(){return u.getClosedPanelDest()},this.openPanel=function(e){u.openPanel(e)},this.closePanel=function(e){u.closePanel(e)},this.setOpenedState=function(e){u.setOpenedState(e)},this.setClosedState=function(e){u.setClosedState(e)},this.setDisabledAtStart=function(e){u.setDisabledAtStart(e)}}function UGThumbsGrid(){var e,t,n,r,o,a,s=this,l=jQuery(this),u=new UniteGalleryMain,d=new UGFunctions,_=new UGThumbsGeneral,g=new UGTileDesign,c={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1};this.events={PANE_CHANGE:"pane_change"};var h={eventSizeChange:"thumb_size_change",isHorizontal:!1,isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};function p(i,o,a){var l;if(t=i.getObjects(),(u=i).attachThumbsPanel("grid",s),e=jQuery(i),n=t.g_objWrapper,r=t.g_arrItems,!0===a&&(h.isTilesMode=!0),h.numThumbs=r.length,l=o,c=jQuery.extend(c,l),_.setOptions(l),h.isNavigationVertical="top"==c.grid_panes_direction||"bottom"==c.grid_panes_direction,h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows,1==h.isTilesMode){g.setFixedMode(),g.setApproveClickFunction(j),g.init(i,c);var d=g.getOptions();h.tileMaxHeight=d.tile_height,h.tileMaxWidth=d.tile_width,_=g.getObjThumbs()}else o.thumb_fixed_size=!0,_.init(i,o)}function m(){var t=u.getSelectedItem();(function(){if(0==h.isHorizontal){if(0==h.gridHeight)throw new Error("You must set height before run.")}else if(0==h.gridWidth)throw new Error("You must set width before run.")}(),1==h.isFirstTimeRun)?(!function(){if(0==h.isTilesMode){_.initEvents();var t=o.find(".ug-thumb-wrapper");t.on("click touchend",C),e.on(u.events.ITEM_CHANGE,z)}else g.initEvents();o.bind("mousedown touchstart",A),jQuery("body").bind("mousemove touchmove",M),jQuery(window).add("body").bind("mouseup touchend",O)}(),1==h.isTilesMode?(b(),v(),g.run()):(_.setHtmlProperties(),v(),_.loadThumbsImages())):1==h.isTilesMode&&1==b()&&(v(),g.run());if(0==h.isHorizontal?h.isNavigationVertical?function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(l);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t+=p+h.spaceBetweenCols;var f=n+m;f>r&&(r=f),++s>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=l,s=0),1==h.numPanes&&h.numThumbsInPane++,f=n+m;var b=u+h.gridHeight;f>b&&(1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(h.gridHeight),b=h.gridHeight),n=b+h.spaceBetweenRows,u=n,t=l=0,s=0,i<_-1&&(h.numPanes++,h.arrPanes.push(n)))}a.height(r),h.innerHeight=r,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=r,o.height(r))}():function(){var e=a.children(".ug-thumb-wrapper"),t=0,n=0,r=0,s=0,l=0,u=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(s);var _=e.length;for(i=0;i<_;i++){var g=jQuery(e[i]);d.placeElement(g,t,n);var p=g.outerWidth(),m=g.outerHeight();t>l&&(l=t);var f=n+m;f>u&&(u=f);var b=l+p;b>h.innerWidth&&(h.innerWidth=b),t+=p+h.spaceBetweenCols,++r>=c.grid_num_cols&&(n+=m+h.spaceBetweenRows,t=s,r=0),1==h.numPanes&&h.numThumbsInPane++,n+m>h.gridHeight&&(n=0,s=h.innerWidth+h.spaceBetweenCols,t=s,r=0,1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(h.gridHeight)),i<_-1&&(h.numPanes++,h.arrPanes.push(s)))}a.width(h.innerWidth),1==h.isMaxHeight&&1==h.numPanes&&(h.gridHeight=u,o.height(u))}():function(){var e=a.children(".ug-thumb-wrapper"),t=c.grid_padding,n=c.grid_padding,r=n,s=t,l=0,u=0,_=0,g=0,p=0;h.innerWidth=0,h.numPanes=1,h.arrPanes=[],h.numThumbsInPane=0,h.arrPanes.push(t-c.grid_padding);var m=e.length;for(i=0;i<m;i++){var f=jQuery(e[i]),b=f.outerWidth(),v=f.outerHeight();s-t+b>h.gridWidth&&(r=0,++p>=c.grid_num_rows?(p=0,t=s,r=n,_=0,1==h.numPanes&&(h.gridWidth=l+c.grid_padding,o.width(h.gridWidth),h.gridHeight=g+c.grid_padding,o.height(h.gridHeight)),h.numPanes++,h.arrPanes.push(t-c.grid_padding)):(s=t,r=_+h.spaceBetweenRows)),d.placeElement(f,s,r);var y=s+b;y>l&&(l=y);var I=r+v;I>_&&(_=I),I>g&&(g=I),I>u&&(u=I);var y=l+b;y>h.innerWidth&&(h.innerWidth=y),s+=b+h.spaceBetweenCols,1==h.numPanes&&h.numThumbsInPane++}h.innerWidth=l+c.grid_padding,h.innerHeight=g+c.grid_padding,a.width(h.innerWidth),a.height(h.innerHeight),1==h.numPanes&&(h.gridWidth=l+c.grid_padding,h.gridHeight=g+c.grid_padding,o.width(h.gridWidth),o.height(h.gridHeight))}(),1==h.isFirstTimeRun&&h.isTilesMode){var r=_.getThumbs();r.each(function(e,t){n.trigger(h.eventSizeChange,jQuery(t))}),r.fadeTo(0,1)}null!=t&&y(t.index),l.trigger(s.events.PANE_CHANGE,h.currentPane),h.isFirstTimeRun=!1}function f(){if(1==h.isTilesMode)var e=g.getGlobalTileSize();else e=_.getGlobalThumbSize();return e}function b(){if(0==h.isTilesMode)throw new Error("Dynamic size can be set only in tiles mode");var e=!1,t=u.isMobileMode(),i=h.spaceBetweenCols;1==t?(h.spaceBetweenCols=c.grid_space_between_mobile,h.spaceBetweenRows=c.grid_space_between_mobile):(h.spaceBetweenCols=c.grid_space_between_cols,h.spaceBetweenRows=c.grid_space_between_rows),h.spaceBetweenCols!=i&&(e=!0);var n=f().width,r=h.tileMaxWidth;return d.getNumItemsInSpace(h.gridWidth,h.tileMaxWidth,h.spaceBetweenCols)<c.grid_min_cols&&(r=d.getItemSizeInSpace(h.gridWidth,c.grid_min_cols,h.spaceBetweenCols)),g.setTileSizeOptions(r),r!=n&&(e=!0),e}function v(){var e,t,i;0==h.isHorizontal?(e=f().width,t=c.grid_num_cols*e+(c.grid_num_cols-1)*h.spaceBetweenCols+2*c.grid_padding,i=h.gridHeight,h.gridWidth=t,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i):function(){var e=f().height,t=h.gridWidth,i=c.grid_num_rows*e+(c.grid_num_rows-1)*h.spaceBetweenRows+2*c.grid_padding;h.gridHeight=i,d.setElementSize(o,t,i),d.setElementSize(a,t,i),h.innerWidth=t,h.innerHeight=i}()}function y(e){var t=P(e);if(-1==t)return!1;s.gotoPane(t,"scroll")}function I(e){if(e>=h.numPanes||e<0)throw new Error("Pane "+index+" doesn't exists.");return!0}function w(e){var t=T(e);if(0==t)return!1;a.stop(!0).animate(t,{duration:c.grid_transition_duration,easing:c.grid_transition_easing,queue:!1})}function E(){w(-h.arrPanes[h.currentPane])}function T(e){var t={};return 1==h.isNavigationVertical?t.top=e+"px":t.left=e+"px",t}function S(){var e=d.getElementSize(a);return 1==h.isNavigationVertical?e.top:e.left}function P(e){return 0==function(e){if(e<0||e>=h.numThumbs)throw new Error("Thumb not exists: "+e);return!0}(e)?-1:Math.floor(e/h.numThumbsInPane)}function x(){var e=d.getStoredEventData(h.storedEventID),t=S();diffPos=Math.abs(e.startInnerPos-t);var i=1==h.isNavigationVertical?h.gridHeight:h.gridWidth,n=Math.round(3*i/8);return diffPos>=n||e.diffTime<300&&diffPos>25}function j(){return 1==h.numPanes||d.isApproveStoredEventClick(h.storedEventID,h.isNavigationVertical)}function C(e){if(1==function(){if(1==h.numPanes)return!1;var e=d.getStoredEventData(h.storedEventID),t=e.diffTime,i=S(),n=Math.abs(i-e.startInnerPos);return n>30||n>5&&t>300}())return!0;var t=jQuery(this),i=_.getItemByThumb(t);u.selectItem(i)}function A(e){if(1==h.numPanes)return!0;if(1==h.touchActive)return!0;0==h.isTilesMode&&e.preventDefault(),h.touchActive=!0;var t={startInnerPos:S()};d.storeEventData(e,h.storedEventID,t)}function M(e){if(0==h.touchActive)return!0;e.preventDefault(),d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(0!=c.grid_vertical_scroll_ondrag&&1!=h.isNavigationVertical&&"vert"===d.handleScrollTop(h.storedEventID))return!0;var i=t.diffMousePos,n=t.startInnerPos+i,r=i>0?"prev":"next",o=h.arrPanes[h.numPanes-1];0==c.grid_carousel&&n>0&&"prev"==r&&(n/=3),0==c.grid_carousel&&n<-o&&"next"==r&&(n=t.startInnerPos+i/3),function(e){var t=T(e);if(0==t)return!1;a.css(t)}(n)}function O(e){if(0==h.touchActive)return!0;d.updateStoredEventData(e,h.storedEventID);var t=d.getStoredEventData(h.storedEventID,h.isNavigationVertical);if(h.touchActive=!1,0==x())return E(),!0;"next"==(S()-t.startInnerPos>0?"prev":"next")?0==c.grid_carousel&&s.isLastPane()?E():s.nextPane():0==c.grid_carousel&&s.isFirstPane()?E():s.prevPane()}function z(){var e=u.getSelectedItem();_.setThumbSelected(e.objThumbWrapper),y(e.index)}this.destroy=function(){if(0==h.isTilesMode){var t=o.find(".ug-thumb-wrapper");t.off("click"),t.off("touchend"),e.on(u.events.ITEM_CHANGE),_.destroy()}else g.destroy();o.unbind("mousedown"),o.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("touchend"),jQuery(window).add("body").unbind("mouseup"),l.off(s.events.PANE_CHANGE)},this.__________EXTERNAL_GENERAL_________=function(){},this.setThumbUnselected=function(e){_.setThumbUnselected(e)},this.isItemThumbVisible=function(e){return P(e.index)==h.currentPane},this.__________EXTERNAL_API_________=function(){},this.getNumPanesEstimationByHeight=function(e){if(1==h.isTilesMode)var t=c.tile_height;else t=_.getOptions().thumb_height;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_cols),r=n*t+(n-1)*h.spaceBetweenRows;return Math.ceil(r/e)},this.getNumPanesEstimationByWidth=function(e){if(h.isTilesMode)var t=c.tile_width;else t=_.getOptions().thumb_width;var i=_.getNumThumbs(),n=Math.ceil(i/c.grid_num_rows),r=n*t+(n-1)*h.spaceBetweenCols;return Math.ceil(r/e)},this.getHeightEstimationByWidth=function(e){if(0==h.isTilesMode)throw new Error("This function works only with tiles mode");var t=_.getNumThumbs(),i=d.getNumItemsInSpace(e,c.tile_width,h.spaceBetweenCols),n=Math.ceil(t/i);n>c.grid_num_rows&&(n=c.grid_num_rows);var r=d.getSpaceByNumItems(n,c.tile_height,h.spaceBetweenRows);return r+=2*c.grid_padding},this.getElement=function(){return o},this.getSize=function(){return d.getElementSize(o)},this.getNumPanes=function(){return h.numPanes},this.isFirstPane=function(){return 0==h.currentPane},this.isLastPane=function(){return h.currentPane==h.numPanes-1},this.getPaneInfo=function(){return{pane:h.currentPane,total:h.numPanes}},this.getPane=function(){return h.currentPane},this.setWidth=function(e){h.gridWidth=e,h.isHorizontal=!0},this.setMaxWidth=function(e){h.gridWidth=e,h.isMaxWidth=!0,h.isHorizontal=!0},this.setHeight=function(e){h.gridHeight=e,h.isHorizontal=!1},this.setMaxHeight=function(e){h.gridHeight=e,h.isMaxHeight=!0,h.isHorizontal=!1},this.gotoPane=function(e,t){if(0==I(e))return!1;if(e==h.currentPane)return!1;var i=-h.arrPanes[e];h.currentPane=e,w(i),l.trigger(s.events.PANE_CHANGE,e)},this.nextPane=function(){var e=h.currentPane+1;if(e>=h.numPanes){if(0==c.grid_carousel)return!0;e=0}s.gotoPane(e,"next")},this.prevPane=function(){var e=h.currentPane-1;if(e<0&&(e=h.numPanes-1,0==c.grid_carousel))return!1;s.gotoPane(e,"prev")},this.attachNextPaneButton=function(e){if(d.setButtonOnClick(e,s.nextPane),1==c.grid_carousel)return!0;s.isLastPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isLastPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachPrevPaneButton=function(e){if(d.setButtonOnClick(e,s.prevPane),1==c.grid_carousel)return!0;s.isFirstPane()&&e.addClass("ug-button-disabled"),l.on(s.events.PANE_CHANGE,function(){s.isFirstPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachBullets=function(e){e.setActive(h.currentPane),jQuery(e).on(e.events.BULLET_CLICK,function(t,i){s.gotoPane(i,"theme"),e.setActive(i)}),jQuery(s).on(s.events.PANE_CHANGE,function(t,i){e.setActive(i)})},this.getObjTileDesign=function(){return g},this.init=function(e,t,i){p(e,t,i)},this.run=function(){m()},this.setHtml=function(e){!function(e){var t=n;e&&(t=e),t.append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'></div></div>"),o=t.children(".ug-thumbs-grid"),a=o.children(".ug-thumbs-grid-inner"),1==h.isTilesMode?g.setHtml(a):_.setHtmlThumbs(a)}(e)}}function UGTileDesign(){var e,t,i=this,n=jQuery(this),r=new UniteGalleryMain,o=new UGFunctions,a=new UGThumbsGeneral;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"},this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"},this.events={TILE_CLICK:"tile_click"};var s={tile_width:250,tile_height:200,tile_size_by:i.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},l={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},u={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};function d(e,n){r=e,jQuery(e);var d=r.getObjects();t=d.g_objWrapper,r.getArrItems(),s=jQuery.extend(s,l),s=jQuery.extend(s,n),function(){1==s.tile_enable_overlay?(s.thumb_overlay_opacity=s.tile_overlay_opacity,s.thumb_overlay_color=s.tile_overlay_color):0==s.tile_enable_icons?s.thumb_color_overlay_effect=!1:s.thumb_overlay_opacity=0;s.tile_as_link&&(s.thumb_wrapper_as_link=!0,s.thumb_link_newpage=s.tile_link_newpage);1==s.tile_enable_outline&&0==s.tile_enable_border&&(s.tile_enable_outline=!1);u.tileInnerReduce=0,s.tile_enable_border&&(u.tileInnerReduce=2*s.tile_border_width,a.setThumbInnerReduce(u.tileInnerReduce));if(u.isSaparateIcons=!o.isRgbaSupported(),1==s.tile_enable_textpanel){switch(s.tile_textpanel_position){case"top":s.tile_textpanel_align="top";case"bottom":u.isTextpanelOutside=!0,s.tile_textpanel_always_on=!0,s.tile_textpanel_offset=0;break;case"inside_top":s.tile_textpanel_align="top";break;case"middle":s.tile_textpanel_align="middle",s.tile_textpanel_appear_type="fade"}0==s.tile_textpanel_always_on&&(u.isSaparateIcons=!0)}0!=s.tile_textpanel_offset&&(s.tile_textpanel_appear_type="fade",s.tile_textpanel_margin=s.tile_textpanel_offset);"title_and_desc"==s.tile_textpanel_source&&(s.tile_textpanel_enable_description=!0,s.tile_textpanel_desc_style_as_title=!0)}(),a.init(e,s);var _=["overlay"];u.funcCustomTileHtml&&(_=[]),a.setCustomThumbs(g,_,{allow_onresize:!1});var c=a.getOptions();s=jQuery.extend(s,c),u.ratioByWidth=s.tile_width/s.tile_height,u.ratioByHeight=s.tile_height/s.tile_width,s.tile_size_by==i.sizeby.GLOBAL_RATIO&&u.isTextpanelOutside&&(u.hasImageContainer=!0)}function _(){var e=r.isMobileMode();switch(u.isTextPanelHidden=!1,1==e&&0==s.tile_textpanel_always_on&&(u.isTextPanelHidden=!0),u.isVideoplayIconAlwaysOn=s.tile_videoplay_icon_always_on,s.tile_videoplay_icon_always_on){case"always":u.isVideoplayIconAlwaysOn=!0;break;case"never":u.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":u.isVideoplayIconAlwaysOn=1==e;break;case"desktop_only":u.isVideoplayIconAlwaysOn=0==e}}function g(e,t){if(e.addClass("ug-tile"),u.funcCustomTileHtml)return u.funcCustomTileHtml(e,t),!1;var n="";1==u.hasImageContainer&&(n+="<div class='ug-image-container ug-trans-enabled'>");var a="ug-thumb-image";0!=s.tile_enable_image_effect&&1!=s.tile_image_effect_reverse||(a+=" ug-trans-enabled");var l=o.stripTags(t.title);l=o.htmlentitles(l),n+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+l+"' class='"+a+"'>",1==u.hasImageContainer&&(n+="</div>"),e.append(n),s.tile_size_by==i.sizeby.GLOBAL_RATIO&&e.fadeTo(0,0);var d={};if(1==s.tile_enable_background&&(d["background-color"]=s.tile_background_color),1==s.tile_enable_border&&(d["border-width"]=s.tile_border_width+"px",d["border-style"]="solid",d["border-color"]=s.tile_border_color,s.tile_border_radius&&(d["border-radius"]=s.tile_border_radius+"px")),1==s.tile_enable_outline&&(d.outline="1px solid "+s.tile_outline_color),1==s.tile_enable_shadow){var _=s.tile_shadow_h+"px ";_+=s.tile_shadow_v+"px ",_+=s.tile_shadow_blur+"px ",_+=s.tile_shadow_spread+"px ",_+=s.tile_shadow_color,d["box-shadow"]=_}e.css(d);var g="";if(s.tile_enable_icons){if(0==s.tile_as_link&&1==s.tile_enable_action){var c="ug-button-play ug-icon-zoom";"image"!=t.type&&(c="ug-button-play ug-icon-play"),g+="<div class='ug-tile-icon "+c+"' style='display:none'></div>"}if(t.link&&1==s.tile_show_link_icon||1==s.tile_as_link)if(0==s.tile_as_link){var h="";1==s.tile_link_newpage&&(h=" target='_blank'"),g+="<a href='"+t.link+"'"+h+" class='ug-tile-icon ug-icon-link'></a>"}else g+="<div class='ug-tile-icon ug-icon-link' style='display:none'></div>";var m=u.isSaparateIcons;if(0==m&&"image"!=t.type&&1==u.isVideoplayIconAlwaysOn&&(m=!0),m)var f=e;else f=e.children(".ug-thumb-overlay");f.append(g);var b=f.children("."+c);0==b.length?b=null:b.hide();var v=f.children(".ug-icon-link");0==v.length?v=null:v.hide(),v||1!=s.tile_enable_action||e.addClass("ug-tile-clickable")}else 1==s.tile_enable_action&&e.addClass("ug-tile-clickable");if(1==s.tile_enable_image_effect){var y="";0==s.tile_image_effect_reverse&&(y=" ug-trans-enabled");var I="<div class='ug-tile-image-overlay"+y+"' >",w=" ug-"+s.tile_image_effect_type+"-effect";I+='<img src="'+o.escapeDoubleSlash(t.urlThumb)+"\" alt='"+t.title+"' class='"+w+y+"'>",I+="</div>",e.append(I),1==s.tile_image_effect_reverse&&e.children(".ug-tile-image-overlay").fadeTo(0,0)}if(1==s.tile_enable_textpanel){var E=new UGTextPanel;E.init(r,s,"tile");var T="";1!=s.tile_textpanel_always_on&&1!=u.isTextpanelOutside||(T="ug-trans-enabled"),E.appendHTML(e,T);var S=t.title,P="";switch(s.tile_textpanel_source){case"desc":case"description":S=t.description;break;case"desc_title":""!=t.description&&(S=t.description);break;case"title_and_desc":S=t.title,P=t.description}if(E.setTextPlain(S,P),0==s.tile_textpanel_always_on&&E.getElement().fadeTo(0,0),e.data("objTextPanel",E),1==s.tile_textpanel_always_on)p(e).css("z-index",2);if(1==u.isTextpanelOutside){e.append("<div class='ug-tile-cloneswrapper'></div>");var x=e.children(".ug-tile-cloneswrapper"),j=new UGTextPanel;j.init(r,s,"tile"),j.appendHTML(x),j.setTextPlain(S,P),e.data("objTextPanelClone",j)}}null!==t.addHtml&&e.append(t.addHtml)}function c(e){return e.children(".ug-tile-image-overlay")}function h(e){return e.data("objTextPanel")}function p(e){return e.children(".ug-textpanel")}function m(e){if(1==u.isTextpanelOutside)var t=function(e){var t=e.find(".ug-tile-cloneswrapper .ug-textpanel");if(0==t.length)throw new Error("text panel cloned element not found");return t}(e);else t=p(e);return t?o.getElementSize(t).height:0}function f(e){var t=e.find(".ug-icon-link");return 0==t.length?null:t}function b(e){var t=e.find(".ug-button-play");return 0==t.length?null:t}function v(e){return!!e.hasClass("ug-thumb-over")}function y(e){return e.hasClass("ug-tile-clickable")}function I(e){return 1==s.tile_enable_icons&&1==u.isVideoplayIconAlwaysOn&&"image"!=e.type}function w(e,t,n,r){var a=c(e),l=i.getTileImage(e),d=function(e){return e.find(".ug-tile-image-overlay img")}(e);t-=u.tileInnerReduce,n-=u.tileInnerReduce;var _=null;if(1==u.isTextpanelOutside){var g=m(e);if(n-=g,"top"==s.tile_textpanel_position&&(_=g),1==u.hasImageContainer){var h=function(e){return 0==u.hasImageContainer?null:e.children(".ug-image-container")}(e);o.setElementSize(h,t,n),null!==_&&o.placeElement(h,0,_)}}if(0==s.tile_enable_image_effect)o.scaleImageCoverParent(l,t,n),0==u.hasImageContainer&&null!==_&&o.placeElement(l,0,_);else{var p="nothing";!0===r&&0==u.isTextpanelOutside&&(p=1==s.tile_image_effect_reverse?"effect":"image"),"effect"!=p&&(o.setElementSize(a,t,n),null!==_&&o.placeElement(a,0,_),o.scaleImageCoverParent(d,t,n)),"image"!=p&&(1==u.hasImageContainer?o.scaleImageCoverParent(l,t,n):"effect"==p?(o.scaleImageCoverParent(l,t,n),null!==_&&o.placeElement(l,0,_)):o.cloneElementSizeAndPos(d,l,!1,null,_))}}function E(e,t,n,r){var o=null;if(n&&(o=n-u.tileInnerReduce),r&&(r-=u.tileInnerReduce),"clone"==t)return function(e){return e.data("objTextPanelClone")}(e).refresh(!0,!0,o),i.getItemByTile(e).textPanelCloneSizeSet=!0,!1;var a=h(e);if(!a)return!1;var l=null;if(1==u.isTextpanelOutside&&(l=m(e)),a.refresh(!1,!0,o,l),1==s.tile_textpanel_always_on||"fade"==s.tile_textpanel_appear_type)if(1==u.isTextpanelOutside&&r&&"bottom"==s.tile_textpanel_position){var d=r-l;a.positionPanel(d)}else a.positionPanel()}function T(e){i.getItemByTile(e);var t=b(e),n=f(e),r=o.getElementSize(e);w(e,r.width,r.height),1==s.tile_enable_textpanel&&E(e,"regular",r.width,r.height);var a=r.width-u.tileInnerReduce,l=r.height-u.tileInnerReduce,d=0;if(1==u.isTextpanelOutside){var _=m(e);l-=_,"top"==s.tile_textpanel_position&&(d=_)}var g=function(e){return e.children(".ug-thumb-overlay")}(e);if(o.setElementSizeAndPosition(g,0,d,a,l),t||n){var c=0;if(1==s.tile_enable_textpanel&&0==u.isTextPanelHidden&&0==u.isTextpanelOutside){var h=p(e),v=o.getElementSize(h);v.height>0&&(c=Math.floor(v.height/2*-1))}}if(t&&n){var y=o.getElementSize(t),I=o.getElementSize(n),T=s.tile_space_between_icons,S=y.width+T+I.width,P=Math.floor((r.width-S)/2);P<T&&(T=Math.floor((r.width-y.width-I.width)/3),S=y.width+T+I.width,P=Math.floor((r.width-S)/2)),o.placeElement(t,P,"middle",0,c),o.placeElement(n,P+y.width+T,"middle",0,c)}else t&&o.placeElement(t,"center","middle",0,c),n&&o.placeElement(n,"center","middle",0,c);t&&t.show(),n&&n.show()}function S(e,t){i.getItemByTile(e);var n=c(e),r=s.thumb_transition_duration;if(0==s.tile_image_effect_reverse){var o=i.getTileImage(e);t?(o.fadeTo(0,1),n.stop(!0).fadeTo(r,0)):n.stop(!0).fadeTo(r,1)}else t?n.stop(!0).fadeTo(r,1):n.stop(!0).fadeTo(r,0)}function P(e,t){var i=s.thumb_transition_duration,n=p(e);if(!n)return!0;if("slide"==s.tile_textpanel_appear_type){var r=o.getElementSize(n);if(0==r.width)return!1;var a=-r.height,l={},u={},d="bottom";"inside_top"==s.tile_textpanel_position&&(d="top"),l[d]=a+"px",u[d]="0px",1==t?(n.fadeTo(0,1),0==n.is(":animated")&&n.css(l),u.opacity=1,n.stop(!0).animate(u,i)):n.stop(!0).animate(l,i)}else 1==t?n.stop(!0).fadeTo(i,1):n.stop(!0).fadeTo(i,0)}function x(e,t,i){var n=s.thumb_transition_duration;i&&!0===i&&(n=0);var r=b(e),o=f(e),a=t?1:0;r&&r.stop(!0).fadeTo(n,a),o&&o.stop(!0).fadeTo(n,a)}function j(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!0),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&0==u.isTextPanelHidden&&P(t,!0),u.isSaparateIcons&&1==s.tile_enable_icons){var n=1==s.thumb_overlay_reverse;0==I(i.getItemByTile(t))&&x(t,n,!1)}}function C(e,t){if(t=jQuery(t),s.tile_enable_image_effect&&S(t,!1),1==s.tile_enable_textpanel&&0==s.tile_textpanel_always_on&&P(t,!1),1==u.isSaparateIcons&&1==s.tile_enable_icons){var n=1!=s.thumb_overlay_reverse;0==I(i.getItemByTile(t))?x(t,n,!1):x(t,!0,!0)}}function A(e,t,i){if(t=jQuery(t),1==s.tile_visible_before_image&&!0!==t.data("image_placed")&&!0!==i)return!0;T(t),a.setThumbNormalStyle(t)}function M(e,t,i){T(t),i.fadeTo(0,1),t.data("image_placed",!0)}function O(e){if(1==y(e))return n.trigger(i.events.TILE_CLICK,e),!0;var t;0==v(e)&&(t=e,a.getThumbs().not(t).each(function(e,t){a.setThumbNormalStyle(jQuery(t))}),a.setThumbOverStyle(e))}function z(e){var t=jQuery(this),r=t.prop("tagName").toLowerCase(),o=!0;if(u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(o=!1),"a"==r)0==o&&e.preventDefault();else if(0==v(t))1==o&&O(t);else{if(0==y(t))return!0;1==o&&n.trigger(i.events.TILE_CLICK,t)}}function L(e){e.stopPropagation();var t=jQuery(this).parents(".ug-tile"),r=!0;return u.funcParentApproveClick&&0==u.funcParentApproveClick()&&(r=!1),0==v(t)?(O(t),!0):1==r?(n.trigger(i.events.TILE_CLICK,t),!1):void 0}function N(e){var t=jQuery(this).parents(".ug-tile");u.funcParentApproveClick&&0==u.funcParentApproveClick()&&e.preventDefault(),0==v(t)&&0==s.tile_as_link&&(e.preventDefault(),O(t))}this.loadTileImage=function(e){var t=i.getTileImage(e);o.checkImagesLoaded(t,null,function(t,i){M(null,e,jQuery(t))})},this.setHtml=function(t,i){e=t,!0!==i&&_(),a.setHtmlThumbs(t,i)},this.initEvents=function(){a.initEvents(),jQuery(a).on(a.events.SETOVERSTYLE,j),jQuery(a).on(a.events.SETNORMALSTYLE,C),jQuery(a).on(a.events.PLACEIMAGE,M),t.on(u.eventSizeChange,A),e.on("click",".ug-tile",z),e.on("click",".ug-tile .ug-button-play",L),e.on("click",".ug-tile .ug-icon-link",N)},this.destroy=function(){if(e.off("click",".ug-tile"),e.off("click",".ug-tile .ug-button-play"),e.off("click",".ug-tile .ug-icon-link"),jQuery(a).off(a.events.SETOVERSTYLE),jQuery(a).off(a.events.SETNORMALSTYLE),jQuery(a).off(a.events.PLACEIMAGE),t.off(u.eventSizeChange),1==s.tile_enable_textpanel){var i=a.getThumbs();jQuery.each(i,function(e,t){var i=h(jQuery(t));i&&i.destroy()})}a.destroy()},this.init=function(e,t,i){d(e,t)},this.setFixedMode=function(){s.tile_size_by=i.sizeby.GLOBAL_RATIO,s.tile_visible_before_image=!0},this.setApproveClickFunction=function(e){u.funcParentApproveClick=e},this.resizeTile=function(e,t,n,r){if(1==u.isTextpanelOutside&&E(e,"clone",t),t){if(!n)n=i.getTileHeightByWidth(t,e)}else{t=s.tile_width;var n=s.tile_height}switch(o.setElementSize(e,t,n),r){default:case i.resizemode.FULL:i.triggerSizeChangeEvent(e,!0);break;case i.resizemode.WRAPPER_ONLY:return!0;case i.resizemode.VISIBLE_ELEMENTS:if(u.funcCustomTileHtml)return i.triggerSizeChangeEvent(e,!0),!0;w(e,t,n,!0),1==s.tile_enable_textpanel&&1==s.tile_textpanel_always_on&&t&&E(e,"regular",t,n)}},this.resizeAllTiles=function(e,t,n){_();var r=null;if(s.tile_size_by==i.sizeby.GLOBAL_RATIO&&(r=i.getTileHeightByWidth(e)),!n)n=a.getThumbs();n.each(function(n,o){i.resizeTile(jQuery(o),e,r,t)})},this.triggerSizeChangeEvent=function(e,i){if(!e)return!1;if(!i)i=!1;t.trigger(u.eventSizeChange,[e,i])},this.triggerSizeChangeEventAllTiles=function(e){a.getThumbs().each(function(){var t=jQuery(this);i.triggerSizeChangeEvent(t,e)})},this.disableEvents=function(){a.getThumbs().css("pointer-events","none")},this.enableEvents=function(){a.getThumbs().css("pointer-events","auto")},this.setOptions=function(e){s=jQuery.extend(s,e),a.setOptions(e)},this.setTileSizeOptions=function(e){if(s.tile_size_by!==i.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");s.tile_width=e,s.tile_height=Math.floor(e*u.ratioByHeight)},this.setCustomFunctions=function(e,t){u.funcCustomTileHtml=e,u.funcCustomPositionElements=t},this.run=function(e){var t=a.type.GET_THUMBS_ALL;!0===e&&(t=a.type.GET_THUMBS_NEW);var n=a.getThumbs(t);s.tile_size_by==i.sizeby.GLOBAL_RATIO&&i.resizeAllTiles(s.tile_width,i.resizemode.WRAPPER_ONLY,n),1==s.tile_enable_image_effect&&0==s.tile_image_effect_reverse&&n.children(".ug-thumb-image").fadeTo(0,0),a.setHtmlProperties(n),1==s.tile_visible_before_image&&(n.children(".ug-thumb-image").fadeTo(0,0),a.loadThumbsImages())},this._____________EXTERNAL_GETTERS____________=function(){},this.getObjThumbs=function(){return a},this.getOptions=function(){return s},this.getTileImage=function(e){return e.find("img.ug-thumb-image")},this.getItemByTile=function(e){return a.getItemByThumb(e)},this.getTileHeightByWidth=function(e,t){var n=function(e){var t=u.ratioByHeight;switch(s.tile_size_by){default:t=u.ratioByHeight;break;case i.sizeby.IMAGE_RATIO:if(!e)throw new Error("tile should be given for tile ratio");var n=i.getItemByTile(e);if(void 0!==n.thumbRatioByHeight){if(0==n.thumbRatioByHeight)throw trace(n),new Error("the item ratio not inited yet");t=n.thumbRatioByHeight}break;case i.sizeby.CUSTOM:return null}return t}(t);if(null===n)return null;var r=Math.floor((e-u.tileInnerReduce)*n)+u.tileInnerReduce;return t&&1==u.isTextpanelOutside&&s.tile_size_by==i.sizeby.IMAGE_RATIO&&(r+=m(t)),r},this.getTileImageSize=function(e){var t=i.getItemByTile(e);if(!t.thumbWidth||!t.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:t.thumbWidth,height:t.thumbHeight}},this.getGlobalTileSize=function(){if(s.tile_size_by!=i.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:s.tile_width,height:s.tile_height}}}function UGTiles(){var e,t,i,n,r,o=this,a=jQuery(this),s=new UniteGalleryMain,l=new UGFunctions,u=new UGTileDesign,d=new UGThumbsGeneral,_={},g={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0};this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"};var c={isFirstTimeRun:!0,handle:null,isTransActive:!1,isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1},h={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};function p(i,n){g_objects=i.getObjects(),s=i,e=jQuery(i),t=g_objects.g_objWrapper,g_objects.g_arrItems,g=jQuery.extend(g,n),function(){g.tiles_min_columns<1&&(g.tiles_min_columns=1);0!=g.tiles_max_columns&&g.tiles_max_columns<g.tiles_min_columns&&(g.tiles_max_columns=g.tiles_min_columns)}(),u.init(i,g),d=u.getObjThumbs()}function m(){if(i.addClass("ug-tiles-rest-mode"),c.isTransInited=!0,1==g.tiles_enable_transition){i.addClass("ug-tiles-transit");var e=u.getOptions();1==e.tile_enable_image_effect&&0==e.tile_image_effect_reverse&&i.addClass("ug-tiles-transit-overlays"),c.isTransActive=!0}}function f(){return l.getElementSize(i).width}function b(){return 0!=c.isTransInited&&(i.addClass("ug-tiles-transition-active"),i.removeClass("ug-tiles-rest-mode"),0!=c.isTransActive&&void u.disableEvents())}function v(){if(0==c.isTransInited)return!1;i.removeClass("ug-tiles-transition-active"),i.addClass("ug-tiles-rest-mode")}function y(){1==c.isTransActive?(setTimeout(function(){u.enableEvents(),u.triggerSizeChangeEventAllTiles(),v()},800),c.handle&&clearTimeout(c.handle),c.handle=setTimeout(function(){v(),u.triggerSizeChangeEventAllTiles(),c.handle=null},2e3)):(u.triggerSizeChangeEventAllTiles(),v())}function I(){_.colWidth=(_.availWidth-_.colGap*(_.numCols-1))/_.numCols,_.colWidth=Math.floor(_.colWidth),_.totalWidth=l.getSpaceByNumItems(_.numCols,_.colWidth,_.colGap)}function w(){if(_.colWidth=g.tiles_col_width,_.minCols=g.tiles_min_columns,_.maxCols=g.tiles_max_columns,0==s.isMobileMode()?_.colGap=g.tiles_space_between_cols:_.colGap=g.tiles_space_between_cols_mobile,_.galleryWidth=f(),_.availWidth=_.galleryWidth,1==g.tiles_include_padding&&(_.availWidth=_.galleryWidth-2*_.colGap),1==g.tiles_exact_width)_.numCols=l.getNumItemsInSpace(_.availWidth,_.colWidth,_.colGap),_.maxCols>0&&_.numCols>_.maxCols&&(_.numCols=_.maxCols),_.numCols<_.minCols?(_.numCols=_.minCols,I()):_.totalWidth=_.numCols*(_.colWidth+_.colGap)-_.colGap;else{var e=l.getNumItemsInSpaceRound(_.availWidth,_.colWidth,_.colGap);e<_.minCols?e=_.minCols:0!=_.maxCols&&e>_.maxCols&&(e=_.maxCols),_.numCols=e,I()}switch(g.tiles_align){case"center":default:_.addX=Math.round((_.galleryWidth-_.totalWidth)/2);break;case"left":_.addX=0;break;case"right":_.addX=_.galleryWidth-_.totalWidth}for(_.arrPosx=[],col=0;col<_.numCols;col++){var t=l.getColX(col,_.colWidth,_.colGap);_.arrPosx[col]=t+_.addX}}function E(){_.maxColHeight=0,_.colHeights=[0]}function T(e,t,n,r){if(null==r)r=function(){var e=0,t=999999999;for(col=0;col<_.numCols;col++){if(null==_.colHeights[col]||0==_.colHeights[col])return col;_.colHeights[col]<t&&(e=col,t=_.colHeights[col])}return e}();var o=0;void 0!==_.colHeights[r]&&(o=_.colHeights[r]);var a=u.getTileHeightByWidth(_.colWidth,e);if(null===a){if(1==g.tiles_enable_transition)throw new Error("Can't know tile height, please turn off transition");a=l.getElementSize(e).height}var s=_.arrPosx[r];l.placeElement(e,s,o);var d=o+a;_.colHeights[r]=d+_.colGap,_.maxColHeight<d&&(_.maxColHeight=d),1==t&&e.show().fadeTo(0,1),1==n&&i.height(_.maxColHeight)}function S(e){e||(e=!1),w(),E();var t=d.getThumbs(d.type.GET_THUMBS_RATIO);b(),u.resizeAllTiles(_.colWidth,u.resizemode.VISIBLE_ELEMENTS,t);for(var n=0;n<t.length;n++){var r=jQuery(t[n]),o=void 0;1==g.tiles_keep_order&&(o=l.getColByIndex(_.numCols,n)),T(r,e,!1,o)}y();var a=i.height();1==c.isTransActive&&a>_.maxColHeight?setTimeout(function(){i.height(_.maxColHeight)},700):i.height(_.maxColHeight)}function P(e,t){if(!0!==t&&0==function(e){var t=e.index();if(!0===s.getItem(t).ordered_placed)return!1;var i=l.getPrevRowSameColIndex(t,_.numCols);return i<0||!0===s.getItem(i).ordered_placed}(e))return!1;var i=e.index(),n=l.getColByIndex(_.numCols,i),r=s.getItem(i);u.resizeTile(e,_.colWidth),T(e,!0,!0,n),r.ordered_placed=!0;var o=s.getNumItems(),a=l.getNextRowSameColIndex(i,_.numCols);if(a>=o)return!1;var g=d.getThumbByIndex(a),c=s.getItem(a);d.isThumbLoaded(g);d.isThumbLoaded(g)&&!c.ordered_placed&&P(g,!0)}function x(){var e=d.getThumbs(d.type.GET_THUMBS_NO_RATIO);if(!e||0==e.length)return!1;if(c.isAllLoaded=!1,1==c.isFirstPlaced){w(),E();var t=Math.abs(_.galleryWidth-_.totalWidth);if(1==g.tiles_set_initial_height&&0==l.isScrollbarExists()&&t<25){e.length;var n=Math.ceil(e.length/_.numCols)*g.tiles_col_width*.75;i.height(n),w()}}e.fadeTo(0,0);var r=e.find("img.ug-thumb-image"),h=_.numCols,p=_.galleryWidth;l.checkImagesLoaded(r,function(){w(),h==_.numCols&&p==_.galleryWidth||S(!1),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){1==c.isFirstPlaced&&s.triggerEvent(o.events.TILES_FIRST_PLACED),function(e,t){if(1==t)return!1;e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e),1==g.tiles_keep_order?P(i):(u.resizeTile(i,_.colWidth),T(i,!0,!0))}(e,t)})}function j(){var e=f(),t=d.getThumbs(!0),i=g.tiles_justified_row_height,n=[],r=0,o=g.tiles_justified_space_between,a=t.length;jQuery.each(t,function(e,t){t=jQuery(t);var o=d.getItemByThumb(t),a=o.thumbWidth;o.thumbHeight!==i&&(a=Math.floor(o.thumbRatioByWidth*i)),n[e]=a,r+=a});var s=Math.ceil(r/e);s>a&&(s=a);var l=r/s,u=[],_=0,c=[],h=[],p=0,m=0;jQuery.each(t,function(e,t){var i=n[e];p+i/2>(m+1)*l&&(c[u.length]=_,u.push(h),h=[],_=0,m++),p+=i,_+=i,h.push(t)}),c[u.length]=_,u.push(h);var b=[],v=[],y=0;return jQuery.each(u,function(t,r){r.length;var a=c[t],s=(r.length-1)*o,l=(e-s)/a,u=Math.round(i*l);y+=u,t>0&&(y+=o),v.push(u);var d=u/i,_=[],g=s;jQuery.each(r,function(e,t){var i=jQuery(t).index(),r=n[i],o=Math.round(r*d);_[e]=o,g+=o});var h=g-e;jQuery.each(_,function(e,t){if(0==h)return!1;h<0?(_[e]=t+1,h++):(_[e]=t-1,h--),e==_.length-1&&0!=h&&(_[e]-=h)}),b[t]=_}),{arrRows:u,arrRowWidths:b,arrRowHeights:v,gap:o,totalHeight:y}}function C(e){if(!e)e=!1;var t=f(),n=j();i.height(n.totalHeight),f()!=t&&(n=j()),b();var r=0,o=0;jQuery.each(n.arrRows,function(t,i){var a=n.arrRowWidths[t],s=n.arrRowHeights[t],d=0;jQuery.each(i,function(t,i){var _=jQuery(i),g=s,c=a[t];u.resizeTile(_,c,g,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(_,d,r),(d+=c)>o&&(o=d),d+=n.gap,1==e&&jQuery(i).show()}),r+=s+n.gap}),y()}function A(){var e=f();switch(h.galleryWidth=e,n={},h.colWidth=g.tiles_nested_col_width,h.optimalTileWidth=g.tiles_nested_optimal_tile_width,h.currentGap=g.tiles_space_between_cols,1==s.isMobileMode()&&(h.currentGap=g.tiles_space_between_cols_mobile),null==h.colWidth?h.colWidth=Math.floor(h.optimalTileWidth/h.nestedOptimalCols):h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.maxColumns=l.getNumItemsInSpace(e,h.colWidth,h.currentGap),h.colWidth=l.getItemSizeInSpace(e,h.maxColumns,h.currentGap),h.gridY=0,r=[],d.getThumbs(!0).each(function(){var e=function(e){var t,i,n={},r=h.colWidth,o=h.currentGap,a=u.getTileImageSize(e),s=e.index(),l=Math.ceil(function(e){return Math.abs(Math.sin(Math.abs(1e3*Math.sin(e))))}(s)*(1*h.nestedOptimalCols/3)+2*h.nestedOptimalCols/3),d=a.width,_=a.height,g=d/_;d>_?(t=l,0==(i=Math.round(t/g))&&(i=1)):(i=l,0==(t=Math.round(i*g))&&(t=1));return n.dimWidth=t,n.dimHeight=i,n.width=t*r+o*(t-1),n.height=i*r+o*(i-1),n.imgWidth=d,n.imgHeight=_,n.left=0,n.top=0,n}(jQuery(this));r.push(e)}),h.optimalTileWidth>h.colWidth?h.nestedOptimalCols=Math.ceil(h.optimalTileWidth/h.colWidth):h.nestedOptimalCols=1,h.totalWidth=h.maxColumns*(h.colWidth+h.currentGap)-h.currentGap,g.tiles_align){case"center":default:h.addX=Math.round((h.galleryWidth-h.totalWidth)/2);break;case"left":h.addX=0;break;case"right":h.addX=h.galleryWidth-h.totalWidth}h.maxGridY=0}function M(e){var t=f();A(),O();var n=h.maxGridY*(h.colWidth+h.currentGap)-h.currentGap;i.height(n),f()!=t&&(A(),O()),0==g.tiles_nested_debug&&function(e){if(!e)var e=!1;b();for(var t=0;t<r.length;t++)U(t,e);i.height(h.maxColHeight),y()}(e)}function O(e){if(1==g.tiles_nested_debug)return void 0===e&&(e=!0),function(e,t){if(0==t){for(var i=h.currentItem;i<r.length;i++)z(i,!0);h.currentItem=r.length-1}else z(h.currentItem,!0);for(i=0;i<=h.currentItem;i++)U(i,!0);h.currentItem++}(0,e),!1;for(var t=0;t<r.length;t++)z(t,!0)}function z(e,t){if(!t)t=!1;h.maxColHeight=0;for(var i=l.getObjectLength(n),r=h.gridY;r<=i+1;r++){for(var o=0;o<h.maxColumns;o++){if(0==Q(h.gridY)||0==B(h.gridY,o))return void L(e,D(o),o)}h.gridY++}}function L(e,t,i){var o=jQuery.extend(!0,{},r[e]),a=o.dimWidth,s=t-o.dimWidth,l=h.nestedOptimalCols;if(t<=o.dimWidth||s<=.33*l||t<=l)H(e,t);else if(s<=l)l>=4?1==G(Math.floor(t/2),i)?H(e,Math.floor(t/2)+1):H(e,Math.floor(t/2)):H(objImage,t);else if(1==G(a,i))switch(a>=l){case!0:H(e,a-1);break;case!1:H(e,a+1)}var u,d,_,g,c,p,m,f,b,v=function(e,t,i){var r=h.gridY-1,o=0,a=0,s=1,l=[],u=[];if(l.push(e),r>=0){for(a=0;r>=0;){if(o=n[r][i],void 0!==n[r][i-1]&&n[r][i-1]==n[r][i]||void 0!==n[r][i+t]&&n[r][i+t-1]==n[r][i+t]||n[r][i]!=n[r][i+t-1])return u.push(s),u.push(l),u;a!=o&&(s++,l.push(o)),r--,a=o}return u.push(s),u.push(l),u}return[0,[]]}(e,(o=jQuery.extend(!0,{},r[e])).dimWidth,i);if(h.columnsValueToEnableHeightResize<=v[0]&&h.maxColumns>=2*h.nestedOptimalCols){var y=function(e,t){var i=0,r=0,o=t.dimWidth,a=t.dimHeight,s=0,l=0,u=jQuery.map(n,function(e,t){return[e]});if(void 0===u[h.gridY]||void 0===u[h.gridY][e-1])r=0;else for(var d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e-1];)s=n[h.gridY+d][e-2],d++,r++;if(void 0===u[h.gridY]||void 0===u[h.gridY][e+o])i=0;else for(d=0;void 0!==n[h.gridY+d]&&-1!=n[h.gridY+d][e+o];)l=n[h.gridY+d][e+o+1],d++,i++;var _=0,g=0;Math.abs(a-r)<Math.abs(a-i)&&0!=r?(_=r,g=s):0!=i?(_=i,g=l):_=a;return{newHeight:_,idToResize:g}}(i,o),I=k(e,y.newHeight,!0);r[e].dimHeight=I.dimHeight;var w=function(e,t){for(var i=0,n=0,o=[],a=0,s=0,l=0;l<e[1].length;l++){var u=e[1][l],d=r[e[1][l]];if(n+=d.dimHeight,0!=l)i+=d.dimHeight,o.push([u,d.dimHeight]);else{var _=H(u,t,!0);i+=_.dimHeight,o.push([e[1][l],_.dimHeight])}}a=d.left,s=d.top;for(var g=n,c=[],l=o.length-1;l>=0;l--){var h,u=o[l][0];0!=l?(h=Math.max(Math.round(1*n/3),Math.floor(o[l][1]*(n/i))),g-=h,(_=k(u,h,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}),s+=_.dimHeight):((_=k(u,h=g,!0)).left=a,_.top=s,c.push({tileID:u,sizes:_}))}return c}(v,I.dimWidth),E=!1;(function(e){for(var t=0,i=0,r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&h.maxColumns>o.left+o.dimWidth&&(a=n[o.top+o.dimHeight-1][o.left+o.dimWidth],s=n[o.top+o.dimHeight][o.left+o.dimWidth]),a!=s&&t++}for(var r=0;r<e.length-1;r++){var o=e[r].sizes,a=-1,s=-1;Q(o.top+o.dimHeight)&&o.left-1>=0&&(a=n[o.top+o.dimHeight-1][o.left-1],s=n[o.top+o.dimHeight][o.left-1]),a!=s&&i++}return Math.max(i,t)})(w)>=2&&(E=!0),y.newHeight>=o.dimHeight&&(o=k(e,y.newHeight,!0));var T=(u=y.idToResize,d=y.newHeight,_=o.dimHeight,g=r[u],c=g.dimHeight,g.dimWidth,p=g.left,m=g.top,parseInt(m/(h.colWidth+h.currentGap)),parseInt(p/(h.colWidth+h.currentGap)),f=k(u,c-d+_,!0),(b=[]).push({tileID:u,sizes:f}),b);return o.top=h.gridY,o.left=i,T.push({tileID:e,sizes:o}),R(T)<R(w)||1==E?void N(T):void N(w)}o.left=i,o.top=h.gridY,r[e]=o,W(e,o,i,h.gridY),h.maxGridY=o.top+o.dimHeight}function N(e){for(var t=0;t<e.length;t++){var i=e[t].sizes,n=e[t].tileID;r[n]=jQuery.extend(!0,{},i),W(n,i,i.left,i.top)}}function H(e,t,i){i||(i=!1);var n=h.colWidth,o=h.currentGap,a=r[e],s=a.imgWidth/a.imgHeight;if(dimWidth=t,dimHeight=Math.round(dimWidth/s),1==i){var l=jQuery.extend(!0,{},a);return l.dimWidth=dimWidth,l.dimHeight=dimHeight,l.width=dimWidth*n+o*(dimWidth-1),l.height=dimHeight*n+o*(dimHeight-1),l}a.dimWidth=dimWidth,a.dimHeight=dimHeight,a.width=dimWidth*n+o*(dimWidth-1),a.height=dimHeight*n+o*(dimHeight-1)}function k(e,t,i){i||(i=!1);var n=r[e],o=n.dimWidth,a=h.colWidth,s=h.currentGap;if(1==i){var l=jQuery.extend(!0,{},n);return l.dimHeight=t,l.width=o*a+s*(o-1),l.height=t*a+s*(t-1),l}n.dimHeight=t,n.width=o*a+s*(o-1),n.height=t*a+s*(t-1)}function R(e){for(var t=0,i=0,n=0;n<e.length;n++){var o=r[e[n].tileID];if(0==o.dimHeight||0==o.height)return;resizeVal=o.dimWidth/o.dimHeight/(o.imgWidth/o.imgHeight),resizeVal<1&&(resizeVal=1/resizeVal),t+=resizeVal,i++}return t/i}function G(e,t){var i=h.gridY-1;return!(i<=0||0==Q(i))&&n[i][t+e-1]!=n[i][t+e]}function D(e){var t=e,i=0;if(1==Q(h.gridY))for(;0==B(h.gridY,t);)i++,t++;else i=h.maxColumns;return i}function Q(e){return void 0!==n[e]}function W(e,t,i,n){for(var r=0;r<t.dimHeight;r++)for(var o=0;o<t.dimWidth;o++)0==Q(n+r)&&F(n+r),Y(n+r,i+o,e)}function F(e){n[e]=new Object;for(var t=0;t<h.maxColumns;t++)n[e][t]=-1}function B(e,t){return-1!=n[e][t]}function Y(e,t,i){n[e][t]=i}function U(e,t){var i=d.getThumbByIndex(e),n=r[e],o=n.top*(h.colWidth+h.currentGap),a=h.addX+n.left*(h.colWidth+h.currentGap);u.resizeTile(i,n.width,n.height,u.resizemode.VISIBLE_ELEMENTS),l.placeElement(i,a,o),o+n.height>h.maxColHeight&&(h.maxColHeight=o+n.height),1==t&&i.fadeTo(0,1)}function V(){if(1==c.isFirstTimeRun)return!0;if(0==c.isAllLoaded)return!1;switch(g.tiles_type){case"columns":S(!1);break;case"justified":C(!1);break;case"nested":1==s.isMobileMode()?S(!1):M(!1)}}function X(){switch(t.children(".ug-tile").show(),1==c.isFirstTimeRun&&(a.on(o.events.ALL_TILES_LOADED,function(){c.isAllLoaded=!0}),e.on(s.events.SIZE_CHANGE,V),e.on(o.events.TILES_FIRST_PLACED,function(){c.isFirstPlaced=!1}),u.initEvents()),u.run(),g.tiles_type){default:case"columns":x();break;case"justified":i=jQuery(t).find("img.ug-thumb-image"),n=d.getThumbs(),c.isAllLoaded=!1,n.fadeTo(0,0),l.checkImagesLoaded(i,function(){setTimeout(function(){C(!0),n.fadeTo(0,1),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)})},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)});break;case"nested":!function(){var e=jQuery(t).find("img.ug-thumb-image"),i=d.getThumbs();c.isAllLoaded=!1,i.fadeTo(0,0),l.checkImagesLoaded(e,function(){1==s.isMobileMode()?S(!0):M(!0),s.triggerEvent(o.events.TILES_FIRST_PLACED),m(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){e=jQuery(e);var i=jQuery(e).parent();d.triggerImageLoadedEvent(i,e)})}()}var i,n;c.isFirstTimeRun=!1}this.destroy=function(){e.off(s.events.SIZE_CHANGE),u.destroy(),e.off(o.events.TILES_FIRST_PLACED)},this.init=function(e,t){p(e,t)},this.setHtml=function(e){!function(e){e||(e=i||t);i=e;var n=g.tiles_type;e.addClass("ug-tiletype-"+n),u.setHtml(e),e.children(".ug-thumb-wrapper").hide()}(e)},this.getObjTileDesign=function(){return u},this.run=function(){X()},this.runNewItems=function(){if(!i)throw new Error("Can't run new items - parent not set");switch(u.setHtml(i,!0),u.run(!0),g.tiles_type){case"columns":x();break;default:case"justified":case"nested":throw new Error("Tiles type: "+g.tiles_type+" not support load more yet")}}}function UGAviaControl(){var e,t,i,n,r,o,a={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",isStripMoving:!1,isControlEnabled:!0,maxDpos:1e3};function s(t){if(0==a.isControlEnabled)return!0;if(1==a.touchEnabled)return jQuery("body").off("mousemove"),!0;a.isMouseInsideStrip=i.ismouseover();var s=e.isTouchMotionActive();1==a.isMouseInsideStrip&&0==s?function(e){var t=function(e){return 0==o?function(e){var t=r.strip_padding_left,o=r.strip_padding_right,a=i.width()-t-o,s=n.width();if(a>s)return null;var l=i.offset().left,u=e-l-t,d=r.thumb_width,_=a-r.thumb_width;u<d&&(u=d);u>_&&(u=_);var g=(u-d)/(_-d)*(s-a);return g=-1*Math.round(g)+t}(e):function(e){var t=r.strip_padding_top,o=(r.strip_padding_bottom,i.height()),a=n.height();if(o>a)return null;var s=i.offset().top,l=e-s-t;if(l<0)return null;var u=r.thumb_height,d=o-r.thumb_height;l<u&&(l=u);l>d&&(l=d);var _=(l-u)/(d-u)*(a-o);return _=-1*Math.round(_)+t}(e)}(e);if(null===t)return!1;a.is_strip_moving=!0,a.strip_finalPos=t,function(){if(1==a.isStripMoving)return!1;a.isStripMoving=!0,a.handle_timeout=setInterval(l,10)}()}(function(e){return 0==o?e.pageX:e.pageY}(t)):u()}function l(){if(0==a.is_strip_moving)return!1;var t=a.maxDpos,i=e.getInnerStripPos();Math.floor(i)==Math.floor(a.strip_finalPos)&&u();var n,r=Math.abs(a.strip_finalPos-i);r<1?n=r:(n=r/4)>0&&n<1&&(n=1),a.strip_finalPos<i&&(n*=-1),n>t&&(n=t),n<-t&&(n=-t);var o=i+n;e.positionInnerStrip(o)}function u(){if(0==a.isStripMoving)return!1;a.isStripMoving=!1,a.handle_timeout=clearInterval(a.handle_timeout)}this.enable=function(){a.isControlEnabled=!0},this.disable=function(){a.isControlEnabled=!1},this.onResize=function(){},this.init=function(l){e=l,t=l.getObjects(),t.g_gallery,i=t.g_objStrip,n=t.g_objStripInner,r=t.g_options,o=t.isVertical,jQuery("body").on("touchstart",function(e){if(0==a.isControlEnabled)return!0;a.touchEnabled=!0}),jQuery("body").mousemove(s)},this.destroy=function(){jQuery("body").off("touchstart"),jQuery("body").off("mousemove")}}function UGSlider(){var e,t,i,n,r,o,a,s,l,u,d,_,g,c=this,h=jQuery(c),p=new UniteGalleryMain,m=null,f=null,b=null,v=new UGVideoPlayer,y=new UGFunctions,I=null,w=null;this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"};var E={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!1,slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_skin:"",slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:20,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:20,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square"},T={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},S={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};function P(i,n,r){p=i,r&&(g=r,n=y.convertCustomPrefixOptions(n,g,"slider")),e=jQuery(i);var o=p.getObjects();if(t=o.g_objWrapper,o.g_objThumbs,n.hasOwnProperty("slider_progress_indicator_type")&&(E.slider_progress_indicator_type=n.slider_progress_indicator_type),"bar"==E.slider_progress_indicator_type&&(E=jQuery.extend(E,T)),n&&c.setOptions(n),function(){var e=p.getOptions(),t=e.gallery_skin;""==E.slider_bullets_skin&&(E.slider_bullets_skin=t);""==E.slider_arrows_skin&&(E.slider_arrows_skin=t);""==E.slider_zoompanel_skin&&(E.slider_zoompanel_skin=t);""==E.slider_play_button_skin&&(E.slider_play_button_skin=t);""==E.slider_fullscreen_button_skin&&(E.slider_fullscreen_button_skin=t);E.video_enable_closebutton=E.slider_video_enable_closebutton,"zoom"!=e.gallery_mousewheel_role&&(E.slider_zoom_mousewheel=!1)}(),1==E.slider_enable_bullets){b=new UGBullets;var a={bullets_skin:E.slider_bullets_skin,bullets_space_between:E.slider_bullets_space_between};b.init(p,a)}E.slider_enable_text_panel&&(w=new UGTextPanel).init(p,E,"slider"),E.slider_enable_zoom_panel&&(_=new UGZoomButtonsPanel).init(c,E);var s=p.getGalleryID();v.init(E,!1,s)}function x(){if(1==S.isRunOnce)return!1;if(S.isRunOnce=!0,E.slider_background_color){var t=E.slider_background_color;1!=E.slider_background_opacity&&(t=y.convertHexToRGB(t,E.slider_background_opacity)),i.css("background-color",t)}else 1!=E.slider_background_opacity&&(t=y.convertHexToRGB("#000000",E.slider_background_opacity),i.css("background-color",t));1==E.slider_control_swipe&&(u=new UGTouchSliderControl).init(c,E),1==E.slider_control_zoom&&(d=new UGZoomSliderControl).init(c,E),w&&w.run(),function(){e.on(p.events.ITEM_IMAGE_UPDATED,se),e.on(p.events.ITEM_CHANGE,K),b&&jQuery(b).on(b.events.BULLET_CLICK,J);1==E.slider_enable_arrows&&(y.addClassOnHover(l,"ug-arrow-hover"),y.addClassOnHover(s,"ug-arrow-hover"),p.setNextButton(l),p.setPrevButton(s));0==E.slider_controls_always_on&&i.hover(ie,ne);i.on("touchend click",$),h.on(c.events.CLICK,ee),w&&1==S.isTextPanelSaparateHover&&i.hover(D,G);m&&(y.addClassOnHover(m,"ug-button-hover"),p.setPlayButton(m));f&&(y.addClassOnHover(f,"ug-button-hover"),p.setFullScreenToggleButton(f));d&&h.on(c.events.ZOOM_CHANGE,te);_&&_.initEvents();v.initEvents(),jQuery(v).on(v.events.SHOW,oe),jQuery(v).on(v.events.HIDE,ae),ue(r),ue(o),ue(a),h.on(c.events.AFTER_PUT_IMAGE,le),i.on("mouseenter",".ug-item-wrapper img",function(e){h.trigger(c.events.IMAGE_MOUSEENTER)}),i.on("mouseleave",".ug-item-wrapper img",function(e){var t=c.isMouseInsideSlideImage(e);0==t&&h.trigger(c.events.IMAGE_MOUSELEAVE)})}()}function j(e,t){var i="ug-type-square";"round"==E.slider_videoplay_button_type&&(i="ug-type-round");var n="";return n+="<div class='ug-slide-wrapper ug-slide"+t+"'>",n+="<div class='ug-item-wrapper'></div>",n+="<div class='ug-slider-preloader "+e+"'></div>",n+="<div class='ug-button-videoplay "+i+"' style='display:none'></div>",n+="</div>"}function C(e){e&&(t=e);var u=function(){var e;switch(E.slider_loader_type){default:case 1:e="ug-loader1";break;case 2:e="ug-loader2";break;case 3:e="ug-loader3";break;case 4:e="ug-loader4";break;case 5:e="ug-loader5";break;case 6:e="ug-loader6";break;case 7:e="ug-loader7";break;case 8:e="ug-loader8";break;case 9:e="ug-loader9"}"black"==E.slider_loader_color&&(e+=" ug-loader-black");return e}(),d=(p.getOptions(),"<div class='ug-slider-wrapper'>");(d+="<div class='ug-slider-inner'>",d+=j(u,1),d+=j(u,2),d+=j(u,3),d+="</div>",1==E.slider_enable_arrows&&(d+="<div class='ug-slider-control ug-arrow-left ug-skin-"+E.slider_arrows_skin+"'></div>",d+="<div class='ug-slider-control ug-arrow-right ug-skin-"+E.slider_arrows_skin+"'></div>"),1==E.slider_enable_play_button&&(d+="<div class='ug-slider-control ug-button-play ug-skin-"+E.slider_play_button_skin+"'></div>"),1==E.slider_enable_fullscreen_button&&(d+="<div class='ug-slider-control ug-button-fullscreen ug-skin-"+E.slider_fullscreen_button_skin+"'></div>"),d+="</div>",t.append(d),i=t.children(".ug-slider-wrapper"),n=i.children(".ug-slider-inner"),r=n.children(".ug-slide1"),o=n.children(".ug-slide2"),a=n.children(".ug-slide3"),r.data("slidenum",1),o.data("slidenum",2),a.data("slidenum",3),b&&b.appendHTML(i),1==E.slider_enable_arrows&&(s=i.children(".ug-arrow-left"),l=i.children(".ug-arrow-right")),1==E.slider_enable_play_button&&(m=i.children(".ug-button-play")),1==E.slider_enable_fullscreen_button&&(f=i.children(".ug-button-fullscreen")),1==E.slider_enable_progress_indicator)&&("bar"==(I=y.initProgressIndicator(E.slider_progress_indicator_type,E,i)).getType()&&"pie"==E.slider_progress_indicator_type&&(E.slider_progress_indicator_type="bar",E=jQuery.extend(E,T)),p.setProgressIndicator(I));1==E.slider_enable_text_panel&&(w.appendHTML(i),0==E.slider_textpanel_always_on&&(w.getElement().hide().data("isHidden",!0),S.isTextPanelSaparateHover=!0));1==E.slider_enable_zoom_panel&&_.appendHTML(i),v.setHtml(n)}function A(e){var t=_e(e);y.placeElementInParentCenter(t);var i=ge(e);y.placeElementInParentCenter(i)}function M(){if(b&&(objBullets=b.getElement(),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert),y.placeElement(objBullets,E.slider_bullets_align_hor,E.slider_bullets_align_vert,E.slider_bullets_offset_hor,E.slider_bullets_offset_vert)),1==E.slider_enable_arrows&&(y.placeElement(s,E.slider_arrow_left_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_left_offset_hor,E.slider_arrow_left_offset_vert),y.placeElement(l,E.slider_arrow_right_align_hor,E.slider_arrow_left_align_vert,E.slider_arrow_right_offset_hor,E.slider_arrow_right_offset_vert)),0==E.slider_controls_always_on&&X(!0),I){var e=I.getElement();if("bar"==E.slider_progress_indicator_type){var t=i.width();I.setSize(t),y.placeElement(e,"left",E.slider_progress_indicator_align_vert,0,E.slider_progress_indicator_offset_vert)}else y.placeElement(e,E.slider_progress_indicator_align_hor,E.slider_progress_indicator_align_vert,E.slider_progress_indicator_offset_hor,E.slider_progress_indicator_offset_vert)}w&&w.positionPanel(),function(){m&&y.placeElement(m,E.slider_play_button_align_hor,E.slider_play_button_align_vert,E.slider_play_button_offset_hor,E.slider_play_button_offset_vert);f&&y.placeElement(f,E.slider_fullscreen_button_align_hor,E.slider_fullscreen_button_align_vert,E.slider_fullscreen_button_offset_hor,E.slider_fullscreen_button_offset_vert);if(_){var e=_.getElement();y.placeElement(e,E.slider_zoompanel_align_hor,E.slider_zoompanel_align_vert,E.slider_zoompanel_offset_hor,E.slider_zoompanel_offset_vert)}}(),A(r),A(o),A(a),p.isMobileMode()?(1==E.slider_fullscreen_button_mobilehide&&f&&f.hide(),1==E.slider_play_button_mobilehide&&m&&m.hide(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().hide()):(1==E.slider_fullscreen_button_mobilehide&&f&&f.show(),1==E.slider_play_button_mobilehide&&m&&m.show(),1==E.slider_zoompanel_mobilehide&&_&&_.getElement().show())}function O(){var e,t,i,r,o=c.getSlidesReference(),a=0;i=c.isSlideHasItem(o.objNextSlide),(r=c.isSlideHasItem(o.objPrevSlide))?(a=o.objPrevSlide.outerWidth(),o.objPrevSlide.css("z-index",1)):o.objPrevSlide.hide(),e=t=a+o.objCurrentSlide.outerWidth(),i?(e=t+o.objNextSlide.outerWidth(),o.objPrevSlide.css("z-index",2)):o.objNextSlide.hide(),o.objCurrentSlide.css("z-index",3),y.placeElement(o.objCurrentSlide,a,0),n.css({left:-a+"px",width:e+"px"}),r&&(y.placeElement(o.objPrevSlide,0,0),y.showElement(o.objPrevSlide)),i&&(y.showElement(o.objNextSlide),y.placeElement(o.objNextSlide,t,0))}function z(e){var t=e.data("index");if(void 0===t||null==t)return!1;var i=p.getItem(t);if(!i)return!1;R(e,i)}function L(e){e.stop(!0).hide(100)}function N(e,t,i){var n={};if(1==E.slider_image_border){n["border-style"]="solid";var r=function(e,t){if((a=E.slider_image_border_width)<=10)return a;var i=y.getElementSize(e),n=i.width,r=i.height;if(t&&(t.hasOwnProperty("imageWidth")&&(n=t.imageWidth),t.hasOwnProperty("imageHeight")&&(r=t.imageHeight)),n<=0)return a;var o=n<r?n:r;if(2*a/o<E.slider_image_border_maxratio)return a;var a=o*E.slider_image_border_maxratio/2;return a=Math.round(a)}(e,i);n["border-width"]=r+"px",n["border-color"]=E.slider_image_border_color,n["border-radius"]=E.slider_image_border_radius}"image"!=t&&1==E.slider_video_constantsize&&(n["background-color"]="#000000"),1==E.slider_image_shadow&&(n["box-shadow"]="3px 3px 10px 0px #353535"),e.css(n)}function H(e,t){var i=E.slider_video_constantsize_width,n=E.slider_video_constantsize_height,r=E.slider_video_constantsize_scalemode;return y.scaleImageExactSizeInParent(e,t.imageWidth,t.imageHeight,i,n,r)}function k(e,t,i){var n=e.children(".ug-item-wrapper"),r=_e(e);if(void 0===t.urlImage||""==t.urlImage)throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");var o=t.urlImage,a=e.data("urlImage");e.data("urlImage",o);var s=c.getScaleMode(e),l=c.getSlideType(e);objPadding=c.getObjImagePadding();var u="";if("string"==typeof t.description&&(u=t.description),a==o&&!0!==i){(_=n.children("img")).attr("alt",u),0!=t.imageWidth&&0!=t.imageHeight||p.checkFillImageSize(_,t);var d={};N(_,l,d="image"!=l&&1==E.slider_video_constantsize?H(_,t):y.scaleImageFitParent(_,t.imageWidth,t.imageHeight,s,objPadding)),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else{var _;if((_=y.placeImageInsideParent(o,n,t.imageWidth,t.imageHeight,s,objPadding)).attr("alt",u),1==t.isBigImageLoaded){if(_.fadeTo(0,1),L(r),"image"!=l&&1==E.slider_video_constantsize)d=H(_,t);else d=y.getImageInsideParentData(n,t.imageWidth,t.imageHeight,s,objPadding);_.css("width",d.imageWidth+"px"),N(_,l,d),h.trigger(c.events.AFTER_PUT_IMAGE,e)}else _.fadeTo(0,0),function(e){e.stop(!0).show(100)}(r),e.data("isLoading",!0),c.isSlideCurrent(e)&&h.trigger(c.events.CURRENTSLIDE_LOAD_START),_.data("itemIndex",t.index),_.on("load",function(){var e=jQuery(this),t=e.data("itemIndex");e.fadeTo(0,1);var i=e.parent().parent(),n=c.getSlideType(i),r=_e(i),o=c.getObjImagePadding(),a=c.getScaleMode(i);L(r),i.data("isLoading",!1),c.isSlideCurrent(i)&&h.trigger(c.events.CURRENTSLIDE_LOAD_END),p.onItemBigImageLoaded(null,e);var s=p.getItem(t),l={};"image"!=n&&1==E.slider_video_constantsize?H(e,s):l=y.scaleImageFitParent(e,s.imageWidth,s.imageHeight,a,o),e.fadeTo(0,1),N(e,n,l),h.trigger(c.events.AFTER_PUT_IMAGE,i)})}}function R(e,t){try{var i=e.children(".ug-item-wrapper");if(null==t)return i.html(""),e.removeData("index"),e.removeData("type"),e.removeData("urlImage"),!1;e.data("index");e.data("index",t.index),e.data("type",t.type),1==E.slider_enable_links&&"image"==t.type&&(t.link?e.addClass("ug-slide-clickable"):e.removeClass("ug-slide-clickable")),k(e,t);var n=ge(e);switch(t.type){case"image":n.hide();break;default:n.show()}}catch(e){throw void 0!==e.fileName&&"showbig"==e.fileName&&p.showErrorMessageReplaceGallery(e.message),i.html(""),new Error(e)}}function G(){if(!w)return!1;if(1==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(t=E.slider_controls_appear_duration),e.stop().fadeTo(t,0),e.data("isHidden",!0)}function D(){if(!w)return!1;if(0==Q())return!1;var e=w.getElement(),t=0;1!=S.isTextPanelSaparateHover&&1!=E.slider_textpanel_always_on||(e.show(),w.positionElements(),t=E.slider_controls_appear_duration),e.stop().show().fadeTo(t,1),e.data("isHidden",!1)}function Q(){return!1!==w.getElement().data("isHidden")}function W(){var e=c.getCurrentSlide(),t=c.getSlideImage(e),i=y.getElementSize(e),n=i.left,r=i.top;if(1==E.slider_video_constantsize){var o=y.getElementSize(t);n+=o.left,r+=o.top}else n+=E.slider_video_padding_left,r+=E.slider_video_padding_top;trace("video top: "+r),v.setPosition(n,r)}function F(){var e=E.slider_video_constantsize_width,t=E.slider_video_constantsize_height;v.setSize(e,t),N(v.getObject(),"video")}function B(e,t,i){h.trigger(c.events.TRANSITION_START);var r=E.slider_transition;switch(i&&(r=i),c.stopSlideAction(null,!0),r){default:case"fade":U(t);break;case"slide":!function e(t,i){var r=c.isAnimating();if(1==r)return S.itemWaiting=i,!0;null!=S.itemWaiting&&(S.itemWaiting=null);var o=c.getSlidesReference();switch(t){case"right":R(o.objPrevSlide,i),O();var a=y.getElementSize(o.objPrevSlide),s=-a.left;c.switchSlideNums("right");break;case"left":R(o.objNextSlide,i),O();var l=y.getElementSize(o.objNextSlide),s=-l.left;c.switchSlideNums("left");break;default:throw new Error("wrong direction: "+t)}var u=E.slider_transition_speed;var d=E.slider_transition_easing;var _={duration:u,easing:d,queue:!1,always:function(){if(c.stopSlideAction(),v.hide(),null!=S.itemWaiting){var t=function(e){var t=c.getSlidesReference().objCurrentSlide.data("index"),i=e.index,n="left";t>i&&(n="right");return n}(S.itemWaiting);e(t,S.itemWaiting)}else c.placeNabourItems(),h.trigger(c.events.TRANSITION_END)}};n.animate({left:s+"px"},_)}(e,t);break;case"lightbox_open":U(t,!1,!0)}}function Y(e,t,i){i?e.fadeTo(E.slider_transition_speed,t,i):e.fadeTo(E.slider_transition_speed,t)}function U(e,t,i){if(!t)t=!1;var n=c.getSlidesReference();R(n.objNextSlide,e);var r=y.getElementSize(n.objCurrentSlide);y.placeElement(n.objNextSlide,r.left,r.top);var o=S.numCurrent;if(S.numCurrent=S.numNext,S.numNext=o,h.trigger(c.events.ITEM_CHANGED),n.objNextSlide.stop(!0),n.objCurrentSlide.stop(!0),1==t)n.objCurrentSlide.fadeTo(0,0),n.objNextSlide.fadeTo(0,1),c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide();else{if(n.objNextSlide.fadeTo(0,0),Y(n.objCurrentSlide,0,function(){c.placeNabourItems(),h.trigger(c.events.TRANSITION_END),!0!==i&&v.hide()}),1==v.isVisible())Y(v.getObject(),0);Y(n.objNextSlide,1)}}function V(){return i.children(".ug-slider-control")}function X(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(0==S.isControlsVisible)return!1;if(!e)e=!1;var t=V();!0===e?t.stop().fadeTo(0,0).hide():t.stop().fadeTo(E.slider_controls_appear_duration,0,function(){t.hide()}),S.isControlsVisible=!1}function Z(e){if(0==y.isTimePassed("sliderControlsToggle"))return!1;if(1==S.isControlsVisible)return!0;if(!e)e=!1;var t=V();!0===e?t.stop().show():(t.stop().show().fadeTo(0,0),t.fadeTo(E.slider_controls_appear_duration,1)),S.isControlsVisible=!0}function q(e){if(e==S.currentControlsMode)return!1;switch(e){case"image":_&&_.getElement().show();break;case"video":_&&_.getElement().hide();break;default:throw new Error("wrong controld mode: "+e)}S.currentControlsMode=e}function K(e,t,i){var n=p.getSelectedItem();c.setItem(n,!1,i);var r=n.index;b&&b.setActive(r),w&&0==S.isTextPanelSaparateHover&&D(),"image"==n.type?q("image"):q("video")}function J(e,t){p.selectItem(t)}function $(e){if(u&&0==u.isTapEventOccured(e))return!0;h.trigger(c.events.CLICK,e)}function ee(){var e=c.getCurrentSlide().hasClass("ug-slide-clickable"),t=c.getCurrentItem();if(e)return 0==E.slider_links_newpage?location.href=t.link:window.open(t.link,"_blank"),!0;0==E.slider_controls_always_on&&1==E.slider_controls_appear_ontap&&1==c.isCurrentSlideType("image")&&(0==S.isControlsVisible?Z():X(),w&&1==E.slider_textpanel_always_on&&c.isCurrentSlideType("image")&&c.isCurrentSlideImageFit()&&D())}function te(e){w&&c.isCurrentSlideType("image")&&0==c.isCurrentSlideImageFit()&&G()}function ie(){Z()}function ne(){X()}function re(e){var t=e.parent();c.startSlideAction(t)}function oe(){p.isPlayMode()&&p.pausePlaying(),h.trigger(c.events.ACTION_START)}function ae(){p.isPlayMode()&&p.continuePlaying(),h.trigger(c.events.ACTION_END)}function se(e,t,i){r.data("index")==t&&(objItem=p.getItem(t),k(r,objItem,!0)),o.data("index")==t&&(objItem=p.getItem(t),k(o,objItem,!0)),a.data("index")==t&&(objItem=p.getItem(t),k(a,objItem,!0))}function le(e,t){t=jQuery(t);var i=c.getSlideImage(t),n=ge(t),r=y.getElementSize(i);y.placeElement(n,"center","middle",r.left,r.top,i)}function ue(e){var t=ge(e);y.addClassOnHover(t),y.setButtonOnClick(t,re)}function de(e){switch(e){case 1:return r;case 2:return o;case 3:return a;default:throw new Error("wrong num: "+e)}}function _e(e){if(!e)e=c.getCurrentSlide();return e.children(".ug-slider-preloader")}function ge(e){return e.children(".ug-button-videoplay")}function ce(e){if(!e)e=c.getCurrentSlide();var t=e.data("index");return null==t?null:p.getItem(t)}this.switchSlideNums=function(e){switch(h.trigger(c.events.BEFORE_SWITCH_SLIDES),e){case"left":var t=S.numCurrent;S.numCurrent=S.numNext,S.numNext=S.numPrev,S.numPrev=t;break;case"right":t=S.numCurrent;S.numCurrent=S.numPrev,S.numPrev=S.numNext,S.numNext=t;break;default:throw new Error("wrong direction: "+e)}h.trigger(c.events.ITEM_CHANGED)},this.destroy=function(){h.off(c.events.AFTER_PUT_IMAGE),e.off(p.events.ITEM_IMAGE_UPDATED),e.off(p.events.ITEM_CHANGE),b&&jQuery(b).on(b.events.BULLET_CLICK),i.off("mouseenter"),i.off("mouseleave"),i.off("touchend"),i.off("click"),h.off(c.events.CLICK),d&&h.off(c.events.ZOOM_CHANGE),h.off(c.events.BEFORE_SWITCH_SLIDES),jQuery(v).off(v.events.SHOW),jQuery(v).off(v.events.HIDE),v.destroy(),i.off("mouseenter",".ug-item-wrapper img"),i.off("mouseleave",".ug-item-wrapper img")},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(e,t,i){P(e,t,i)},this.getSlideImage=function(e){if(!e)e=c.getCurrentSlide();return e.find(".ug-item-wrapper img")},this.setHtml=function(e){C(e)},this.run=function(){x()},this.isInnerInPlace=function(){var e=c.getSlidesReference();return-y.getElementSize(e.objCurrentSlide).left==y.getElementSize(n).left},this.isAnimating=function(){return n.is(":animated")},this.isSlideCurrent=function(e){var t=e.data("slidenum");return S.numCurrent==t},this.isSlideHasItem=function(e){var t=e.data("index");return null!=t},this.getObjImagePadding=function(){return{padding_top:E.slider_image_padding_top,padding_bottom:E.slider_image_padding_bottom,padding_left:E.slider_image_padding_left,padding_right:E.slider_image_padding_right}},this.getSlidesReference=function(){return{objPrevSlide:de(S.numPrev),objNextSlide:de(S.numNext),objCurrentSlide:de(S.numCurrent)}},this.getCurrentSlide=function(){return c.getSlidesReference().objCurrentSlide},this.getCurrentItemIndex=function(){var e=c.getSlidesReference().objCurrentSlide.data("index");return null==e&&(e=-1),e},this.getCurrentItem=function(){var e=c.getCurrentItemIndex();return-1==e?null:p.getItem(e)},this.getSlideType=function(e){return null==e&&(e=c.getCurrentSlide()),e.data("type")},this.isMouseInsideSlideImage=function(e){var t=c.getSlideImage(),i=y.getMousePosition(e);void 0===i.pageX&&(i=u.getLastMousePos());var n=y.getMouseElementPoint(i,t),r=y.getElementSize(t);return isMouseInside=y.isPointInsideElement(n,r),isMouseInside},this.isCurrentSlideType=function(e){return c.getSlideType()==e},this.isCurrentSlideLoadingImage=function(){return!0===c.getCurrentSlide().data("isLoading")},this.setItem=function(e,t,i){var n=c.getSlidesReference(),r=n.objCurrentSlide.data("index"),o=e.index;if(o==r)return!0;if(null==r)R(n.objCurrentSlide,e),c.placeNabourItems();else{var a="left";p.getNumItems();"next"==i?a="left":"prev"==i||r>o?a="right":r>o&&(a="right"),B(a,e,t)}},this.placeNabourItems=function(){var e=c.getSlidesReference(),t=e.objCurrentSlide.data("index"),i=p.getPrevItem(t),n=p.getNextItem(t);R(e.objNextSlide,n),R(e.objPrevSlide,i),O()},this.________EXTERNAL_API___________=function(){},this.stopSlideAction=function(e,t){e||(e=c.getCurrentSlide()),!0===t?v.pause():v.hide()},this.startSlideAction=function(e){e||(e=c.getCurrentSlide());var t=ce(e);if("image"==t.type)return!0;switch(1==E.slider_video_constantsize&&F(),W(),v.show(),t.type){case"youtube":v.playYoutube(t.videoid,!0,t.video_start);break;case"vimeo":v.playVimeo(t.videoid);break;case"html5video":v.playHtml5Video(t.videoogv,t.videowebm,t.videomp4,t.urlImage);break;case"soundcloud":v.playSoundCloud(t.trackid);break;case"wistia":v.playWistia(t.videoid)}},this.getScaleMode=function(e){if(!e)e=c.getCurrentSlide();return"image"!=c.getSlideType(e)?E.slider_scale_mode_media:E.slider_scale_mode==E.slider_scale_mode_fullscreen?E.slider_scale_mode:1==p.isFullScreen()?E.slider_scale_mode_fullscreen:E.slider_scale_mode},this.getObjects=function(){return{g_objSlider:i,g_objInner:n,g_options:E,g_objZoomSlider:d}},this.getObjZoom=function(){return d},this.getOptions=function(){return E},this.getElement=function(){return i},this.getVideoObject=function(){return v},this.isCurrentSlideImageFit=function(){var e=c.getCurrentSlide();c.getSlideType(e);!function(e,t){null==t&&(t=c.getCurrentSlide());var i=c.getSlideType(t);if(i!=e)throw new Error("Wrong slide type: "+i+", should be: "+e)}("image",e);var t=c.getSlideImage(e);return 0!=t.length&&y.isImageFitParent(t)},this.isCurrentImageInPlace=function(){var e=c.getSlideImage();if(0==e.length)return!1;var t=c.getScaleMode(),i=c.getObjImagePadding(),n=ce(),r=e.parent(),o=y.getImageInsideParentData(r,n.imageWidth,n.imageHeight,t,i),a=y.getElementSize(e),s=!1;return o.imageWidth==a.width&&(s=!0),s},this.isSlideActionActive=function(){return v.isVisible()},this.isSwiping=function(){return!!u&&u.isTouchActive()},this.isPreloading=function(){return!!_e().is(":visible")},this.setOptions=function(e){g&&(e=y.convertCustomPrefixOptions(e,g,"slider")),E=jQuery.extend(E,e)},this.setSize=function(e,t){if(e<0||t<0)return!0;var s={};s.width=e+"px",s.height=t+"px",i.css(s);var l={};l.height=t+"px",l.top="0px",l.left="0px",n.css(l);var u={};u.height=t+"px",u.width=e+"px",r.css(u),o.css(u),a.css(u);var d=e-E.slider_item_padding_left-E.slider_item_padding_right,_=t-E.slider_item_padding_top-E.slider_item_padding_bottom,g={};if(g.width=d+"px",g.height=_+"px",g.top=E.slider_item_padding_top+"px",g.left=E.slider_item_padding_left+"px",i.find(".ug-item-wrapper").css(g),w&&w.setSizeByParent(),M(),z(r),z(o),z(a),O(),"image"!=c.getSlideType()&&1==E.slider_video_constantsize)F();else{var h=e-E.slider_video_padding_left-E.slider_video_padding_right,p=t-E.slider_video_padding_top-E.slider_video_padding_bottom;v.setSize(h,p)}W()},this.refreshSlideItems=function(){if(1==c.isAnimating())return!0;z(r),z(o),z(a),O()},this.isMouseOver=function(){return i.ismouseover()},this.setPosition=function(e,t){y.placeElement(i,e,t)},this.zoomIn=function(){if(!d)return!0;d.zoomIn()},this.zoomOut=function(){if(!d)return!0;d.zoomOut()},this.zoomBack=function(){if(!d)return!0;d.zoomBack()}}function UGTextPanel(){var e,t,i,n,r,o,a,s=this,l=new UGFunctions,u="",d={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_title_as_link:!1,textpanel_title_link_newtab:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},_={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};function g(t,a){if(!a)a=d.textpanel_padding_top;var s=a;if(i){var u=s;if(l.placeElement(i,0,u),1==i.is(":visible")){(s=l.getElementSize(i).bottom)>0&&(_.lastTitleBottom=s)}else{s=20;_.lastTitleBottom>0&&(s=_.lastTitleBottom)}}var g="";if(n&&(g=jQuery.trim(n.text())),""!=g){var c=s;if(i&&(c+=d.textpanel_padding_title_description),l.placeElement(n,0,c),1==jQuery(n).is(":visible")){var h=l.getElementSize(n);s=h.bottom,h.height>0&&(_.lastDescHeight=h.height)}else{var p=16;_.lastDescHeight>0&&(p=_.lastDescHeight),s=c+p}}d.textpanel_height||1!=_.setInternalHeight||function(t,i){if(!i)var i=!1;if(1==i){if(r){var n=r.height();t>n&&r.height(t)}var a={height:t+"px"};e.add(o).animate(a,d.textpanel_fade_duration)}else r&&r.height(t),e.add(o).height(t)}(s+d.textpanel_padding_bottom,t)}function c(){var e=0;if(i&&(e+=i.outerHeight()),n){var t="";n&&(t=jQuery.trim(n.text())),""!=t&&(i&&(e+=d.textpanel_padding_title_description),e+=n.outerHeight())}return e}function h(){if(1==d.textpanel_enable_bg){(r=e.children(".ug-textpanel-bg")).fadeTo(0,d.textpanel_bg_opacity);var t={"background-color":d.textpanel_bg_color};t=jQuery.extend(t,d.textpanel_bg_css),r.css(t)}if(1==d.textpanel_enable_title){i=o.children(".ug-textpanel-title");var a={};null!==d.textpanel_title_color&&(a.color=d.textpanel_title_color),null!==d.textpanel_title_font_family&&(a["font-family"]=d.textpanel_title_font_family),null!==d.textpanel_title_text_align&&(a["text-align"]=d.textpanel_title_text_align),null!==d.textpanel_title_font_size&&(a["font-size"]=d.textpanel_title_font_size+"px"),null!==d.textpanel_title_bold&&(!0===d.textpanel_title_bold?a["font-weight"]="bold":a["font-weight"]="normal"),d.textpanel_css_title&&(a=jQuery.extend(a,d.textpanel_css_title)),i.css(a)}if(1==d.textpanel_enable_description){n=o.children(".ug-textpanel-description");var s={};null!==d.textpanel_desc_color&&(s.color=d.textpanel_desc_color),null!==d.textpanel_desc_font_family&&(s["font-family"]=d.textpanel_desc_font_family),null!==d.textpanel_desc_text_align&&(s["text-align"]=d.textpanel_desc_text_align),null!==d.textpanel_desc_font_size&&(s["font-size"]=d.textpanel_desc_font_size+"px"),null!==d.textpanel_desc_bold&&(!0===d.textpanel_desc_bold?s["font-weight"]="bold":s["font-weight"]="normal"),d.textpanel_css_title&&(s=jQuery.extend(s,d.textpanel_css_description)),n.css(s)}}function p(){var e=a.getSelectedItem();s.setText(e.title,e.description,e.link)}this.positionElements=function(e){if(!d.textpanel_height||"top"==d.textpanel_text_valign)return g(e),!1;switch(d.textpanel_text_valign){default:case"top":g(!1);break;case"bottom":t=c(),g(!1,o.height()-t-d.textpanel_padding_bottom);break;case"center":case"middle":!function(){var e=c();g(!1,(o.height()-e)/2)}()}var t},this.init=function(e,t,i){if(a=e,i&&(u=i,t=l.convertCustomPrefixOptions(t,u,"textpanel")),t&&(d=jQuery.extend(d,t)),0==d.textpanel_enable_title&&0==d.textpanel_enable_description)throw new Error("Textpanel Error: The title or description must be enabled");d.textpanel_height&&d.textpanel_height<0&&(d.textpanel_height=null),1==d.textpanel_desc_style_as_title&&(d.textpanel_desc_color||(d.textpanel_desc_color=d.textpanel_title_color),d.textpanel_desc_bold||(d.textpanel_desc_bold=d.textpanel_title_bold),d.textpanel_desc_font_family||(d.textpanel_desc_font_family=d.textpanel_title_font_family),d.textpanel_desc_font_size||(d.textpanel_desc_font_size=d.textpanel_title_font_size),d.textpanel_desc_text_align||(d.textpanel_desc_text_align=d.textpanel_title_text_align))},this.appendHTML=function(i,n){t=i;var r="<div class='ug-textpanel"+(n=n?" "+n:"")+"'>";1==d.textpanel_enable_bg&&(r+="<div class='ug-textpanel-bg"+n+"'></div>"),r+="<div class='ug-textpanel-textwrapper"+n+"'>",1==d.textpanel_enable_title&&(r+="<div class='ug-textpanel-title"+n+"'></div>"),1==d.textpanel_enable_description&&(r+="<div class='ug-textpanel-description"+n+"'></div>"),r+="</div></div>",i.append(r),e=i.children(".ug-textpanel"),o=e.children(".ug-textpanel-textwrapper"),h()},this.destroy=function(){jQuery(a).off(a.events.ITEM_CHANGE)},this.run=function(){s.setSizeByParent(),jQuery(a).on(a.events.ITEM_CHANGE,p)},this.setPanelSize=function(t,a){if(_.setInternalHeight=!0,a)_.setInternalHeight=!1;else a=80;d.textpanel_height&&(a=d.textpanel_height),e.width(t),e.height(a),r&&(r.width(t),r.height(a));var u=t-d.textpanel_padding_left-d.textpanel_padding_right,g=d.textpanel_padding_left;l.setElementSizeAndPosition(o,g,0,u,a),i&&i.width(u),n&&n.width(u),0==_.isFirstTime&&s.positionElements(!1)},this.setSizeByParent=function(){var e=l.getElementSize(t);s.setPanelSize(e.width)},this.setTextPlain=function(e,t,r){if(1==d.textpanel_title_as_link&&e&&r){var o="";1==d.textpanel_title_link_newtab&&(o+=' target="blank"'),e='<a class="ug-textpanel-link" href="'+r+'" '+o+">"+e+"</a>"}i&&i.html(e),n&&n.html(t)},this.setText=function(e,t,i){1==_.isFirstTime?(s.setTextPlain(e,t,i),_.isFirstTime=!1,s.positionElements(!1)):o.stop().fadeTo(d.textpanel_fade_duration,0,function(){s.setTextPlain(e,t,i),s.positionElements(!0),jQuery(this).fadeTo(d.textpanel_fade_duration,1)})},this.positionPanel=function(t,i){var n={};if(null!=t)n.top=t,n.bottom="auto";else switch(d.textpanel_align){case"top":n.top=d.textpanel_margin+"px";break;case"bottom":n.top="auto",n.bottom=d.textpanel_margin+"px";break;case"middle":n.top=l.getElementRelativePos(e,"middle",d.textpanel_margin)}null!=i&&(n.left=i),e.css(n)},this.setOptions=function(e){u&&(e=l.convertCustomPrefixOptions(e,u,"textpanel")),d=jQuery.extend(d,e)},this.getElement=function(){return e},this.getSize=function(){return l.getElementSize(e)},this.refresh=function(e,t,i,n){h(),i?s.setPanelSize(i,n):s.setSizeByParent(),s.positionElements(!1),!0!==t&&s.positionPanel(),!0===e&&s.show()},this.hide=function(){e.hide()},this.show=function(){e.show()},this.getOptions=function(){return d},this.getOption=function(e){return 0==d.hasOwnProperty(e)?null:d[e]}}function UGZoomButtonsPanel(){var e,t,i,n,r=new UGSlider,o=new UGFunctions,a={slider_zoompanel_skin:""};function s(e){return!e||!!e.hasClass("ug-zoompanel-button-disabled")}function l(e){e&&e.addClass("ug-zoompanel-button-disabled")}function u(e){e&&e.removeClass("ug-zoompanel-button-disabled")}function d(){if(0==r.isCurrentSlideType("image"))return!0;1==r.isCurrentSlideImageFit()?0==s(i)&&(l(i),l(n)):1==s(i)&&(u(i),u(n))}this.init=function(e,t){r=e,t&&(a=jQuery.extend(a,t))},this.appendHTML=function(r){r;var o="<div class='ug-slider-control ug-zoompanel ug-skin-"+a.slider_zoompanel_skin+"'>";o+="<div class='ug-zoompanel-button ug-zoompanel-plus'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-minus ug-zoompanel-button-disabled'></div>",o+="<div class='ug-zoompanel-button ug-zoompanel-return ug-zoompanel-button-disabled'></div>",o+="</div>",r.append(o),e=r.children(".ug-zoompanel"),t=e.children(".ug-zoompanel-plus"),i=e.children(".ug-zoompanel-minus"),n=e.children(".ug-zoompanel-return")},this.setObjects=function(e,r,o){t=e,n=o,(i=r)&&i.addClass("ug-zoompanel-button-disabled"),n&&n.addClass("ug-zoompanel-button-disabled")},this.getElement=function(){return e},this.initEvents=function(){o.addClassOnHover(t,"ug-button-hover"),o.addClassOnHover(i,"ug-button-hover"),o.addClassOnHover(n,"ug-button-hover"),o.setButtonOnClick(t,function(){if(1==s(t))return!0;r.zoomIn()}),o.setButtonOnClick(i,function(){if(1==s(i))return!0;r.zoomOut()}),o.setButtonOnClick(n,function(){if(1==s(n))return!0;r.zoomBack()}),jQuery(r).on(r.events.ZOOM_CHANGE,d),jQuery(r).on(r.events.ITEM_CHANGED,d)}}function UGBullets(){var e,t,i=this,n=0,r=new UniteGalleryMain,o=new UGFunctions,a={isInited:!1},s={bullets_skin:"",bullets_addclass:"",bullets_space_between:-1};function l(){var i="",r="";-1!=s.bullets_space_between&&(r=" style='margin-left:"+s.bullets_space_between+"px'");for(var o=0;o<n;o++)i+=0==o?"<div class='ug-bullet'></div>":"<div class='ug-bullet'"+r+"></div>";if(e.html(i),!t){var a=e.find(".ug-bullet:first-child");a.length&&(t=a.width())}}function u(e){if(1==i.isActive(e))return!0;var t=e.index();jQuery(i).trigger(i.events.BULLET_CLICK,t)}function d(){var t=e.children(".ug-bullet");o.setButtonOnClick(t,u),t.on("mousedown mouseup",function(e){return!1})}function _(e){if(e<0||e>=n)throw new Error("wrong bullet index: "+e)}function g(){if(1==a.isInited)return!0;throw new Error("The bullets are not inited!")}this.events={BULLET_CLICK:"bullet_click"},this.init=function(e,t,i){r=e,n=i||r.getNumItems(),a.isInited=!0,""==(s=jQuery.extend(s,t)).bullets_skin&&(s.bullets_skin=s.gallery_skin)},this.getBulletsWidth=function(){return 0==n?0:t?n*t+(n-1)*s.bullets_space_between:0},this.appendHTML=function(t){t,g();var i="";""!=s.bullets_addclass&&(i=" "+s.bullets_addclass);var n="<div class='ug-slider-control ug-bullets ug-skin-"+s.bullets_skin+i+"'>";e=jQuery(n+="</div>"),t.append(e),l(),d()},this.updateNumBullets=function(e){n=e,l(),d()},this.getElement=function(){return e},this.setActive=function(t){g(),_(t);var i=e.children(".ug-bullet");i.removeClass("ug-bullet-active"),jQuery(i[t]).addClass("ug-bullet-active"),t},this.isActive=function(t){if(_(t),"number"!=typeof t)var i=t;else i=e.children(".ug-bullet")[t];return!!i.hasClass("ug-bullet-active")},this.getNumBullets=function(){return n}}function UGProgressBar(){var e,t,i=this,n=0,r=new UGFunctions,o={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(i,n){n&&(o=jQuery.extend(o,n)),i.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'></div></div>"),e=i.children(".ug-progress-bar"),(t=e.children(".ug-progress-bar-inner")).css("background-color",o.slider_progressbar_color),e.height(o.slider_progressbar_line_width),t.height(o.slider_progressbar_line_width),t.width("0%");var r=o.slider_progressbar_opacity,a=t[0];a.style.opacity=r,a.style.filter="alpha(opacity="+100*r+")"},this.putHidden=function(t,n){i.put(t,n),e.hide()},this.getElement=function(){return e},this.setSize=function(n){e.width(n),t.width(n),i.draw()},this.setPosition=function(t,i,n,o){r.placeElement(e,t,i,n,o)},this.draw=function(){var e=100*n;t.width(e+"%")},this.setProgress=function(e){n=r.normalizePercent(e),i.draw()},this.getType=function(){return"bar"}}function UGProgressPie(){var e,t=this,i=!1,n=new UGFunctions,r={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};function o(t){if(!t)t=0;var n=Math.min(r.slider_progresspie_width,r.slider_progresspie_height)/2,o=e[0].getContext("2d");0==i&&(i=!0,o.rotate(1.5*Math.PI),o.translate(-2*n,0)),o.clearRect(0,0,r.slider_progresspie_width,r.slider_progresspie_height);var a=r.slider_progresspie_width/2,s=r.slider_progresspie_height/2,l=0,u=t*Math.PI*2;if(1==r.slider_progresspie_type_fill)o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath();else{o.globalCompositeOperation="source-over",o.beginPath(),o.moveTo(a,s),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath(),o.globalCompositeOperation="destination-out";var d=n-r.slider_progresspie_stroke_width;o.beginPath(),o.moveTo(a,s),o.arc(a,s,d,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color1,o.fill(),o.closePath()}1==r.slider_progresspie_type_fill&&(l=u,u=2*Math.PI,o.beginPath(),o.arc(a,s,n,l,u),o.lineTo(a,s),o.fillStyle=r.slider_progresspie_color2,o.fill(),o.closePath())}this.put=function(t,i){i&&(r=jQuery.extend(r,i)),t.append("<canvas class='ug-canvas-pie' width='"+r.slider_progresspie_width+"' height='"+r.slider_progresspie_height+"'></canvas>"),e=t.children(".ug-canvas-pie")},this.putHidden=function(i,n){t.put(i,n),o(.1),e.hide()},this.getElement=function(){return e},this.setPosition=function(t,i){n.placeElement(e,t,i)},this.getSize=function(){return{width:r.slider_progresspie_width,height:r.slider_progresspie_height}},this.setProgress=function(e){e=n.normalizePercent(e),e,o(e)},this.getType=function(){return"pie"}}function UGTouchSliderControl(){var e,t,i,n=new UGSlider,r=new UGFunctions,o={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},a={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};function s(e){if(!e)e=n.getSlidesReference();return-r.getElementSize(e.objCurrentSlide).left-r.getElementSize(t).left}function l(e){if(1==n.isInnerInPlace())return!1;if(i.trigger(n.events.BEFORE_RETURN),!e)e=n.getSlidesReference();var s=-r.getElementSize(e.objCurrentSlide).left;t.animate({left:s+"px"},{duration:o.slider_transition_return_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(e,i,n){if(1==a.isDragVideo){var o=r.getElementSize(t).left-s,l=a.videoStartX+o;a.videoObject.css("left",l)}},complete:function(){i.trigger(n.events.AFTER_RETURN)}})}function u(){var e=n.getSlidesReference(),u=s(e);if(0==u)return!1;var d=u>0?"left":"right",_=!1;switch(d){case"right":if(n.isSlideHasItem(e.objPrevSlide))var g=-r.getElementSize(e.objPrevSlide).left;else _=!0;break;case"left":if(n.isSlideHasItem(e.objNextSlide))g=-r.getElementSize(e.objNextSlide).left;else _=!0}1==_?l(e):t.stop().animate({left:g+"px"},{duration:o.slider_transition_continuedrag_speed,easing:o.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(1==a.isDragVideo){var e=r.getElementSize(t).left-a.startPosx,i=a.videoStartX+e;a.videoObject.css("left",i)}},always:function(){!function(e){n.getVideoObject().hide(),n.switchSlideNums(e),n.placeNabourItems()}(d),i.trigger(n.events.AFTER_DRAG_CHANGE)}})}function d(e){var i=r.getMousePosition(e);a.startMouseX=i.pageX,a.startMouseY=i.pageY,a.lastMouseX=a.startMouseX,a.lastMouseY=a.startMouseY,a.startTime=jQuery.now();var n=r.getArrTouches(e);a.startArrTouches=r.getArrTouchPositions(n);var o=r.getElementSize(t);a.startPosx=o.left,a.isInitDataValid=!0,a.isDragVideo=!1,r.storeEventData(e,a.storedEventID)}function _(e){a.touch_active=!1}function g(e,t){a.touch_active=!0,d(t)}function c(e){return e.preventDefault(),a.isDragging=!1,1==n.isAnimating()&&t.stop(!0,!0),r.getArrTouches(e).length>1?(1==a.touch_active&&_(),!0):1==a.touch_active||void g(0,e)}function h(s){if(0==a.touch_active)return!0;if(0==s.buttons)return _(),u(),!0;r.updateStoredEventData(s,a.storedEventID),s.preventDefault();var l=r.getMousePosition(s);a.lastMouseX=l.pageX,a.lastMouseY=l.pageY;var g=null;1==o.slider_vertical_scroll_ondrag&&(g=r.handleScrollTop(a.storedEventID)),"vert"!==g&&function(r){var o=a.lastMouseX-a.startMouseX;if(0==o)return!0;var s=o<0?"left":"right",l=n.getObjZoom();if(l){if(1==l.isPanEnabled(r,s))return a.isInitDataValid=!1,!0;if(0==a.isInitDataValid)return d(r),!0}var u=a.startPosx+o;o>0&&u>0?u/=3:o<0&&u+t.width()<e.width()&&(u=a.startPosx+o/3);if(0==a.isDragging&&(a.isDragging=!0,i.trigger(n.events.START_DRAG)),t.css("left",u+"px"),1==a.isDragVideo){var _=u-a.startPosx,g=a.videoStartX+_;a.videoObject.css("left",g)}}(s)}function p(e){var t=r.getArrTouches(e).length;if(1==n.isInnerInPlace()&&0==a.touch_active&&0==t)return!0;if(0==t&&1==a.touch_active){_();var i=!1;0==r.wasVerticalScroll(a.storedEventID)&&(i=function(){var e=n.getSlidesReference(),t=s(e),i=Math.round(3*e.objCurrentSlide.width()/8);if(Math.abs(t)>=i)return!0;var r=Math.abs(a.lastMouseX-a.startMouseX);return Math.abs(a.lastMouseY-a.startMouseY),!(r<20)&&jQuery.now()-a.startTime<500}()),1==i?u():l()}else 1==t&&0==a.touch_active&&g(0,e)}this.isTapEventOccured=function(e){var t=r.getArrTouches(e).length;if(0!=t||0!=a.lastNumTouches)return a.lastNumTouches=t,!1;a.lastNumTouches=t;s(n.getSlidesReference());var i=Math.abs(a.lastMouseX-a.startMouseX),o=Math.abs(a.lastMouseY-a.startMouseY),l=jQuery.now()-a.startTime;return i<20&&o<50&&l<500},this.init=function(r,a){n=r,i=jQuery(n),g_objects=r.getObjects(),e=g_objects.g_objSlider,t=g_objects.g_objInner,o=jQuery.extend(o,a),e.bind("mousedown touchstart",c),jQuery("body").bind("mousemove touchmove",h),jQuery(window).add("body").bind("mouseup touchend",p)},this.getLastMousePos=function(){return{pageX:a.lastMouseX,pageY:a.lastMouseY}},this.isTouchActive=function(){return a.touch_active}}function UGZoomSliderControl(){var e,t,i=new UGSlider,n=new UGFunctions,r={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},o={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};function a(n,a){i=n,t=jQuery(i),g_objects=n.getObjects(),e=g_objects.g_objSlider,g_objects.g_objInner,r=jQuery.extend(r,a),e.on("mousewheel",b),e.bind("mousedown touchstart",p),jQuery("body").bind("mousemove touchmove",f),jQuery(window).add("body").bind("mouseup touchend",m),t.bind(i.events.BEFORE_RETURN,function(){h()}),t.bind(i.events.ITEM_CHANGED,function(){o.isZoomedOnce=!1}),t.bind(i.events.ZOOM_CHANGE,function(){o.isZoomedOnce=!0})}function s(){var e=i.getScaleMode();return"down"!=e&&(e="fit"),e}function l(){if((r=jQuery.now())-o.storeImageLastTime<20)return!1;var e=i.getSlidesReference();if(o.objSlide=e.objCurrentSlide,o.objImage=e.objCurrentSlide.find("img"),0==o.objImage.length)return!1;o.objImageSize=n.getElementSize(o.objImage),o.objParent=o.objImage.parent(),o.objParentSize=n.getElementSize(o.objParent);var t=s();objPadding=i.getObjImagePadding(),o.objFitImageSize=n.getImageInsideParentDataByImage(o.objImage,t,objPadding);var r=jQuery.now();return o.storeImageLastTime=r,!0}function u(e,o){var a=i.getSlidesReference().objCurrentSlide.find("img"),l=s();t.trigger(i.events.ZOOM_START);var u=!0,d=i.getObjImagePadding();if("back"==e){var _=n.getImageOriginalSize(a);n.scaleImageFitParent(a,_.width,_.height,l,d)}else{var g="in"==e;u=n.zoomImageInsideParent(a,g,r.slider_zoom_step,o,l,r.slider_zoom_max_ratio,d)}1==u&&(t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE),t.trigger(i.events.ZOOM_END))}function d(e,t,i){var r=n.getArrTouches(t);if(!0===i){if(1!=r.length)return!1}else if(r.length>1)return!1;return!!n.isElementBiggerThenParent(e)}function _(e){o.isPanActive=!0,function(e){var t=n.getMousePosition(e);o.startMouseX=t.pageX,o.startMouseY=t.pageY,o.lastMouseX=o.startMouseX,o.lastMouseY=o.startMouseY,o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height}(e)}function g(e){if(0==o.isZoomActive)return!1;2!=n.getArrTouches(e).length&&(o.isZoomActive=!1,t.trigger(i.events.ZOOM_END))}function c(e){if(1==o.isZoomActive)return!0;var r=n.getArrTouches(e);if(2!=r.length)return!0;!function(e){o.isZoomActive=!0,o.startDistance=n.getDistance(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),0==o.startDistance&&(o.startDistance=1),o.startMiddlePoint=n.getMiddlePoint(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),o.objImageSize=n.getElementSize(o.objImage),o.startImageX=o.objImageSize.left,o.startImageY=o.objImageSize.top,o.imageOrientPoint=n.getElementLocalPoint(o.startMiddlePoint,o.objImage),0==n.isPointInsideElement(o.imageOrientPoint,o.objImageSize)&&(o.imageOrientPoint=n.getElementCenterPoint(o.objImage)),t.trigger(i.events.ZOOM_START)}(r)}function h(){if(null==o.objImage||0==o.objImage.length)return!0;if(n.getElementSize(o.objImage).width<o.objFitImageSize.imageWidth){o.objImage.css({position:"absolute",margin:"none"});var e={top:o.objFitImageSize.imageTop+"px",left:o.objFitImageSize.imageLeft+"px",width:o.objFitImageSize.imageWidth+"px",height:o.objFitImageSize.imageHeight+"px"};o.objImage.animate(e,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}else!function(){var e=!1,t=!1,a=0,s=0,l=n.getElementSize(o.objImage),u=i.getObjImagePadding(),d=n.getElementCenterPosition(o.objImage,u);o.panXActive=o.objImageSize.width>o.objParentSize.width,o.panYActive=o.objImageSize.height>o.objParentSize.height,1==o.panYActive?l.top>0?(s=0,t=!0):l.bottom<o.objParentSize.height&&(s=o.objParentSize.height-l.height,t=!0):l.top!=d.top&&(t=!0,s=d.top),1==o.panXActive?l.left>0?(a=0,e=!0):l.right<o.objParentSize.width&&(a=o.objParentSize.width-l.width,e=!0):l.left!=d.left&&(e=!0,a=d.left);var _={};1==t&&(_.top=s+"px"),1==e&&(_.left=a+"px"),1!=t&&1!=e||o.objImage.animate(_,{duration:r.slider_zoom_return_pan_duration,easing:r.slider_zoom_return_pan_easing,queue:!1})}()}function p(e){if(0==i.isCurrentSlideType("image"))return!0;l();if(null==o.objImage||0==o.objImage.length)return!0;e.preventDefault(),1==!(!o.objImage||!o.objImage.is(":animated"))&&o.objImage.stop(!0),1==o.isZoomActive?g(e):c(e),1==o.isZoomActive?o.isPanActive=!1:1==d(o.objImage,e)&&1==o.isZoomedOnce&&_(e)}function m(e){if(0==i.isCurrentSlideType("image"))return!0;if(1==jQuery(e.target).data("ug-button"))return!1;l();if(null==o.objImage||0==o.objImage.length)return!0;var t=o.isPanActive,n=o.isZoomActive;if(0==i.isInnerInPlace())return o.isZoomActive=!1,o.isPanActive=!1,!0;if(1==o.isZoomActive?g(e):c(e),1==o.isZoomActive)o.isPanActive=!1;else{var r=d(o.objImage,e,!0);1==o.isPanActive?o.isPanActive=!1:1==r&&_(e)}(t||n)&&0==o.isZoomActive&&0==o.isPanActive&&h()}function f(e){if(0==i.isCurrentSlideType("image"))return!0;1==o.isZoomActive?function(e){var a=n.getArrTouches(e),s=n.getDistance(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY)/o.startDistance,l=n.getMiddlePoint(a[0].pageX,a[0].pageY,a[1].pageX,a[1].pageY),u=o.objImageSize.width*s,d=o.objImageSize.height*s,_=n.getImageOriginalSize(o.objImage),g=1;if(_.width>0&&(g=u/_.width),g>r.slider_zoom_max_ratio)return!0;panX=-(o.imageOrientPoint.x*s-o.imageOrientPoint.x),panY=-(o.imageOrientPoint.y*s-o.imageOrientPoint.y);var c=l.x-o.startMiddlePoint.x,h=l.y-o.startMiddlePoint.y,p=o.startImageX+panX+c,m=o.startImageY+panY+h;n.setElementSizeAndPosition(o.objImage,p,m,u,d),t.trigger(i.events.ZOOMING),t.trigger(i.events.ZOOM_CHANGE)}(e):1==o.isPanActive&&function(e){if(null==o.objImage||0==o.objImage.length)return!0;var t=n.getMousePosition(e),r=(t.pageX,o.startMouseX,t.pageY,o.startMouseY,t.pageX-o.lastMouseX),a=t.pageY-o.lastMouseY,s=r<0?"left":"right",l=a<0?"up":"down";o.lastMouseX=t.pageX,o.lastMouseY=t.pageY;var u=n.getElementSize(o.objImage);0==o.panYActive?a=0:"down"==l&&u.top>0?a/=3:"up"==l&&u.bottom<o.objParentSize.height&&(a/=3),0==o.panXActive||0==i.isInnerInPlace()?r=0:"right"==s&&u.left>0?r/=3:"left"==s&&u.right<o.objParentSize.width&&(r/=3);var d=u.left+r,_=u.top+a;n.placeElement(o.objImage,d,_)}(e)}function b(e,t,o,a){return 0==r.slider_zoom_mousewheel||(0==i.isCurrentSlideType("image")||(e.preventDefault(),void u(1==t>0?"in":"out",n.getMousePosition(e))))}this.________EXTERNAL_____________=function(){},this.isPanEnabled=function(e,t){if(l(),null==o.objImage||0==o.objImage.length)return!1;if(0==o.isZoomedOnce)return!1;if(0==d(o.objImage,e))return!1;if(0==i.isInnerInPlace())return!1;if("left"==t){if(o.objImageSize.right<=o.objParentSize.width)return!1}else if(o.objImageSize.left>=0)return!1;return!0},this.init=function(e,t){a(e,t)},this.zoomIn=function(){u("in")},this.zoomOut=function(){u("out")},this.zoomBack=function(){u("back")}}function UGWistiaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=!1;function o(){return"undefined"!=typeof Wistia}function a(e,o,a,s,l){t=null,r=!1;var u=e+"_video",d="<div id='"+u+"' class='wistia_embed' style='width:"+a+";height:"+s+";' data-video-width='"+a+"' data-video-height='"+s+"'>&nbsp;</div>";jQuery("#"+e).html(d),t=Wistia.embed(o,{version:"v1",videoWidth:a,videoHeight:s,container:u,autoPlay:l}),r=!0,t.bind("play",function(){n.trigger(i.events.START_PLAYING)}),t.bind("pause",function(){n.trigger(i.events.STOP_PLAYING)}),t.bind("end",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugWistiaAPI.isAPILoaded||(o()?(g_ugWistiaAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0),void(g_ugWistiaAPI.isAPILoaded=!0)))},this.doCommand=function(e){if(null==t)return!1;if(0==r)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.putVideo=function(t,i,n,r,s,l){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!r||!t)}}function UGSoundCloudAPI(){this.isAPILoaded=!1;var e,t,i,n=this,r=jQuery(this);function o(){return"undefined"!=typeof SC}function a(e,o,a,s,l){t=null,g_isPlayerReady=!1;var u=e+"_iframe",d=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+o;d+="&amp;buying=false&amp;liking=false&amp;download=false&amp;sharing=false&amp;show_artwork=true&show_comments=false&amp;show_playcount=true&amp;show_user=false&amp;hide_related=true&amp;visual=true&amp;start_track=0&amp;callback=true";var _="<iframe id='"+u+"' src="+(d+=!0===l?"&amp;auto_play=true":"&amp;auto_play=false")+" width='"+a+"' height='"+s+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(_),(t=SC.Widget(u)).bind(SC.Widget.Events.READY,function(){t&&(g_isPlayerReady=!0,t.bind(SC.Widget.Events.PLAY,function(){r.trigger(n.events.START_PLAYING)}),t.bind(SC.Widget.Events.PAUSE,function(){r.trigger(n.events.STOP_PLAYING)}),t.bind(SC.Widget.Events.FINISH,function(){r.trigger(n.events.STOP_PLAYING),r.trigger(n.events.VIDEO_ENDED)}))}),i=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugSoundCloudAPI.isAPILoaded||(o()?(g_ugSoundCloudAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0),void(g_ugSoundCloudAPI.isAPILoaded=!0)))},this.putSound=function(t,i,n,r,s){if(o())return a(t,i,n,r,s),!0;this.loadAPI(),e=setInterval(function(){o()&&(a(t,i,n,r,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){n.doCommand("pause")},this.play=function(){n.doCommand("play")},this.destroy=function(){g_isPlayerReady=!1,t=null,i&&(jQuery("#"+i).html(""),i=null)}}function UGHtml5MediaAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this);function r(){return"undefined"!=typeof mejs}function o(e,r,o,a,s){t=null,g_isPlayerReady=!1;var l=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",u=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",d=e+"_video",_="";s&&!0===s&&(_="autoplay='autoplay'");var g="";r.posterImage&&(g="poster='"+r.posterImage+"'");var c="<video id='"+d+"' width='"+o+"' height='"+a+"' controls='controls' preload='none' "+_+" "+g+">";""!=r.mp4&&(c+="<source type='video/mp4' src='"+r.mp4+"' />"),""!=r.webm&&(c+="<source type='video/webm' src='"+r.webm+"' />"),""!=r.ogv&&(c+="<source type='video/ogg' src='"+r.ogv+"' />"),c+="<object width='"+o+"' height='"+a+"' type='application/x-shockwave-flash' data='"+l+"'>",c+="<param name='movie' value='"+l+"' />",c+="<param name='flashvars' value='controls=true&file="+r.mp4+"' />",c+="</object>",c+="</video>",jQuery("#"+e).html(c),new MediaElement(d,{enablePluginDebug:!1,flashName:l,silverlightName:u,success:function(e,r){g_isPlayerReady=!0,t=e,0==s&&t.pause(),g_ugFunctions.addEvent(t,"play",function(){n.trigger(i.events.START_PLAYING)}),g_ugFunctions.addEvent(t,"pause",function(){n.trigger(i.events.STOP_PLAYING)}),g_ugFunctions.addEvent(t,"ended",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})},error:function(e){trace(e)}})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugHtml5MediaAPI.isAPILoaded||(r()?(g_ugHtml5MediaAPI.isAPILoaded=!0,!0):(!0!==e&&(g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0),g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0)),void(g_ugHtml5MediaAPI.isAPILoaded=!0)))},this.putVideo=function(t,i,n,a,s){if(r())return o(t,i,n,a,s),!0;this.loadAPI(),e=setInterval(function(){r()&&(o(t,i,n,a,s),clearInterval(e))},500)},this.doCommand=function(e){if(null==t)return!1;if(0==g_isPlayerReady)return!1;switch(e){case"play":t.play();break;case"pause":t.pause()}},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")}}function UGVimeoAPI(){this.isAPILoaded=!1;var e,t,i=this,n=jQuery(this),r=null,o=!1,a=!1;function s(){return"undefined"!=typeof Froogaloop}function l(e,s,l,u,d){r=null,o=!1;var _=location.protocol+"//player.vimeo.com/video/"+s+"?api=1";!0===d&&(_+="&amp;byline=0&amp;autoplay=1&amp;title=0&amp;portrait=0");var g="<iframe src="+_+" width='"+l+"' height='"+u+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(g);var c=jQuery("#"+e+" iframe")[0];(r=Froogaloop(c)).addEvent("ready",function(){r&&(o=!0,function(){if(!r)return!1;r.addEvent("cuechange",function(){1==a&&i.play()}),r.addEvent("play",function(){n.trigger(i.events.START_PLAYING)}),r.addEvent("pause",function(){n.trigger(i.events.STOP_PLAYING)}),r.addEvent("finish",function(){n.trigger(i.events.STOP_PLAYING),n.trigger(i.events.VIDEO_ENDED)})}())}),t=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugVimeoAPI.isAPILoaded||(s()?(g_ugVimeoAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("f.vimeocdn.com/js/froogaloop2.min.js",!0),void(g_ugVimeoAPI.isAPILoaded=!0)))},this.doCommand=function(e){return null!=r&&(0!=o&&void r.api(e))},this.pause=function(){i.doCommand("pause")},this.play=function(){i.doCommand("play")},this.destroy=function(){r&&(r.api("unload"),r=null,o=!1),t&&jQuery("#"+t).html("")},this.putVideo=function(t,i,n,r,o){if(s())return l(t,i,n,r,o),!0;this.loadAPI(),e=setInterval(function(){s()&&(l(t,i,n,r,o),clearInterval(e))},500)},this.isPlayerReady=function(){return!(!o||!r)},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;a=t,r.api("loadVideo",e)},this.getVideoImages=function(e,t,i){var n=location.protocol+"//vimeo.com/api/v2/video/"+e+".json";jQuery.get(n,{},function(e){var n={};n.preview=e[0].thumbnail_large,n.thumb=e[0].thumbnail_medium,i(t,n)})}}function UGYoutubeAPI(){this.isAPILoaded=!1;var e,t,i=this,n=null,r=!1,o=jQuery(this),a=-1,s=new UGFunctions,l={video_youtube_showinfo:!0};function u(e,i,o,a,u,d){n&&r&&n.destroy();var c={controls:1,showinfo:l.video_youtube_showinfo,start:0,rel:0};!0===u&&(c.autoplay=1);var h=s.getVal(d,"start");h&&jQuery.isNumeric(h)&&(c.start=h),r=!1,n=new YT.Player(e,{height:a,width:o,videoId:i,playerVars:c,events:{onReady:_,onStateChange:g}}),t=e}function d(){return"undefined"!=typeof YT&&void 0!==YT.Player}function _(){r=!0}function g(){if("function"!=typeof n.getPlayerState)return trace("Youtube API error: can't get player state"),!1;var e=n.getPlayerState();switch(e){case YT.PlayerState.PLAYING:o.trigger(i.events.START_PLAYING);break;case YT.PlayerState.ENDED:o.trigger(i.events.STOP_PLAYING),o.trigger(i.events.VIDEO_ENDED);break;default:a==YT.PlayerState.PLAYING&&o.trigger(i.events.STOP_PLAYING)}a=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.setOptions=function(e){l=jQuery.extend(l,e)},this.putVideo=function(t,i,n,r,o,a){if(d())return u(t,i,n,r,o,a),!0;this.loadAPI(),e=setInterval(function(){d()&&(u(t,i,n,r,o,a),clearInterval(e))},500)},this.loadAPI=function(e){return 1==g_ugYoutubeAPI.isAPILoaded||("undefined"!=typeof YT?(g_ugYoutubeAPI.isAPILoaded=!0,!0):(!0!==e&&g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1),void(g_ugYoutubeAPI.isAPILoaded=!0)))},this.doCommand=function(e,t){if(!n)return!0;if(0==r)return!1;switch(e){case"play":if("function"!=typeof n.playVideo)return!1;n.playVideo();break;case"pause":if("function"!=typeof n.pauseVideo)return!1;n.pauseVideo();break;case"seek":if("function"!=typeof n.seekTo)return!1;n.seekTo(t);break;case"stopToBeginning":var i=n.getPlayerState();switch(n.pauseVideo(),i){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:n.seekTo(0)}}},this.play=function(){i.doCommand("play")},this.pause=function(){i.doCommand("pause")},this.destroy=function(){try{n&&(r=!1,n.clearVideo(),n.destroy())}catch(e){jQuery("#"+t).html("")}},this.stopToBeginning=function(){i.doCommand("stopToBeginning")},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;t&&1==t?n.loadVideoById(e,0,"large"):n.cueVideoById(e,0,"large")},this.isPlayerReady=function(){return!(!r||!n)},this.getVideoImages=function(e){var t={};return t.preview="https://i.ytimg.com/vi/"+e+"/sddefault.jpg",t.thumb="https://i.ytimg.com/vi/"+e+"/default.jpg",t}}function UGVideoPlayer(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UGFunctions,_=new UGYoutubeAPI,g=new UGVimeoAPI,c=new UGHtml5MediaAPI,h=new UGSoundCloudAPI,p=new UGWistiaAPI,m=null,f={video_enable_closebutton:!0};this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"};var b={standAloneMode:!1,youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",soundCloudPlayerID:""};function v(){l.hide()}function y(){u.trigger(l.events.PLAY_START),o&&o.hide()}function I(){u.trigger(l.events.PLAY_STOP),o&&o.show()}function w(){u.trigger(l.events.VIDEO_ENDED)}function E(e){var t=["youtube","vimeo","html5","soundcloud","wistia"];for(var o in t){var l=t[o];if(l!=e)switch(l){case"youtube":_.pause(),_.destroy(),i.hide();break;case"vimeo":g.pause(),g.destroy(),n.hide();break;case"html5":c.pause(),r.hide();break;case"soundcloud":h.pause(),h.destroy(),a.hide();break;case"wistia":p.pause(),s.hide()}}}this.init=function(t,i,n){if(!(e=n))throw new Error("missing gallery ID for video player, it's a must!");f=jQuery.extend(f,t),_.setOptions(f),i&&1==i&&(b.standAloneMode=!0)},this.setHtml=function(l){b.youtubeInnerID=e+"_youtube_inner",b.vimeoPlayerID=e+"_videoplayer_vimeo",b.html5PlayerID=e+"_videoplayer_html5",b.wistiaPlayerID=e+"_videoplayer_wistia",b.soundCloudPlayerID=e+"_videoplayer_soundcloud";var u="<div class='ug-videoplayer' style='display:none'>";u+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+b.youtubeInnerID+"'></div></div>",u+="<div id='"+b.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'></div>",u+="<div id='"+b.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'></div>",u+="<div id='"+b.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'></div>",u+="<div id='"+b.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'></div>",0==b.standAloneMode&&1==f.video_enable_closebutton&&(u+="<div class='ug-videoplayer-button-close'></div>"),u+="</div>",l.append(u),t=l.children(".ug-videoplayer"),i=t.children(".ug-videoplayer-youtube"),n=t.children(".ug-videoplayer-vimeo"),r=t.children(".ug-videoplayer-html5"),a=t.children(".ug-videoplayer-soundcloud"),s=t.children(".ug-videoplayer-wistia"),0==b.standAloneMode&&1==f.video_enable_closebutton&&(o=t.children(".ug-videoplayer-button-close"))},this.destroy=function(){o&&(o.off("click"),o.off("touchend")),jQuery(_).off(_.events.START_PLAYING),jQuery(_).off(_.events.STOP_PLAYING),jQuery(g).off(g.events.START_PLAYING),jQuery(g).off(g.events.STOP_PLAYING),jQuery(c).off(c.events.START_PLAYING),jQuery(c).off(c.events.STOP_PLAYING),jQuery(h).off(h.events.START_PLAYING,y),jQuery(h).off(h.events.STOP_PLAYING,I),jQuery(p).off(p.events.START_PLAYING,y),jQuery(p).off(p.events.STOP_PLAYING,I),m=null},this.initEvents=function(){o&&(d.setButtonMobileReady(o),d.setButtonOnClick(o,v)),jQuery(_).on(_.events.START_PLAYING,y),jQuery(_).on(_.events.STOP_PLAYING,I),jQuery(_).on(_.events.VIDEO_ENDED,w),jQuery(g).on(g.events.START_PLAYING,y),jQuery(g).on(g.events.STOP_PLAYING,I),jQuery(g).on(g.events.VIDEO_ENDED,w),jQuery(c).on(c.events.START_PLAYING,y),jQuery(c).on(c.events.STOP_PLAYING,I),jQuery(c).on(c.events.VIDEO_ENDED,w),jQuery(h).on(h.events.START_PLAYING,y),jQuery(h).on(h.events.STOP_PLAYING,I),jQuery(h).on(h.events.VIDEO_ENDED,w),jQuery(p).on(p.events.START_PLAYING,y),jQuery(p).on(p.events.STOP_PLAYING,I),jQuery(p).on(p.events.VIDEO_ENDED,w)},this.setSize=function(e,i){d.setElementSize(t,e,i),o&&d.placeElement(o,"right","top")},this.setPosition=function(e,i){d.placeElement(t,e,i)},this.getObject=function(){return t},this.show=function(){if(1==l.isVisible())return!0;t.show(),t.fadeTo(0,1),o&&o.show(),u.trigger(l.events.SHOW)},this.hide=function(){if(0==l.isVisible())return!0;E(),m=null,t.hide(),u.trigger(l.events.HIDE)},this.getActiveAPI=function(){switch(m){case"youtube":return _;case"vimeo":return g;case"wistia":return p;case"soundcloud":return h;case"html5":return c;default:return null}},this.pause=function(){var e=l.getActiveAPI();if(null==e)return!1;"function"==typeof e.pause&&e.pause()},this.isVisible=function(){return t.is(":visible")},this.playYoutube=function(e,t,n){if(void 0===t)t=!0;if(!n)n=null;E("youtube"),i.show(),0==i.children("#"+b.youtubeInnerID).length&&i.append("<div id='"+b.youtubeInnerID+"'></div>");var r={};n&&(r.start=n),1==_.isPlayerReady()&&1==b.standAloneMode?_.changeVideo(e,t):_.putVideo(b.youtubeInnerID,e,"100%","100%",t,r),m="youtube"},this.playVimeo=function(e,t){if(void 0===t)t=!0;E("vimeo"),n.show(),g.putVideo(b.vimeoPlayerID,e,"100%","100%",t),m="vimeo"},this.playHtml5Video=function(e,t,i,n,o){if(void 0===o)o=!0;E("html5"),r.show();var a={ogv:e,webm:t,mp4:i,posterImage:n};c.putVideo(b.html5PlayerID,a,"100%","100%",o),m="html5"},this.playSoundCloud=function(e,t){if(void 0===t)t=!0;E("soundcloud"),a.show(),h.putSound(b.soundCloudPlayerID,e,"100%","100%",t),m="soundcloud"},this.playWistia=function(e,t){if(void 0===t)t=!0;E("wistia"),s.show(),p.putVideo(b.wistiaPlayerID,e,"100%","100%",t),m="wistia"}}var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI;function ugCheckForMinJQueryVersion(){if(0==g_ugFunctions.checkMinJqueryVersion("1.8.0"))throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.")}function ugCheckForErrors(e,t){try{"jquery"==t?(!function(){if("undefined"==typeof jQuery)throw new Error("jQuery library not included")}(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),function(){if("function"==typeof jQuery.fn.unitegallery)return!0;var e="You have some jquery.js library include that comes after the gallery files js include.";throw e+="<br> This include eliminates the gallery libraries, and make it not work.","cms"==t?(e+="<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Gallery Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true.",e+="<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it."):e+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.",new Error(e)}())}catch(r){var i=r.message;if(i="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+(i="Unite Gallery Error: "+i)+"</div>","jquery"==t){var n=document.getElementById(e);n.innerHTML=i,n.style.display="block"}else jQuery(e).show().html(i);return!1}return!0}function UniteGalleryMain(){var t=this,g_galleryID,g_objGallery=jQuery(t),g_objWrapper,g_objParent,g_objThumbs,g_objSlider,g_objLightbox,g_functions=new UGFunctions,g_objTabs,g_objLoadMore,g_arrItems=[],g_numItems,g_selectedItem=null,g_selectedItemIndex=-1,g_objTheme,g_objCache={};this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"};var g_options={gallery_width:900,gallery_height:500,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!1,gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:"",load_api_externally:!1},g_temp={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};function __________INIT_GALLERY_______(){}function getThemeFunction(e){var t=e;return-1==t.indexOf("UGTheme_")&&(t="UGTheme_"+t),t}function initTheme(objCustomOptions){if(objCustomOptions.hasOwnProperty("gallery_theme"))g_options.gallery_theme=objCustomOptions.gallery_theme;else{var defaultTheme=g_options.gallery_theme;0==g_ugFunctions.isThemeRegistered(defaultTheme)&&(g_options.gallery_theme=g_ugFunctions.getFirstRegisteredTheme())}var themeFunction=getThemeFunction(g_options.gallery_theme);try{g_options.gallery_theme=eval(themeFunction)}catch(e){}g_options.gallery_theme=eval(themeFunction),g_objTheme=new g_options.gallery_theme,g_objTheme.init(t,objCustomOptions)}function resetOptions(){g_options=jQuery.extend({},g_temp.originalOptions),g_selectedItemIndex=-1,g_selectedItem=null,g_objSlider=void 0,g_objThumbs=void 0,g_objLightbox=void 0}function checkForStartupErrors(){try{ugCheckForMinJQueryVersion()}catch(e){throwErrorShowMessage(e.message)}"object"==typeof g_objWrapper.outerWidth()&&throwErrorShowMessage("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version."),setTimeout(function(){ugCheckForErrors(g_galleryID,"cms")},5e3)}function runGallery(e,i,n,r){var o="object"==typeof i;if(o&&(g_temp.objCustomOptions=i),1==g_temp.isRunFirstTime){if(g_galleryID=e,0==(g_objWrapper=jQuery(g_galleryID)).length)return trace("div with id: "+g_galleryID+" not found"),!1;g_objParent=g_objWrapper.parent(),checkForStartupErrors(),g_temp.originalOptions=jQuery.extend({},g_options),o&&(g_options=jQuery.extend(g_options,i)),1==g_options.gallery_enable_cache&&g_options.gallery_initial_catid&&cacheItems(g_options.gallery_initial_catid),t.setSizeClass(),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.find("img").fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}else if(t.destroy(),resetOptions(),g_options=jQuery.extend(g_options,g_temp.objCustomOptions),n){if(r&&1==g_options.gallery_enable_cache&&cacheItems(r,n),"noitems"==n)return showErrorMessage("No items in this category",""),!1;g_objWrapper.html(n),fillItemsArray(g_objWrapper.children()),loadAPIs(),g_objWrapper.children().fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_tabs&&(g_objTabs=new UGTabs).init(t,g_options),1==g_temp.isRunFirstTime&&1==g_options.gallery_enable_loadmore&&(g_objLoadMore=new UGLoadMore).init(t,g_options),o&&modifyInitParams(g_temp.objCustomOptions),validateParams(),1==g_options.gallery_shuffle&&t.shuffleItems(),initTheme(g_temp.objCustomOptions),setGalleryHtml(),setHtmlObjectsProperties(),0==g_objWrapper.width()?g_functions.waitForWidth(g_objWrapper,runGalleryActually):runGalleryActually()}function runGalleryActually(){t.setSizeClass(),0==g_temp.isFreestyleMode&&1==g_options.gallery_preserve_ratio&&setHeightByOriginalRatio(),g_objTheme.run(),g_objTabs&&g_temp.isRunFirstTime&&g_objTabs.run(),preloadBigImages(),initEvents(),g_numItems>0&&t.selectItem(0),1==g_options.gallery_autoplay&&t.startPlayMode(),g_temp.isRunFirstTime=!1}function showErrorMessage(e,t){if(void 0===t)t="<b>Unite Gallery Error: </b>";else t="<b>"+t+": </b>";var i="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+(e=t+e)+"</div></div>";g_objWrapper.children().remove(),g_objWrapper.html(i),g_objWrapper.show()}function throwErrorShowMessage(e){throw showErrorMessage(e),new Error(e)}function modifyInitParams(){g_options.gallery_images_preload_type||(g_options.gallery_images_preload_type="minimal"),(null==g_options.gallery_min_height||g_options.gallery_height<g_options.gallery_min_height)&&(g_options.gallery_min_height=0),(null==g_options.gallery_min_width||g_options.gallery_width<g_options.gallery_min_width)&&(g_options.gallery_min_width=0)}function validateParams(){if(!g_options.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(g_options.gallery_height)&&g_options.gallery_height<g_options.gallery_min_height)throw new Error("The <b>gallery_height</b> option must be bigger then <b>gallery_min_height option</b>");if(g_options.gallery_width<g_options.gallery_min_width)throw new Error("The <b>gallery_width</b> option must be bigger then <b>gallery_min_width option</b>")}function setGalleryHtml(){g_objWrapper.addClass("ug-gallery-wrapper"),g_objWrapper.append("<div class='ug-overlay-disabled' style='display:none'></div>"),t.setSizeClass()}function clearInitData(){g_objWrapper.children().remove()}function storeLastSize(){var e=t.getSize();g_temp.lastWidth=e.width,g_temp.lastHeight=e.height}function setHeightByOriginalRatio(){var e=t.getSize();if(e.width/e.height!=e.orig_ratio){var i=e.width/e.orig_ratio;(i=Math.round(i))<g_options.gallery_min_height&&(i=g_options.gallery_min_height),g_objWrapper.height(i)}}function setHtmlObjectsProperties(){var e={"max-width":g_functions.getCssSizeParam(g_options.gallery_width),"min-width":g_functions.getCssSizeParam(g_options.gallery_min_width)};if(0==g_temp.isFreestyleMode){var t=g_functions.getCssSizeParam(g_options.gallery_height);e.height=t}else e.overflow="visible";g_options.gallery_background_color&&(e["background-color"]=g_options.gallery_background_color),g_objWrapper.css(e)}function fillItemByChild(e){var i=t.isMobileMode();if("noscript"==(a=e.prop("tagName").toLowerCase()))return null;if("picture"==a){var n=e.find("img");if(0==n.length)return null;e=n,a="img"}var r=e.data("lazy-src");r&&e.attr("src",r);var o="";if("a"==a){o=e.attr("href");var a=(e=e.children("img:first-child")).prop("tagName").toLowerCase()}var s=e.data("type");null==s&&(s="image");var l={};if(l.type=s,"img"==a){if(!(u=e.data("lazyload-src")))var u=e.data("lazy-src");u&&""!=u&&(e.attr("src",u),jQuery.removeData(e,"lazyload-src"));var d=e.data("image"),_=e.data("thumb"),g=e.data("title");void 0===d&&(d=null),void 0===_&&(_=null);var c=e.attr("src");d||(d=c),_||(_=c),_||(_=d),d||(d=_),l.urlThumb=_,l.urlImage=d,l.title=e.attr("alt"),g&&(l.title=g),l.objThumbImage=e,l.objThumbImage.attr("src",l.urlThumb)}else{if("image"==s)throw trace("Problematic gallery item found:"),trace(e),trace("Please look for some third party js script that could add this item to the gallery"),new Error("The item should not be image type");l.urlThumb=e.data("thumb"),l.title=e.data("title"),l.objThumbImage=null,l.urlImage=e.data("image")}if(1==i){var h=e.data("thumb-mobile");void 0!==h&&""!=h&&(l.urlThumb=h,"img"==a&&e.attr("src",l.urlThumb));var p=e.data("image-mobile");void 0!==p&&""!=p&&(l.urlImage=p)}l.link=o,l.description=e.attr("title"),l.description||(l.description=e.data("description")),l.description||(l.description=""),l.isNewAdded=!1,l.isLoaded=!1,l.isThumbImageLoaded=!1,l.objPreloadImage=null,l.isBigImageLoadStarted=!1,l.isBigImageLoaded=!1,l.isBigImageLoadError=!1,l.imageWidth=0,l.imageHeight=0,l.thumbWidth=0,l.thumbHeight=0,l.thumbRatioByWidth=0,l.thumbRatioByHeight=0;var m=e.data("width"),f=e.data("height");m&&"number"==typeof m&&f&&"number"==typeof f&&(l.thumbWidth=m,l.thumbHeight=f,l.thumbRatioByWidth=m/f,l.thumbRatioByHeight=f/m),l.addHtml=null;var b=null==l.urlImage||""==l.urlImage,v=null==l.urlThumb||""==l.urlThumb;switch(l.type){case"youtube":if(l.videoid=e.data("videoid"),l.video_start=e.data("start"),b||v){var y=g_ugYoutubeAPI.getVideoImages(l.videoid);b&&(l.urlImage=y.preview),v&&(l.urlThumb=y.thumb,"img"==a&&e.attr("src",l.urlThumb))}g_temp.isYoutubePresent=!0;break;case"vimeo":l.videoid=e.data("videoid"),g_temp.isVimeoPresent=!0;break;case"html5video":l.videoogv=e.data("videoogv"),l.videowebm=e.data("videowebm"),l.videomp4=e.data("videomp4"),g_temp.isHtml5VideoPresent=!0;break;case"soundcloud":l.trackid=e.data("trackid"),g_temp.isSoundCloudPresent=!0;break;case"wistia":l.videoid=e.data("videoid"),g_temp.isWistiaPresent=!0;break;case"custom":var I=e.children("img");I.length&&(I=jQuery(I[0]),l.urlThumb=I.attr("src"),l.title=I.attr("alt"),l.objThumbImage=I);var w=e.children().not("img:first-child");w.length&&(l.addHtml=w.clone())}return l.objThumbImage&&(l.objThumbImage.removeAttr("data-description",""),l.objThumbImage.removeAttr("data-image",""),l.objThumbImage.removeAttr("data-thumb",""),l.objThumbImage.removeAttr("title","")),l}function fillItemsArray(e,t){if(!0!==t)g_arrItems=[];else for(var i=0;i<g_numItems;i++)g_arrItems[i].isNewAdded=!1;for(i=0;i<e.length;i++){var n=jQuery(e[i]),r=fillItemByChild(n);null!==r?(numIndex=g_arrItems.length,r.index=numIndex,!0===t&&(r.isNewAdded=!0),g_arrItems.push(r)):n.remove()}g_numItems=g_arrItems.length}function loadAPIs(){var e=g_options.load_api_externally;g_temp.isYoutubePresent&&g_ugYoutubeAPI.loadAPI(e),g_temp.isVimeoPresent&&g_ugVimeoAPI.loadAPI(e),g_temp.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI(e),g_temp.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI(e),g_temp.isWistiaPresent&&g_ugWistiaAPI.loadAPI(e)}function preloadBigImages(){if("visible"!=g_options.gallery_images_preload_type||g_objThumbs||(g_options.gallery_images_preload_type="minimal"),1==g_temp.isAllItemsPreloaded)return!0;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":jQuery(g_arrItems).each(function(){preloadItemImage(this)});break;case"visible":jQuery(g_arrItems).each(function(){1==g_objThumbs.isItemThumbVisible(this)&&preloadItemImage(this)})}}function checkPreloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!1;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":preloadItemImage(e);break;case"visible":1==g_objThumbs.isItemThumbVisible(e)&&preloadItemImage(e)}}function preloadItemImage(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return!0;var i=e.urlImage;if(""==i||null==i)return e.isBigImageLoadError=!0,!1;e.isBigImageLoadStarted=!0,e.objPreloadImage=jQuery("<img/>").attr("src",i),e.objPreloadImage.data("itemIndex",e.index),e.objPreloadImage.on("load",t.onItemBigImageLoaded),e.objPreloadImage.on("error",function(){var e=jQuery(this).data("itemIndex"),i=g_arrItems[e];i.isBigImageLoadError=!0,i.isBigImageLoaded=!1;var n=jQuery(this).attr("src");console.log("Can't load image: "+n),g_objGallery.trigger(t.events.ITEM_IMAGE_UPDATED,[e,i.urlImage]),i.objThumbImage.attr("src",i.urlThumb)}),checkAllItemsStartedPreloading()}function preloadNearBigImages(e){if(1==g_temp.isAllItemsPreloaded)return!1;if(!e)e=g_selectedItem;if(!e)return!0;var t=e.index,i=t-1,n=t+1;i>0&&preloadItemImage(g_arrItems[i]),n<g_numItems&&preloadItemImage(g_arrItems[n])}function checkAllItemsStartedPreloading(){if(1==g_temp.isAllItemsPreloaded)return!1;for(var e in g_arrItems)if(0==g_arrItems[e].isBigImageLoadStarted)return!1;g_temp.isAllItemsPreloaded=!0}function __________END_INIT_GALLERY_______(){}function __________EVENTS_____________(){}function onSliderMouseEnter(e){1==g_options.gallery_pause_on_mouseover&&0==t.isFullScreen()&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&t.pausePlaying()}function onSliderMouseLeave(e){1==g_options.gallery_pause_on_mouseover&&1==g_temp.isPlayMode&&g_objSlider&&0==g_objSlider.isSlideActionActive()&&(0==g_objSlider.isCurrentSlideLoadingImage()&&t.continuePlaying())}function isThisGalleryForKeyAction(){if(!window.ugArrGalleriesObjects)return!0;window.ugArrGalleriesObjects.length;if(1==window.ugArrGalleriesObjects.length)return!0;var e,i=0,n=t.getGalleryID();return jQuery.each(window.ugArrGalleriesObjects,function(t,r){var o=r.getGalleryID(),a=r.getKeyPressScore();a>i&&(i=a),o==n&&(e=a)}),e==i}function onKeyPress(e){var i=jQuery(e.target);if(i.is("textarea")||i.is("select")||i.is("input"))return!0;var n=e.charCode?e.charCode:e.keyCode?e.keyCode:e.which?e.which:0,r=!1;switch(n){case 39:1==isThisGalleryForKeyAction()&&(t.nextItem(),r=!0);break;case 37:1==isThisGalleryForKeyAction()&&(t.prevItem(),r=!0);break;default:r=!1}1==r&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()),g_objGallery.trigger(t.events.GALLERY_KEYPRESS,[n,e])}function onGalleryResized(){var e;if(0==(e=t.getSize()).width)return!0;if(t.setSizeClass(),(e=t.getSize()).width!=g_temp.lastWidth||0==g_temp.isFreestyleMode&&e.height!=g_temp.lastHeight){var i=!1;if(g_temp.funcCustomHeight){var n=g_temp.funcCustomHeight(e);n&&(g_objWrapper.height(n),i=!0)}0==i&&1==g_options.gallery_preserve_ratio&&0==g_temp.isFreestyleMode&&setHeightByOriginalRatio(),storeLastSize(),g_objGallery.trigger(t.events.SIZE_CHANGE)}}function onThumbsChange(e){"visible"==g_options.gallery_images_preload_type&&0==g_temp.isAllItemsPreloaded&&preloadBigImages()}function onFullScreenChange(){var e=g_functions.isFullScreen(),i=e?t.events.ENTER_FULLSCREEN:t.events.EXIT_FULLSCREEN,n=g_functions.getGlobalData("fullscreenID");if(g_galleryID!==n)return!0;e?g_objWrapper.addClass("ug-fullscreen"):g_objWrapper.removeClass("ug-fullscreen"),g_objGallery.trigger(i),onGalleryResized()}function onItemImageUpdated(e,i){checkPreloadItemImage(t.getItem(i))}function onCurrentSlideImageLoadEnd(){1==t.isPlayMode()&&t.continuePlaying()}function initEvents(){if(g_objWrapper.on("dragstart",function(e){e.preventDefault()}),g_objGallery.on(t.events.ITEM_IMAGE_UPDATED,onItemImageUpdated),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).on(g_objThumbs.events.STRIP_MOVE,onThumbsChange);break;case"grid":jQuery(g_objThumbs).on(g_objThumbs.events.PANE_CHANGE,onThumbsChange)}if("advance"==g_options.gallery_mousewheel_role&&0==g_temp.isFreestyleMode&&g_objWrapper.on("mousewheel",t.onGalleryMouseWheel),storeLastSize(),jQuery(window).resize(function(){g_objWrapper.css("width","auto"),g_functions.whenContiniousEventOver("gallery_resize",onGalleryResized,g_temp.resizeDelay)}),setTimeout(function(){setInterval(onGalleryResized,2e3)},1e4),g_functions.addFullScreenChangeEvent(onFullScreenChange),g_objSlider){if(jQuery(g_objSlider).on(g_objSlider.events.ITEM_CHANGED,function(){var e=g_objSlider.getCurrentItemIndex();-1!=e&&t.selectItem(e)}),1==g_options.gallery_pause_on_mouseover)g_objSlider.getElement().hover(onSliderMouseEnter,onSliderMouseLeave),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){onSliderMouseLeave()});retriggerEvent(g_objSlider,g_objSlider.events.ACTION_START,t.events.SLIDER_ACTION_START),retriggerEvent(g_objSlider,g_objSlider.events.ACTION_END,t.events.SLIDER_ACTION_END),jQuery(g_objSlider).on(g_objSlider.events.CURRENTSLIDE_LOAD_END,onCurrentSlideImageLoadEnd)}1==g_options.gallery_control_keyboard&&jQuery(document).keydown(onKeyPress)}function __________GENERAL_______(){}function cacheItems(e,t){if(t)"noitems"!=(i=t)&&(i=jQuery(t).clone());else var i=g_objWrapper.children().clone();g_objCache[e]=i}function removeAllSizeClasses(e){e||(e=g_objWrapper),e.removeClass("ug-under-480"),e.removeClass("ug-under-780"),e.removeClass("ug-under-960")}function retriggerEvent(e,t,i){jQuery(e).on(t,function(e){g_objGallery.trigger(i,[this])})}function advanceNextStep(){var e=jQuery.now(),i=e-g_temp.playTimeLastStep;if(g_temp.playTimeLastStep=e,0==t.isGalleryVisible())return!1;if(g_temp.playTimePassed+=i,g_temp.objProgress){var n=g_temp.playTimePassed/g_options.gallery_play_interval;g_temp.objProgress.setProgress(n)}g_temp.playTimePassed>=g_options.gallery_play_interval&&(t.nextItem(),g_temp.playTimePassed=0)}function unselectSeletedItem(){if(null==g_selectedItem)return!0;g_objThumbs&&g_objThumbs.setThumbUnselected(g_selectedItem.objThumbWrapper),g_selectedItem=null,g_selectedItemIndex=-1}function toFakeFullScreen(){jQuery("body").addClass("ug-body-fullscreen"),g_objWrapper.addClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!0,g_objGallery.trigger(t.events.ENTER_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}function exitFakeFullscreen(){jQuery("body").removeClass("ug-body-fullscreen"),g_objWrapper.removeClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!1,g_objGallery.trigger(t.events.EXIT_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}this.onItemBigImageLoaded=function(e,t){if(!t)t=jQuery(this);var i=t.data("itemIndex"),n=g_arrItems[i];n.isBigImageLoaded=!0;var r=g_functions.getImageOriginalSize(t);n.imageWidth=r.width,n.imageHeight=r.height},this.checkFillImageSize=function(e,t){if(!t){var i=e.data("itemIndex");if(void 0===i)throw new Error("Wrong image given to gallery.checkFillImageSize");t=g_arrItems[i]}var n=g_functions.getImageOriginalSize(e);t.imageWidth=n.width,t.imageHeight=n.height},this.setFreestyleMode=function(){g_temp.isFreestyleMode=!0},this.attachThumbsPanel=function(e,t){g_temp.thumbsType=e,g_objThumbs=t},this.initSlider=function(e,i){if(!e)e={};e=jQuery.extend(g_temp.objCustomOptions,e),(g_objSlider=new UGSlider).init(t,e,i)},this.onGalleryMouseWheel=function(e,i,n,r){e.preventDefault(),i>0?t.prevItem():t.nextItem()},this.getKeyPressScore=function(){if(t.isGalleryInsideScreen())return 1;if(g_objLightbox&&1==g_objLightbox.isOpened())return 2;return 0},this.getGalleryID=function(){return g_galleryID},this.destroy=function(){if(g_objWrapper.off("dragstart"),g_objGallery.off(t.events.ITEM_IMAGE_UPDATED),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).off(g_objThumbs.events.STRIP_MOVE);break;case"grid":jQuery(g_objThumbs).off(g_objThumbs.events.PANE_CHANGE)}if(g_objWrapper.off("mousewheel"),jQuery(window).off("resize"),g_functions.destroyFullScreenChangeEvent(),g_objSlider){jQuery(g_objSlider).off(g_objSlider.events.ITEM_CHANGED);var e=g_objSlider.getElement();e.off("mouseenter"),e.off("mouseleave"),g_objGallery.off(t.events.ENTER_FULLSCREEN),jQuery(g_objSlider).off(g_objSlider.events.ACTION_START),jQuery(g_objSlider).off(g_objSlider.events.ACTION_END),jQuery(g_objSlider).off(g_objSlider.events.CURRENTSLIDE_LOAD_END)}1==g_options.gallery_control_keyboard&&jQuery(document).off("keydown"),g_objTheme&&"function"==typeof g_objTheme.destroy&&g_objTheme.destroy(),g_objWrapper.html("")},this.getArrItems=function(){return g_arrItems},this.getObjects=function(){return{g_galleryID:g_galleryID,g_objWrapper:g_objWrapper,g_objThumbs:g_objThumbs,g_objSlider:g_objSlider,g_options:g_options,g_arrItems:g_arrItems,g_numItems:g_numItems}},this.getObjSlider=function(){return g_objSlider},this.getItem=function(e){if(e<0)throw new Error("item with index: "+e+" not found");if(e>=g_numItems)throw new Error("item with index: "+e+" not found");return g_arrItems[e]},this.getWidth=function(){return t.getSize().width},this.getHeight=function(){return t.getSize().height},this.getSize=function(){var e=g_functions.getElementSize(g_objWrapper);return e.orig_width=g_options.gallery_width,e.orig_height=g_options.gallery_height,e.orig_ratio=e.orig_width/e.orig_height,e},this.getGalleryID=function(){return g_galleryID.replace("#","")},this.getNextItem=function(e,t){"object"==typeof e&&(e=e.index);var i=e+1;if(!0!==t&&1==g_numItems)return null;if(i>=g_numItems){if(1!=g_options.gallery_carousel&&!0!==t)return null;i=0}return g_arrItems[i]},this.getPrevItem=function(e){"object"==typeof e&&(e=e.index);var t=e-1;if(t<0){if(1!=g_options.gallery_carousel&&!0!==forceCarousel)return null;t=g_numItems-1}return g_arrItems[t]},this.getSelectedItem=function(){return g_selectedItem},this.getSelectedItemIndex=function(){return g_selectedItemIndex},this.getNumItems=function(){return g_numItems},this.isLastItem=function(){return g_selectedItemIndex==g_numItems-1},this.isFirstItem=function(){return 0==g_selectedItemIndex},this.getOptions=function(){return g_options},this.getElement=function(){return g_objWrapper},this.___________SET_CONTROLS___________=function(){},this.setNextButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.nextItem)},this.setPrevButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.prevItem)},this.setFullScreenToggleButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnTap(e,t.toggleFullscreen),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){e.addClass("ug-fullscreenmode")}),g_objGallery.on(t.events.EXIT_FULLSCREEN,function(){e.removeClass("ug-fullscreenmode")})},this.destroyFullscreenButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.ENTER_FULLSCREEN),g_objGallery.off(t.events.EXIT_FULLSCREEN)},this.setPlayButton=function(e){e.data("ug-button",!0),g_functions.setButtonOnClick(e,t.togglePlayMode),g_objGallery.on(t.events.START_PLAY,function(){e.addClass("ug-stop-mode")}),g_objGallery.on(t.events.STOP_PLAY,function(){e.removeClass("ug-stop-mode")})},this.destroyPlayButton=function(e){g_functions.destroyButton(e),g_objGallery.off(t.events.START_PLAY),g_objGallery.off(t.events.STOP_PLAY)},this.setProgressIndicator=function(e){g_temp.objProgress=e},this.setTextContainers=function(e,i){g_objGallery.on(t.events.ITEM_CHANGE,function(){var n=t.getSelectedItem();e.html(n.title),i.html(n.description)})},this.showDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").show()},this.hideDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").hide()},this.___________END_SET_CONTROLS___________=function(){},this.___________PLAY_MODE___________=function(){},this.startPlayMode=function(){if(g_temp.isPlayMode=!0,g_temp.isPlayModePaused=!1,g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval),g_temp.objProgress){var e=g_temp.objProgress.getElement();g_temp.objProgress.setProgress(0),e.show()}g_objGallery.trigger(t.events.START_PLAY),g_objSlider&&1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying()},this.resetPlaying=function(){if(0==g_temp.isPlayMode)return!0;g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now()},this.pausePlaying=function(){if(1==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!0,clearInterval(g_temp.playHandle),g_objGallery.trigger(t.events.PAUSE_PLAYING)},this.continuePlaying=function(){if(0==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!1,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval)},this.stopPlayMode=function(){(g_temp.isPlayMode=!1,clearInterval(g_temp.playHandle),g_temp.playTimePassed=0,g_temp.objProgress)&&g_temp.objProgress.getElement().hide();g_objGallery.trigger(t.events.STOP_PLAY)},this.isPlayMode=function(){return g_temp.isPlayMode},this.togglePlayMode=function(){0==t.isPlayMode()?t.startPlayMode():t.stopPlayMode()},this.___________GENERAL_EXTERNAL___________=function(){},this.getCurrentNumItem=function(){return g_selectedItemIndex},this.shuffleItems=function(){for(var e in g_arrItems=g_functions.arrayShuffle(g_arrItems))g_arrItems[e].index=parseInt(e)},this.setOptions=function(e){g_options=jQuery.extend(g_options,e)},this.selectItem=function(e,i){"number"==typeof e&&(e=t.getItem(e));var n=e.index;if(n==g_selectedItemIndex)return!0;(unselectSeletedItem(),g_selectedItem=e,g_selectedItemIndex=n,g_objGallery.trigger(t.events.ITEM_CHANGE,[e,i]),1==g_temp.isPlayMode)&&(t.resetPlaying(),1==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying())},this.nextItem=function(){var e=g_selectedItemIndex+1;return 0==g_numItems||(0==g_options.gallery_carousel&&e>=g_numItems||(e>=g_numItems&&(e=0),void t.selectItem(e,"next")))},this.prevItem=function(){var e=g_selectedItemIndex-1;return-1==g_selectedItemIndex&&(e=0),0==g_numItems||(0==g_options.gallery_carousel&&e<0||(e<0&&(e=g_numItems-1),void t.selectItem(e,"prev")))},this.isFullScreen=function(){return 1==g_temp.isFakeFullscreen||1==g_functions.isFullScreen()},this.isFakeFullscreen=function(){return g_temp.isFakeFullscreen},this.toFullScreen=function(){g_functions.setGlobalData("fullscreenID",g_galleryID);var e=g_objWrapper.get(0);0==g_functions.toFullscreen(e)&&toFakeFullScreen()},this.exitFullScreen=function(){1==g_temp.isFakeFullscreen?exitFakeFullscreen():g_functions.exitFullscreen()},this.toggleFullscreen=function(){0==t.isFullScreen()?t.toFullScreen():t.exitFullScreen()},this.resize=function(e,t,i){g_objWrapper.css("width","auto"),g_objWrapper.css("max-width",e+"px"),t&&g_objWrapper.height(t),i||!0===i||onGalleryResized()},this.setSizeClass=function(e,i){if(!e)e=g_objWrapper;if(!i)i=t.getSize().width;if(0==i)i=jQuery(window).width();var n="";if(i<=480?n="ug-under-480":i<=780?n="ug-under-780":i<960&&(n="ug-under-960"),1==e.hasClass(n))return!0;removeAllSizeClasses(e),""!=n&&e.addClass(n)},this.isMobileMode=function(){return!!g_objWrapper.hasClass("ug-under-480")},this.isSmallWindow=function(){var e=jQuery(window).width();return!e||e<=480},this.isGalleryVisible=function(){return g_objWrapper.is(":visible")},this.isGalleryInsideScreen=function(){return 1!=g_temp.isFreestyleMode&&(!!g_objSlider&&g_functions.isElementInsideScreen(g_objWrapper))},this.changeItems=function(e,t){if(!e)e="noitems";runGallery(g_galleryID,"nochange",e,t)},this.addItems=function(e){if(!e||0==e.length)return!1;var t=g_objWrapper.children(".ug-newitems-wrapper");if(0==t.length&&g_objWrapper.append("<div class='ug-newitems-wrapper' style='display:none'></div>"),(t=g_objWrapper.children(".ug-newitems-wrapper")).append(e),fillItemsArray(jQuery(t.children()),!0),loadAPIs(),!g_objTheme||"function"!=typeof g_objTheme.addItems)throw new Error("addItems function not found in the theme");t.remove(),g_objTheme.addItems()},this.getNewAddedItemsIndexes=function(){var e=[];return jQuery.each(g_arrItems,function(t,i){1==i.isNewAdded&&e.push(t)}),e},this.showErrorMessageReplaceGallery=function(e){showErrorMessage(e)},this.setFuncCustomHeight=function(e){g_temp.funcCustomHeight=e},this.setObjLightbox=function(e){g_objLightbox=e},this.__________EXTERNAL_EVENTS_______=function(){},this.triggerEvent=function(e,t){t?("array"!=jQuery.type(t)&&(t=[t]),g_objGallery.trigger(e,t)):g_objGallery.trigger(e)},this.onEvent=function(e,t){g_objGallery.on(e,t)},this.destroyEvent=function(e){g_objGallery.off(e)},this.__________AJAX_REQUEST_______=function(){},this.ajaxRequest=function(e,t,i,n){if(!i||"function"!=typeof i)throw new Error("ajaxRequest error: success function should be passed");var r=g_options.gallery_urlajax;if(!r||""==r)throw new Error("ajaxRequest error: Ajax url don't passed");if(void 0===t)t={};var o={action:"unitegallery_ajax_action",client_action:e,galleryID:g_galleryID,data:t};jQuery.ajax({type:"post",url:g_options.gallery_urlajax,dataType:"json",data:o,success:function(e){if(!e)throw new Error("Empty ajax response!");if(-1==e||0===e)throw new Error("ajax error!!!");if(void 0===e.success)throw new Error("ajax error!!!");if(0==e.success)return showErrorMessage(e.message,"ajax error"),!1;i(e)},error:function(e,t,i){console.log("Ajax Error!!! "+t),responseText=e.responseText,n&&"function"==typeof n?n(responseText):trace(responseText)}})},this.requestNewItems=function(e,i,n){var r=g_options.gallery_enable_cache;if(n||(n=e),1==i&&(r=!1),1==r&&g_objCache.hasOwnProperty(n)){var o=g_objCache[n];t.changeItems(o,n)}else g_objGallery.trigger(t.events.GALLERY_BEFORE_REQUEST_ITEMS),t.ajaxRequest("front_get_cat_items",{catid:e},function(e){var i=e.html;t.changeItems(i,n)})},this.run=function(e,t){if(t&&t.hasOwnProperty("gallery_debug_errors")&&(g_options.gallery_debug_errors=t.gallery_debug_errors),1==g_options.gallery_debug_errors)try{runGallery(e,t)}catch(e){if("object"==typeof e){var i=e.message,n=e.lineNumber,r=e.fileName;e.stack;i+=" <br><br> in file: "+r,i+=" <b> line "+n+"</b>",trace(e)}else i=e;showErrorMessage(i=i.replace("Error:",""))}else runGallery(e,t)}}function UGLightbox(){var e,t,i,n,r,o,a,s,l=this,u=jQuery(this),d=new UniteGalleryMain,_=new UGSlider,g=new UGFunctions,c=new UGTextPanel,h={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0};this.events={LIGHTBOX_INIT:"lightbox_init"};var p={topPanelHeight:44,initTextPanelHeight:26,isOpened:!1,isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},m={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:p.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:38,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},f={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};function b(){1==p.isCompact&&1==h.lightbox_show_textpanel&&(h.lightbox_slider_image_padding_bottom=p.initTextPanelHeight),1==p.isCompact&&"inside"==h.lightbox_arrows_position&&(p.isArrowsInside=!0),1==p.isArrowsInside&&0==h.lightbox_arrows_inside_alwayson&&(p.isArrowsOnHoverMode=!0),0==h.lightbox_show_textpanel&&(p.isTopPanelEnabled=!1,p.topPanelHeight=0,h.lightbox_slider_image_padding_top=0)}function v(e){if(!_)return!0;var t={slider_image_padding_top:e};_.setOptions(t),_.refreshSlideItems()}function y(e){if(!s)return!1;if(!c)return!1;var t=s.height();if(0==t)return!1;if(0==s.is(":visible"))return!1;var i=t,n=c.getSize().height;t!=p.topPanelHeight&&(i=p.topPanelHeight),n>i&&(i=n),t!=i&&(s.height(i),_&&0==_.isAnimating()&&v(i))}function I(e){if(0==p.isOpened)return!1;if(!c)return!1;if(!_)return!1;var i=g.getElementSize(t),n=c.getSize();if(0==n.width||n.height>120)return!1;if(!e){var r=_.getSlideImage();e=g.getElementSize(r)}if(0==e.height||0==e.width)return!1;if(e.bottom+n.height<i.height)return!1;var o=_.getOptions(),a=n.height;if(a!=o.slider_image_padding_bottom){var s={slider_image_padding_bottom:a};if(0==_.isAnimating())return _.setOptions(s),_.refreshSlideItems(),!0}return!1}function w(e){g.getElementSize(t);var i=_.getSlideImage(),n=g.getElementSize(i);if(0==n.width)return!1;p.textPanelLeft=n.left,p.textPanelTop=n.bottom;var r=n.width;if(a){var o=g.getElementSize(a);r-=o.width;var s=n.right-o.width;g.placeElement(a,s,p.textPanelTop)}c&&(c.show(),c.refresh(!0,!0,r),function(e,t){if(!e){var i=_.getSlideImage();e=g.getElementSize(i)}p.textPanelTop=e.bottom,!0===t&&c.positionPanel(p.textPanelTop,p.textPanelLeft)}(n)),0==I(n)&&(p.positionFrom="handleCompactTextpanelSizes",c&&(c.positionPanel(p.textPanelTop,p.textPanelLeft),!0===e&&(e(),H())))}function E(){return 0==_.isCurrentSlideType("image")||1==_.isCurrentImageInPlace()}function T(e,t){if(0==p.isArrowsInside)return!1;if(!n)return!1;var i=E();if(n.show(),r.show(),p.positionFrom="positionArrowsInside",1==p.isArrowsOnHoverMode&&1==i&&0==A()&&M(!0),0==i)var o=g.getElementRelativePos(n,"left",h.lightbox_arrows_offset),a=g.getElementRelativePos(n,"middle"),s=g.getElementRelativePos(r,"right",h.lightbox_arrows_offset),l=a;else{var u=_.getSlideImage(),d=g.getElementSize(u);g.getElementSize(_.getElement()),o=g.getElementRelativePos(n,"left",0,u)+d.left+h.lightbox_arrows_inside_offset,a=g.getElementRelativePos(n,"middle",0,u)+d.top,s=g.getElementRelativePos(n,"right",0,u)+d.left-h.lightbox_arrows_inside_offset,l=a}if(!0===t){var c={left:o,top:a},m={left:s,top:l};n.stop().animate(c,{duration:p.fadeDuration}),r.stop().animate(m,{duration:p.fadeDuration})}else n.stop(),r.stop(),g.placeElement(n,o,a),g.placeElement(r,s,l);1==e&&O(t)}function S(e,i){p.positionFrom=null;var n=E(),r=g.getElementRelativePos(o,"right",2,t);if(0==n)var a=2,s=r;else{var l=_.getSlideImage(),u=g.getElementSize(l),d=g.getElementSize(_.getElement()),c=g.getElementSize(o);d.top==d.height&&(d.top=0);s=d.left+u.right-c.width/2+h.lightbox_compact_closebutton_offsetx;(a=d.top+u.top-c.height/2-h.lightbox_compact_closebutton_offsety)<2&&(a=2),s>r&&(s=r)}if(!0===i){var m={left:s,top:a};o.stop().animate(m,{duration:p.fadeDuration})}else o.stop(),g.placeElement(o,s,a);!0===e&&function(e){!0!==e&&o.stop();o.fadeTo(p.fadeDuration,1)}(i)}function P(){o&&o.stop().fadeTo(p.fadeDuration,0),j(),C(),p.positionFrom="hideCompactElements",1==p.isArrowsInside&&M()}function x(){var e=g.getElementSize(t);s&&g.setElementSizeAndPosition(s,0,0,e.width,p.topPanelHeight),n&&0==p.isArrowsInside&&(1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show()),g.placeElement(n,"left","middle",h.lightbox_arrows_offset),g.placeElement(r,"right","middle",h.lightbox_arrows_offset)),0==p.isCompact&&g.placeElement(o,"right","top",2,2),c&&(p.positionFrom="positionElements",0==p.isCompact?function(e){var t={},i=h.lightbox_textpanel_width;i>e.width-47-40?(t.textpanel_padding_left=47,t.textpanel_padding_right=40,t.textpanel_title_text_align="center",t.textpanel_desc_text_align="center"):(t.textpanel_padding_left=Math.floor((e.width-i)/2),t.textpanel_padding_right=t.textpanel_padding_left,t.textpanel_title_text_align="left",t.textpanel_desc_text_align="left",h.lightbox_textpanel_title_text_align&&(t.textpanel_title_text_align=h.lightbox_textpanel_desc_text_align),h.lightbox_textpanel_desc_text_align&&(t.textpanel_desc_text_align=h.lightbox_textpanel_desc_text_align)),c.setOptions(t),c.refresh(!0,!0),y(),c.positionPanel()}(e):(N(),H()));var i=e.width,a=e.height;if(_){if(s){var l={slider_image_padding_top:s.height()};_.setOptions(l)}_.setSize(i,a),_.setPosition(0,0)}}function j(){c&&c.getElement().stop().fadeTo(p.fadeDuration,0)}function C(){a&&a.stop().fadeTo(p.fadeDuration,0)}function A(){if(!p.lastMouseX)return!0;var e={pageX:p.lastMouseX,pageY:p.lastMouseY};return _.isMouseInsideSlideImage(e)}function M(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!1===t?(A(),!0):void(!0===e?(n.stop().fadeTo(0,0),r.stop().fadeTo(0,0)):(n.stop().fadeTo(p.fadeDuration,0),r.stop().fadeTo(p.fadeDuration,0))))}function O(e,t){return!!n&&(1==p.isArrowsOnHoverMode&&!0!==t&&1==E()||(1==_.isSwiping()||(!0!==e&&(n.stop(),r.stop()),n.fadeTo(p.fadeDuration,1),void r.fadeTo(p.fadeDuration,1))))}function z(e){if(!c)return!1;if(!e)e=_.getCurrentItem();c.setTextPlain(e.title,e.description)}function L(e){if(!a)return!1;if(!e)e=_.getCurrentItem();var t=d.getNumItems(),i=e.index+1;a.html(i+" / "+t)}function N(){if(!c)return!1;c.getElement().show().stop().fadeTo(p.fadeDuration,1)}function H(){a&&a.stop().fadeTo(p.fadeDuration,1)}function k(){if(0==p.isCompact)return!0;P()}function R(){if(0==p.isCompact)return!0;(p.positionFrom="onZoomChange",S(!1,!0),T(!1,!0),1==p.isCompact)&&(0==(_.isCurrentSlideType("image")&&1==_.isCurrentImageInPlace())?(j(),C()):(p.positionFrom="onZoomChange",N(),H()))}function G(){if(0==p.isCompact)return!0;p.positionFrom="onSliderAfterReturn",S(!0),T(!0),0==I()&&w(),N(),H()}function D(e,t){return t=jQuery(t),0==p.isCompact||(0==_.isSlideCurrent(t)||(p.positionFrom="onSliderAfterPutImage",S(!0),T(!0),void w()))}function Q(){var e=_.getOptions().slider_image_padding_top;if(s){var t=s.height();t!=e&&v(t)}if(1==p.isCompact){if(z(),L(),p.positionFrom="onSliderTransitionEnd",S(!0),T(!0),0==_.isSlideActionActive())0==I()&&w();N(),H()}}function W(e,t){0==p.isCompact?(a&&L(t),c&&(z(t),0==p.isRightNowOpened&&(c.positionElements(!1),y(),c.positionPanel()))):0==_.isAnimating()&&(c&&z(t),a&&L(t)),0==p.isSliderChangedOnce&&(p.isSliderChangedOnce=!0,u.trigger(l.events.LIGHTBOX_INIT))}function F(e,t){if("image"!=_.getSlideType()&&0==p.isCompact&&_.isSlideActionActive())return!0;if(1==_.isPreloading())return l.close("slider"),!0;1==h.lightbox_close_on_emptyspace&&(0==_.isMouseInsideSlideImage(t)&&l.close("slider_inside"))}function B(){x()}function Y(){s?function(){if(!s)return!1;s.hide()}():a&&a.hide(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.hide(),r.hide())}function U(){s?(!function(){if(!s)return!1;s.show()}(),y()):a&&a.show(),n&&1==h.lightbox_hide_arrows_onvideoplay&&(n.show(),r.show())}function V(e,t,i){var n=!1;switch(t){case 27:1==p.isOpened&&l.close("keypress");break;case 38:case 40:case 33:case 34:n=!0}1==p.isOpened&&1==n&&i.preventDefault()}function X(){1==p.isArrowsOnHoverMode&&O(!1,!0)}function Z(e){p.positionFrom="hideCompactElements",1==p.isArrowsOnHoverMode&&1==E()&&M(!1,!0)}function q(e){p.lastMouseX=e.pageX,p.lastMouseY=e.pageY,1==(!n||0==n.is(":visible")||1!=n.css("opacity"))&&A()&&0==_.isAnimating()&&(p.positionFrom="onMouseMove",n&&0==n.is(":animated")&&O(!1,!0))}function K(e,t,i,n){if(0==p.isOpened)return!0;switch(h.gallery_mousewheel_role){default:case"zoom":"image"!=_.getSlideType()&&e.preventDefault();break;case"none":e.preventDefault();break;case"advance":d.onGalleryMouseWheel(e,t,i,n)}}this.destroy=function(){if(jQuery(document).unbind("mousemove"),i.off("touchstart"),i.off("touchend"),o.off("click"),e.off(d.events.ITEM_CHANGE),_){jQuery(_).off(_.events.TRANSITION_END),jQuery(_).off(_.events.CLICK),jQuery(_).off(_.events.START_DRAG),jQuery(_).off(_.events.TRANSITION_START),jQuery(_).off(_.events.AFTER_DRAG_CHANGE),jQuery(_).off(_.events.AFTER_RETURN);var n=_.getVideoObject();jQuery(n).off(n.events.PLAY_START),jQuery(n).off(n.events.PLAY_STOP),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z),_.destroy()}jQuery(window).unbind("resize"),e.off(d.events.GALLERY_KEYPRESS,V),t.off("mousewheel"),t.remove()},this.isOpened=function(){return p.isOpened},this.open=function(s){var l=d.getItem(s);(p.isOpened=!0,p.isRightNowOpened=!0,setTimeout(function(){p.isRightNowOpened=!1},100),_&&_.setItem(l,"lightbox_open"),c&&c.setTextPlain(l.title,l.description),i.stop().fadeTo(0,0),t.show(),t.fadeTo(0,1),i.stop().fadeTo(p.fadeDuration,h.lightbox_overlay_opacity),x(),1==p.isCompact)&&(1==_.isPreloading()?(o&&o.hide(),n&&1==p.isArrowsInside&&(n.hide(),r.hide()),a&&a.hide(),c&&c.hide()):1==p.isArrowsInside&&(n.hide(),r.hide()));_&&_.startSlideAction(),e.trigger(d.events.OPEN_LIGHTBOX,l)},this.close=function(i){p.isOpened=!1,1==p.isCompact&&P(),_&&_.stopSlideAction(),"image"!=_.getSlideType()?t.hide():t.fadeTo(p.fadeDuration,0,function(){t.hide()}),e.trigger(d.events.CLOSE_LIGHTBOX)},this.init=function(t,i){!function(t,i){d=t,e=jQuery(t),d.setObjLightbox(l),h=jQuery.extend(h,m),h=jQuery.extend(h,i),p.originalOptions=jQuery.extend({},h),"compact"==h.lightbox_type&&(p.isCompact=!0,h=jQuery.extend(h,f),h=jQuery.extend(h,i)),b(),1==p.putSlider?(d.initSlider(h,"lightbox"),g_objects=t.getObjects(),_=g_objects.g_objSlider):_=null,1==h.lightbox_show_textpanel?c.init(d,h,"lightbox"):c=null}(t,i)},this.putHtml=function(){var e,l;d.isSmallWindow()&&1==p.isCompact&&(p.isCompact=!1,b(),p.isArrowsInside=!1,p.isArrowsOnHoverMode=!1,(h=jQuery.extend({},p.originalOptions)).lightbox_arrows_position="sides",_.setOptions(h)),e="",l="",1==p.isCompact&&(l=" ug-lightbox-compact"),e+="<div class='ug-gallery-wrapper ug-lightbox"+l+"' >",e+="<div class='ug-lightbox-overlay'></div>",0==p.isCompact&&p.isTopPanelEnabled?(e+="<div class='ug-lightbox-top-panel'>",e+="<div class='ug-lightbox-top-panel-overlay'></div>",h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="</div>"):h.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="<div href=\"javascript:void(0)\" class='ug-lightbox-button-close'></div>",e+="<div class='ug-lightbox-arrow-left'></div>",e+="<div class='ug-lightbox-arrow-right'></div>",e+="</div>",t=jQuery(e),jQuery("body").append(t),_&&_.setHtml(t),i=t.children(".ug-lightbox-overlay"),0==p.isCompact&&1==p.isTopPanelEnabled&&0==(s=t.children(".ug-lightbox-top-panel")).length&&(s=null),o=t.find(".ug-lightbox-button-close"),h.lightbox_show_numbers&&(a=t.find(".ug-lightbox-numbers")),n=t.children(".ug-lightbox-arrow-left"),r=t.children(".ug-lightbox-arrow-right"),c&&(s?c.appendHTML(s):c.appendHTML(t))},this.run=function(){!function(){if(null!==h.lightbox_overlay_color&&i.css("background-color",h.lightbox_overlay_color),null!==h.lightbox_overlay_opacity&&i.fadeTo(0,h.lightbox_overlay_opacity),s&&null!==h.lightbox_top_panel_opacity&&s.children(".ug-lightbox-top-panel-overlay").fadeTo(0,h.lightbox_top_panel_opacity),a){var e={};null!==h.lightbox_numbers_size&&(e["font-size"]=h.lightbox_numbers_size+"px"),h.lightbox_numbers_color&&(e.color=h.lightbox_numbers_color),null!==h.lightbox_numbers_padding_right&&(e["padding-right"]=h.lightbox_numbers_padding_right+"px"),null!==h.lightbox_numbers_padding_top&&(e["padding-top"]=h.lightbox_numbers_padding_top+"px"),a.css(e)}}(),_&&_.run(),function(){if(i.on("touchstart",function(e){e.preventDefault()}),i.on("touchend",function(e){l.close("overlay")}),g.addClassOnHover(r,"ug-arrow-hover"),g.addClassOnHover(n,"ug-arrow-hover"),g.addClassOnHover(o),d.setNextButton(r),d.setPrevButton(n),o.on("click",function(){l.close("button")}),e.on(d.events.ITEM_CHANGE,W),_){jQuery(_).on(_.events.TRANSITION_END,Q),jQuery(_).on(_.events.CLICK,F);var a=_.getVideoObject();jQuery(a).on(a.events.PLAY_START,Y),jQuery(a).on(a.events.PLAY_STOP,U),jQuery(_).on(_.events.START_DRAG,k),jQuery(_).on(_.events.TRANSITION_START,k),jQuery(_).on(_.events.AFTER_DRAG_CHANGE,G),jQuery(_).on(_.events.AFTER_RETURN,G),jQuery(_).on(_.events.AFTER_PUT_IMAGE,D),jQuery(_).on(_.events.ZOOM_CHANGE,R),jQuery(_).on(_.events.IMAGE_MOUSEENTER,X),jQuery(_).on(_.events.IMAGE_MOUSELEAVE,Z)}jQuery(window).resize(function(){if(0==p.isOpened)return!0;g.whenContiniousEventOver("lightbox_resize",B,100)}),e.on(d.events.GALLERY_KEYPRESS,V),1==p.isArrowsOnHoverMode&&jQuery(document).bind("mousemove",q),t.on("mousewheel",K)}()}}function UGCarousel(){var e,t,i,n,r=this,o=jQuery(this),a=new UniteGalleryMain,s=new UGFunctions,l=new UGTileDesign,u=new UGThumbsGeneral,d={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1};this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"};var _={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!1,startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};function g(e,t){if(!t)t=_.initTileHeight/_.initTileWidth*e;_.tileWidth=e;var i={tile_width:e,tile_height:t};l.setOptions(i),d.tile_width=e,d.tile_height=t,l.resizeAllTiles(e),I(!0)}function c(){if(null===_.carouselMaxWidth)throw new Error("The carousel width not set");if(_.tileWidth<_.initTileWidth){(a=_.carouselMaxWidth-2*d.carousel_padding)>_.initTileWidth&&(a=_.initTileWidth),g(a);var o=s.getNumItemsInSpace(_.carouselMaxWidth,a,d.carousel_space_between_tiles)}else{var a;if((o=s.getNumItemsInSpace(_.carouselMaxWidth,_.tileWidth,d.carousel_space_between_tiles))<=0)o=1,g(a=_.carouselMaxWidth-2*d.carousel_padding)}var u=s.getSpaceByNumItems(o,_.tileWidth,d.carousel_space_between_tiles);u+=2*d.carousel_padding,i.width(u),1==_.isFirstTimeRun?(l.initEvents(),i.bind("mousedown touchstart",C),jQuery("body").bind("mousemove touchmove",A),jQuery(window).add("body").bind("mouseup touchend",M),i.hover(O,z),l.run(),jQuery.each(t,function(t,i){i.objThumbWrapper.data("index",t),e.trigger(_.eventSizeChange,[i.objThumbWrapper,!0]),i.objTileOriginal=i.objThumbWrapper.clone(!0,!0)}),I(!0),1==d.carousel_autoplay&&r.startAutoplay()):(1==d.carousel_autoplay&&r.pauseAutoplay(),S(0,!1),1==d.carousel_autoplay&&r.startAutoplay()),s.placeElement(n,0,d.carousel_padding),x(),_.isFirstTimeRun=!1}function h(){return s.getElementSize(n).left}function p(e){return s.getMousePosition(e).pageX}function m(){return n.children(".ug-thumb-wrapper")}function f(e){return s.getNumItemsInSpace(e,_.tileWidth,d.carousel_space_between_tiles)}function b(){return m().length}function v(e){w(e);var t=m();return jQuery(t[e])}function y(){return f(s.getElementSize(i).width)}function I(e){if(!e)e=!1;var t,r=m(),o=0,a=0;return jQuery.each(r,function(e,i){i=jQuery(i),s.placeElement(i,o,0);var n=s.getElementSize(i);o+=n.width+d.carousel_space_between_tiles,a=Math.max(a,n.height),e==r.length-1&&(t=n.right)}),n.width(t),a+=2*d.carousel_padding,!0===e&&(n.height(a),i.height(a)),S(_.numCurrent,!1),t}function w(e){if(e>m().length-1)throw new Error("Wrogn tile number: "+e)}function E(t,i){if("left"==i)var r=n.children(".ug-thumb-wrapper").first();else r=n.children(".ug-thumb-wrapper").last();var o=function(e,t,i){var n=e.data("index");if(null==n)throw new Error("every tile should have index!");for(var r=[],o=0;o<t;o++){if("prev"==i)var s=a.getPrevItem(n,!0);else s=a.getNextItem(n,!0);if(!s)throw new Error("the item to add is empty");var l=s.objTileOriginal.clone(!0,!0);n=s.index,l.addClass("cloned"),r.push(l)}return r}(r,t,"left"==i?"prev":"next");jQuery.each(o,function(t,r){"left"==i?n.prepend(r):n.append(r),e.trigger(_.eventSizeChange,r),l.loadTileImage(r)})}function T(e,t){w(n);for(var i=m(),n=i.length,r=0;r<e;r++)"left"==t?jQuery(i[r]).remove():jQuery(i[n-1-r]).remove()}function S(e,t,i){if(void 0===t){t=!0;if(n.is(":animated"))return!0}var r=v(e),o={left:-s.getElementSize(r).left+d.carousel_padding+"px"};if(!0===t){var a=d.carousel_scroll_duration,l=d.carousel_scroll_easing;!0===i&&(a=_.scrollShortDuration,l=_.scrollShortEasing),n.stop(!0).animate(o,{duration:a,easing:l,queue:!1,complete:function(){_.numCurrent=e,x()}})}else _.numCurrent=e,n.css(o)}function P(){var e,t,i,n;S((e=-h(),t=f(e),i=s.getElementSize(v(t)).left,n=s.getElementSize(v(t+1)).left,Math.abs(i-e)<Math.abs(n-e)?t:t+1),!0,!0)}function x(){var e,t=(e=-h(),_.sideSpace-e),r=function(){var e=s.getElementSize(i),t=s.getElementSize(n),r=t.width-e.width+t.left;return _.sideSpace-r}(),o=0,a=0,l=0,u=0,d=b();if(t>_.spaceActionSize)E(o=f(t),"left"),_.numCurrent+=o;else if(t<-_.spaceActionSize){T(l=f(Math.abs(t)),"left"),_.numCurrent-=l}if(r>_.spaceActionSize?E(a=f(r),"right"):r<-_.spaceActionSize&&T(u=f(Math.abs(r)),"right"),u>d)throw new Error("Can't remove more then num tiles");var g=!1;return(o||a||l||u)&&(I(),g=!0),g}function j(){"left"==d.carousel_autoplay_direction?r.scrollRight(1):r.scrollLeft(1)}function C(e){if(1==_.touchActive)return!0;_.touchActive=!0,r.pauseAutoplay(),_.startTime=jQuery.now(),_.startMousePos=p(e),_.startInnerPos=h(),_.lastTime=_.startTime,_.lastMousePos=_.startMousePos,s.storeEventData(e,_.storedEventID)}function A(e){if(0==_.touchActive)return!0;s.updateStoredEventData(e,_.storedEventID),e.preventDefault();var t=null;if(1==d.carousel_vertical_scroll_ondrag&&(t=s.handleScrollTop(_.storedEventID)),"vert"===t)return!0;_.lastMousePos=p(e);var i,r=_.lastMousePos-_.startMousePos,o=_.startInnerPos+r,a=r>0?"prev":"next";o>0&&"prev"==a&&(o/=3),o<-s.getElementSize(n).width&&"next"==a&&(o=_.startInnerPos+r/3),i={left:o+"px"},n.css(i)}function M(e){if(0==_.touchActive)return!0;_.touchActive=!1,P(),r.unpauseAutoplay()}function O(e){if(0==d.carousel_autoplay_pause_onhover)return!0;1==_.isPlayMode&&0==_.isPaused&&r.pauseAutoplay()}function z(e){if(0==d.carousel_autoplay_pause_onhover)return!0;r.unpauseAutoplay()}function L(){var e=_.lastTime-_.startTime,t=Math.abs(_.lastMousePos-_.startMousePos);return!(e>300)&&!(t>30)}this.startAutoplay=function(){_.isPlayMode=!0,_.isPaused=!1,o.trigger(r.events.START_PLAY),_.handle&&clearInterval(_.handle),_.handle=setInterval(j,d.carousel_autoplay_timeout)},this.unpauseAutoplay=function(){return 0==_.isPlayMode||(0==_.isPaused||void r.startAutoplay())},this.pauseAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!0,_.handle&&clearInterval(_.handle),o.trigger(r.events.PAUSE_PLAY)},this.stopAutoplay=function(){if(0==_.isPlayMode)return!0;_.isPaused=!1,_.isPlayMode=!1,_.handle&&clearInterval(_.handle),o.trigger(r.events.STOP_PLAY)},this.destroy=function(){_.handle&&clearInterval(_.handle),o.off(r.events.START_PLAY),o.off(r.events.STOP_PLAY),i.unbind("mousedown"),i.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),i.off("mouseenter").off("mouseleave"),l.destroy()},this.init=function(i,n,r){r&&this.setMaxWidth(r),function(i,n){g_objects=i.getObjects(),a=i,jQuery(i),e=g_objects.g_objWrapper,t=g_objects.g_arrItems,d=jQuery.extend(d,n),l.setFixedMode(),l.setApproveClickFunction(L),l.init(i,d),u=l.getObjThumbs(),d=l.getOptions(),_.initTileWidth=d.tile_width,_.initTileHeight=d.tile_height,_.tileWidth=d.tile_width}(i,n)},this.setMaxWidth=function(e){_.carouselMaxWidth=e},this.setHtml=function(t){!function(t){t||(t=e);e.append("<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'></div></div>"),i=e.children(".ug-carousel-wrapper"),n=i.children(".ug-carousel-inner"),l.setHtml(n),u.getThumbs().fadeTo(0,1)}(t)},this.getElement=function(){return i},this.getObjTileDesign=function(){return l},this.getEstimatedHeight=function(){return d.tile_height+2*d.carousel_padding},this.run=function(){c()},this.scrollRight=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=_.numCurrent-e;i<=0&&(i=0),S(i)},this.scrollLeft=function(e){if(!e||"object"==typeof e)e=d.carousel_navigation_numtiles;var t=y();e>t&&(e=t);var i=b(),n=_.numCurrent+e;n>=i&&(n=i-1),S(n)},this.setScrollLeftButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollLeft)},this.setScrollRightButton=function(e){s.setButtonMobileReady(e),s.setButtonOnClick(e,r.scrollRight)},this.setPlayPauseButton=function(e){s.setButtonMobileReady(e),1==_.isPlayMode&&0==_.isPaused&&e.addClass("ug-pause-icon"),o.on(r.events.START_PLAY,function(){e.addClass("ug-pause-icon")}),o.on(r.events.STOP_PLAY,function(){e.removeClass("ug-pause-icon")}),s.setButtonOnClick(e,function(){0==_.isPlayMode||1==_.isPaused?r.startAutoplay():r.stopAutoplay()})}}function UGLoadMore(){jQuery(this);var e,t,i,n,r=new UniteGalleryMain,o=(new UGFunctions,{isInited:!1}),a={loadmore_container:"ug_loadmore_wrapper"};function s(){e.show()}function l(){t.hide(),i.show();var o={numitems:r.getNumItems()};r.ajaxRequest("front_loadmore",o,function(n){i.hide();var o=n.html_items;1==n.show_loadmore?(t.blur().show(),i.hide()):e.hide(),r.addItems(o)},function(e){e="Ajax Error!"+e,i.hide(),n.show(),n.html(e)})}this.events={},this.destroy=function(){if(0==o.isInited)return!1},this.init=function(u,d){if(r=u,jQuery(r),a=jQuery.extend(a,d),0!=(e=jQuery("#"+a.loadmore_container)).length&&0!=(t=e.find(".ug-loadmore-button")).length&&0!=(i=e.find(".ug-loadmore-loader")).length&&0!=(n=e.find(".ug-loadmore-error")).length&&(o.isInited=!0),0==o.isInited)return trace("load more not inited, something is wrong"),!1;r.onEvent("tiles_first_placed",s),t.click(l)}}function UGTabs(){jQuery(this);var e,t,i=new UniteGalleryMain,n=(new UGFunctions,{tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"});function r(){"select"==n.tabs_type?t.change(s):e.click(a)}function o(e){i.requestNewItems(e)}function a(){var t=n.tabs_class_selected,i=jQuery(this);if(i.hasClass(t))return!0;e.not(i).removeClass(t),i.addClass(t);var r=i.data("catid");if(!r)return!0;o(r)}function s(){var e=jQuery(this).val();if(!e)return!0;o(e)}this.events={},this.destroy=function(){t&&t.off("change"),e&&e.off("click")},this.init=function(r,o){!function(r,o){i=r,jQuery(i),"select"==(n=jQuery.extend(n,o)).tabs_type?t=jQuery(n.tabs_container):e=jQuery(n.tabs_container+" .ug-tab")}(r,o)},this.run=function(){r()}}function UG_API(e){var t,i=this,n=(jQuery(i),new UniteGalleryMain),r=[];function o(e){var t={index:e.index,title:e.title,description:e.description,urlImage:e.urlImage,urlThumb:e.urlThumb},i=e.objThumbImage.data();for(var n in i){switch(n){case"image":case"description":continue}t[n]=i[n]}return t}n=e,t=jQuery(e),this.events={API_INIT_FUNCTIONS:"api_init",API_ON_EVENT:"api_on_event"},this.on=function(e,a,s){switch(!0!==s&&r.push({event:e,func:a}),e){case"item_change":t.on(n.events.ITEM_CHANGE,function(){var e=o(n.getSelectedItem());a(e.index,e)});break;case"resize":t.on(n.events.SIZE_CHANGE,a);break;case"enter_fullscreen":t.on(n.events.ENTER_FULLSCREEN,a);break;case"exit_fullscreen":t.on(n.events.EXIT_FULLSCREEN,a);break;case"play":t.on(n.events.START_PLAY,a);break;case"stop":t.on(n.events.STOP_PLAY,a);break;case"pause":t.on(n.events.PAUSE_PLAYING,a);break;case"continue":t.on(n.events.CONTINUE_PLAYING,a);break;case"open_lightbox":t.on(n.events.OPEN_LIGHTBOX,a);break;case"close_lightbox":t.on(n.events.CLOSE_LIGHTBOX,a);break;default:console&&console.log("wrong api event: "+e)}t.trigger(i.events.API_ON_EVENT,[e,a])},this.play=function(){n.startPlayMode()},this.stop=function(){n.stopPlayMode()},this.togglePlay=function(){n.togglePlayMode()},this.enterFullscreen=function(){n.toFullScreen()},this.exitFullscreen=function(){n.exitFullScreen()},this.toggleFullscreen=function(){n.toggleFullscreen()},this.resetZoom=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomBack()},this.zoomIn=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomIn()},this.zoomOut=function(){var e=n.getObjSlider();if(!e)return!1;e.zoomOut()},this.nextItem=function(){n.nextItem()},this.prevItem=function(){n.prevItem()},this.selectItem=function(e){n.selectItem(e)},this.resize=function(e,t){t?n.resize(e,t):n.resize(e)},this.getItem=function(e){return o(n.getItem(e))},this.getNumItems=function(){return n.getNumItems()},this.getNumCurrent=function(){return n.getCurrentNumItem()},this.reloadGallery=function(e){if(!e)e={};n.run(null,e),r.map(function(e){i.on(e.event,e.func,!0)})},this.changeItems=function(e){n.changeItems(e)},this.addItems=function(e){n.addItems(e)},this.destroy=function(){n.destroy()},t.trigger(i.events.API_INIT_FUNCTIONS,i)}jQuery.fn.unitegallery=function(e){var t="#"+jQuery(this).attr("id");if(!e)e={};var i=new UniteGalleryMain;return i.run(t,e),void 0===window.ugArrGalleriesObjects&&(window.ugArrGalleriesObjects=[]),window.ugArrGalleriesObjects.push(i),new UG_API(i)};
1
+ //Unite Gallery, Version: 1.7.61, released 26 July 2022
2
 
3
+ function debugLine(html,addRandom,addHtml){!0===html&&(html="true"),!1===html&&(html="false");var output=html;if("object"==typeof html)for(name in output="",html){var value=html[name];output+=" "+name+": "+value}if(!0!=addRandom||addHtml||(output+=" "+Math.random()),!0==addHtml){var objLine=jQuery("#debug_line");objLine.width(200),objLine.height()>=500&&objLine.html(""),output=objLine.html()+"<br> -------------- <br>"+output}jQuery("#debug_line").show().html(output)}function debugSide(obj){var html="";for(name in obj){var value=obj[name];html+=name+" : "+value+"<br>"}jQuery("#debug_side").show().html(html)}function trace(str){"undefined"!=typeof console&&console.log(str)}function UGFunctions(){var g_browserPrefix=null,t=this,g_temp={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};function addEvent(evnt,elem,func){elem.addEventListener?elem.addEventListener(evnt,func,!1):elem.attachEvent?elem.attachEvent("on"+evnt,func):elem[evnt]=func}this.debugVar="",this.getvalopt={FORCE_BOOLEAN:"force_boolean",FORCE_NUMERIC:"force_numeric",TRIM:"trim"},this.z__________GENERAL___________=function(){},this.getVal=function(b,d,c,e){if(!c)var c="";var a="";switch(a=b&&"object"==typeof b?!1==b.hasOwnProperty(d)?c:b[d]:c,e){case t.getvalopt.FORCE_BOOLEAN:a=t.strToBool(a);break;case t.getvalopt.TRIM:a=String(a),a=jQuery.trim(a);break;case t.getvalopt.FORCE_NUMERIC:"string"==typeof(a=jQuery.trim(a))&&(a.replace("px",""),a=Number(a))}return a},this.z__________FULL_SCREEN___________=function(){},this.toFullscreen=function(a,b){if(a.requestFullscreen)a.requestFullscreen();else if(a.mozRequestFullScreen)a.mozRequestFullScreen();else if(a.webkitRequestFullscreen)a.webkitRequestFullscreen();else{if(!a.msRequestFullscreen)return!1;a.msRequestFullscreen()}return!0},this.exitFullscreen=function(){if(!1==t.isFullScreen())return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},this.addFullScreenChangeEvent=function(a){document.webkitCancelFullScreen?addEvent("webkitfullscreenchange",document,a):document.msExitFullscreen?addEvent("MSFullscreenChange",document,a):document.mozCancelFullScreen?addEvent("mozfullscreenchange",document,a):addEvent("fullscreenchange",document,a)},this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange"),jQuery(document).unbind("mozfullscreenchange"),jQuery(document).unbind("webkitfullscreenchange"),jQuery(document).unbind("MSFullscreenChange")},this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},this.isFullScreen=function(){var a;return!!(document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement)},this.z__________GET_PROPS___________=function(){},this.getBrowserPrefix=function(){if(null!==g_browserPrefix)return g_browserPrefix;var b=["webkit","Moz","ms","O"],c=document.createElement("div");for(var d in b){var a=b[d];if(a+"Transform" in c.style)return g_browserPrefix=a=a.toLowerCase(),a}return g_browserPrefix="",""},this.getImageInsideParentDataByImage=function(a,c,d){var e=a.parent(),b=t.getImageOriginalSize(a);return t.getImageInsideParentData(e,b.width,b.height,c,d)},this.getImageInsideParentData=function(m,i,j,l,a,c,f){if(!a)var a={};var h={};if(void 0===c)var c=m.width();if(void 0===f)var f=m.height();a.padding_left&&(c-=a.padding_left),a.padding_right&&(c-=a.padding_right),a.padding_top&&(f-=a.padding_top),a.padding_bottom&&(f-=a.padding_bottom);var d=null,b="100%",e=null,g=null,n="display:block;margin:0px auto;";if(i>0&&j>0){if("down"==l&&i<c&&j<f)b=j,g=(c-(d=i))/2,e=(f-b)/2;else if("fill"==l){var k=i/j;(d=(b=f)*k)<c?(b=(d=c)/k,g=0,e=Math.round(-((b-f)/2*1))):(e=0,g=Math.round(-((d-c)/2*1)))}else{var k=i/j;d=(b=f)*k,e=0,g=(c-d)/2,"fitvert"!=l&&d>c&&(b=(d=c)/k,g=0,e=(f-b)/2)}d=Math.floor(d),b=Math.floor(b),e=Math.floor(e),g=Math.floor(g),n="position:absolute;"}return a.padding_top&&(e+=a.padding_top),a.padding_left&&(g+=a.padding_left),h.imageWidth=d,h.imageHeight=b,h.imageTop=e,h.imageLeft=g,h.imageRight=g+d,0==e||"100%"==b?h.imageBottom=null:h.imageBottom=e+b,h.style=n,h},this.getElementCenterPosition=function(e,a){var h=e.parent(),f=t.getElementSize(e),g=t.getElementSize(h),c=g.width,d=g.height;a&& void 0!==a.padding_top&&(d-=a.padding_top),a&& void 0!==a.padding_bottom&&(d-=a.padding_bottom),a&& void 0!==a.padding_left&&(c-=a.padding_left),a&& void 0!==a.padding_right&&(c-=a.padding_right);var b={};return b.left=Math.round((c-f.width)/2),b.top=Math.round((d-f.height)/2),a&& void 0!==a.padding_top&&(b.top+=a.padding_top),a&& void 0!==a.padding_left&&(b.left+=a.padding_left),b},this.getElementCenterPoint=function(d,c){if(!c)var c=!1;var b=t.getElementSize(d),a={};return a.x=b.width/2,a.y=b.height/2,!0==c&&(a.x+=b.left,a.y+=b.top),a.x=Math.round(a.x),a.y=Math.round(a.y),a},this.getMousePosition=function(a,c){var b={pageX:a.pageX,pageY:a.pageY,clientX:a.clientX,clientY:a.clientY};if(a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches.length>0&&(b.pageX=a.originalEvent.touches[0].pageX,b.pageY=a.originalEvent.touches[0].pageY,b.clientX=a.originalEvent.touches[0].clientX,b.clientY=a.originalEvent.touches[0].clientY),c){var d=c.offset();b.mouseX=b.pageX-d.left,b.mouseY=b.pageY-d.top}return b},this.getMouseElementPoint=function(a,b){var c={x:a.pageX,y:a.pageY};return t.getElementLocalPoint(c,b)},this.getElementLocalPoint=function(b,d){var a={},c=d.offset();return a.x=Math.round(b.x-c.left),a.y=Math.round(b.y-c.top),a},this.getImageOriginalSize=function(b,e,f){if(void 0!==e&& void 0!==f)return{width:e,height:f};var c=b[0];if(void 0===c)throw new Error("getImageOriginalSize error - Image not found");var a={};if(void 0!==c.naturalWidth)return a.width=c.naturalWidth,a.height=c.naturalHeight,a;if("number"==typeof b.data("naturalWidth")){var a={};return a.width=b.data("naturalWidth"),a.height=b.data("naturalHeight"),a}var d=new Image;return(d.src=c.src,d.complete)?(a.width=d.width,a.height=d.height,b.data("naturalWidth",a.width),b.data("naturalHeight",a.height),a):{width:0,height:0}},this.getimageRatio=function(a){var b=t.getImageOriginalSize(a),c=t.getElementSize(a),d=c.width/b.width;return d},this.isImageFitParent=function(a){var d=a.parent(),b=t.getElementSize(a),c=t.getElementSize(d);return b.width<=c.width&&b.height<=c.height},this.getElementSize=function(b){if(void 0===b)throw new Error("Can't get size, empty element");var a=b.position();return a.height=b.outerHeight(),a.width=b.outerWidth(),a.left=Math.round(a.left),a.top=Math.round(a.top),a.right=a.left+a.width,a.bottom=a.top+a.height,a},this.isElementBiggerThenParent=function(a){var d=a.parent(),b=t.getElementSize(a),c=t.getElementSize(d);return b.width>c.width||b.height>c.height},this.isPointInsideElement=function(a,b){return!1!=(a.x>=0&&a.x<b.width)&& !1!=(a.y>=0&&a.y<b.height)},this.getElementRelativePos=function(c,a,b,f){if(!f)var f=c.parent();if("number"==typeof c)var d={width:c,height:c};else var d=t.getElementSize(c);var e=t.getElementSize(f);switch(a){case"top":case"left":a=0,b&&(a+=b);break;case"center":a=Math.round((e.width-d.width)/2),b&&(a+=b);break;case"right":a=e.width-d.width,b&&(a-=b);break;case"middle":a=Math.round((e.height-d.height)/2),b&&(a+=b);break;case"bottom":a=e.height-d.height,b&&(a-=b)}return a},this.getScreenVisibleSize=function(){document.body.clientWidth,document.body.clientHeight,jQuery(document).scrollTop();var c=jQuery(document),a=c.scrollLeft(),b=c.scrollTop();a=Math.round(a),b=Math.round(b);var f=window.innerHeight,g=window.innerWidth,d=b+f,e=a+g,h={top:b,left:a,height:d-b,width:e-a,right:e,bottom:d};return h},this.isElementsIntersect=function(a,b){return!(a.right<b.left)&&!(a.left>b.right)&&!(a.bottom<b.top)&&!(a.top>b.bottom)},this.isElementInsideScreen=function(a){var b=t.getElementSize(a),c=t.getScreenVisibleSize(),d=t.isElementsIntersect(c,b);return d},this.z_________SET_ELEMENT_PROPS_______=function(){},this.zoomImageInsideParent=function(a,q,j,r,i,s,t){if(!j)var j=1.2;if(!i)var i="fit";var k,g,l,m,b=j,x=a.parent(),e=t.getElementSize(a),f=t.getImageOriginalSize(a),h=!1,n=0,o=0,c=0,d=0;if(r){var p=t.getMouseElementPoint(r,a);h=t.isPointInsideElement(p,e),c=p.x,d=p.y}else h=!1;if(!1==h){var u=t.getElementCenterPoint(a);c=u.x,d=u.y}if(!0==q)k=e.height*b,g=e.width*b,0!=c&&(n=-(c*b-c)),0!=d&&(o=-(d*b-d));else{k=e.height/b,g=e.width/b;var y=t.getImageInsideParentData(x,f.width,f.height,i,t);if(g<y.imageWidth)return t.scaleImageFitParent(a,f.width,f.height,i,t),!0;!0==h&&(0!=c&&(n=-(c/b-c)),0!=d&&(o=-(d/b-d)))}if(s){var v=1;if(0!=f.width&&(v=g/f.width),v>s)return!1}if(t.setElementSize(a,g,k),!1==q&& !1==h){var w=t.getElementCenterPosition(a);l=w.left,m=w.top}else l=e.left+n,m=e.top+o;return t.placeElement(a,l,m),!0},this.placeElement=function(g,a,b,c,d,h){if(!1==jQuery.isNumeric(a)|| !1==jQuery.isNumeric(b)){if(!h)var h=g.parent();var e=t.getElementSize(g),f=t.getElementSize(h)}if(!1==jQuery.isNumeric(a))switch(a){case"left":a=0,c&&(a+=c);break;case"center":a=Math.round((f.width-e.width)/2),c&&(a+=c);break;case"right":a=f.width-e.width,c&&(a-=c)}if(!1==jQuery.isNumeric(b))switch(b){case"top":b=0,d&&(b+=d);break;case"middle":case"center":b=Math.round((f.height-e.height)/2),d&&(b+=d);break;case"bottom":b=f.height-e.height,d&&(b-=d)}var i={position:"absolute",margin:"0px"};null!==a&&(i.left=a),null!==b&&(i.top=b),g.css(i)},this.placeElementInParentCenter=function(a){t.placeElement(a,"center","middle")},this.setElementSizeAndPosition=function(a,b,c,d,e){var f={width:d+"px",height:e+"px",left:b+"px",top:c+"px",position:"absolute",margin:"0px"};a.css(f)},this.setElementSize=function(c,d,a){var b={width:d+"px"};null!=a&&(b.height=a+"px"),c.css(b)},this.cloneElementSizeAndPos=function(b,e,f,c,d){var a=b.position();if(void 0==a)throw new Error("Can't get size, empty element");!0===f?(a.height=b.outerHeight(),a.width=b.outerWidth()):(a.height=b.height(),a.width=b.width()),a.left=Math.round(a.left),a.top=Math.round(a.top),c&&(a.left+=c),d&&(a.top+=d),t.setElementSizeAndPosition(e,a.left,a.top,a.width,a.height)},this.placeImageInsideParent=function(c,d,e,f,g,h){var a=t.getImageInsideParentData(d,e,f,g,h),b="<img";return null!==a.imageWidth&&(b+=" width = '"+a.imageWidth+"'",a.style+="width:"+a.imageWidth+";"),null!=a.imageHeight&&("100%"==a.imageHeight?(b+=" height = '"+a.imageHeight+"'",a.style+="height:"+a.imageHeight+";"):(b+=" height = '"+a.imageHeight+"'",a.style+="height:"+a.imageHeight+"px;")),null!==a.imageTop&&(a.style+="top:"+a.imageTop+"px;"),null!==a.imageLeft&&(a.style+="left:"+a.imageLeft+"px;"),c=t.escapeDoubleSlash(c),b+=" style='"+a.style+"'",b+=' src="'+c+'"',b+=">",d.html(b),d.children("img")},this.scaleImageCoverParent=function(h,c,k){if("number"==typeof c)var d=c,e=k;else var d=c.outerWidth(),e=c.outerHeight();var i=t.getImageOriginalSize(h),l=i.width,m=i.height,j=l/m,a=e,b=a*j,f=0,g=0;b<d?(a=(b=d)/j,g=0,f=Math.round(-((a-e)/2*1))):(f=0,g=Math.round(-((b-d)/2*1))),b=Math.round(b),a=Math.round(a),h.css({width:b+"px",height:a+"px",left:g+"px",top:f+"px"})},this.scaleImageFitParent=function(d,e,f,g,h){var i=d.parent(),a=t.getImageInsideParentData(i,e,f,g,h),c=!1,b={};return null!==a.imageWidth&&(c=!0,d.removeAttr("width"),b.width=a.imageWidth+"px"),null!=a.imageHeight&&(c=!0,d.removeAttr("height"),b.height=a.imageHeight+"px"),null!==a.imageTop&&(c=!0,b.top=a.imageTop+"px"),null!==a.imageLeft&&(c=!0,b.left=a.imageLeft+"px"),!0==c&&(b.position="absolute",b.margin="0px 0px",d.css(b)),a},this.scaleImageByHeight=function(b,a,d,e){var c=t.getImageOriginalSize(b,d,e),f=Math.round(a*(c.width/c.height));a=Math.round(a),t.setElementSize(b,f,a)},this.scaleImageByWidth=function(b,a,d,e){var c=t.getImageOriginalSize(b,d,e),f=Math.round(a/(c.width/c.height));a=Math.round(a),t.setElementSize(b,a,f)},this.scaleImageExactSizeInParent=function(g,o,p,b,c,q){var r=g.parent(),d=t.getElementSize(r);d.width<b&&(b=d.width),d.height<c&&(c=d.height);var e=t.getImageInsideParentData(null,o,p,q,null,b,c),k=b,l=c,m=e.imageLeft,h=e.imageLeft,n=e.imageTop,i=e.imageTop,s=Math.round((d.width-b)/2),t=Math.round((d.height-c)/2),u=e.imageWidth+m+h,f=b-u;0!=f&&(h+=f);var v=e.imageHeight+n+i,f=c-v;0!=f&&(i+=f),g.removeAttr("width"),g.removeAttr("height");var a={position:"absolute",margin:"0px 0px"};a.width=k+"px",a.height=l+"px",a.left=s+"px",a.top=t+"px",a["padding-left"]=m+"px",a["padding-top"]=n+"px",a["padding-right"]=h+"px",a["padding-bottom"]=i+"px",g.css(a);var j={};return j.imageWidth=k,j.imageHeight=l,j},this.showElement=function(c,a,b){c.show().fadeTo(0,1),a&&a.show().fadeTo(0,1),b&&b.show().fadeTo(0,1)},this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){},this.disableButton=function(b,a){if(!a)var a="ug-button-disabled";!1==t.isButtonDisabled(b,a)&&b.addClass(a)},this.convertCustomPrefixOptions=function(a,b,d){if(!b)return a;var c={};return jQuery.each(a,function(a,e){0===a.indexOf(b+"_"+d+"_")?c[a.replace(b+"_"+d+"_",d+"_")]=e:c[a]=e}),c},this.enableButton=function(b,a){if(!a)var a="ug-button-disabled";!0==t.isButtonDisabled(b,a)&&b.removeClass(a)},this.isButtonDisabled=function(b,a){if(!a)var a="ug-button-disabled";return!!b.hasClass(a)},this.z_________MATH_FUNCTIONS_______=function(){},this.normalizeSetting=function(b,c,e,f,a,d){if(!d)var d=!1;return a=b+(c-b)*((a-e)/(f-e)),!0==d&&(a<b&&(a=b),a>c&&(a=c)),a},this.getNormalizedValue=function(a,c,d,e,b){var f=(b-a)/(c-a);return b=a+(e-d)*f},this.getDistance=function(a,b,c,d){return Math.round(Math.sqrt(Math.abs((c-a)*(c-a)+(d-b)*(d-b))))},this.getMiddlePoint=function(b,c,d,e){var a={};return a.x=b+Math.round((d-b)/2),a.y=c+Math.round((e-c)/2),a},this.getNumItemsInSpace=function(b,c,a){return Math.floor((b+a)/(c+a))},this.getNumItemsInSpaceRound=function(b,c,a){return Math.round((b+a)/(c+a))},this.getSpaceByNumItems=function(a,b,c){return a*b+(a-1)*c},this.getItemSizeInSpace=function(b,a,c){return Math.floor((b-(a-1)*c)/a)},this.getColX=function(a,b,c){return a*(b+c)},this.getColByIndex=function(a,b){return b%a},this.getColRowByIndex=function(a,b){var c=Math.floor(a/b),d=Math.floor(a%b);return{col:d,row:c}},this.getIndexByRowCol=function(a,b,c){return a<0||b<0?-1:a*c+b},this.getPrevRowSameColIndex=function(c,a){var b=t.getColRowByIndex(c,a);return t.getIndexByRowCol(b.row-1,b.col,a)},this.getNextRowSameColIndex=function(c,a){var b=t.getColRowByIndex(c,a);return t.getIndexByRowCol(b.row+1,b.col,a)},this.z_________DATA_FUNCTIONS_______=function(){},this.setGlobalData=function(a,b){jQuery.data(document.body,a,b)},this.getGlobalData=function(a){return jQuery.data(document.body,a)},this.z_________EVENT_DATA_FUNCTIONS_______=function(){},this.handleScrollTop=function(b){if(!1==t.isTouchDevice())return null;var a=t.getStoredEventData(b),d=15,e=15;if(null===a.scrollDir&&(Math.abs(a.diffMouseX)>d?a.scrollDir="hor":Math.abs(a.diffMouseY)>e&&Math.abs(a.diffMouseY)>Math.abs(a.diffMouseX)&&(a.scrollDir="vert",a.scrollStartY=a.lastMouseClientY,a.scrollOrigin=jQuery(document).scrollTop(),g_temp.dataCache[b].scrollStartY=a.lastMouseClientY,g_temp.dataCache[b].scrollOrigin=a.scrollOrigin),g_temp.dataCache[b].scrollDir=a.scrollDir),"vert"!==a.scrollDir)return a.scrollDir;jQuery(document).scrollTop();var c=a.scrollOrigin-(a.lastMouseClientY-a.scrollStartY);return c>=0&&jQuery(document).scrollTop(c),a.scrollDir},this.wasVerticalScroll=function(a){return"vert"===t.getStoredEventData(a).scrollDir},this.storeEventData=function(e,f,c){var a=t.getMousePosition(e),d=jQuery.now(),b={startTime:d,lastTime:d,startMouseX:a.pageX,startMouseY:a.pageY,lastMouseX:a.pageX,lastMouseY:a.pageY,startMouseClientY:a.clientY,lastMouseClientY:a.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};c&&(b=jQuery.extend(b,c)),g_temp.dataCache[f]=b},this.updateStoredEventData=function(e,c,d){if(!g_temp.dataCache[c])throw new Error("updateEventData error: must have stored cache object");var a=g_temp.dataCache[c],b=t.getMousePosition(e);a.lastTime=jQuery.now(),void 0!==b.pageX&&(a.lastMouseX=b.pageX,a.lastMouseY=b.pageY,a.lastMouseClientY=b.clientY),d&&(a=jQuery.extend(a,d)),g_temp.dataCache[c]=a},this.getStoredEventData=function(b,c){if(!g_temp.dataCache[b])throw new Error("updateEventData error: must have stored cache object");var a=g_temp.dataCache[b];return a.diffMouseX=a.lastMouseX-a.startMouseX,a.diffMouseY=a.lastMouseY-a.startMouseY,a.diffMouseClientY=a.lastMouseClientY-a.startMouseClientY,a.diffTime=a.lastTime-a.startTime,!0===c?(a.startMousePos=a.lastMouseY,a.lastMousePos=a.lastMouseY,a.diffMousePos=a.diffMouseY):(a.startMousePos=a.lastMouseX,a.lastMousePos=a.lastMouseX,a.diffMousePos=a.diffMouseX),a},this.isApproveStoredEventClick=function(a,c){if(!g_temp.dataCache[a])return!0;var b=t.getStoredEventData(a,c),d=Math.abs(b.diffMousePos);return!(b.diffTime>400)&&!(d>30)},this.clearStoredEventData=function(a){g_temp.dataCache[a]=null},this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){},this.isCanvasExists=function(){return"function"==typeof jQuery('<canvas width="500" height="500" > </canvas>')[0].getContext},this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth},this.isTouchDevice=function(){if(-1!==g_temp.isTouchDevice)return g_temp.isTouchDevice;try{document.createEvent("TouchEvent"),g_temp.isTouchDevice=!0}catch(a){g_temp.isTouchDevice=!1}return g_temp.isTouchDevice},this.isRgbaSupported=function(){if(-1!==g_temp.isRgbaSupported)return g_temp.isRgbaSupported;var a=document.getElementsByTagName("script")[0],b=a.style.color;try{a.style.color="rgba(1,5,13,0.44)"}catch(d){}var c=a.style.color!=b;return a.style.color=b,g_temp.isRgbaSupported=c,c},this.z_________GENERAL_FUNCTIONS_______=function(){},this.checkMinJqueryVersion=function(f){for(var b=jQuery.fn.jquery.split("."),c=f.split("."),a=0,g=b.length;a<g;a++){var d=parseInt(b[a]),e=parseInt(c[a]);if(void 0===c[a])break;if(e>d)return!1;if(d>e)break}return!0},this.getCssSizeParam=function(a){return jQuery.isNumeric(a)?a+"px":a},this.convertHexToRGB=function(b,c){var a=b.replace("#","");return a===b?b:(r=parseInt(a.substring(0,2),16),g=parseInt(a.substring(2,4),16),b=parseInt(a.substring(4,6),16),result="rgba("+r+","+g+","+b+","+c+")")},this.timestampToString=function(b){var c,a=new Date(b);return a.getDate()+"/"+a.getMonth()+(" "+a.getHours()+":"+a.getMinutes()+":"+a.getSeconds()+":"+a.getMilliseconds())},this.getArrTouches=function(a){var b=[];return a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches.length>0&&(b=a.originalEvent.touches),b},this.getArrTouchPositions=function(b){for(var c=[],a=0;a<b.length;a++){var d={pageX:b[a].pageX,pageY:b[a].pageY};c.push(d)}return c},this.startTimeDebug=function(){g_temp.starTime=jQuery.now()},this.showTimeDebug=function(){debugLine({"Time Passed":jQuery.now()-g_temp.starTime},!0)},this.initProgressIndicator=function(c,b,d){switch("bar"!=c&& !1==t.isCanvasExists()&&(c="bar"),c){case"bar":var a=new UGProgressBar;a.putHidden(d,b);break;default:case"pie":var a=new UGProgressPie;a.putHidden(d,b);break;case"pie2":b.type_fill=!0;var a=new UGProgressPie;a.putHidden(d,b)}return a},this.setButtonMobileReady=function(a){a.on("touchstart",function(a){jQuery(this).addClass("ug-nohover")}),a.on("mousedown touchend",function(a){return a.stopPropagation(),a.stopImmediatePropagation(),!1})},this.registerTheme=function(a){g_temp.arrThemes.push(a)},this.getArrThemes=function(){return g_temp.arrThemes},this.isThemeRegistered=function(a){return -1!==jQuery.inArray(a,g_temp.arrThemes)},this.getFirstRegisteredTheme=function(){return 0==g_temp.arrThemes.length?"":g_temp.arrThemes[0]},this.isTimePassed=function(a,b){if(!b)var b=100;var c=jQuery.now(),d=c-(lastTime=!1==g_temp.timeCache.hasOwnProperty(a)?0:g_temp.timeCache[a]);return g_temp.timeCache[a]=c,!(d<=b)},this.whenContiniousEventOver=function(a,c,b){if(!b)var b=300;!0==g_temp.timeCache.hasOwnProperty(a)&&null!=g_temp.timeCache[a]&&(clearTimeout(g_temp.timeCache[a]),g_temp.timeCache[a]=null),g_temp.timeCache[a]=setTimeout(c,b)},this.validateClickTouchstartEvent=function(a){var b=!0,c=jQuery.now()-g_temp.lastEventTime;return"click"==a&&"touchstart"==g_temp.lastEventType&&c<1e3&&(b=!1),g_temp.lastEventTime=jQuery.now(),g_temp.lastEventType=a,b},this.addClassOnHover=function(b,a){if(!a)var a="ug-button-hover";b.hover(function(){jQuery(this).addClass(a)},function(){jQuery(this).removeClass(a)})},this.destroyButton=function(a){a.off("mouseenter"),a.off("mouseleave"),a.off("click"),a.off("touchstart"),a.off("touchend"),a.off("mousedown"),a.off("tap")},this.setButtonOnClick=function(a,b){t.setButtonMobileReady(a),a.on("click touchstart",function(a){if(objThis=jQuery(this),a.stopPropagation(),a.stopImmediatePropagation(),!1==t.validateClickTouchstartEvent(a.type))return!0;b(objThis,a)})},this.setButtonOnTap=function(a,b){a.on("tap",b),!1==t.isTouchDevice()?a.on("click",function(a){var b=jQuery(this);if(!1==t.validateClickTouchstartEvent(a.type))return!0;b.trigger("tap")}):(a.on("touchstart",function(a){jQuery(this).addClass("ug-nohover"),g_temp.lastTouchStartElement=jQuery(this),g_temp.lastEventTime=jQuery.now()}),a.on("touchend",function(b){var a=jQuery(this);if(!1==a.is(g_temp.lastTouchStartElement)||!g_temp.lastEventTime||jQuery.now()-g_temp.lastEventTime>g_temp.touchThreshold)return!0;a.trigger("tap")}))},this.loadJs=function(a,d){!0===d&&(a=location.protocol+"//"+a);var b=document.createElement("script");b.src=a;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)},this.loadCss=function(b,c){!0===c&&(b=location.protocol+"//"+b);var a=document.createElement("link");a.setAttribute("rel","stylesheet"),a.setAttribute("type","text/css"),a.setAttribute("href",b),document.getElementsByTagName("head")[0].appendChild(a)},this.addEvent=function(a,b,c){void 0!==a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},this.checkImagesLoaded=function(b,a,d){var e=0,c=b.length;if(0==c&&a)return a(),!1;function f(b,f){e++,"function"==typeof d&&setTimeout(function(){d(b,f)}),e==c&&"function"==typeof a&&setTimeout(function(){a()})}setTimeout(function(){for(var a=0;a<c;a++){var e=b[a];if(void 0!==e.naturalWidth&&0!==e.naturalWidth)f(b[a],!1);else{var d=jQuery("<img/>");d.data("index",a),d.on("load",function(){var a=jQuery(this).data("index");f(b[a],!1)}),d.on("error",function(){var a=jQuery(this).data("index");f(b[a],!0)}),d.attr("src",e.src)}}})},this.waitForWidth=function(a,b){var c=a.width();if(0!=c)return b(),!1;g_temp.handle=setInterval(function(){0!=(c=a.width())&&(clearInterval(g_temp.handle),b())},300)},this.arrayShuffle=function(a){if("object"!=typeof a)return a;for(var c,d,b=a.length;b;c=parseInt(Math.random()*b),d=a[--b],a[b]=a[c],a[c]=d);return a},this.getObjectLength=function(b){var a=0;for(var c in b)a++;return a},this.normalizePercent=function(a){return a<0&&(a=0),a>1&&(a=1),a},this.stripTags=function(a){return"string"!=typeof a?a:a.replace(/(<([^>]+)>)/ig,"")},this.escapeDoubleSlash=function(a){return a.replace('"','"')},this.htmlentitles=function(a){return jQuery("<div/>").text(a).html()},this.z_________END_GENERAL_FUNCTIONS_______=function(){}}!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function d(k){var b=k||window.event,o=j.call(arguments,1),i=0,d=0,c=0,l=0;if((k=a.event.fix(b)).type="mousewheel","detail"in b&&(c=-1*b.detail),"wheelDelta"in b&&(c=b.wheelDelta),"wheelDeltaY"in b&&(c=b.wheelDeltaY),"wheelDeltaX"in b&&(d=-1*b.wheelDeltaX),"axis"in b&&b.axis===b.HORIZONTAL_AXIS&&(d=-1*c,c=0),i=0===c?d:c,"deltaY"in b&&(i=c=-1*b.deltaY),"deltaX"in b&&(d=b.deltaX,0===c&&(i=-1*d)),0!==c||0!==d){if(1===b.deltaMode){var m=a.data(this,"mousewheel-line-height");i*=m,c*=m,d*=m}else if(2===b.deltaMode){var n=a.data(this,"mousewheel-page-height");i*=n,c*=n,d*=n}return l=Math.max(Math.abs(c),Math.abs(d)),(!h||h>l)&&(h=l,f(b,l)&&(h/=40)),f(b,l)&&(i/=40,d/=40,c/=40),i=Math[i>=1?"floor":"ceil"](i/h),d=Math[d>=1?"floor":"ceil"](d/h),c=Math[c>=1?"floor":"ceil"](c/h),k.deltaX=d,k.deltaY=c,k.deltaFactor=h,k.deltaMode=0,o.unshift(k,i,d,c),g&&clearTimeout(g),g=setTimeout(e,200),(a.event.dispatch||a.event.handle).apply(this,o)}}function e(){h=null}function f(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120==0}var g,h,b=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],j=Array.prototype.slice;if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var b=i.length;b;)this.addEventListener(i[--b],d,!1);else this.onmousewheel=d;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var a=i.length;a;)this.removeEventListener(i[--a],d,!1);else this.onmousewheel=null},getLineHeight:function(b){return parseInt(a(b)["offsetParent"in a.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),function(a){"function"==typeof define&&define.amd?define(["jquery"],function($){return a($)}):"object"==typeof module&&"object"==typeof module.exports?exports=a(require("jquery")):a(jQuery)}(function($){$.easing.jswing=$.easing.swing;var d=Math.pow,e=Math.sqrt,f=Math.sin,g=Math.cos,a=Math.PI,b=1.70158,h=1.525*b,i=b+1,j=2*a/3,k=2*a/4.5;function c(a){var c=7.5625,b=2.75;return a<1/b?c*a*a:a<2/b?c*(a-=1.5/b)*a+.75:a<2.5/b?c*(a-=2.25/b)*a+.9375:c*(a-=2.625/b)*a+.984375}$.extend($.easing,{def:"easeOutQuad",swing:function(a){return $.easing[$.easing.def](a)},easeInQuad:function(a){return a*a},easeOutQuad:function(a){return 1-(1-a)*(1-a)},easeInOutQuad:function(a){return a<.5?2*a*a:1-d(-2*a+2,2)/2},easeInCubic:function(a){return a*a*a},easeOutCubic:function(a){return 1-d(1-a,3)},easeInOutCubic:function(a){return a<.5?4*a*a*a:1-d(-2*a+2,3)/2},easeInQuart:function(a){return a*a*a*a},easeOutQuart:function(a){return 1-d(1-a,4)},easeInOutQuart:function(a){return a<.5?8*a*a*a*a:1-d(-2*a+2,4)/2},easeInQuint:function(a){return a*a*a*a*a},easeOutQuint:function(a){return 1-d(1-a,5)},easeInOutQuint:function(a){return a<.5?16*a*a*a*a*a:1-d(-2*a+2,5)/2},easeInSine:function(b){return 1-g(b*a/2)},easeOutSine:function(b){return f(b*a/2)},easeInOutSine:function(b){return-(g(a*b)-1)/2},easeInExpo:function(a){return 0===a?0:d(2,10*a-10)},easeOutExpo:function(a){return 1===a?1:1-d(2,-10*a)},easeInOutExpo:function(a){return 0===a?0:1===a?1:a<.5?d(2,20*a-10)/2:(2-d(2,-20*a+10))/2},easeInCirc:function(a){return 1-e(1-d(a,2))},easeOutCirc:function(a){return e(1-d(a-1,2))},easeInOutCirc:function(a){return a<.5?(1-e(1-d(2*a,2)))/2:(e(1-d(-2*a+2,2))+1)/2},easeInElastic:function(a){return 0===a?0:1===a?1:-d(2,10*a-10)*f((10*a-10.75)*j)},easeOutElastic:function(a){return 0===a?0:1===a?1:d(2,-10*a)*f((10*a-.75)*j)+1},easeInOutElastic:function(a){return 0===a?0:1===a?1:a<.5?-(d(2,20*a-10)*f((20*a-11.125)*k))/2:d(2,-20*a+10)*f((20*a-11.125)*k)/2+1},easeInBack:function(a){return i*a*a*a-b*a*a},easeOutBack:function(a){return 1+i*d(a-1,3)+b*d(a-1,2)},easeInOutBack:function(a){return a<.5?d(2*a,2)*((h+1)*2*a-h)/2:(d(2*a-2,2)*((h+1)*(2*a-2)+h)+2)/2},easeInBounce:function(a){return 1-c(1-a)},easeOutBounce:c,easeInOutBounce:function(a){return a<.5?(1-c(1-2*a))/2:(1+c(2*a-1))/2}})}),function(a,i){if(void 0===a.cssHooks)return!1;function j(a,c,d){var b=o[c.type]||{};return null==a?d||!c.def?null:c.def:isNaN(a=b.floor?~~a:parseFloat(a))?c.def:b.mod?(a+b.mod)%b.mod:0>a?0:b.max<a?b.max:a}function k(d){var h=b(),g=h._rgba=[];return d=d.toLowerCase(),e(n,function(j,a){var b,f=a.re.exec(d),i=f&&a.parse(f),e=a.space||"rgba";return i?(b=h[e](i),h[c[e].cache]=b[c[e].cache],g=h._rgba=b._rgba,!1):void 0}),g.length?("0,0,0,0"===g.join()&&a.extend(g,f.transparent),h):f[d]}function l(b,c,a){return 1>6*(a=(a+1)%1)?b+(c-b)*a*6:1>2*a?c:2>3*a?b+(c-b)*(2/3-a)*6:b}var f,g="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",m=/^([\-+])=\s*(\d+\.?\d*)/,n=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(a){return[a[1],a[2]/100,a[3]/100,a[4]]}}],b=a.Color=function(b,c,d,e){return new a.Color.fn.parse(b,c,d,e)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},o={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},h=b.support={},d=a("<p>")[0],e=a.each;d.style.cssText="background-color:rgba(1,1,1,.5)",h.rgba=d.style.backgroundColor.indexOf("rgba")> -1,e(c,function(b,a){a.cache="_"+b,a.props.alpha={idx:3,type:"percent",def:1}}),b.fn=a.extend(b.prototype,{parse:function(d,g,l,m){if(d===i)return this._rgba=[null,null,null,null],this;(d.jquery||d.nodeType)&&(d=a(d).css(g),g=i);var n=this,h=a.type(d),o=this._rgba=[];return g!==i&&(d=[d,g,l,m],h="array"),"string"===h?this.parse(k(d)||f._default):"array"===h?(e(c.rgba.props,function(b,a){o[a.idx]=j(d[a.idx],a)}),this):"object"===h?(d instanceof b?e(c,function(b,a){d[a.cache]&&(n[a.cache]=d[a.cache].slice())}):e(c,function(f,b){var c=b.cache;e(b.props,function(a,e){if(!n[c]&&b.to){if("alpha"===a||null==d[a])return;n[c]=b.to(n._rgba)}n[c][e.idx]=j(d[a],e,!0)}),n[c]&&0>a.inArray(null,n[c].slice(0,3))&&(n[c][3]=1,b.from&&(n._rgba=b.from(n[c])))}),this):void 0},is:function(a){var f=b(a),d=!0,g=this;return e(c,function(h,a){var b,c=f[a.cache];return c&&(b=g[a.cache]||a.to&&a.to(g._rgba)||[],e(a.props,function(e,a){return null!=c[a.idx]?d=c[a.idx]===b[a.idx]:void 0})),d}),d},_space:function(){var a=[],b=this;return e(c,function(c,d){b[d.cache]&&a.push(c)}),a.pop()},transition:function(h,l){var d=b(h),f=d._space(),a=c[f],g=0===this.alpha()?b("transparent"):this,i=g[a.cache]||a.to(g._rgba),k=i.slice();return d=d[a.cache],e(a.props,function(g,f){var e=f.idx,a=i[e],b=d[e],c=o[f.type]||{};null!==b&&(null===a?k[e]=b:(c.mod&&(b-a>c.mod/2?a+=c.mod:a-b>c.mod/2&&(a-=c.mod)),k[e]=j((b-a)*l+a,f)))}),this[f](k)},blend:function(d){if(1===this._rgba[3])return this;var c=this._rgba.slice(),e=c.pop(),f=b(d)._rgba;return b(a.map(c,function(a,b){return(1-e)*f[b]+e*a}))},toRgbaString:function(){var c="rgba(",b=a.map(this._rgba,function(a,b){return null==a?b>2?1:0:a});return 1===b[3]&&(b.pop(),c="rgb("),c+b.join()+")"},toHslaString:function(){var c="hsla(",b=a.map(this.hsla(),function(a,b){return null==a&&(a=b>2?1:0),b&&3>b&&(a=Math.round(100*a)+"%"),a});return 1===b[3]&&(b.pop(),c="hsl("),c+b.join()+")"},toHexString:function(c){var b=this._rgba.slice(),d=b.pop();return c&&b.push(~~(255*d)),"#"+a.map(b,function(a){return 1===(a=(a||0).toString(16)).length?"0"+a:a}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),b.fn.parse.prototype=b.fn,c.hsla.to=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var i,j,c=a[0]/255,d=a[1]/255,f=a[2]/255,k=a[3],e=Math.max(c,d,f),g=Math.min(c,d,f),b=e-g,h=e+g,l=.5*h;return i=g===e?0:c===e?60*(d-f)/b+360:d===e?60*(f-c)/b+120:60*(c-d)/b+240,j=0===b?0:.5>=l?b/h:b/(2-h),[Math.round(i)%360,j,l,null==k?1:k]},c.hsla.from=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var d=a[0]/360,e=a[1],b=a[2],g=a[3],c=.5>=b?b*(1+e):b+e-b*e,f=2*b-c;return[Math.round(255*l(f,c,d+1/3)),Math.round(255*l(f,c,d)),Math.round(255*l(f,c,d-1/3)),g]},e(c,function(d,c){var f=c.props,g=c.cache,h=c.to,k=c.from;b.fn[d]=function(c){if(h&&!this[g]&&(this[g]=h(this._rgba)),c===i)return this[g].slice();var l,m=a.type(c),n="array"===m||"object"===m?c:arguments,d=this[g].slice();return e(f,function(c,a){var b=n["object"===m?c:a.idx];null==b&&(b=d[a.idx]),d[a.idx]=j(b,a)}),k?((l=b(k(d)))[g]=d,l):b(d)},e(f,function(c,e){b.fn[c]||(b.fn[c]=function(b){var g,f=a.type(b),j="alpha"===c?this._hsla?"hsla":"rgba":d,h=this[j](),i=h[e.idx];return"undefined"===f?i:("function"===f&&(b=b.call(this,i),f=a.type(b)),null==b&&e.empty?this:("string"===f&&(g=m.exec(b))&&(b=i+parseFloat(g[2])*("+"===g[1]?1:-1)),h[e.idx]=b,this[j](h)))})})}),b.hook=function(c){e(c.split(" "),function(d,c){a.cssHooks[c]={set:function(g,d){var i,e,f="";if("transparent"!==d&&("string"!==a.type(d)||(i=k(d)))){if(d=b(i||d),!h.rgba&&1!==d._rgba[3]){for(e="backgroundColor"===c?g.parentNode:g;(""===f||"transparent"===f)&&e&&e.style;)try{f=a.css(e,"backgroundColor"),e=e.parentNode}catch(j){}d=d.blend(f&&"transparent"!==f?f:"_default")}d=d.toRgbaString()}try{g.style[c]=d}catch(l){}}},a.fx.step[c]=function(d){d.colorInit||(d.start=b(d.elem,c),d.end=b(d.end),d.colorInit=!0),a.cssHooks[c].set(d.elem,d.start.transition(d.end,d.pos))}})},b.hook(g),a.cssHooks.borderColor={expand:function(b){var a={};return e(["Top","Right","Bottom","Left"],function(d,c){a["border"+c+"Color"]=b}),a}},f=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(a){function b(){try{var c=this===document?a(this):a(this).contents()}catch(d){return!1}c.mousemove(function(b){a.mlp={x:b.pageX,y:b.pageY}}),c.find("iframe").on("load",b)}a.mlp={x:0,y:0},a(b),a.fn.ismouseover=function(){var b=!1;return this.eq(0).each(function(){var d=a(this).is("iframe")?a(this).contents().find("body"):a(this),c=d.offset();b=c.left<=a.mlp.x&&c.left+d.outerWidth()>a.mlp.x&&c.top<=a.mlp.y&&c.top+d.outerHeight()>a.mlp.y}),b}}(jQuery);var g_ugFunctions=new UGFunctions;function UGThumbsGeneral(){var g_arrItems,g_objParent,g_objGallery,g_objects,g_objWrapper,t=this,g_objThis=jQuery(t),g_gallery=new UniteGalleryMain,g_functions=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"},this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"};var g_options={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!1,thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},g_temp={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},g_serviceParams={timeout_thumb_check:100,thumb_max_check_times:600,eventSizeChange:"thumb_size_change"};function appendHtmlThumbFromItem(itemIndex,imageEffectClass){var objItem=g_arrItems[itemIndex],classAddition="";!1==g_temp.customThumbs&&(classAddition=" ug-thumb-generated");var htmlThumb="<div class='ug-thumb-wrapper"+classAddition+"' "+("style='z-index:"+(objItem.index+1)+";'")+"></div>";if(!0==g_options.thumb_wrapper_as_link){var urlLink=objItem.link;""==objItem.link&&(urlLink="javascript:void(0)");var linkTarget="";!0==g_options.thumb_link_newpage&&objItem.link&&(linkTarget=" target='_blank'");var htmlThumb="<a href='"+urlLink+"'"+linkTarget+" class='ug-thumb-wrapper"+classAddition+"'></a>"}var objThumbWrapper=jQuery(htmlThumb),objImage=objItem.objThumbImage;if(!1==g_temp.customThumbs){if(!0==g_options.thumb_show_loader&&objImage){var loaderClass="ug-thumb-loader-dark";"bright"==g_options.thumb_loader_type&&(loaderClass="ug-thumb-loader-bright"),objThumbWrapper.append("<div class='ug-thumb-loader "+loaderClass+"'></div>"),objThumbWrapper.append("<div class='ug-thumb-error' style='display:none'></div>")}if(objImage){if(objImage.addClass("ug-thumb-image"),!0==g_options.thumb_image_overlay_effect){var objImageOverlay=objImage.clone().appendTo(objThumbWrapper);objImageOverlay.addClass("ug-thumb-image-overlay "+imageEffectClass).removeClass("ug-thumb-image"),objImageOverlay.fadeTo(0,0),objItem.objImageOverlay=objImageOverlay}objThumbWrapper.append(objImage)}}return g_temp.isEffectBorder&&objThumbWrapper.append("<div class='ug-thumb-border-overlay'></div>"),g_temp.isEffectOverlay&&objThumbWrapper.append("<div class='ug-thumb-overlay'></div>"),g_objParent.append(objThumbWrapper),g_temp.customThumbs&&g_temp.funcSetCustomThumbHtml(objThumbWrapper,objItem),g_arrItems[itemIndex].objThumbWrapper=objThumbWrapper,objThumbWrapper}function setThumbSize(width,height,objThumb,innerOnly){var objCss={width:width+"px",height:height+"px"},objCssInner={width:width-g_temp.thumbInnerReduce+"px",height:height-g_temp.thumbInnerReduce+"px"},selectorsString=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";objThumb?(!0!==innerOnly&&objThumb.css(objCss),objThumb.find(selectorsString).css(objCssInner)):(g_objParent.children(".ug-thumb-wrapper").css(objCss),g_objParent.find(selectorsString).css(objCssInner))}function setThumbBorderEffect(objThumb,borderWidth,borderColor,noAnimation){if(!noAnimation)var noAnimation=!1;g_gallery.isFakeFullscreen()&&(noAnimation=!0);var objBorderOverlay=objThumb.children(".ug-thumb-border-overlay"),objCss={};objCss["border-width"]=borderWidth+"px",0!=borderWidth&&(objCss["border-color"]=borderColor),noAnimation&& !0===noAnimation?(objBorderOverlay.css(objCss),0==borderWidth?objBorderOverlay.hide():objBorderOverlay.show()):(0==borderWidth?objBorderOverlay.stop().fadeOut(g_options.thumb_transition_duration):objBorderOverlay.show().stop().fadeIn(g_options.thumb_transition_duration),animateThumb(objBorderOverlay,objCss))}function setThumbColorOverlayEffect(objThumb,isActive,noAnimation){var objOverlay=objThumb.children(".ug-thumb-overlay"),animationDuration=g_options.thumb_transition_duration;noAnimation&& !0===noAnimation&&(animationDuration=0),isActive?objOverlay.stop(!0).fadeTo(animationDuration,g_temp.colorOverlayOpacity):objOverlay.stop(!0).fadeTo(animationDuration,0)}function setThumbImageOverlayEffect(objThumb,isActive,noAnimation){var objImage=objThumb.children("img.ug-thumb-image"),objImageOverlay=objThumb.children("img.ug-thumb-image-overlay"),animationDuration=g_options.thumb_transition_duration;noAnimation&& !0===noAnimation&&(animationDuration=0),isActive?objImageOverlay.stop(!0).fadeTo(animationDuration,1):(objImage.fadeTo(0,1),objImageOverlay.stop(!0).fadeTo(animationDuration,0))}function setThumbSelectedStyle(objThumb,noAnimation){g_temp.isEffectBorder&&setThumbBorderEffect(objThumb,g_options.thumb_selected_border_width,g_options.thumb_selected_border_color,noAnimation),g_temp.isEffectOverlay&&setThumbColorOverlayEffect(objThumb,!0==g_options.thumb_overlay_reverse,noAnimation),g_temp.isEffectImage&&setThumbImageOverlayEffect(objThumb,!1,noAnimation),g_objThis.trigger(t.events.SETSELECTEDSTYLE,objThumb)}function setItemThumbLoadedError(objThumb){var objItem=t.getItemByThumb(objThumb);if(objItem.isLoaded=!0,objItem.isThumbImageLoaded=!1,!0==g_temp.customThumbs)return g_objThis.trigger(t.events.IMAGELOADERROR,objThumb),!0;objThumb.children(".ug-thumb-loader").hide(),objThumb.children(".ug-thumb-error").show()}function setThumbsBorderRadius(objThumbs){if(g_options.thumb_round_corners_radius<=0)return!1;var objCss={"border-radius":g_options.thumb_round_corners_radius+"px"};objThumbs?(objThumbs.css(objCss),objThumbs.find(".ug-thumb-border-overlay").css(objCss)):g_objParent.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(objCss)}function animateThumb(objThumb,objThumbCss){objThumb.stop(!0).animate(objThumbCss,{duration:g_options.thumb_transition_duration,easing:g_options.thumb_transition_easing,queue:!1})}function redrawThumbStyle(objThumb){!0==isThumbSelected(objThumb)?setThumbSelectedStyle(objThumb,!0,"redraw"):t.setThumbNormalStyle(objThumb,!0,"redraw")}function placeThumbImage(objThumb,objImage,objItem){if(!0==g_options.thumb_fixed_size)g_functions.scaleImageCoverParent(objImage,objThumb);else{"height"==g_options.thumb_resize_by?g_functions.scaleImageByHeight(objImage,g_options.thumb_height):g_functions.scaleImageByWidth(objImage,g_options.thumb_width);var imageSize=g_functions.getElementSize(objImage);g_functions.placeElement(objImage,0,0),setThumbSize(imageSize.width,imageSize.height,objThumb)}objThumb.children(".ug-thumb-loader").hide(),objImage.show(),!1==g_options.thumb_image_overlay_effect?objImage.fadeTo(0,1):(!0==g_options.thumb_image_overlay_effect&&copyPositionToThumbOverlayImage(objImage),objImage.fadeTo(0,0),redrawThumbStyle(objThumb)),g_objThis.trigger(t.events.AFTERPLACEIMAGE,objThumb)}function copyPositionToThumbOverlayImage(objImage){var objImageBW=objImage.siblings(".ug-thumb-image-overlay");if(0==objImageBW.length)return!1;var objSize=g_functions.getElementSize(objImage),objCss={width:objSize.width+"px",height:objSize.height+"px",left:objSize.left+"px",top:objSize.top+"px"};objImageBW.css(objCss),!1==g_temp.customThumbs&&objImageBW.fadeTo(0,1)}function getImageEffectsClass(){var imageEffectClass="",arrEffects=g_options.thumb_image_overlay_type.split(",");for(var index in arrEffects){var effect=arrEffects[index];switch(effect){case"bw":imageEffectClass+=" ug-bw-effect";break;case"blur":imageEffectClass+=" ug-blur-effect";break;case"sepia":imageEffectClass+=" ug-sepia-effect"}}return imageEffectClass}function isThumbSelected(objThumbWrapper){return!!objThumbWrapper.hasClass("ug-thumb-selected")}function onThumbSizeChange(temp,objThumb){objThumb=jQuery(objThumb),t.getItemByThumb(objThumb);var objSize=g_functions.getElementSize(objThumb);setThumbSize(objSize.width,objSize.height,objThumb,!0),redrawThumbStyle(objThumb)}function onMouseOver(objThumb){if(!0==g_temp.touchEnabled)return objThumbs.off("mouseenter").off("mouseleave"),!0;!1==isThumbSelected(objThumb)&&t.setThumbOverStyle(objThumb)}function onMouseOut(objThumb){if(!0==g_temp.touchEnabled)return!0;!1==isThumbSelected(objThumb)&&t.setThumbNormalStyle(objThumb,!1)}function onImageLoaded(image,isForce){if(!isForce)var isForce=!1;var objImage=jQuery(image),objThumb=objImage.parents(".ug-thumb-wrapper");if(0==objThumb.parent().length|| !0==(objItem=t.getItemByThumb(objThumb)).isLoaded&& !1===isForce)return!1;t.triggerImageLoadedEvent(objThumb,objImage),!0==g_temp.customThumbs?g_objThis.trigger(t.events.PLACEIMAGE,[objThumb,objImage]):placeThumbImage(objThumb,objImage,objItem)}function onThumbImageLoaded(data,objThumb,objImage){(objItem=t.getItemByThumb(objThumb)).isLoaded=!0,objItem.isThumbImageLoaded=!0;var objSize=g_functions.getImageOriginalSize(objImage);objItem.thumbWidth=objSize.width,objItem.thumbHeight=objSize.height,objItem.thumbRatioByWidth=objSize.width/objSize.height,objItem.thumbRatioByHeight=objSize.height/objSize.width,objThumb.addClass("ug-thumb-ratio-set")}this.init=function(a,b){g_objects=a.getObjects(),g_gallery=a,g_objGallery=jQuery(a),g_objWrapper=g_objects.g_objWrapper,g_arrItems=g_objects.g_arrItems,g_options=jQuery.extend(g_options,b),g_temp.isEffectBorder=g_options.thumb_border_effect,g_temp.isEffectOverlay=g_options.thumb_color_overlay_effect,g_temp.isEffectImage=g_options.thumb_image_overlay_effect},this._____________EXTERNAL_SETTERS__________=function(){},this.setHtmlThumbs=function(b,c){if(g_objParent=b,!0==g_temp.isEffectImage)var d=getImageEffectsClass();if(!0!==c)for(var e=g_gallery.getNumItems(),a=0;a<e;a++)appendHtmlThumbFromItem(a,d);else{t.getThumbs().removeClass(g_temp.classNewThumb);var f=g_gallery.getNewAddedItemsIndexes();jQuery.each(f,function(b,a){appendHtmlThumbFromItem(a,d).addClass(g_temp.classNewThumb)})}},this.setThumbNormalStyle=function(a,b,c){!0==g_temp.customThumbs&&a.removeClass("ug-thumb-over"),g_temp.isEffectBorder&&setThumbBorderEffect(a,g_options.thumb_border_width,g_options.thumb_border_color,b),g_temp.isEffectOverlay&&setThumbColorOverlayEffect(a,!0!=g_options.thumb_overlay_reverse,b),g_temp.isEffectImage&&setThumbImageOverlayEffect(a,!0,b),g_objThis.trigger(t.events.SETNORMALSTYLE,a)},this.setThumbOverStyle=function(a){!0==g_temp.customThumbs&&a.addClass("ug-thumb-over"),g_temp.isEffectBorder&&setThumbBorderEffect(a,g_options.thumb_over_border_width,g_options.thumb_over_border_color),g_temp.isEffectOverlay&&setThumbColorOverlayEffect(a,!0==g_options.thumb_overlay_reverse),!0==g_temp.isEffectImage&&setThumbImageOverlayEffect(a,!1),g_objThis.trigger(t.events.SETOVERSTYLE,a)},this.setHtmlProperties=function(a){if(!a)var a=t.getThumbs();if(!1==g_temp.customThumbs&&(!0==g_options.thumb_fixed_size&&setThumbSize(g_options.thumb_width,g_options.thumb_height,a),setThumbsBorderRadius(a)),a.each(function(){var a=jQuery(this);redrawThumbStyle(a)}),g_temp.isEffectOverlay&&g_options.thumb_overlay_color){var b={};if(g_functions.isRgbaSupported()){var c=g_functions.convertHexToRGB(g_options.thumb_overlay_color,g_options.thumb_overlay_opacity);b["background-color"]=c}else b["background-color"]=g_options.thumb_overlay_color,g_temp.colorOverlayOpacity=g_options.thumb_overlay_opacity;a.find(".ug-thumb-overlay").css(b)}},this.setThumbSelected=function(a){if(!0==g_temp.customThumbs&&a.removeClass("ug-thumb-over"),!0==isThumbSelected(a))return!0;a.addClass("ug-thumb-selected"),setThumbSelectedStyle(a)},this.setThumbUnselected=function(a){a.removeClass("ug-thumb-selected"),t.setThumbNormalStyle(a,!1,"set unselected")},this.setOptions=function(a){g_options=jQuery.extend(g_options,a)},this.setThumbInnerReduce=function(a){g_temp.thumbInnerReduce=a},this.setCustomThumbs=function(a,b,c){if(g_temp.customThumbs=!0,"function"!=typeof a)throw new Error("The argument should be function");g_temp.funcSetCustomThumbHtml=a,-1==jQuery.inArray("overlay",b)&&(g_temp.isEffectOverlay=!1),-1==jQuery.inArray("border",b)&&(g_temp.isEffectBorder=!1),g_temp.isEffectImage=!1,c&& !1===c.allow_onresize&&(g_temp.allowOnResize=!1)},this._____________EXTERNAL_GETTERS__________=function(){},this.getOptions=function(){return g_options},this.getNumThumbs=function(){return g_arrItems.length},this.getThumbImage=function(a){return a.find(".ug-thumb-image")},this.getThumbByIndex=function(a){var b=t.getThumbs();if(a>=b.length||a<0)throw new Error("Wrong thumb index");return jQuery(b[a])},this.getThumbs=function(d){var b=".ug-thumb-wrapper",c=".ug-thumb-ratio-set";switch(d){default:case t.type.GET_THUMBS_ALL:var a=g_objParent.children(b);break;case t.type.GET_THUMBS_NO_RATIO:var a=g_objParent.children(b).not(c);break;case t.type.GET_THUMBS_RATIO:var a=g_objParent.children(b+c);break;case t.type.GET_THUMBS_NEW:var a=g_objParent.children("."+g_temp.classNewThumb)}return a},this.getItemByThumb=function(b){var a=b.data("index");return void 0===a&&(a=b.index()),g_arrItems[a]},this.isThumbLoaded=function(a){return t.getItemByThumb(a).isLoaded},this.getGlobalThumbSize=function(){return{width:g_options.thumb_width,height:g_options.thumb_height}},this._____________EXTERNAL_OTHERS__________=function(){},this.initEvents=function(){var a=".ug-thumb-wrapper";!0==g_temp.allowOnResize&&g_objWrapper.on(g_serviceParams.eventSizeChange,onThumbSizeChange),g_objThis.on(t.events.THUMB_IMAGE_LOADED,onThumbImageLoaded),g_objParent.on("touchstart",a,function(){g_temp.touchEnabled=!0,g_objParent.off("mouseenter").off("mouseleave")}),g_objParent.on("mouseenter",a,function(b){var a=jQuery(this);onMouseOver(a)}),g_objParent.on("mouseleave",a,function(b){var a=jQuery(this);onMouseOut(a)})},this.destroy=function(){var a=".ug-thumb-wrapper";g_objParent.off("touchstart",a),g_objWrapper.off(g_serviceParams.eventSizeChange),g_objParent.off("mouseenter",a),g_objParent.off("mouseleave",a),g_objThis.off(t.events.THUMB_IMAGE_LOADED)},this.loadThumbsImages=function(){var a=g_objParent.find(".ug-thumb-image");g_functions.checkImagesLoaded(a,null,function(a,b){if(!1==b)onImageLoaded(a,!0);else{var c=jQuery(a).parent();setItemThumbLoadedError(c)}})},this.triggerImageLoadedEvent=function(a,b){g_objThis.trigger(t.events.THUMB_IMAGE_LOADED,[a,b])},this.hideThumbs=function(){g_objParent.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){var g_objGallery,g_objects,g_objWrapper,g_arrItems,g_objStrip,g_objStripInner,g_aviaControl,g_touchThumbsControl,t=this,g_gallery=new UniteGalleryMain,g_functions=new UGFunctions,g_isVertical=!1,g_thumbs=new UGThumbsGeneral,g_functions=new UGFunctions,g_options={strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0},g_temp={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},g_sizes={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0};this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};var g_defaultsVertical={strip_thumbs_align:"top",thumb_resize_by:"width"};function initStrip(gallery,customOptions){g_objects=gallery.getObjects(),g_gallery=gallery,g_gallery.attachThumbsPanel("strip",t),g_objGallery=jQuery(gallery),g_objWrapper=g_objects.g_objWrapper,g_arrItems=g_objects.g_arrItems,g_options=jQuery.extend(g_options,customOptions),g_isVertical=g_options.strip_vertical_type,!0==g_isVertical&&(g_options=jQuery.extend(g_options,g_defaultsVertical),g_options=jQuery.extend(g_options,customOptions),customOptions.thumb_resize_by="width"),g_thumbs.init(gallery,customOptions),onAfterSetOptions()}function onAfterSetOptions(){var thumbsOptions=g_thumbs.getOptions();g_temp.isNotFixedThumbs=!1===thumbsOptions.thumb_fixed_size,g_isVertical=g_options.strip_vertical_type}function runStrip(){g_thumbs.setHtmlProperties(),initSizeParams(),fixSize(),positionThumbs(),!1==g_temp.isRunOnce&&(!0==g_options.strip_control_touch&&(g_touchThumbsControl=new UGTouchThumbsControl).init(t),!0==g_options.strip_control_avia&&(g_aviaControl=new UGAviaControl).init(t),checkControlsEnableDisable(),g_thumbs.loadThumbsImages(),initEvents()),g_temp.isRunOnce=!0}function storeStripSize(size){g_sizes.stripSize=size,!1==g_isVertical?g_sizes.stripActiveSize=g_sizes.stripSize-g_options.strip_padding_left-g_options.strip_padding_right:g_sizes.stripActiveSize=g_sizes.stripSize-g_options.strip_padding_top-g_options.strip_padding_bottom,g_sizes.stripActiveSize<0&&(g_sizes.stripActiveSize=0)}function initSizeParams(){var firstThumb=jQuery(g_objStripInner.children(".ug-thumb-wrapper")[0]),thumbsRealWidth=firstThumb.outerWidth(),thumbsRealHeight=firstThumb.outerHeight(),thumbs_options=g_thumbs.getOptions();!1==g_isVertical?(g_sizes.thumbSize=thumbsRealWidth,!0==thumbs_options.thumb_fixed_size?g_sizes.thumbSecondSize=thumbsRealHeight:g_sizes.thumbSecondSize=thumbs_options.thumb_height,storeStripSize(g_objStrip.width()),g_sizes.stripInnerSize=g_objStripInner.width()):(g_sizes.thumbSize=thumbsRealHeight,!0==thumbs_options.thumb_fixed_size?g_sizes.thumbSecondSize=thumbsRealWidth:g_sizes.thumbSecondSize=thumbs_options.thumb_width,storeStripSize(g_objStrip.height()),g_sizes.stripInnerSize=g_objStripInner.height())}function setInnerStripSize(innerSize){!1==g_isVertical?g_objStripInner.width(innerSize):g_objStripInner.height(innerSize),g_sizes.stripInnerSize=innerSize,checkControlsEnableDisable(),jQuery(t).trigger(t.events.INNER_SIZE_CHANGE)}function positionThumbs(){var arrThumbs=g_objStripInner.children(".ug-thumb-wrapper"),posx=0,posy=0;for(!1==g_isVertical&&(posy=g_options.strip_padding_top),i=0;i<arrThumbs.length;i++){var objThumb=jQuery(arrThumbs[i]);if(!0==g_temp.isNotFixedThumbs){if(!1==(objItem=g_thumbs.getItemByThumb(objThumb)).isLoaded)continue;objThumb.show()}g_functions.placeElement(objThumb,posx,posy),!1==g_isVertical?posx+=objThumb.outerWidth()+g_options.strip_space_between_thumbs:posy+=objThumb.outerHeight()+g_options.strip_space_between_thumbs}if(!1==g_isVertical)var innerStripSize=posx-g_options.strip_space_between_thumbs;else var innerStripSize=posy-g_options.strip_space_between_thumbs;setInnerStripSize(innerStripSize)}function fixSize(){if(!1==g_isVertical){var height=g_sizes.thumbSecondSize,objCssStrip={};objCssStrip.height=height+"px";var objCssInner={};objCssInner.height=height+"px"}else{var width=g_sizes.thumbSecondSize,objCssStrip={};objCssStrip.width=width+"px";var objCssInner={};objCssInner.width=width+"px"}g_objStrip.css(objCssStrip),g_objStripInner.css(objCssInner)}function scrollBy(scrollStep){var finalPos=t.getInnerStripPos()+scrollStep;finalPos=t.fixInnerStripLimits(finalPos),t.positionInnerStrip(finalPos,!0)}function scrollToThumbMin(objThumb){var scrollPos=-1*getThumbPos(objThumb).min;scrollPos=t.fixInnerStripLimits(scrollPos),t.positionInnerStrip(scrollPos,!0)}function scrollToThumbMax(objThumb){var scrollPos=-1*getThumbPos(objThumb).max+g_sizes.stripSize;scrollPos=t.fixInnerStripLimits(scrollPos),t.positionInnerStrip(scrollPos,!0)}function scrollToThumb(objThumb){if(!1==isStripMovingEnabled())return!1;var objBounds=getThumbsInsideBounds(),objThumbPos=getThumbPos(objThumb);if(objThumbPos.min<objBounds.minPosThumbs){var prevThumb=objThumb.prev();prevThumb.length?scrollToThumbMin(prevThumb):scrollToThumbMin(objThumb)}else if(objThumbPos.max>objBounds.maxPosThumbs){var nextThumb=objThumb.next();nextThumb.length?scrollToThumbMax(nextThumb):scrollToThumbMax(objThumb)}}function scrollToSelectedThumb(){var selectedItem=g_gallery.getSelectedItem();if(null==selectedItem)return!0;var objThumb=selectedItem.objThumbWrapper;objThumb&&scrollToThumb(objThumb)}function checkAndRepositionInnerStrip(){if(!1==isStripMovingEnabled())return!1;var pos=t.getInnerStripPos(),posFixed=t.fixInnerStripLimits(pos);pos!=posFixed&&t.positionInnerStrip(posFixed,!0)}function checkControlsEnableDisable(){!0==isStripMovingEnabled()?(g_aviaControl&&g_aviaControl.enable(),g_touchThumbsControl&&g_touchThumbsControl.enable()):(g_aviaControl&&g_aviaControl.disable(),g_touchThumbsControl&&g_touchThumbsControl.disable())}function alignInnerStrip(){if(isStripMovingEnabled())return!1;!1==g_isVertical?g_functions.placeElement(g_objStripInner,g_options.strip_thumbs_align,0):g_functions.placeElement(g_objStripInner,0,g_options.strip_thumbs_align)}function onThumbClick(objThumb){if(t.isTouchMotionActive()&& !0==g_touchThumbsControl.isSignificantPassed())return!0;var objItem=g_thumbs.getItemByThumb(objThumb);g_gallery.selectItem(objItem)}function onThumbPlaced(){clearTimeout(g_temp.handle),g_temp.handle=setTimeout(function(){positionThumbs()},50)}function onItemChange(){var objItem=g_gallery.getSelectedItem();g_thumbs.setThumbSelected(objItem.objThumbWrapper),scrollToThumb(objItem.objThumbWrapper)}function initEvents(){g_thumbs.initEvents(),g_objStrip.find(".ug-thumb-wrapper").on("click touchend",function(b){var a=jQuery(this);onThumbClick(a)}),g_objGallery.on(g_gallery.events.ITEM_CHANGE,onItemChange),g_temp.isNotFixedThumbs&&jQuery(g_thumbs).on(g_thumbs.events.AFTERPLACEIMAGE,onThumbPlaced)}function isStripMovingEnabled(){return g_sizes.stripInnerSize>g_sizes.stripActiveSize}function getThumbsInsideBounds(){var obj={},innerPos=t.getInnerStripPos();return obj.minPosThumbs=-1*innerPos+1,obj.maxPosThumbs=-1*innerPos+g_sizes.stripSize-1,obj}function getThumbPos(objThumb){var objReturn={},objPos=objThumb.position();return!1==g_isVertical?(objReturn.min=objPos.left,objReturn.max=objPos.left+g_sizes.thumbSize):(objReturn.min=objPos.top,objReturn.max=objPos.top+g_sizes.thumbSize),objReturn}this.setHtml=function(a){if(!a){var a=g_objWrapper;null!=g_options.parent_container&&(a=g_options.parent_container)}a.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"),g_objStripInner=(g_objStrip=a.children(".ug-thumbs-strip")).children(".ug-thumbs-strip-inner"),g_thumbs.setHtmlThumbs(g_objStripInner),!0==g_temp.isNotFixedThumbs&&g_thumbs.hideThumbs()},this.destroy=function(){var a=g_objStrip.find(".ug-thumb-wrapper");a.off("click"),a.off("touchend"),g_objGallery.off(g_gallery.events.ITEM_CHANGE),jQuery(g_thumbs).off(g_thumbs.events.AFTERPLACEIMAGE),g_touchThumbsControl&&g_touchThumbsControl.destroy(),g_aviaControl&&g_aviaControl.destroy(),g_thumbs.destroy()},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(a,b){initStrip(a,b)},this.run=function(){runStrip()},this.positionInnerStrip=function(c,a){if(void 0===a)var a=!1;if(!1==g_isVertical)var b={left:c+"px"};else var b={top:c+"px"};!1==a?(g_objStripInner.css(b),t.triggerStripMoveEvent()):(t.triggerStripMoveEvent(),g_objStripInner.stop(!0).animate(b,{duration:g_options.strip_scroll_to_thumb_duration,easing:g_options.strip_scroll_to_thumb_easing,queue:!1,progress:function(){t.triggerStripMoveEvent()},always:function(){t.triggerStripMoveEvent()}}))},this.triggerStripMoveEvent=function(){jQuery(t).trigger(t.events.STRIP_MOVE)},this.isTouchMotionActive=function(){return!!g_touchThumbsControl&&g_touchThumbsControl.isTouchActive()},this.isItemThumbVisible=function(h){var b=h.objThumbWrapper,a=b.position(),c=-1*t.getInnerStripPos();if(!1==g_isVertical)var d=c+g_sizes.stripSize,e=a.left,f=a.left+b.width();else var d=c+g_sizes.stripSize,e=a.top,f=a.top+b.height();var g=!1;return f>=c&&e<=d&&(g=!0),g},this.getInnerStripPos=function(){return!1==g_isVertical?g_objStripInner.position().left:g_objStripInner.position().top},this.getInnerStripLimits=function(){var a={};return!1==g_isVertical?a.maxPos=g_options.strip_padding_left:a.maxPos=g_options.strip_padding_top,a.minPos=-(g_sizes.stripInnerSize-g_sizes.stripActiveSize),a},this.fixInnerStripLimits=function(a){var b=t.getInnerStripLimits();return a>b.maxPos&&(a=b.maxPos),a<b.minPos&&(a=b.minPos),a},this.scrollForeward=function(){scrollBy(-g_sizes.stripSize)},this.scrollBack=function(){scrollBy(g_sizes.stripSize)},this.________EXTERNAL_SETTERS___________=function(){},this.setOptions=function(a){g_options=jQuery.extend(g_options,a),g_thumbs.setOptions(a),onAfterSetOptions()},this.setSizeVertical=function(c){if(!1==g_isVertical)throw new Error("setSizeVertical error, the strip size is not vertical");var d=g_sizes.thumbSecondSize,b={};b.width=d+"px",b.height=c+"px",g_objStrip.css(b),storeStripSize(c);var a={};a.width=d+"px",a.left="0px",a.top="0px",g_objStripInner.css(a),g_temp.is_placed=!0,checkControlsEnableDisable()},this.setSizeHorizontal=function(c){if(!0==g_isVertical)throw new Error("setSizeHorizontal error, the strip size is not horizontal");var d=g_sizes.thumbSecondSize+g_options.strip_padding_top+g_options.strip_padding_bottom,b={};b.width=c+"px",b.height=d+"px",g_objStrip.css(b),storeStripSize(c);var e=g_options.strip_padding_left,a={};a.height=d+"px",a.left=e+"px",a.top="0px",g_objStripInner.css(a),g_temp.is_placed=!0,checkControlsEnableDisable()},this.setPosition=function(a,b,c,d){g_functions.placeElement(g_objStrip,a,b,c,d)},this.resize=function(a){!1==g_isVertical?(g_objStrip.width(a),g_sizes.stripActiveSize=a-g_options.strip_padding_left-g_options.strip_padding_right):(g_objStrip.height(a),g_sizes.stripActiveSize=a-g_options.strip_padding_top-g_options.strip_padding_bottom),storeStripSize(a),checkControlsEnableDisable(),checkAndRepositionInnerStrip(),alignInnerStrip(),scrollToSelectedThumb(),g_aviaControl&&g_aviaControl.onResize()},this.setThumbUnselected=function(a){g_thumbs.setThumbUnselected(a)},this.setCustomThumbs=function(a){g_thumbs.setCustomThumbs(a)},this.________EXTERNAL_GETTERS___________=function(){},this.getObjects=function(){var a=g_thumbs.getOptions(),b=jQuery.extend(g_options,a);return{g_gallery:g_gallery,g_objGallery:g_objGallery,g_objWrapper:g_objWrapper,g_arrItems:g_arrItems,g_objStrip:g_objStrip,g_objStripInner:g_objStripInner,g_aviaControl:g_aviaControl,g_touchThumbsControl:g_touchThumbsControl,isVertical:g_isVertical,g_options:b,g_thumbs:g_thumbs}},this.getObjThumbs=function(){return g_thumbs},this.getSelectedThumb=function(){var a=g_gallery.getSelectedItemIndex();return -1==a?null:g_thumbs.getThumbByIndex(a)},this.getSizeAndPosition=function(){return g_functions.getElementSize(g_objStrip)},this.getHeight=function(){return g_objStrip.outerHeight()},this.getWidth=function(){return g_objStrip.outerWidth()},this.getSizes=function(){return g_sizes},this.isVertical=function(){return g_isVertical},this.isPlaced=function(){return g_temp.is_placed},this.isMoveEnabled=function(){return isStripMovingEnabled()}}function UGTouchThumbsControl(){var g_parent,g_gallery,g_objGallery,g_objects,g_objStrip,g_objStripInner,g_options,g_isVertical,g_functions=new UGFunctions,g_serviceParams={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},g_temp={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};function getActionVars(){var currentTime=jQuery.now(),obj={};return obj.passedTime=g_temp.lastTime-g_temp.startTime,obj.lastActiveTime=currentTime-g_temp.buttonReleaseTime,obj.passedDistance=g_temp.lastPos-g_temp.startPos,obj.passedDistanceAbs=Math.abs(obj.passedDistance),obj}function setServiceParams(){g_serviceParams.thumb_touch_slowFactor=g_functions.normalizeSetting(5e-5,.01,1,100,g_options.strip_thumb_touch_sensetivity,!0)}function getMouseOrientPosition(event){return!1==g_isVertical?g_functions.getMousePosition(event).pageX:g_functions.getMousePosition(event).pageY}function handleStripDrag(mousePos){var diff=g_temp.mousePos-mousePos,distPos=g_temp.innerPos-diff,objLimits=g_parent.getInnerStripLimits();if(distPos>objLimits.maxPos){var path=distPos-objLimits.maxPos;distPos=objLimits.maxPos+path/3}if(distPos<objLimits.minPos){var path=objLimits.minPos-distPos;distPos=objLimits.minPos-path/3}g_parent.positionInnerStrip(distPos)}function storeInitTouchValues(pagePos){var currentInnerPos=g_parent.getInnerStripPos();g_temp.mousePos=pagePos,g_temp.innerPos=currentInnerPos,g_temp.lastPortionPos=currentInnerPos,g_temp.lastDeltaTime=0,g_temp.lastDeltaPos=0,g_temp.startTime=jQuery.now(),g_temp.startPos=g_temp.innerPos,g_temp.lastTime=g_temp.startTime,g_temp.lastPos=g_temp.startPos,g_temp.speed=0}function storeTouchPortionData(){var currentTime=jQuery.now();currentTime-g_temp.lastTime>=g_serviceParams.touch_portion_time&&(g_temp.lastDeltaTime=currentTime-g_temp.lastTime,g_temp.lastDeltaTime>g_serviceParams.touch_portion_time&&(g_temp.lastDeltaTime=g_serviceParams.touch_portion_time),g_temp.lastDeltaPos=g_temp.lastPos-g_temp.lastPortionPos,g_temp.lastPortionPos=g_temp.lastPos,g_temp.lastTime=currentTime)}function continueTouchMotion(){var slowFactor=g_serviceParams.thumb_touch_slowFactor,minDeltaTime=g_serviceParams.minDeltaTime,minPath=g_serviceParams.minPath,currentInnerPos=g_parent.getInnerStripPos(),deltaTime=jQuery.now()-g_temp.lastTime,deltaPos=currentInnerPos-g_temp.lastPortionPos;deltaTime<minDeltaTime&&g_temp.lastDeltaTime>0&&(deltaTime=g_temp.lastDeltaTime,deltaPos=g_temp.lastDeltaPos+deltaPos),deltaTime<minDeltaTime&&(deltaTime=minDeltaTime);var dir=deltaPos>0?1:-1,speed=0;deltaTime>0&&(speed=deltaPos/deltaTime);var path=speed*speed/(2*slowFactor)*dir;Math.abs(path)<=minPath&&(path=0);var innerStripPos=g_parent.getInnerStripPos(),newPos=innerStripPos+path,correctPos=g_parent.fixInnerStripLimits(newPos),objLimits=g_parent.getInnerStripLimits(),limitsBreakAddition=g_serviceParams.limitsBreakAddition,doQueue=!1,returnPos=correctPos;if(newPos>objLimits.maxPos&&(doQueue=!0,correctPos=limitsBreakAddition,newPos<limitsBreakAddition&&(correctPos=newPos)),newPos<objLimits.minPos){doQueue=!0;var maxStopPos=objLimits.minPos-limitsBreakAddition;correctPos=maxStopPos,newPos>maxStopPos&&(correctPos=newPos)}var correctPath=correctPos-innerStripPos,animateSpeed=Math.abs(Math.round(speed/slowFactor));if(0!=path&&(animateSpeed=animateSpeed*correctPath/path),innerStripPos!=correctPos){var animateProps={left:correctPos+"px"};!0==g_isVertical&&(animateProps={top:correctPos+"px"}),g_objStripInner.animate(animateProps,{duration:animateSpeed,easing:g_serviceParams.animationEasing,queue:!0,progress:onAnimateProgress})}if(!0==doQueue){var returnAnimateSpeed=g_serviceParams.returnAnimateSpeed,returnAnimateProps={left:returnPos+"px"};!0==g_isVertical&&(returnAnimateProps={top:returnPos+"px"}),g_objStripInner.animate(returnAnimateProps,{duration:returnAnimateSpeed,easing:g_serviceParams.returnAnimationEasing,queue:!0,progress:onAnimateProgress})}}function onAnimateProgress(){g_temp.lastPos=g_parent.getInnerStripPos(),g_parent.triggerStripMoveEvent()}function startStripTouchLoop(){if(!0==g_temp.loop_active)return!0;g_temp.loop_active=!0,g_temp.handle=setInterval(storeTouchPortionData,10)}function endStripTouchLoop(event){if(!1==g_temp.loop_active)return!0;if(event){var pagePos=getMouseOrientPosition(event);continueTouchMotion(pagePos)}g_temp.loop_active=!1,g_temp.handle=clearInterval(g_temp.handle)}function onTouchEnd(event){return!1==g_temp.isControlEnabled||((g_temp.buttonReleaseTime=jQuery.now(),!1==g_temp.touch_active)?(endStripTouchLoop(event),!0):void(event.preventDefault(),g_temp.touch_active=!1,endStripTouchLoop(event),g_objStrip.removeClass("ug-dragging")))}function onTouchStart(event){if(!1==g_temp.isControlEnabled)return!0;event.preventDefault(),g_temp.touch_active=!0;var pagePos=getMouseOrientPosition(event);g_objStripInner.stop(!0),storeInitTouchValues(pagePos),startStripTouchLoop(),g_objStrip.addClass("ug-dragging")}function onTouchMove(event){if(!1==g_temp.isControlEnabled|| !1==g_temp.touch_active)return!0;if(event.preventDefault(),0==event.buttons)return g_temp.touch_active=!1,endStripTouchLoop(event),!0;var pagePos=getMouseOrientPosition(event);g_temp.lastPos=g_parent.getInnerStripPos(),handleStripDrag(pagePos),storeTouchPortionData()}function initEvents(){g_objStrip.bind("mousedown touchstart",onTouchStart),jQuery(window).add("body").bind("mouseup touchend",onTouchEnd),jQuery("body").bind("mousemove touchmove",onTouchMove)}this.enable=function(){g_temp.isControlEnabled=!0},this.disable=function(){g_temp.isControlEnabled=!1},this.init=function(a){g_parent=a,g_objects=a.getObjects(),g_gallery=g_objects.g_gallery,g_objGallery=g_objects.g_objGallery,g_objStrip=g_objects.g_objStrip,g_objStripInner=g_objects.g_objStripInner,g_options=g_objects.g_options,g_isVertical=g_objects.isVertical,setServiceParams(),initEvents()},this.isSignificantPassed=function(){var a=getActionVars();return a.passedTime>300||a.passedDistanceAbs>30},this.isTouchActive=function(){return!0==g_temp.touch_active|| !0==g_objStripInner.is(":animated")||getActionVars().lastActiveTime<50},this.destroy=function(){g_objStrip.unbind("mousedown"),g_objStrip.unbind("touchstart"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){var g_temp,g_panel,g_objPanel,g_options,g_objThis,g_objHandle,g_objGallery,g_gallery=new UniteGalleryMain,t=this,g_functions=new UGFunctions;function placePanelAnimation(panelDest,functionOnComplete){switch(g_temp.orientation){case"right":case"left":var objCss={left:panelDest+"px"};break;case"top":case"bottom":var objCss={top:panelDest+"px"}}g_objPanel.stop(!0).animate(objCss,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){functionOnComplete&&functionOnComplete()}})}function placePanelNoAnimation(panelDest){switch(g_temp.orientation){case"right":case"left":g_functions.placeElement(g_objPanel,panelDest,null);break;case"top":case"bottom":g_functions.placeElement(g_objPanel,null,panelDest)}}function onPanelSlideFinish(){g_objThis.trigger(g_panel.events.FINISH_MOVE)}this.init=function(a,b,c,d,e){g_temp=b,g_panel=c,g_gallery=a,g_options=d,g_objThis=e,g_objGallery=jQuery(g_gallery)},this.setHtml=function(b){if(g_objPanel=b,"strip"==g_temp.panelType)var a=g_options.strippanel_enable_handle;else var a=g_options.gridpanel_enable_handle;if(!0==a&&((g_objHandle=new UGPanelHandle).init(g_panel,g_objPanel,g_options,g_temp.panelType,g_gallery),g_objHandle.setHtml()),!0===g_temp.isDisabledAtStart){var c="<div class='ug-overlay-disabled'></div>";g_objPanel.append(c),setTimeout(function(){g_objPanel.children(".ug-overlay-disabled").hide()},g_temp.disabledAtStartTimeout)}},this.placeElements=function(){g_objHandle&&g_objHandle.placeHandle()},this.initEvents=function(){g_objHandle&&(g_objHandle.initEvents(),g_objGallery.on(g_gallery.events.SLIDER_ACTION_START,function(){g_objHandle.hideHandle()}),g_objGallery.on(g_gallery.events.SLIDER_ACTION_END,function(){g_objHandle.showHandle()}))},this.destroy=function(){g_objHandle&&(g_objHandle.destroy(),g_objGallery.off(g_gallery.events.SLIDER_ACTION_START),g_objGallery.off(g_gallery.events.SLIDER_ACTION_END))},this.openPanel=function(a){if(!a)var a=!1;if(g_objPanel.is(":animated")|| !1==g_temp.isClosed)return!1;g_temp.isClosed=!1,g_objThis.trigger(g_panel.events.OPEN_PANEL),!1===a?placePanelAnimation(g_temp.originalPos,onPanelSlideFinish):(placePanelNoAnimation(g_temp.originalPos),onPanelSlideFinish())},this.closePanel=function(a){if(!a)var a=!1;if(g_objPanel.is(":animated")|| !0==g_temp.isClosed)return!1;var b=t.getClosedPanelDest();g_temp.isClosed=!0,g_objThis.trigger(g_panel.events.CLOSE_PANEL),!1===a?placePanelAnimation(b,onPanelSlideFinish):(placePanelNoAnimation(b),onPanelSlideFinish())},this.setClosedState=function(a){g_temp.originalPos=a,g_objThis.trigger(g_panel.events.CLOSE_PANEL),g_temp.isClosed=!0},this.setOpenedState=function(a){g_objThis.trigger(g_panel.events.OPEN_PANEL),g_temp.isClosed=!1},this.getClosedPanelDest=function(){var a,b=g_functions.getElementSize(g_objPanel);switch(g_temp.orientation){case"left":g_temp.originalPos=b.left,a=-g_temp.panelWidth;break;case"right":g_temp.originalPos=b.left;var c=g_gallery.getSize();a=c.width;break;case"top":g_temp.originalPos=b.top,a=-g_temp.panelHeight;break;case"bottom":g_temp.originalPos=b.top;var c=g_gallery.getSize();a=c.height}return a},this.isPanelClosed=function(){return g_temp.isClosed},this.setDisabledAtStart=function(a){if(a<=0)return!1;g_temp.isDisabledAtStart=!0,g_temp.disabledAtStartTimeout=a}}function UGPanelHandle(){var g_objPanel,g_panel,g_objHandleTip,g_functions=new UGFunctions,g_options={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0};function removeHoverState(){g_objHandleTip.removeClass("ug-button-hover")}function setClosedState(){g_objHandleTip.addClass("ug-button-closed")}function removeClosedState(){g_objHandleTip.removeClass("ug-button-closed")}function onHandleClick(event){if(event.stopPropagation(),event.stopImmediatePropagation(),!1==g_functions.validateClickTouchstartEvent(event.type))return!0;g_panel.isPanelClosed()?g_panel.openPanel():g_panel.closePanel()}function checkAndFixAlign(){var orientation=g_panel.getOrientation();switch(orientation){case"right":case"left":"top"!=g_options.panel_handle_align&&"bottom"!=g_options.panel_handle_align&&(g_options.panel_handle_align="top");break;case"bottom":"left"!=g_options.panel_handle_align&&"right"!=g_options.panel_handle_align&&(g_options.panel_handle_align="left");break;case"top":"left"!=g_options.panel_handle_align&&"right"!=g_options.panel_handle_align&&(g_options.panel_handle_align="right")}}this.init=function(c,d,a,b,e){switch(g_panel=c,g_objPanel=d,b){case"grid":g_options.panel_handle_align=a.gridpanel_handle_align,g_options.panel_handle_offset=a.gridpanel_handle_offset,g_options.panel_handle_skin=a.gridpanel_handle_skin;break;case"strip":g_options.panel_handle_align=a.strippanel_handle_align,g_options.panel_handle_offset=a.strippanel_handle_offset,g_options.panel_handle_skin=a.strippanel_handle_skin;break;default:throw new Error("Panel handle error: wrong panel type: "+b)}var f=e.getOptions().gallery_skin;""==g_options.panel_handle_skin&&(g_options.panel_handle_skin=f)},this.setHtml=function(){var b=g_panel.getOrientation(),a="ug-panel-handle-tip";switch(b){case"right":a+=" ug-handle-tip-left";break;case"left":a+=" ug-handle-tip-right";break;case"bottom":a+=" ug-handle-tip-top";break;case"top":a+=" ug-handle-tip-bottom"}g_objPanel.append("<div class='"+a+" ug-skin-"+g_options.panel_handle_skin+"'></div>"),g_objHandleTip=g_objPanel.children(".ug-panel-handle-tip")},this.initEvents=function(){g_functions.addClassOnHover(g_objHandleTip),g_objHandleTip.bind("click touchstart",onHandleClick),jQuery(g_panel).on(g_panel.events.OPEN_PANEL,function(){removeHoverState(),removeClosedState()}),jQuery(g_panel).on(g_panel.events.CLOSE_PANEL,function(){removeHoverState(),setClosedState()})},this.destroy=function(){g_functions.destroyButton(g_objHandleTip),jQuery(g_panel).off(g_panel.events.OPEN_PANEL),jQuery(g_panel).off(g_panel.events.CLOSE_PANEL)},this.placeHandle=function(){var a=g_functions.getElementSize(g_objHandleTip);checkAndFixAlign();var b=g_panel.getOrientation();switch(b){case"left":g_functions.placeElement(g_objHandleTip,"right",g_options.panel_handle_align,-a.width);break;case"right":g_functions.placeElement(g_objHandleTip,-a.width,g_options.panel_handle_align,0,g_options.panel_handle_offset);break;case"top":g_functions.placeElement(g_objHandleTip,g_options.panel_handle_align,"bottom",g_options.panel_handle_offset,-a.height);break;case"bottom":g_functions.placeElement(g_objHandleTip,g_options.panel_handle_align,"top",g_options.panel_handle_offset,-a.height);break;default:throw new Error("Wrong panel orientation: "+b)}},this.hideHandle=function(){!0==g_objHandleTip.is(":visible")&&g_objHandleTip.hide()},this.showHandle=function(){!1==g_objHandleTip.is(":visible")&&g_objHandleTip.show()}}function UGStripPanel(){var g_objButtonNext,g_objButtonPrev,g_objGallery,g_objWrapper,g_objPanel,t=this,g_objThis=jQuery(this),g_gallery=new UniteGalleryMain,g_functions=new UGFunctions,g_objStrip=new UGThumbsStrip,g_panelBase=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var g_options={strippanel_vertical_type:!1,strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},g_defaults_vertical={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},g_defaults_no_buttons={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},g_temp={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0};function initPanel(gallery,customOptions){g_objGallery=jQuery(g_gallery=gallery);var repeatCustomOptions=!1;!0==(g_options=jQuery.extend(g_options,customOptions)).strippanel_vertical_type&&(g_options=jQuery.extend(g_options,g_defaults_vertical),repeatCustomOptions=!0),!1==g_options.strippanel_enable_buttons&&(g_options=jQuery.extend(g_options,g_defaults_no_buttons),repeatCustomOptions=!0),!0==repeatCustomOptions&&(g_options=jQuery.extend(g_options,customOptions));var globalSkin=g_gallery.getOptions().gallery_skin;""==g_options.strippanel_buttons_skin&&(g_options.strippanel_buttons_skin=globalSkin),g_objWrapper=g_gallery.getElement(),g_panelBase.init(g_gallery,g_temp,t,g_options,g_objThis),(g_objStrip=new UGThumbsStrip).init(g_gallery,g_options)}function validatePanelBeforeRun(){if(!1==g_options.strippanel_vertical_type){if(0==g_temp.panelWidth)throw new Error("Strip panel error: The width not set, please set width")}else if(0==g_temp.panelHeight)throw new Error("Strip panel error: The height not set, please set height");if(null==g_temp.orientation)throw new Error("Wrong orientation, please set panel orientation before run");return!0}function runPanel(){if(!0==g_temp.isFirstRun&& !1==validatePanelBeforeRun())return!1;g_objStrip.run(),setElementsSize(),placeElements(),initEvents(),g_temp.isFirstRun=!1,checkSideButtons()}function setPanelHtml(parentContainer){if(!parentContainer)var parentContainer=g_objWrapper;if(parentContainer.append("<div class='ug-strip-panel'></div>"),g_objPanel=parentContainer.children(".ug-strip-panel"),!0==g_options.strippanel_enable_buttons){var arrowPrevClass="ug-strip-arrow-left",arrowNextClass="ug-strip-arrow-right";!0==g_options.strippanel_vertical_type&&(arrowPrevClass="ug-strip-arrow-up",arrowNextClass="ug-strip-arrow-down"),g_objPanel.append("<div class='ug-strip-arrow "+arrowPrevClass+" ug-skin-"+g_options.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>"),g_objPanel.append("<div class='ug-strip-arrow "+arrowNextClass+" ug-skin-"+g_options.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'></div></div>")}g_panelBase.setHtml(g_objPanel),g_objStrip.setHtml(g_objPanel),!0==g_options.strippanel_enable_buttons&&(g_objButtonPrev=g_objPanel.children("."+arrowPrevClass),g_objButtonNext=g_objPanel.children("."+arrowNextClass)),setHtmlProperties()}function setHtmlProperties(){""!=g_options.strippanel_background_color&&g_objPanel.css("background-color",g_options.strippanel_background_color)}function setElementsSize_hor(){var stripHeight=g_objStrip.getHeight(),panelWidth=g_temp.panelWidth;if(g_objButtonNext){g_objButtonPrev.height(stripHeight),g_objButtonNext.height(stripHeight);var prevTip=g_objButtonPrev.children(".ug-strip-arrow-tip");g_functions.placeElement(prevTip,"center","middle");var nextTip=g_objButtonNext.children(".ug-strip-arrow-tip");g_functions.placeElement(nextTip,"center","middle")}var panelHeight=stripHeight+g_options.strippanel_padding_top+g_options.strippanel_padding_bottom;g_objPanel.width(panelWidth),g_objPanel.height(panelHeight),g_temp.panelHeight=panelHeight;var stripWidth=panelWidth-g_options.strippanel_padding_left-g_options.strippanel_padding_right;g_objButtonNext&&(stripWidth=stripWidth-2*g_objButtonNext.outerWidth()-2*g_options.strippanel_padding_buttons),g_objStrip.resize(stripWidth)}function setElementsSize_vert(){var stripWidth=g_objStrip.getWidth(),panelHeight=g_temp.panelHeight;if(g_objButtonNext){g_objButtonPrev.width(stripWidth),g_objButtonNext.width(stripWidth);var prevTip=g_objButtonPrev.children(".ug-strip-arrow-tip");g_functions.placeElement(prevTip,"center","middle");var nextTip=g_objButtonNext.children(".ug-strip-arrow-tip");g_functions.placeElement(nextTip,"center","middle")}var panelWidth=stripWidth+g_options.strippanel_padding_left+g_options.strippanel_padding_right;g_objPanel.width(panelWidth),g_objPanel.height(panelHeight),g_temp.panelWidth=panelWidth;var stripHeight=panelHeight-g_options.strippanel_padding_top-g_options.strippanel_padding_bottom;g_objButtonNext&&(stripHeight=stripHeight-2*g_objButtonNext.outerHeight()-2*g_options.strippanel_padding_buttons),g_objStrip.resize(stripHeight)}function setElementsSize(){!1==g_options.strippanel_vertical_type?setElementsSize_hor():setElementsSize_vert()}function placeElements_hor(){g_objButtonNext&&(g_functions.placeElement(g_objButtonPrev,"left","top",g_options.strippanel_padding_left,g_options.strippanel_padding_top),g_functions.placeElement(g_objButtonNext,"right","top",g_options.strippanel_padding_right,g_options.strippanel_padding_top));var stripX=g_options.strippanel_padding_left;g_objButtonNext&&(stripX+=g_objButtonNext.outerWidth()+g_options.strippanel_padding_buttons),g_objStrip.setPosition(stripX,g_options.strippanel_padding_top)}function placeElements_vert(){g_objButtonNext&&(g_functions.placeElement(g_objButtonPrev,"left","top",g_options.strippanel_padding_left,g_options.strippanel_padding_top),g_functions.placeElement(g_objButtonNext,"left","bottom",g_options.strippanel_padding_left,g_options.strippanel_padding_bottom));var stripY=g_options.strippanel_padding_top;g_objButtonNext&&(stripY+=g_objButtonNext.outerHeight()+g_options.strippanel_padding_buttons),g_objStrip.setPosition(g_options.strippanel_padding_left,stripY)}function placeElements(){!1==g_options.strippanel_vertical_type?placeElements_hor():placeElements_vert(),g_panelBase.placeElements()}function onNextButtonClick(objButton){if(g_functions.isButtonDisabled(objButton))return!0;"advance_item"==g_options.strippanel_buttons_role?g_gallery.nextItem():g_objStrip.scrollForeward()}function onPrevButtonClick(objButton){if(g_functions.isButtonDisabled(objButton))return!0;"advance_item"==g_options.strippanel_buttons_role?g_gallery.prevItem():g_objStrip.scrollBack()}function checkSideButtons(){if(!g_objButtonNext)return!0;if(!1==g_objStrip.isMoveEnabled())return g_functions.disableButton(g_objButtonPrev),g_functions.disableButton(g_objButtonNext),!0;var limits=g_objStrip.getInnerStripLimits(),pos=g_objStrip.getInnerStripPos();pos>=limits.maxPos?g_functions.disableButton(g_objButtonPrev):g_functions.enableButton(g_objButtonPrev),pos<=limits.minPos?g_functions.disableButton(g_objButtonNext):g_functions.enableButton(g_objButtonNext)}function onStripMove(){checkSideButtons()}function onItemChange(){g_gallery.isLastItem()?g_functions.disableButton(g_objButtonNext):g_functions.enableButton(g_objButtonNext),g_gallery.isFirstItem()?g_functions.disableButton(g_objButtonPrev):g_functions.enableButton(g_objButtonPrev)}function initEvents(){if(!0==g_temp.isEventsInited)return!1;g_temp.isEventsInited=!0,g_objButtonNext&&((g_functions.addClassOnHover(g_objButtonNext,"ug-button-hover"),g_functions.addClassOnHover(g_objButtonPrev,"ug-button-hover"),g_functions.setButtonOnClick(g_objButtonPrev,onPrevButtonClick),g_functions.setButtonOnClick(g_objButtonNext,onNextButtonClick),"advance_item"!=g_options.strippanel_buttons_role)?(jQuery(g_objStrip).on(g_objStrip.events.STRIP_MOVE,onStripMove),jQuery(g_objStrip).on(g_objStrip.events.INNER_SIZE_CHANGE,checkSideButtons),g_objGallery.on(g_gallery.events.SIZE_CHANGE,checkSideButtons)):!1==g_gallery.getOptions().gallery_carousel&&jQuery(g_gallery).on(g_gallery.events.ITEM_CHANGE,onItemChange)),g_panelBase.initEvents()}this.destroy=function(){g_objButtonNext&&(g_functions.destroyButton(g_objButtonNext),g_functions.destroyButton(g_objButtonPrev),jQuery(g_objStrip).off(g_objStrip.events.STRIP_MOVE),jQuery(g_gallery).off(g_gallery.events.ITEM_CHANGE),jQuery(g_gallery).off(g_gallery.events.SIZE_CHANGE)),g_panelBase.destroy(),g_objStrip.destroy()},this.getOrientation=function(){return g_temp.orientation},this.setOrientation=function(a){g_temp.orientation=a},this.init=function(a,b){initPanel(a,b)},this.run=function(){runPanel()},this.setHtml=function(a){setPanelHtml(a)},this.getElement=function(){return g_objPanel},this.getSize=function(){return g_functions.getElementSize(g_objPanel)},this.setWidth=function(a){g_temp.panelWidth=a},this.setHeight=function(a){g_temp.panelHeight=a},this.resize=function(a){t.setWidth(a),setElementsSize(),placeElements()},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return g_panelBase.isPanelClosed()},this.getClosedPanelDest=function(){return g_panelBase.getClosedPanelDest()},this.openPanel=function(a){g_panelBase.openPanel(a)},this.closePanel=function(a){g_panelBase.closePanel(a)},this.setOpenedState=function(a){g_panelBase.setOpenedState(a)},this.setClosedState=function(a){g_panelBase.setClosedState(a)},this.setCustomThumbs=function(a){g_objStrip.setCustomThumbs(a)},this.setDisabledAtStart=function(a){g_panelBase.setDisabledAtStart(a)}}function UGGridPanel(){var g_objArrowNext,g_objArrowPrev,g_objWrapper,g_objPanel,t=this,g_objThis=jQuery(this),g_gallery=new UniteGalleryMain,g_functions=new UGFunctions,g_objGrid=new UGThumbsGrid,g_panelBase=new UGPanelsBase;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var g_options={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!1,gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},g_defaultsVertical={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},g_defaultsHorType={gridpanel_grid_align:"center"},g_temp={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};function initGridPanel(gallery,customOptions){g_gallery=gallery,validateOrientation(),customOptions&&customOptions.vertical_scroll&&(g_options.gridpanel_vertical_scroll=customOptions.vertical_scroll),g_options=jQuery.extend(g_options,customOptions),!0==g_temp.isHorType?(g_options=jQuery.extend(g_options,g_defaultsHorType),g_options=jQuery.extend(g_options,customOptions)):!0==g_options.gridpanel_vertical_scroll&&(g_options=jQuery.extend(g_options,g_defaultsVertical),g_options=jQuery.extend(g_options,customOptions),g_options.grid_panes_direction="bottom");var globalSkin=g_gallery.getOptions().gallery_skin;""==g_options.gridpanel_arrows_skin&&(g_options.gridpanel_arrows_skin=globalSkin),g_objWrapper=gallery.getObjects().g_objWrapper,g_panelBase.init(g_gallery,g_temp,t,g_options,g_objThis),(g_objGrid=new UGThumbsGrid).init(g_gallery,g_options)}function validateOrientation(){if(null==g_temp.orientation)throw new Error("Wrong orientation, please set panel orientation before run")}function runPanel(){validateOrientation(),processOptions(),g_objGrid.run(),setArrows(),setPanelSize(),placeElements(),initEvents()}function setHtmlPanel(){g_objWrapper.append("<div class='ug-grid-panel'></div>"),g_objPanel=g_objWrapper.children(".ug-grid-panel"),g_temp.isHorType?(g_objPanel.append("<div class='grid-arrow grid-arrow-left-hortype ug-skin-"+g_options.gridpanel_arrows_skin+"'></div>"),g_objPanel.append("<div class='grid-arrow grid-arrow-right-hortype ug-skin-"+g_options.gridpanel_arrows_skin+"'></div>"),g_objArrowPrev=g_objPanel.children(".grid-arrow-left-hortype"),g_objArrowNext=g_objPanel.children(".grid-arrow-right-hortype")):!1==g_options.gridpanel_vertical_scroll?(g_objPanel.append("<div class='grid-arrow grid-arrow-left ug-skin-"+g_options.gridpanel_arrows_skin+"'></div>"),g_objPanel.append("<div class='grid-arrow grid-arrow-right ug-skin-"+g_options.gridpanel_arrows_skin+"'></div>"),g_objArrowPrev=g_objPanel.children(".grid-arrow-left"),g_objArrowNext=g_objPanel.children(".grid-arrow-right")):(g_objPanel.append("<div class='grid-arrow grid-arrow-up ug-skin-"+g_options.gridpanel_arrows_skin+"'></div>"),g_objPanel.append("<div class='grid-arrow grid-arrow-down ug-skin-"+g_options.gridpanel_arrows_skin+"'></div>"),g_objArrowPrev=g_objPanel.children(".grid-arrow-up"),g_objArrowNext=g_objPanel.children(".grid-arrow-down")),g_panelBase.setHtml(g_objPanel),g_objArrowPrev.fadeTo(0,0),g_objArrowNext.fadeTo(0,0),g_objGrid.setHtml(g_objPanel),setHtmlProperties()}function setHtmlProperties(){""!=g_options.gridpanel_background_color&&g_objPanel.css("background-color",g_options.gridpanel_background_color)}function processOptions(){"center"==g_options.gridpanel_grid_align&&(g_options.gridpanel_grid_align="middle")}function getGridMaxHeight(){var spaceTaken=g_options.gridpanel_padding_border_top+g_options.gridpanel_padding_border_bottom,maxGridHeight=g_temp.panelHeight-spaceTaken;if(!1==g_options.gridpanel_arrows_always_on&&1==g_objGrid.getNumPanesEstimationByHeight(maxGridHeight))return maxGridHeight;var spaceTaken=g_functions.getElementSize(g_objArrowNext).height+g_options.gridpanel_arrows_padding_vert;return!0==g_options.gridpanel_vertical_scroll&&(spaceTaken*=2),spaceTaken+=g_options.gridpanel_padding_border_top+g_options.gridpanel_padding_border_bottom,maxGridHeight=g_temp.panelHeight-spaceTaken}function getGridMaxWidth(){var spaceTaken=g_options.gridpanel_padding_border_left+g_options.gridpanel_padding_border_right,maxGridWidth=g_temp.panelWidth-spaceTaken;if(!1==g_options.gridpanel_arrows_always_on&&1==g_objGrid.getNumPanesEstimationByWidth(maxGridWidth))return maxGridWidth;var arrowsWidth=g_functions.getElementSize(g_objArrowNext).width;return spaceTaken+=(arrowsWidth+g_options.gridpanel_arrows_padding_hor)*2,maxGridWidth=g_temp.panelWidth-spaceTaken}function setArrows(){var showArrows=!1;!0==g_options.gridpanel_arrows_always_on?showArrows=!0:g_objGrid.getNumPanes()>1&&(showArrows=!0),!0==showArrows?(g_objArrowNext.show().fadeTo(0,1),g_objArrowPrev.show().fadeTo(0,1),g_temp.arrowsVisible=!0):(g_objArrowNext.hide(),g_objArrowPrev.hide(),g_temp.arrowsVisible=!1)}function setPanelSize(){var gridSize=g_objGrid.getSize();!0==g_temp.isHorType?g_temp.panelHeight=gridSize.height+g_options.gridpanel_padding_border_top+g_options.gridpanel_padding_border_bottom:g_temp.panelWidth=gridSize.width+g_options.gridpanel_padding_border_left+g_options.gridpanel_padding_border_right,g_functions.setElementSize(g_objPanel,g_temp.panelWidth,g_temp.panelHeight)}function initEvents(){if(!0==g_temp.isEventsInited)return!1;g_temp.isEventsInited=!0,g_objArrowPrev&&(g_functions.addClassOnHover(g_objArrowPrev),g_objGrid.attachPrevPaneButton(g_objArrowPrev)),g_objArrowNext&&(g_functions.addClassOnHover(g_objArrowNext),g_objGrid.attachNextPaneButton(g_objArrowNext)),g_panelBase.initEvents()}function getGridPaddingLeft(){return g_options.gridpanel_padding_border_left}function placeElements_noarrows(){var gridY=g_options.gridpanel_grid_align,gridPaddingY=0;switch(gridY){case"top":gridPaddingY=g_options.gridpanel_padding_border_top;break;case"bottom":gridPaddingY=g_options.gridpanel_padding_border_bottom}var gridPanelLeft=getGridPaddingLeft(),gridElement=g_objGrid.getElement();g_functions.placeElement(gridElement,gridPanelLeft,gridY,0,gridPaddingY)}function placeElementsVert_arrows(){var gridY,prevArrowY,nextArrowY,nextArrowPaddingY,objArrowSize=g_functions.getElementSize(g_objArrowPrev),objGridSize=g_objGrid.getSize();switch(g_options.gridpanel_grid_align){default:case"top":gridY=g_options.gridpanel_padding_border_top+objArrowSize.height+g_options.gridpanel_arrows_padding_vert;break;case"middle":gridY="middle";break;case"bottom":gridY=g_temp.panelHeight-objGridSize.height-objArrowSize.height-g_options.gridpanel_padding_border_bottom-g_options.gridpanel_arrows_padding_vert}var gridPanelLeft=getGridPaddingLeft(),gridElement=g_objGrid.getElement();g_functions.placeElement(gridElement,gridPanelLeft,gridY);var objGridSize=g_objGrid.getSize();switch(g_options.gridpanel_arrows_align_vert){default:case"center":case"middle":prevArrowY=(objGridSize.top-objArrowSize.height)/2,nextArrowY=objGridSize.bottom+(g_temp.panelHeight-objGridSize.bottom-objArrowSize.height)/2,nextArrowPaddingY=0;break;case"grid":prevArrowY=objGridSize.top-objArrowSize.height-g_options.gridpanel_arrows_padding_vert_vert,nextArrowY=objGridSize.bottom+g_options.gridpanel_arrows_padding_vert,nextArrowPaddingY=0;break;case"border":case"borders":prevArrowY=g_options.gridpanel_padding_border_top,nextArrowY="bottom",nextArrowPaddingY=g_options.gridpanel_padding_border_bottom}g_functions.placeElement(g_objArrowPrev,"center",prevArrowY),g_functions.placeElement(g_objArrowNext,"center",nextArrowY,0,nextArrowPaddingY)}function placeElementsVert(){!0==g_temp.arrowsVisible?placeElementsVert_arrows():placeElements_noarrows()}function placeElementsHor_arrows(){var arrowsY,prevArrowPadding,arrowsPaddingY,nextArrowPadding,objArrowSize=g_functions.getElementSize(g_objArrowPrev),objGridSize=g_objGrid.getSize(),gridY=g_options.gridpanel_padding_border_top;switch(g_options.gridpanel_grid_align){case"middle":switch(g_options.gridpanel_arrows_align_vert){default:var elementsHeight=objGridSize.height+g_options.gridpanel_arrows_padding_vert+objArrowSize.height;gridY=(g_temp.panelHeight-elementsHeight)/2;break;case"border":case"borders":gridY=(g_temp.panelHeight-objArrowSize.height-g_options.gridpanel_padding_border_bottom-objGridSize.height)/2}break;case"bottom":var elementsHeight=objGridSize.height+objArrowSize.height+g_options.gridpanel_arrows_padding_vert;gridY=g_temp.panelHeight-elementsHeight-g_options.gridpanel_padding_border_bottom}var gridElement=g_objGrid.getElement(),gridPanelLeft=getGridPaddingLeft();g_functions.placeElement(gridElement,gridPanelLeft,gridY);var objGridSize=g_objGrid.getSize();switch(g_options.gridpanel_arrows_align_vert){default:case"center":case"middle":arrowsY=objGridSize.bottom+(g_temp.panelHeight-objGridSize.bottom-objArrowSize.height)/2,arrowsPaddingY=0;break;case"grid":arrowsY=objGridSize.bottom+g_options.gridpanel_arrows_padding_vert,arrowsPaddingY=0;break;case"border":case"borders":arrowsY="bottom",arrowsPaddingY=g_options.gridpanel_padding_border_bottom}prevArrowPadding=-objArrowSize.width/2-g_options.gridpanel_space_between_arrows/2,g_functions.placeElement(g_objArrowPrev,"center",arrowsY,prevArrowPadding,arrowsPaddingY);var nextArrowPadding=Math.abs(prevArrowPadding);g_functions.placeElement(g_objArrowNext,"center",arrowsY,nextArrowPadding,arrowsPaddingY)}function placeElementsHor(){!0==g_temp.arrowsVisible?placeElementsHor_arrows():placeElements_noarrows()}function placeElementsHorType_arrows(){var gridX,prevArrowX,nextArrowX,arrowsY,objArrowSize=g_functions.getElementSize(g_objArrowPrev),objGridSize=g_objGrid.getSize();switch(g_options.gridpanel_grid_align){default:case"left":gridX=g_options.gridpanel_padding_border_left+g_options.gridpanel_arrows_padding_hor+objArrowSize.width;break;case"middle":case"center":gridX="center";break;case"right":gridX=g_temp.panelWidth-objGridSize.width-objArrowSize.width-g_options.gridpanel_padding_border_right-g_options.gridpanel_arrows_padding_hor}var gridElement=g_objGrid.getElement();switch(g_functions.placeElement(gridElement,gridX,g_options.gridpanel_padding_border_top),objGridSize=g_objGrid.getSize(),g_options.gridpanel_arrows_align_vert){default:case"center":case"middle":arrowsY=(objGridSize.height-objArrowSize.height)/2+objGridSize.top;break;case"top":arrowsY=g_options.gridpanel_padding_border_top+g_options.gridpanel_arrows_padding_vert;break;case"bottom":arrowsY=g_temp.panelHeight-g_options.gridpanel_padding_border_bottom-g_options.gridpanel_arrows_padding_vert-objArrowSize.height}switch(g_options.gridpanel_arrows_align_hor){default:case"borders":prevArrowX=g_options.gridpanel_padding_border_left,nextArrowX=g_temp.panelWidth-g_options.gridpanel_padding_border_right-objArrowSize.width;break;case"grid":prevArrowX=objGridSize.left-g_options.gridpanel_arrows_padding_hor-objArrowSize.width,nextArrowX=objGridSize.right+g_options.gridpanel_arrows_padding_hor;break;case"center":prevArrowX=(objGridSize.left-objArrowSize.width)/2,nextArrowX=objGridSize.right+(g_temp.panelWidth-objGridSize.right-objArrowSize.width)/2}g_functions.placeElement(g_objArrowPrev,prevArrowX,arrowsY),g_functions.placeElement(g_objArrowNext,nextArrowX,arrowsY)}function placeElementHorType_noarrows(){var gridX,objGridSize=g_objGrid.getSize();switch(g_options.gridpanel_grid_align){default:case"left":gridX=g_options.gridpanel_padding_border_left;break;case"middle":case"center":gridX="center";break;case"right":gridX=g_temp.panelWidth-objGridSize.width-g_options.gridpanel_padding_border_right}var gridElement=g_objGrid.getElement();g_functions.placeElement(gridElement,gridX,g_options.gridpanel_padding_border_top)}function placeElementsHorType(){!0==g_temp.arrowsVisible?placeElementsHorType_arrows():placeElementHorType_noarrows()}function placeElements(){!1==g_temp.isHorType?!0==g_options.gridpanel_vertical_scroll?placeElementsVert():placeElementsHor():placeElementsHorType(),g_panelBase.placeElements()}this.destroy=function(){g_objArrowPrev&&g_functions.destroyButton(g_objArrowPrev),g_objArrowNext&&g_functions.destroyButton(g_objArrowNext),g_panelBase.destroy(),g_objGrid.destroy()},this.getOrientation=function(){return g_temp.orientation},this.setOrientation=function(a){switch(g_temp.orientation=a,a){case"right":case"left":g_temp.isHorType=!1;break;case"top":case"bottom":g_temp.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+a)}},this.setHeight=function(a){if(!0==g_temp.isHorType)throw new Error("setHeight is not appliable to this orientatio ("+g_temp.orientation+"). Please use setWidth");g_temp.panelHeight=a;var b=getGridMaxHeight();g_objGrid.setMaxHeight(b)},this.setWidth=function(a){if(!1==g_temp.isHorType)throw new Error("setWidth is not appliable to this orientatio ("+g_temp.orientation+"). Please use setHeight");g_temp.panelWidth=a;var b=getGridMaxWidth();g_objGrid.setMaxWidth(b)},this.init=function(a,b){initGridPanel(a,b)},this.setHtml=function(){setHtmlPanel()},this.run=function(){runPanel()},this.getElement=function(){return g_objPanel},this.getSize=function(){return g_functions.getElementSize(g_objPanel)},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return g_panelBase.isPanelClosed()},this.getClosedPanelDest=function(){return g_panelBase.getClosedPanelDest()},this.openPanel=function(a){g_panelBase.openPanel(a)},this.closePanel=function(a){g_panelBase.closePanel(a)},this.setOpenedState=function(a){g_panelBase.setOpenedState(a)},this.setClosedState=function(a){g_panelBase.setClosedState(a)},this.setDisabledAtStart=function(a){g_panelBase.setDisabledAtStart(a)}}function UGThumbsGrid(){var g_objGallery,g_objects,g_objWrapper,g_arrItems,g_objGrid,g_objInner,t=this,g_objThis=jQuery(this),g_gallery=new UniteGalleryMain,g_functions=new UGFunctions,g_thumbs=new UGThumbsGeneral,g_tilesDesign=new UGTileDesign,g_options={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1};this.events={PANE_CHANGE:"pane_change"};var g_temp={eventSizeChange:"thumb_size_change",isHorizontal:!1,isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};function init(gallery,customOptions,isTilesMode){if(g_objects=gallery.getObjects(),g_gallery=gallery,g_gallery.attachThumbsPanel("grid",t),g_objGallery=jQuery(gallery),g_objWrapper=g_objects.g_objWrapper,g_arrItems=g_objects.g_arrItems,!0===isTilesMode&&(g_temp.isTilesMode=!0),g_temp.numThumbs=g_arrItems.length,setOptions(customOptions),!0==g_temp.isTilesMode){g_tilesDesign.setFixedMode(),g_tilesDesign.setApproveClickFunction(isApproveTileClick),g_tilesDesign.init(gallery,g_options);var options_td=g_tilesDesign.getOptions();g_temp.tileMaxHeight=options_td.tile_height,g_temp.tileMaxWidth=options_td.tile_width,g_thumbs=g_tilesDesign.getObjThumbs()}else customOptions.thumb_fixed_size=!0,g_thumbs.init(gallery,customOptions)}function setHtml(parentContainer){var objParent=g_objWrapper;parentContainer&&(objParent=parentContainer),objParent.append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'></div></div>"),g_objInner=(g_objGrid=objParent.children(".ug-thumbs-grid")).children(".ug-thumbs-grid-inner"),!0==g_temp.isTilesMode?g_tilesDesign.setHtml(g_objInner):g_thumbs.setHtmlThumbs(g_objInner)}function validateBeforeRun(){if(!1==g_temp.isHorizontal){if(0==g_temp.gridHeight)throw new Error("You must set height before run.")}else if(0==g_temp.gridWidth)throw new Error("You must set width before run.")}function run(){var selectedItem=g_gallery.getSelectedItem();if((validateBeforeRun(),!0==g_temp.isFirstTimeRun)?(initEvents(),!0==g_temp.isTilesMode?(initGridDynamicSize(),initSizeParams(),g_tilesDesign.run()):(g_thumbs.setHtmlProperties(),initSizeParams(),g_thumbs.loadThumbsImages())):!0==g_temp.isTilesMode&& !0==initGridDynamicSize()&&(initSizeParams(),g_tilesDesign.run()),positionThumbs(),!0==g_temp.isFirstTimeRun&&g_temp.isTilesMode){var objTiles=g_thumbs.getThumbs();objTiles.each(function(b,a){g_objWrapper.trigger(g_temp.eventSizeChange,jQuery(a))}),objTiles.fadeTo(0,1)}null!=selectedItem&&scrollToThumb(selectedItem.index),g_objThis.trigger(t.events.PANE_CHANGE,g_temp.currentPane),g_temp.isFirstTimeRun=!1}function getThumbsSize(){if(!0==g_temp.isTilesMode)var objThumbSize=g_tilesDesign.getGlobalTileSize();else var objThumbSize=g_thumbs.getGlobalThumbSize();return objThumbSize}function initGridDynamicSize(){if(!1==g_temp.isTilesMode)throw new Error("Dynamic size can be set only in tiles mode");var isChanged=!1,isMobile=g_gallery.isMobileMode(),spaceOld=g_temp.spaceBetweenCols;!0==isMobile?(g_temp.spaceBetweenCols=g_options.grid_space_between_mobile,g_temp.spaceBetweenRows=g_options.grid_space_between_mobile):(g_temp.spaceBetweenCols=g_options.grid_space_between_cols,g_temp.spaceBetweenRows=g_options.grid_space_between_rows),g_temp.spaceBetweenCols!=spaceOld&&(isChanged=!0);var lastThumbWidth=getThumbsSize().width,tileWidth=g_temp.tileMaxWidth;return g_functions.getNumItemsInSpace(g_temp.gridWidth,g_temp.tileMaxWidth,g_temp.spaceBetweenCols)<g_options.grid_min_cols&&(tileWidth=g_functions.getItemSizeInSpace(g_temp.gridWidth,g_options.grid_min_cols,g_temp.spaceBetweenCols)),g_tilesDesign.setTileSizeOptions(tileWidth),tileWidth!=lastThumbWidth&&(isChanged=!0),isChanged}function initSizeParamsHor(){var thumbsHeight=getThumbsSize().height,gridWidth=g_temp.gridWidth,gridHeight=g_options.grid_num_rows*thumbsHeight+(g_options.grid_num_rows-1)*g_temp.spaceBetweenRows+2*g_options.grid_padding;g_temp.gridHeight=gridHeight,g_functions.setElementSize(g_objGrid,gridWidth,gridHeight),g_functions.setElementSize(g_objInner,gridWidth,gridHeight),g_temp.innerWidth=gridWidth,g_temp.innerHeight=gridHeight}function initSizeParamsVert(){var thumbsWidth=getThumbsSize().width,gridWidth=g_options.grid_num_cols*thumbsWidth+(g_options.grid_num_cols-1)*g_temp.spaceBetweenCols+2*g_options.grid_padding,gridHeight=g_temp.gridHeight;g_temp.gridWidth=gridWidth,g_functions.setElementSize(g_objGrid,gridWidth,gridHeight),g_functions.setElementSize(g_objInner,gridWidth,gridHeight),g_temp.innerWidth=gridWidth,g_temp.innerHeight=gridHeight}function initSizeParams(){!1==g_temp.isHorizontal?initSizeParamsVert():initSizeParamsHor()}function scrollToThumb(thumbIndex){var paneIndex=getPaneIndexByThumbIndex(thumbIndex);if(-1==paneIndex)return!1;t.gotoPane(paneIndex,"scroll")}function setOptions(objOptions){g_options=jQuery.extend(g_options,objOptions),g_thumbs.setOptions(objOptions),g_temp.isNavigationVertical="top"==g_options.grid_panes_direction||"bottom"==g_options.grid_panes_direction,g_temp.spaceBetweenCols=g_options.grid_space_between_cols,g_temp.spaceBetweenRows=g_options.grid_space_between_rows}function positionThumb_hor(){var arrThumbs=g_objInner.children(".ug-thumb-wrapper"),posx=0,posy=0,counter=0,baseX=0,maxx=0,maxy=0;g_temp.innerWidth=0,g_temp.numPanes=1,g_temp.arrPanes=[],g_temp.numThumbsInPane=0,g_temp.arrPanes.push(baseX);var numThumbs=arrThumbs.length;for(i=0;i<numThumbs;i++){var objThumb=jQuery(arrThumbs[i]);g_functions.placeElement(objThumb,posx,posy);var thumbWidth=objThumb.outerWidth(),thumbHeight=objThumb.outerHeight();posx>maxx&&(maxx=posx);var endY=posy+thumbHeight;endY>maxy&&(maxy=endY);var endX=maxx+thumbWidth;endX>g_temp.innerWidth&&(g_temp.innerWidth=endX),posx+=thumbWidth+g_temp.spaceBetweenCols,++counter>=g_options.grid_num_cols&&(posy+=thumbHeight+g_temp.spaceBetweenRows,posx=baseX,counter=0),1==g_temp.numPanes&&g_temp.numThumbsInPane++,posy+thumbHeight>g_temp.gridHeight&&(posy=0,posx=baseX=g_temp.innerWidth+g_temp.spaceBetweenCols,counter=0,!0==g_temp.isMaxHeight&&1==g_temp.numPanes&&(g_temp.gridHeight=maxy,g_objGrid.height(g_temp.gridHeight)),i<numThumbs-1&&(g_temp.numPanes++,g_temp.arrPanes.push(baseX)))}g_objInner.width(g_temp.innerWidth),!0==g_temp.isMaxHeight&&1==g_temp.numPanes&&(g_temp.gridHeight=maxy,g_objGrid.height(maxy))}function positionThumb_vert(){var arrThumbs=g_objInner.children(".ug-thumb-wrapper"),posx=0,posy=0,maxy=0,counter=0,baseX=0,paneStartY=0;g_temp.innerWidth=0,g_temp.numPanes=1,g_temp.arrPanes=[],g_temp.numThumbsInPane=0,g_temp.arrPanes.push(baseX);var numThumbs=arrThumbs.length;for(i=0;i<numThumbs;i++){var objThumb=jQuery(arrThumbs[i]);g_functions.placeElement(objThumb,posx,posy);var thumbWidth=objThumb.outerWidth(),thumbHeight=objThumb.outerHeight();posx+=thumbWidth+g_temp.spaceBetweenCols;var endy=posy+thumbHeight;endy>maxy&&(maxy=endy),++counter>=g_options.grid_num_cols&&(posy+=thumbHeight+g_temp.spaceBetweenRows,posx=baseX,counter=0),1==g_temp.numPanes&&g_temp.numThumbsInPane++,endy=posy+thumbHeight;var paneMaxY=paneStartY+g_temp.gridHeight;endy>paneMaxY&&(!0==g_temp.isMaxHeight&&1==g_temp.numPanes&&(g_temp.gridHeight=maxy,g_objGrid.height(g_temp.gridHeight),paneMaxY=g_temp.gridHeight),paneStartY=posy=paneMaxY+g_temp.spaceBetweenRows,posx=baseX=0,counter=0,i<numThumbs-1&&(g_temp.numPanes++,g_temp.arrPanes.push(posy)))}g_objInner.height(maxy),g_temp.innerHeight=maxy,!0==g_temp.isMaxHeight&&1==g_temp.numPanes&&(g_temp.gridHeight=maxy,g_objGrid.height(maxy))}function positionThumb_hortype(){var arrThumbs=g_objInner.children(".ug-thumb-wrapper"),baseX=g_options.grid_padding,baseY=g_options.grid_padding,posy=baseY,posx=baseX,maxx=0,maxy=0,paneMaxY=0,gridMaxY=0,rowsCounter=0;g_temp.innerWidth=0,g_temp.numPanes=1,g_temp.arrPanes=[],g_temp.numThumbsInPane=0,g_temp.arrPanes.push(baseX-g_options.grid_padding);var numThumbs=arrThumbs.length;for(i=0;i<numThumbs;i++){var objThumb=jQuery(arrThumbs[i]),thumbWidth=objThumb.outerWidth(),thumbHeight=objThumb.outerHeight();posx-baseX+thumbWidth>g_temp.gridWidth&&(posy=0,++rowsCounter>=g_options.grid_num_rows?(rowsCounter=0,baseX=posx,posy=baseY,paneMaxY=0,1==g_temp.numPanes&&(g_temp.gridWidth=maxx+g_options.grid_padding,g_objGrid.width(g_temp.gridWidth),g_temp.gridHeight=gridMaxY+g_options.grid_padding,g_objGrid.height(g_temp.gridHeight)),g_temp.numPanes++,g_temp.arrPanes.push(baseX-g_options.grid_padding)):(posx=baseX,posy=paneMaxY+g_temp.spaceBetweenRows)),g_functions.placeElement(objThumb,posx,posy);var endX=posx+thumbWidth;endX>maxx&&(maxx=endX);var endY=posy+thumbHeight;endY>paneMaxY&&(paneMaxY=endY),endY>gridMaxY&&(gridMaxY=endY),endY>maxy&&(maxy=endY);var endX=maxx+thumbWidth;endX>g_temp.innerWidth&&(g_temp.innerWidth=endX),posx+=thumbWidth+g_temp.spaceBetweenCols,1==g_temp.numPanes&&g_temp.numThumbsInPane++}g_temp.innerWidth=maxx+g_options.grid_padding,g_temp.innerHeight=gridMaxY+g_options.grid_padding,g_objInner.width(g_temp.innerWidth),g_objInner.height(g_temp.innerHeight),1==g_temp.numPanes&&(g_temp.gridWidth=maxx+g_options.grid_padding,g_temp.gridHeight=gridMaxY+g_options.grid_padding,g_objGrid.width(g_temp.gridWidth),g_objGrid.height(g_temp.gridHeight))}function positionThumbs(){!1==g_temp.isHorizontal?g_temp.isNavigationVertical?positionThumb_vert():positionThumb_hor():positionThumb_hortype()}function validateThumbIndex(thumbIndex){if(thumbIndex<0||thumbIndex>=g_temp.numThumbs)throw new Error("Thumb not exists: "+thumbIndex);return!0}function validatePaneIndex(paneIndex){if(paneIndex>=g_temp.numPanes||paneIndex<0)throw new Error("Pane "+index+" doesn't exists.");return!0}function setInnerPos(pos){var objCss=getInnerPosObj(pos);if(!1==objCss)return!1;g_objInner.css(objCss)}function animateInnerTo(pos){var objCss=getInnerPosObj(pos);if(!1==objCss)return!1;g_objInner.stop(!0).animate(objCss,{duration:g_options.grid_transition_duration,easing:g_options.grid_transition_easing,queue:!1})}function animateToCurrentPane(){animateInnerTo(-g_temp.arrPanes[g_temp.currentPane])}function getPaneSize(){return!0==g_temp.isNavigationVertical?g_temp.gridHeight:g_temp.gridWidth}function getInnerPosObj(pos){var obj={};return!0==g_temp.isNavigationVertical?obj.top=pos+"px":obj.left=pos+"px",obj}function getInnerPos(){var objSize=g_functions.getElementSize(g_objInner);return!0==g_temp.isNavigationVertical?objSize.top:objSize.left}function getPaneIndexByThumbIndex(thumbIndex){return!1==validateThumbIndex(thumbIndex)?-1:Math.floor(thumbIndex/g_temp.numThumbsInPane)}function isSignificantPassed(){if(1==g_temp.numPanes)return!1;var objData=g_functions.getStoredEventData(g_temp.storedEventID),passedTime=objData.diffTime,passedDistanceAbs=Math.abs(getInnerPos()-objData.startInnerPos);return passedDistanceAbs>30||passedDistanceAbs>5&&passedTime>300}function isMovementValidForChange(){var objData=g_functions.getStoredEventData(g_temp.storedEventID),currentInnerPos=getInnerPos();diffPos=Math.abs(objData.startInnerPos-currentInnerPos);var breakSize=Math.round(3*getPaneSize()/8);return!!(diffPos>=breakSize||objData.diffTime<300&&diffPos>25)}function isApproveTileClick(){return 1==g_temp.numPanes||g_functions.isApproveStoredEventClick(g_temp.storedEventID,g_temp.isNavigationVertical)}function onThumbClick(event){if(!0==isSignificantPassed())return!0;var objThumb=jQuery(this),objItem=g_thumbs.getItemByThumb(objThumb);g_gallery.selectItem(objItem)}function onTouchStart(event){if(1==g_temp.numPanes|| !0==g_temp.touchActive)return!0;!1==g_temp.isTilesMode&&event.preventDefault(),g_temp.touchActive=!0;var addData={startInnerPos:getInnerPos()};g_functions.storeEventData(event,g_temp.storedEventID,addData)}function handleScrollTop(){return!1!=g_options.grid_vertical_scroll_ondrag&& !0!=g_temp.isNavigationVertical&&"vert"===g_functions.handleScrollTop(g_temp.storedEventID)}function onTouchMove(event){if(!1==g_temp.touchActive)return!0;event.preventDefault(),g_functions.updateStoredEventData(event,g_temp.storedEventID);var objData=g_functions.getStoredEventData(g_temp.storedEventID,g_temp.isNavigationVertical);if(handleScrollTop())return!0;var diff=objData.diffMousePos,innerPos=objData.startInnerPos+diff,direction=diff>0?"prev":"next",lastPaneSize=g_temp.arrPanes[g_temp.numPanes-1];!1==g_options.grid_carousel&&innerPos>0&&"prev"==direction&&(innerPos/=3),!1==g_options.grid_carousel&&innerPos< -lastPaneSize&&"next"==direction&&(innerPos=objData.startInnerPos+diff/3),setInnerPos(innerPos)}function onTouchEnd(event){if(!1==g_temp.touchActive)return!0;g_functions.updateStoredEventData(event,g_temp.storedEventID);var objData=g_functions.getStoredEventData(g_temp.storedEventID,g_temp.isNavigationVertical);if(g_temp.touchActive=!1,!1==isMovementValidForChange())return animateToCurrentPane(),!0;"next"==(getInnerPos()-objData.startInnerPos>0?"prev":"next")?!1==g_options.grid_carousel&&t.isLastPane()?animateToCurrentPane():t.nextPane():!1==g_options.grid_carousel&&t.isFirstPane()?animateToCurrentPane():t.prevPane()}function onItemChange(){var objItem=g_gallery.getSelectedItem();g_thumbs.setThumbSelected(objItem.objThumbWrapper),scrollToThumb(objItem.index)}function initEvents(){!1==g_temp.isTilesMode?(g_thumbs.initEvents(),g_objGrid.find(".ug-thumb-wrapper").on("click touchend",onThumbClick),g_objGallery.on(g_gallery.events.ITEM_CHANGE,onItemChange)):g_tilesDesign.initEvents(),g_objGrid.bind("mousedown touchstart",onTouchStart),jQuery("body").bind("mousemove touchmove",onTouchMove),jQuery(window).add("body").bind("mouseup touchend",onTouchEnd)}this.destroy=function(){if(!1==g_temp.isTilesMode){var a=g_objGrid.find(".ug-thumb-wrapper");a.off("click"),a.off("touchend"),g_objGallery.on(g_gallery.events.ITEM_CHANGE),g_thumbs.destroy()}else g_tilesDesign.destroy();g_objGrid.unbind("mousedown"),g_objGrid.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("touchend"),jQuery(window).add("body").unbind("mouseup"),g_objThis.off(t.events.PANE_CHANGE)},this.__________EXTERNAL_GENERAL_________=function(){},this.setThumbUnselected=function(a){g_thumbs.setThumbUnselected(a)},this.isItemThumbVisible=function(a){return getPaneIndexByThumbIndex(a.index)==g_temp.currentPane},this.__________EXTERNAL_API_________=function(){},this.getNumPanesEstimationByHeight=function(c){if(!0==g_temp.isTilesMode)var a=g_options.tile_height;else var a=g_thumbs.getOptions().thumb_height;var b=Math.ceil(g_thumbs.getNumThumbs()/g_options.grid_num_cols);return Math.ceil((b*a+(b-1)*g_temp.spaceBetweenRows)/c)},this.getNumPanesEstimationByWidth=function(c){if(g_temp.isTilesMode)var a=g_options.tile_width;else var a=g_thumbs.getOptions().thumb_width;var b=Math.ceil(g_thumbs.getNumThumbs()/g_options.grid_num_rows);return Math.ceil((b*a+(b-1)*g_temp.spaceBetweenCols)/c)},this.getHeightEstimationByWidth=function(b){if(!1==g_temp.isTilesMode)throw new Error("This function works only with tiles mode");var e,c=g_thumbs.getNumThumbs(),d=g_functions.getNumItemsInSpace(b,g_options.tile_width,g_temp.spaceBetweenCols),a=Math.ceil(c/d);return a>g_options.grid_num_rows&&(a=g_options.grid_num_rows),g_functions.getSpaceByNumItems(a,g_options.tile_height,g_temp.spaceBetweenRows)+2*g_options.grid_padding},this.getElement=function(){return g_objGrid},this.getSize=function(){return g_functions.getElementSize(g_objGrid)},this.getNumPanes=function(){return g_temp.numPanes},this.isFirstPane=function(){return 0==g_temp.currentPane},this.isLastPane=function(){return g_temp.currentPane==g_temp.numPanes-1},this.getPaneInfo=function(){return{pane:g_temp.currentPane,total:g_temp.numPanes}},this.getPane=function(){return g_temp.currentPane},this.setWidth=function(a){g_temp.gridWidth=a,g_temp.isHorizontal=!0},this.setMaxWidth=function(a){g_temp.gridWidth=a,g_temp.isMaxWidth=!0,g_temp.isHorizontal=!0},this.setHeight=function(a){g_temp.gridHeight=a,g_temp.isHorizontal=!1},this.setMaxHeight=function(a){g_temp.gridHeight=a,g_temp.isMaxHeight=!0,g_temp.isHorizontal=!1},this.gotoPane=function(a,c){if(!1==validatePaneIndex(a)||a==g_temp.currentPane)return!1;var b=-g_temp.arrPanes[a];g_temp.currentPane=a,animateInnerTo(b),g_objThis.trigger(t.events.PANE_CHANGE,a)},this.nextPane=function(){var a=g_temp.currentPane+1;if(a>=g_temp.numPanes){if(!1==g_options.grid_carousel)return!0;a=0}t.gotoPane(a,"next")},this.prevPane=function(){var a=g_temp.currentPane-1;if(a<0&&(a=g_temp.numPanes-1,!1==g_options.grid_carousel))return!1;t.gotoPane(a,"prev")},this.attachNextPaneButton=function(a){if(g_functions.setButtonOnClick(a,t.nextPane),!0==g_options.grid_carousel)return!0;t.isLastPane()&&a.addClass("ug-button-disabled"),g_objThis.on(t.events.PANE_CHANGE,function(){t.isLastPane()?a.addClass("ug-button-disabled"):a.removeClass("ug-button-disabled")})},this.attachPrevPaneButton=function(a){if(g_functions.setButtonOnClick(a,t.prevPane),!0==g_options.grid_carousel)return!0;t.isFirstPane()&&a.addClass("ug-button-disabled"),g_objThis.on(t.events.PANE_CHANGE,function(){t.isFirstPane()?a.addClass("ug-button-disabled"):a.removeClass("ug-button-disabled")})},this.attachBullets=function(a){a.setActive(g_temp.currentPane),jQuery(a).on(a.events.BULLET_CLICK,function(c,b){t.gotoPane(b,"theme"),a.setActive(b)}),jQuery(t).on(t.events.PANE_CHANGE,function(c,b){a.setActive(b)})},this.getObjTileDesign=function(){return g_tilesDesign},this.init=function(a,b,c){init(a,b,c)},this.run=function(){run()},this.setHtml=function(a){setHtml(a)}}function UGTileDesign(){var g_objGallery,g_objParentWrapper,g_objWrapper,g_items,t=this,g_objThis=jQuery(this),g_gallery=new UniteGalleryMain,g_functions=new UGFunctions,g_thumbs=new UGThumbsGeneral;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"},this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"},this.events={TILE_CLICK:"tile_click"};var g_options={tile_width:250,tile_height:200,tile_size_by:t.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},g_defaults={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},g_temp={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};function init(gallery,customOptions){g_gallery=gallery,g_objGallery=jQuery(gallery),g_objWrapper=g_gallery.getObjects().g_objWrapper,g_items=g_gallery.getArrItems(),g_options=jQuery.extend(g_options,g_defaults),g_options=jQuery.extend(g_options,customOptions),modifyOptions(),g_thumbs.init(gallery,g_options);var objCustomOptions={allow_onresize:!1},customThumbsAdd=["overlay"];g_temp.funcCustomTileHtml&&(customThumbsAdd=[]),g_thumbs.setCustomThumbs(setHtmlThumb,customThumbsAdd,objCustomOptions);var thumbOptions=g_thumbs.getOptions();g_options=jQuery.extend(g_options,thumbOptions),g_temp.ratioByWidth=g_options.tile_width/g_options.tile_height,g_temp.ratioByHeight=g_options.tile_height/g_options.tile_width,g_options.tile_size_by==t.sizeby.GLOBAL_RATIO&&g_temp.isTextpanelOutside&&(g_temp.hasImageContainer=!0)}function modifyOptions(){if(!0==g_options.tile_enable_overlay?(g_options.thumb_overlay_opacity=g_options.tile_overlay_opacity,g_options.thumb_overlay_color=g_options.tile_overlay_color):!1==g_options.tile_enable_icons?g_options.thumb_color_overlay_effect=!1:g_options.thumb_overlay_opacity=0,g_options.tile_as_link&&(g_options.thumb_wrapper_as_link=!0,g_options.thumb_link_newpage=g_options.tile_link_newpage),!0==g_options.tile_enable_outline&& !1==g_options.tile_enable_border&&(g_options.tile_enable_outline=!1),g_temp.tileInnerReduce=0,g_options.tile_enable_border&&(g_temp.tileInnerReduce=2*g_options.tile_border_width,g_thumbs.setThumbInnerReduce(g_temp.tileInnerReduce)),g_temp.isSaparateIcons=!g_functions.isRgbaSupported(),!0==g_options.tile_enable_textpanel){switch(g_options.tile_textpanel_position){case"top":g_options.tile_textpanel_align="top";case"bottom":g_temp.isTextpanelOutside=!0,g_options.tile_textpanel_always_on=!0,g_options.tile_textpanel_offset=0;break;case"inside_top":g_options.tile_textpanel_align="top";break;case"middle":g_options.tile_textpanel_align="middle",g_options.tile_textpanel_appear_type="fade"}!1==g_options.tile_textpanel_always_on&&(g_temp.isSaparateIcons=!0)}0!=g_options.tile_textpanel_offset&&(g_options.tile_textpanel_appear_type="fade",g_options.tile_textpanel_margin=g_options.tile_textpanel_offset),"title_and_desc"==g_options.tile_textpanel_source&&(g_options.tile_textpanel_enable_description=!0,g_options.tile_textpanel_desc_style_as_title=!0)}function modifyOptionsBeforeRender(){var isMobile=g_gallery.isMobileMode();switch(g_temp.isTextPanelHidden=!1,!0==isMobile&& !1==g_options.tile_textpanel_always_on&&(g_temp.isTextPanelHidden=!0),g_temp.isVideoplayIconAlwaysOn=g_options.tile_videoplay_icon_always_on,g_options.tile_videoplay_icon_always_on){case"always":g_temp.isVideoplayIconAlwaysOn=!0;break;case"never":g_temp.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":g_temp.isVideoplayIconAlwaysOn=!0==isMobile;break;case"desktop_only":g_temp.isVideoplayIconAlwaysOn=!1==isMobile}}function setHtmlThumb(objThumbWrapper,objItem){if(objThumbWrapper.addClass("ug-tile"),g_temp.funcCustomTileHtml)return g_temp.funcCustomTileHtml(objThumbWrapper,objItem),!1;var html="";!0==g_temp.hasImageContainer&&(html+="<div class='ug-image-container ug-trans-enabled'>");var classImage="ug-thumb-image";(!1==g_options.tile_enable_image_effect|| !0==g_options.tile_image_effect_reverse)&&(classImage+=" ug-trans-enabled");var imageAlt=g_functions.stripTags(objItem.title);imageAlt=g_functions.htmlentitles(imageAlt),html+='<img src="'+g_functions.escapeDoubleSlash(objItem.urlThumb)+"\" alt='"+imageAlt+"' class='"+classImage+"'>",!0==g_temp.hasImageContainer&&(html+="</div>"),objThumbWrapper.append(html),g_options.tile_size_by==t.sizeby.GLOBAL_RATIO&&objThumbWrapper.fadeTo(0,0);var objCss={};if(!0==g_options.tile_enable_background&&(objCss["background-color"]=g_options.tile_background_color),!0==g_options.tile_enable_border&&(objCss["border-width"]=g_options.tile_border_width+"px",objCss["border-style"]="solid",objCss["border-color"]=g_options.tile_border_color,g_options.tile_border_radius&&(objCss["border-radius"]=g_options.tile_border_radius+"px")),!0==g_options.tile_enable_outline&&(objCss.outline="1px solid "+g_options.tile_outline_color),!0==g_options.tile_enable_shadow){var htmlShadow=g_options.tile_shadow_h+"px ";htmlShadow+=g_options.tile_shadow_v+"px ",htmlShadow+=g_options.tile_shadow_blur+"px ",htmlShadow+=g_options.tile_shadow_spread+"px ",htmlShadow+=g_options.tile_shadow_color,objCss["box-shadow"]=htmlShadow}objThumbWrapper.css(objCss);var htmlAdd="";if(g_options.tile_enable_icons){if(!1==g_options.tile_as_link&& !0==g_options.tile_enable_action){var iconPlayClass="ug-button-play ug-icon-zoom";"image"!=objItem.type&&(iconPlayClass="ug-button-play ug-icon-play"),htmlAdd+="<div class='ug-tile-icon "+iconPlayClass+"' style='display:none'></div>"}if(objItem.link&& !0==g_options.tile_show_link_icon|| !0==g_options.tile_as_link){if(!1==g_options.tile_as_link){var linkTarget="";!0==g_options.tile_link_newpage&&(linkTarget=" target='_blank'"),htmlAdd+="<a href='"+objItem.link+"'"+linkTarget+" class='ug-tile-icon ug-icon-link'></a>"}else htmlAdd+="<div class='ug-tile-icon ug-icon-link' style='display:none'></div>"}var toSaparateIcon=g_temp.isSaparateIcons;if(!1==toSaparateIcon&&"image"!=objItem.type&& !0==g_temp.isVideoplayIconAlwaysOn&&(toSaparateIcon=!0),toSaparateIcon)var objOverlay=objThumbWrapper;else var objOverlay=objThumbWrapper.children(".ug-thumb-overlay");objOverlay.append(htmlAdd);var objButtonZoom=objOverlay.children("."+iconPlayClass);0==objButtonZoom.length?objButtonZoom=null:objButtonZoom.hide();var objButtonLink=objOverlay.children(".ug-icon-link");0==objButtonLink.length?objButtonLink=null:objButtonLink.hide(),objButtonLink|| !0!=g_options.tile_enable_action||objThumbWrapper.addClass("ug-tile-clickable")}else!0==g_options.tile_enable_action&&objThumbWrapper.addClass("ug-tile-clickable");if(!0==g_options.tile_enable_image_effect){var imageEffectClassAdd="";!1==g_options.tile_image_effect_reverse&&(imageEffectClassAdd=" ug-trans-enabled");var imageOverlayHtml="<div class='ug-tile-image-overlay"+imageEffectClassAdd+"' >",imageEffectClass=" ug-"+g_options.tile_image_effect_type+"-effect";imageOverlayHtml+='<img src="'+g_functions.escapeDoubleSlash(objItem.urlThumb)+"\" alt='"+objItem.title+"' class='"+imageEffectClass+imageEffectClassAdd+"'>",imageOverlayHtml+="</div>",objThumbWrapper.append(imageOverlayHtml),!0==g_options.tile_image_effect_reverse&&objThumbWrapper.children(".ug-tile-image-overlay").fadeTo(0,0)}if(!0==g_options.tile_enable_textpanel){var objTextPanel=new UGTextPanel;objTextPanel.init(g_gallery,g_options,"tile");var textpanelAddClass="";(!0==g_options.tile_textpanel_always_on|| !0==g_temp.isTextpanelOutside)&&(textpanelAddClass="ug-trans-enabled"),objTextPanel.appendHTML(objThumbWrapper,textpanelAddClass);var panelTitle=objItem.title,panelDesc="";switch(g_options.tile_textpanel_source){case"desc":case"description":panelTitle=objItem.description;break;case"desc_title":""!=objItem.description&&(panelTitle=objItem.description);break;case"title_and_desc":panelTitle=objItem.title,panelDesc=objItem.description}if(objTextPanel.setTextPlain(panelTitle,panelDesc),!1==g_options.tile_textpanel_always_on&&objTextPanel.getElement().fadeTo(0,0),objThumbWrapper.data("objTextPanel",objTextPanel),!0==g_options.tile_textpanel_always_on&&getTextPanelElement(objThumbWrapper).css("z-index",2),!0==g_temp.isTextpanelOutside){var htmlClone="<div class='ug-tile-cloneswrapper'></div>";objThumbWrapper.append(htmlClone);var objCloneWrapper=objThumbWrapper.children(".ug-tile-cloneswrapper"),objTextPanelClone=new UGTextPanel;objTextPanelClone.init(g_gallery,g_options,"tile"),objTextPanelClone.appendHTML(objCloneWrapper),objTextPanelClone.setTextPlain(panelTitle,panelDesc),objThumbWrapper.data("objTextPanelClone",objTextPanelClone)}}null!==objItem.addHtml&&objThumbWrapper.append(objItem.addHtml)}function getTileOverlayImage(objTile){return objTile.children(".ug-tile-image-overlay")}function getTileOverlay(objTile){return objTile.children(".ug-thumb-overlay")}function getTileImageContainer(objTile){return!1==g_temp.hasImageContainer?null:objTile.children(".ug-image-container")}function getTileImageEffect(objTile){return objTile.find(".ug-tile-image-overlay img")}function getTextPanel(objTile){return objTile.data("objTextPanel")}function getTextPanelClone(objTile){return objTile.data("objTextPanelClone")}function getTextPanelElement(objTile){return objTile.children(".ug-textpanel")}function getTextPanelCloneElement(objTile){var objTextPanel=objTile.find(".ug-tile-cloneswrapper .ug-textpanel");if(0==objTextPanel.length)throw new Error("text panel cloned element not found");return objTextPanel}function getTextPanelHeight(objTile){if(!0==g_temp.isTextpanelOutside)var objTextPanel=getTextPanelCloneElement(objTile);else var objTextPanel=getTextPanelElement(objTile);return objTextPanel?g_functions.getElementSize(objTextPanel).height:0}function getButtonLink(objTile){var objButton=objTile.find(".ug-icon-link");return 0==objButton.length?null:objButton}function getTileRatio(objTile){var ratio=g_temp.ratioByHeight;switch(g_options.tile_size_by){default:ratio=g_temp.ratioByHeight;break;case t.sizeby.IMAGE_RATIO:if(!objTile)throw new Error("tile should be given for tile ratio");var item=t.getItemByTile(objTile);if(void 0!==item.thumbRatioByHeight){if(0==item.thumbRatioByHeight)throw trace(item),new Error("the item ratio not inited yet");ratio=item.thumbRatioByHeight}break;case t.sizeby.CUSTOM:return null}return ratio}function getButtonZoom(objTile){var objButton=objTile.find(".ug-button-play");return 0==objButton.length?null:objButton}function isOverStyle(objTile){return!!objTile.hasClass("ug-thumb-over")}function isTileClickable(objTile){return objTile.hasClass("ug-tile-clickable")}function isItemIconAlwaysOn(objItem){return!0==g_options.tile_enable_icons&& !0==g_temp.isVideoplayIconAlwaysOn&&"image"!=objItem.type}function positionElements_images(objTile,width,height,visibleOnly){var objImageOverlay=getTileOverlayImage(objTile),objThumbImage=t.getTileImage(objTile),objImageEffect=getTileImageEffect(objTile);width-=g_temp.tileInnerReduce,height-=g_temp.tileInnerReduce;var imagePosy=null;if(!0==g_temp.isTextpanelOutside){var textHeight=getTextPanelHeight(objTile);if(height-=textHeight,"top"==g_options.tile_textpanel_position&&(imagePosy=textHeight),!0==g_temp.hasImageContainer){var objImageContainer=getTileImageContainer(objTile);g_functions.setElementSize(objImageContainer,width,height),null!==imagePosy&&g_functions.placeElement(objImageContainer,0,imagePosy)}}if(!1==g_options.tile_enable_image_effect)g_functions.scaleImageCoverParent(objThumbImage,width,height),!1==g_temp.hasImageContainer&&null!==imagePosy&&g_functions.placeElement(objThumbImage,0,imagePosy);else{var dontResize="nothing";!0===visibleOnly&& !1==g_temp.isTextpanelOutside&&(dontResize=!0==g_options.tile_image_effect_reverse?"effect":"image"),"effect"!=dontResize&&(g_functions.setElementSize(objImageOverlay,width,height),null!==imagePosy&&g_functions.placeElement(objImageOverlay,0,imagePosy),g_functions.scaleImageCoverParent(objImageEffect,width,height)),"image"!=dontResize&&(!0==g_temp.hasImageContainer?g_functions.scaleImageCoverParent(objThumbImage,width,height):"effect"==dontResize?(g_functions.scaleImageCoverParent(objThumbImage,width,height),null!==imagePosy&&g_functions.placeElement(objThumbImage,0,imagePosy)):g_functions.cloneElementSizeAndPos(objImageEffect,objThumbImage,!1,null,imagePosy))}}function positionElements_textpanel(objTile,panelType,tileWidth,tileHeight){var panelWidth=null;if(tileWidth&&(panelWidth=tileWidth-g_temp.tileInnerReduce),tileHeight&&(tileHeight-=g_temp.tileInnerReduce),"clone"==panelType)return getTextPanelClone(objTile).refresh(!0,!0,panelWidth),t.getItemByTile(objTile).textPanelCloneSizeSet=!0,!1;var objTextPanel=getTextPanel(objTile);if(!objTextPanel)return!1;var panelHeight=null;if(!0==g_temp.isTextpanelOutside&&(panelHeight=getTextPanelHeight(objTile)),objTextPanel.refresh(!1,!0,panelWidth,panelHeight),!0==g_options.tile_textpanel_always_on||"fade"==g_options.tile_textpanel_appear_type){if(!0==g_temp.isTextpanelOutside&&tileHeight&&"bottom"==g_options.tile_textpanel_position){var posy=tileHeight-panelHeight;objTextPanel.positionPanel(posy)}else objTextPanel.positionPanel()}}function positionElements(objTile){t.getItemByTile(objTile);var objButtonZoom=getButtonZoom(objTile),objButtonLink=getButtonLink(objTile),sizeTile=g_functions.getElementSize(objTile);positionElements_images(objTile,sizeTile.width,sizeTile.height),!0==g_options.tile_enable_textpanel&&positionElements_textpanel(objTile,"regular",sizeTile.width,sizeTile.height);var overlayWidth=sizeTile.width-g_temp.tileInnerReduce,overlayHeight=sizeTile.height-g_temp.tileInnerReduce,overlayY=0;if(!0==g_temp.isTextpanelOutside){var textHeight=getTextPanelHeight(objTile);overlayHeight-=textHeight,"top"==g_options.tile_textpanel_position&&(overlayY=textHeight)}var objOverlay=getTileOverlay(objTile);if(g_functions.setElementSizeAndPosition(objOverlay,0,overlayY,overlayWidth,overlayHeight),objButtonZoom||objButtonLink){var gapVert=0;if(!0==g_options.tile_enable_textpanel&& !1==g_temp.isTextPanelHidden&& !1==g_temp.isTextpanelOutside){var objTextPanelElement=getTextPanelElement(objTile),texPanelSize=g_functions.getElementSize(objTextPanelElement);texPanelSize.height>0&&(gapVert=Math.floor(-(texPanelSize.height/2*1)))}}if(objButtonZoom&&objButtonLink){var sizeZoom=g_functions.getElementSize(objButtonZoom),sizeLink=g_functions.getElementSize(objButtonLink),spaceBetween=g_options.tile_space_between_icons,buttonsWidth=sizeZoom.width+spaceBetween+sizeLink.width,buttonsX=Math.floor((sizeTile.width-buttonsWidth)/2);buttonsX<spaceBetween&&(spaceBetween=Math.floor((sizeTile.width-sizeZoom.width-sizeLink.width)/3),buttonsWidth=sizeZoom.width+spaceBetween+sizeLink.width,buttonsX=Math.floor((sizeTile.width-buttonsWidth)/2)),g_functions.placeElement(objButtonZoom,buttonsX,"middle",0,gapVert),g_functions.placeElement(objButtonLink,buttonsX+sizeZoom.width+spaceBetween,"middle",0,gapVert)}else objButtonZoom&&g_functions.placeElement(objButtonZoom,"center","middle",0,gapVert),objButtonLink&&g_functions.placeElement(objButtonLink,"center","middle",0,gapVert);objButtonZoom&&objButtonZoom.show(),objButtonLink&&objButtonLink.show()}function setImageOverlayEffect(objTile,isActive){t.getItemByTile(objTile);var objOverlayImage=getTileOverlayImage(objTile),animationDuration=g_options.thumb_transition_duration;if(!1==g_options.tile_image_effect_reverse){var objThumbImage=t.getTileImage(objTile);isActive?(objThumbImage.fadeTo(0,1),objOverlayImage.stop(!0).fadeTo(animationDuration,0)):objOverlayImage.stop(!0).fadeTo(animationDuration,1)}else isActive?objOverlayImage.stop(!0).fadeTo(animationDuration,1):objOverlayImage.stop(!0).fadeTo(animationDuration,0)}function setTextpanelEffect(objTile,isActive){var animationDuration=g_options.thumb_transition_duration,objTextPanel=getTextPanelElement(objTile);if(!objTextPanel)return!0;if("slide"==g_options.tile_textpanel_appear_type){var panelSize=g_functions.getElementSize(objTextPanel);if(0==panelSize.width)return!1;var startPos=-panelSize.height,endPos=0,startClass={},endClass={},posName="bottom";"inside_top"==g_options.tile_textpanel_position&&(posName="top"),startClass[posName]=startPos+"px",endClass[posName]=endPos+"px",!0==isActive?(objTextPanel.fadeTo(0,1),!1==objTextPanel.is(":animated")&&objTextPanel.css(startClass),endClass.opacity=1,objTextPanel.stop(!0).animate(endClass,animationDuration)):objTextPanel.stop(!0).animate(startClass,animationDuration)}else!0==isActive?objTextPanel.stop(!0).fadeTo(animationDuration,1):objTextPanel.stop(!0).fadeTo(animationDuration,0)}function setIconsEffect(objTile,isActive,noAnimation){var animationDuration=g_options.thumb_transition_duration;noAnimation&& !0===noAnimation&&(animationDuration=0);var g_objIconZoom=getButtonZoom(objTile),g_objIconLink=getButtonLink(objTile),opacity=isActive?1:0;g_objIconZoom&&g_objIconZoom.stop(!0).fadeTo(animationDuration,opacity),g_objIconLink&&g_objIconLink.stop(!0).fadeTo(animationDuration,opacity)}function setOverStyle(data,objTile){if(objTile=jQuery(objTile),g_options.tile_enable_image_effect&&setImageOverlayEffect(objTile,!0),!0==g_options.tile_enable_textpanel&& !1==g_options.tile_textpanel_always_on&& !1==g_temp.isTextPanelHidden&&setTextpanelEffect(objTile,!0),g_temp.isSaparateIcons&& !0==g_options.tile_enable_icons){var isSet=!0==g_options.thumb_overlay_reverse,objItem=t.getItemByTile(objTile);!1==isItemIconAlwaysOn(objItem)&&setIconsEffect(objTile,isSet,!1)}}function setNormalStyle(data,objTile){if(objTile=jQuery(objTile),g_options.tile_enable_image_effect&&setImageOverlayEffect(objTile,!1),!0==g_options.tile_enable_textpanel&& !1==g_options.tile_textpanel_always_on&&setTextpanelEffect(objTile,!1),!0==g_temp.isSaparateIcons&& !0==g_options.tile_enable_icons){var isSet=!0!=g_options.thumb_overlay_reverse,objItem=t.getItemByTile(objTile);!1==isItemIconAlwaysOn(objItem)?setIconsEffect(objTile,isSet,!1):setIconsEffect(objTile,!0,!0)}}function setAllTilesNormalStyle(objTileExcept){g_thumbs.getThumbs().not(objTileExcept).each(function(b,a){g_thumbs.setThumbNormalStyle(jQuery(a))})}function onSizeChange(data,objTile,forcePosition){if(objTile=jQuery(objTile),!0==g_options.tile_visible_before_image&& !0!==objTile.data("image_placed")&& !0!==forcePosition)return!0;positionElements(objTile),g_thumbs.setThumbNormalStyle(objTile)}function onPlaceImage(data,objTile,objImage){positionElements(objTile),objImage.fadeTo(0,1),objTile.data("image_placed",!0)}function onMobileClick(objTile){if(!0==isTileClickable(objTile))return g_objThis.trigger(t.events.TILE_CLICK,objTile),!0;!1==isOverStyle(objTile)&&(setAllTilesNormalStyle(objTile),g_thumbs.setThumbOverStyle(objTile))}function onTileClick(event){var objTile=jQuery(this),tagname=objTile.prop("tagName").toLowerCase(),isApproved=!0;if(g_temp.funcParentApproveClick&& !1==g_temp.funcParentApproveClick()&&(isApproved=!1),"a"==tagname)!1==isApproved&&event.preventDefault();else if(!1==isOverStyle(objTile))!0==isApproved&&onMobileClick(objTile);else{if(!1==isTileClickable(objTile))return!0;!0==isApproved&&g_objThis.trigger(t.events.TILE_CLICK,objTile)}}function onZoomButtonClick(event){event.stopPropagation();var objTile=jQuery(this).parents(".ug-tile"),isApproved=!0;return(g_temp.funcParentApproveClick&& !1==g_temp.funcParentApproveClick()&&(isApproved=!1),!1==isOverStyle(objTile))?(onMobileClick(objTile),!0):!0==isApproved?(g_objThis.trigger(t.events.TILE_CLICK,objTile),!1):void 0}function onLinkButtonClick(event){var objTile=jQuery(this).parents(".ug-tile");g_temp.funcParentApproveClick&& !1==g_temp.funcParentApproveClick()&&event.preventDefault(),!1==isOverStyle(objTile)&& !1==g_options.tile_as_link&&(event.preventDefault(),onMobileClick(objTile))}this.loadTileImage=function(a){var b=t.getTileImage(a);g_functions.checkImagesLoaded(b,null,function(b,c){onPlaceImage(null,a,jQuery(b))})},this.setHtml=function(a,b){g_objParentWrapper=a,!0!==b&&modifyOptionsBeforeRender(),g_thumbs.setHtmlThumbs(a,b)},this.initEvents=function(){g_thumbs.initEvents(),jQuery(g_thumbs).on(g_thumbs.events.SETOVERSTYLE,setOverStyle),jQuery(g_thumbs).on(g_thumbs.events.SETNORMALSTYLE,setNormalStyle),jQuery(g_thumbs).on(g_thumbs.events.PLACEIMAGE,onPlaceImage),g_objWrapper.on(g_temp.eventSizeChange,onSizeChange),g_objParentWrapper.on("click",".ug-tile",onTileClick),g_objParentWrapper.on("click",".ug-tile .ug-button-play",onZoomButtonClick),g_objParentWrapper.on("click",".ug-tile .ug-icon-link",onLinkButtonClick)},this.destroy=function(){if(g_objParentWrapper.off("click",".ug-tile"),g_objParentWrapper.off("click",".ug-tile .ug-button-play"),g_objParentWrapper.off("click",".ug-tile .ug-icon-link"),jQuery(g_thumbs).off(g_thumbs.events.SETOVERSTYLE),jQuery(g_thumbs).off(g_thumbs.events.SETNORMALSTYLE),jQuery(g_thumbs).off(g_thumbs.events.PLACEIMAGE),g_objWrapper.off(g_temp.eventSizeChange),!0==g_options.tile_enable_textpanel){var a=g_thumbs.getThumbs();jQuery.each(a,function(c,b){var a=getTextPanel(jQuery(b));a&&a.destroy()})}g_thumbs.destroy()},this.init=function(a,b,c){init(a,b,c)},this.setFixedMode=function(){g_options.tile_size_by=t.sizeby.GLOBAL_RATIO,g_options.tile_visible_before_image=!0},this.setApproveClickFunction=function(a){g_temp.funcParentApproveClick=a},this.resizeTile=function(b,a,c,d){if(!0==g_temp.isTextpanelOutside&&positionElements_textpanel(b,"clone",a),a){if(!c)var c=t.getTileHeightByWidth(a,b)}else var a=g_options.tile_width,c=g_options.tile_height;switch(g_functions.setElementSize(b,a,c),d){default:case t.resizemode.FULL:t.triggerSizeChangeEvent(b,!0);break;case t.resizemode.WRAPPER_ONLY:return!0;case t.resizemode.VISIBLE_ELEMENTS:if(g_temp.funcCustomTileHtml)return t.triggerSizeChangeEvent(b,!0),!0;positionElements_images(b,a,c,!0),!0==g_options.tile_enable_textpanel&& !0==g_options.tile_textpanel_always_on&&a&&positionElements_textpanel(b,"regular",a,c)}},this.resizeAllTiles=function(b,d,a){modifyOptionsBeforeRender();var c=null;if(g_options.tile_size_by==t.sizeby.GLOBAL_RATIO&&(c=t.getTileHeightByWidth(b)),!a)var a=g_thumbs.getThumbs();a.each(function(e,a){t.resizeTile(jQuery(a),b,c,d)})},this.triggerSizeChangeEvent=function(b,a){if(!b)return!1;if(!a)var a=!1;g_objWrapper.trigger(g_temp.eventSizeChange,[b,a])},this.triggerSizeChangeEventAllTiles=function(a){g_thumbs.getThumbs().each(function(){var b=jQuery(this);t.triggerSizeChangeEvent(b,a)})},this.disableEvents=function(){g_thumbs.getThumbs().css("pointer-events","none")},this.enableEvents=function(){g_thumbs.getThumbs().css("pointer-events","auto")},this.setOptions=function(a){g_options=jQuery.extend(g_options,a),g_thumbs.setOptions(a)},this.setTileSizeOptions=function(a){if(g_options.tile_size_by!==t.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");g_options.tile_width=a,g_options.tile_height=Math.floor(a*g_temp.ratioByHeight)},this.setCustomFunctions=function(a,b){g_temp.funcCustomTileHtml=a,g_temp.funcCustomPositionElements=b},this.run=function(c){var b=g_thumbs.type.GET_THUMBS_ALL;!0===c&&(b=g_thumbs.type.GET_THUMBS_NEW);var a=g_thumbs.getThumbs(b);g_options.tile_size_by==t.sizeby.GLOBAL_RATIO&&t.resizeAllTiles(g_options.tile_width,t.resizemode.WRAPPER_ONLY,a),!0==g_options.tile_enable_image_effect&& !1==g_options.tile_image_effect_reverse&&a.children(".ug-thumb-image").fadeTo(0,0),g_thumbs.setHtmlProperties(a),!0==g_options.tile_visible_before_image&&(a.children(".ug-thumb-image").fadeTo(0,0),g_thumbs.loadThumbsImages())},this._____________EXTERNAL_GETTERS____________=function(){},this.getObjThumbs=function(){return g_thumbs},this.getOptions=function(){return g_options},this.getTileImage=function(a){return a.find("img.ug-thumb-image")},this.getItemByTile=function(a){return g_thumbs.getItemByThumb(a)},this.getTileHeightByWidth=function(d,a){var b=getTileRatio(a);if(null===b)return null;var c=Math.floor((d-g_temp.tileInnerReduce)*b)+g_temp.tileInnerReduce;return a&& !0==g_temp.isTextpanelOutside&&g_options.tile_size_by==t.sizeby.IMAGE_RATIO&&(c+=getTextPanelHeight(a)),c},this.getTileImageSize=function(b){var a=t.getItemByTile(b);if(!a.thumbWidth||!a.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:a.thumbWidth,height:a.thumbHeight}},this.getGlobalTileSize=function(){if(g_options.tile_size_by!=t.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:g_options.tile_width,height:g_options.tile_height}}}function UGTiles(){var g_arrNestedGridRow,g_arrNestedItems,g_objGallery,g_objWrapper,g_objParent,g_arrItems,t=this,g_objThis=jQuery(this),g_gallery=new UniteGalleryMain,g_functions=new UGFunctions,g_objTileDesign=new UGTileDesign,g_thumbs=new UGThumbsGeneral,g_vars={},g_options={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0};this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"};var g_temp={isFirstTimeRun:!0,handle:null,isTransActive:!1,isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1},g_nestedWork={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};function init(gallery,customOptions){g_objects=gallery.getObjects(),g_gallery=gallery,g_objGallery=jQuery(gallery),g_objWrapper=g_objects.g_objWrapper,g_arrItems=g_objects.g_arrItems,g_options=jQuery.extend(g_options,customOptions),modifyOptions(),g_objTileDesign.init(gallery,g_options),g_thumbs=g_objTileDesign.getObjThumbs()}function modifyOptions(){g_options.tiles_min_columns<1&&(g_options.tiles_min_columns=1),0!=g_options.tiles_max_columns&&g_options.tiles_max_columns<g_options.tiles_min_columns&&(g_options.tiles_max_columns=g_options.tiles_min_columns)}function setHtml(objParent){if(!objParent){if(g_objParent)objParent=g_objParent;else var objParent=g_objWrapper}g_objParent=objParent;var tilesType=g_options.tiles_type;objParent.addClass("ug-tiletype-"+tilesType),g_objTileDesign.setHtml(objParent),objParent.children(".ug-thumb-wrapper").hide()}function setTransition(){if(g_objParent.addClass("ug-tiles-rest-mode"),g_temp.isTransInited=!0,!0==g_options.tiles_enable_transition){g_objParent.addClass("ug-tiles-transit");var optionsTile=g_objTileDesign.getOptions();!0==optionsTile.tile_enable_image_effect&& !1==optionsTile.tile_image_effect_reverse&&g_objParent.addClass("ug-tiles-transit-overlays"),g_temp.isTransActive=!0}}function getParentWidth(){return g_functions.getElementSize(g_objParent).width}function doBeforeTransition(){return!1!=g_temp.isTransInited&&(g_objParent.addClass("ug-tiles-transition-active"),g_objParent.removeClass("ug-tiles-rest-mode"),!1!=g_temp.isTransActive&&void g_objTileDesign.disableEvents())}function doAfterTransition_setClasses(){if(!1==g_temp.isTransInited)return!1;g_objParent.removeClass("ug-tiles-transition-active"),g_objParent.addClass("ug-tiles-rest-mode")}function doAfterTransition(){!0==g_temp.isTransActive?(setTimeout(function(){g_objTileDesign.enableEvents(),g_objTileDesign.triggerSizeChangeEventAllTiles(),doAfterTransition_setClasses()},800),g_temp.handle&&clearTimeout(g_temp.handle),g_temp.handle=setTimeout(function(){doAfterTransition_setClasses(),g_objTileDesign.triggerSizeChangeEventAllTiles(),g_temp.handle=null},2e3)):(g_objTileDesign.triggerSizeChangeEventAllTiles(),doAfterTransition_setClasses())}function fillTilesVars_countWidthByCols(){g_vars.colWidth=(g_vars.availWidth-g_vars.colGap*(g_vars.numCols-1))/g_vars.numCols,g_vars.colWidth=Math.floor(g_vars.colWidth),g_vars.totalWidth=g_functions.getSpaceByNumItems(g_vars.numCols,g_vars.colWidth,g_vars.colGap)}function fillTilesVars(){if(g_vars.colWidth=g_options.tiles_col_width,g_vars.minCols=g_options.tiles_min_columns,g_vars.maxCols=g_options.tiles_max_columns,!1==g_gallery.isMobileMode()?g_vars.colGap=g_options.tiles_space_between_cols:g_vars.colGap=g_options.tiles_space_between_cols_mobile,g_vars.galleryWidth=getParentWidth(),g_vars.availWidth=g_vars.galleryWidth,!0==g_options.tiles_include_padding&&(g_vars.availWidth=g_vars.galleryWidth-2*g_vars.colGap),!0==g_options.tiles_exact_width)g_vars.numCols=g_functions.getNumItemsInSpace(g_vars.availWidth,g_vars.colWidth,g_vars.colGap),g_vars.maxCols>0&&g_vars.numCols>g_vars.maxCols&&(g_vars.numCols=g_vars.maxCols),g_vars.numCols<g_vars.minCols?(g_vars.numCols=g_vars.minCols,fillTilesVars_countWidthByCols()):g_vars.totalWidth=g_vars.numCols*(g_vars.colWidth+g_vars.colGap)-g_vars.colGap;else{var numCols=g_functions.getNumItemsInSpaceRound(g_vars.availWidth,g_vars.colWidth,g_vars.colGap);numCols<g_vars.minCols?numCols=g_vars.minCols:0!=g_vars.maxCols&&numCols>g_vars.maxCols&&(numCols=g_vars.maxCols),g_vars.numCols=numCols,fillTilesVars_countWidthByCols()}switch(g_options.tiles_align){case"center":default:g_vars.addX=Math.round((g_vars.galleryWidth-g_vars.totalWidth)/2);break;case"left":g_vars.addX=0;break;case"right":g_vars.addX=g_vars.galleryWidth-g_vars.totalWidth}for(col=0,g_vars.arrPosx=[];col<g_vars.numCols;col++){var colX=g_functions.getColX(col,g_vars.colWidth,g_vars.colGap);g_vars.arrPosx[col]=colX+g_vars.addX}}function initColHeights(){g_vars.maxColHeight=0,g_vars.colHeights=[0]}function getTilesMinCol(){var numCol=0,minHeight=999999999;for(col=0;col<g_vars.numCols;col++){if(void 0==g_vars.colHeights[col]||0==g_vars.colHeights[col])return col;g_vars.colHeights[col]<minHeight&&(numCol=col,minHeight=g_vars.colHeights[col])}return numCol}function placeTile(objTile,toShow,setGalleryHeight,numCol){if(null==numCol)var numCol=getTilesMinCol();var posy=0;void 0!==g_vars.colHeights[numCol]&&(posy=g_vars.colHeights[numCol]);var itemHeight=g_objTileDesign.getTileHeightByWidth(g_vars.colWidth,objTile);if(null===itemHeight){if(!0==g_options.tiles_enable_transition)throw new Error("Can't know tile height, please turn off transition");itemHeight=g_functions.getElementSize(objTile).height}var posx=g_vars.arrPosx[numCol];g_functions.placeElement(objTile,posx,posy);var realHeight=posy+itemHeight;g_vars.colHeights[numCol]=realHeight+g_vars.colGap,g_vars.maxColHeight<realHeight&&(g_vars.maxColHeight=realHeight),!0==toShow&&objTile.show().fadeTo(0,1),!0==setGalleryHeight&&g_objParent.height(g_vars.maxColHeight)}function placeTiles(toShow){toShow||(toShow=!1),fillTilesVars(),initColHeights();var objThumbs=g_thumbs.getThumbs(g_thumbs.type.GET_THUMBS_RATIO);doBeforeTransition(),g_objTileDesign.resizeAllTiles(g_vars.colWidth,g_objTileDesign.resizemode.VISIBLE_ELEMENTS,objThumbs);for(var index=0;index<objThumbs.length;index++){var objTile=jQuery(objThumbs[index]),col=void 0;!0==g_options.tiles_keep_order&&(col=g_functions.getColByIndex(g_vars.numCols,index)),placeTile(objTile,toShow,!1,col)}doAfterTransition();var galleryHeight=g_objParent.height();!0==g_temp.isTransActive&&galleryHeight>g_vars.maxColHeight?setTimeout(function(){g_objParent.height(g_vars.maxColHeight)},700):g_objParent.height(g_vars.maxColHeight)}function isOrderedTilePlaceAlowed(objTile){var index=objTile.index();if(!0===g_gallery.getItem(index).ordered_placed)return!1;var prevIndex=g_functions.getPrevRowSameColIndex(index,g_vars.numCols);return prevIndex<0|| !0===g_gallery.getItem(prevIndex).ordered_placed}function placeOrderedTile(objTile,isForce){if(!0!==isForce&& !1==isOrderedTilePlaceAlowed(objTile))return!1;var index=objTile.index(),col=g_functions.getColByIndex(g_vars.numCols,index),objItem=g_gallery.getItem(index);g_objTileDesign.resizeTile(objTile,g_vars.colWidth),placeTile(objTile,!0,!0,col),objItem.ordered_placed=!0;var numItems=g_gallery.getNumItems(),nextIndex=g_functions.getNextRowSameColIndex(index,g_vars.numCols);if(nextIndex>=numItems)return!1;var nextTile=g_thumbs.getThumbByIndex(nextIndex),nextItem=g_gallery.getItem(nextIndex);g_thumbs.isThumbLoaded(nextTile),g_thumbs.isThumbLoaded(nextTile)&&!nextItem.ordered_placed&&placeOrderedTile(nextTile,!0)}function onSingleImageLoad(objImage,isError){if(!0==isError)return!1;objImage=jQuery(objImage);var objTile=jQuery(objImage).parent();g_thumbs.triggerImageLoadedEvent(objTile,objImage),!0==g_options.tiles_keep_order?placeOrderedTile(objTile):(g_objTileDesign.resizeTile(objTile,g_vars.colWidth),placeTile(objTile,!0,!0))}function runColumnsType(){var objThumbs=g_thumbs.getThumbs(g_thumbs.type.GET_THUMBS_NO_RATIO);if(!objThumbs||0==objThumbs.length)return!1;if(g_temp.isAllLoaded=!1,!0==g_temp.isFirstPlaced){fillTilesVars(),initColHeights();var diffWidth=Math.abs(g_vars.galleryWidth-g_vars.totalWidth);if(!0==g_options.tiles_set_initial_height&& !1==g_functions.isScrollbarExists()&&diffWidth<25){objThumbs.length;var estimateHeight=Math.ceil(objThumbs.length/g_vars.numCols)*g_options.tiles_col_width*.75;g_objParent.height(estimateHeight),fillTilesVars()}}objThumbs.fadeTo(0,0);var objImages=objThumbs.find("img.ug-thumb-image"),initNumCols=g_vars.numCols,initWidth=g_vars.galleryWidth;g_functions.checkImagesLoaded(objImages,function(){fillTilesVars(),(initNumCols!=g_vars.numCols||initWidth!=g_vars.galleryWidth)&&placeTiles(!1),setTransition(),g_objThis.trigger(t.events.ALL_TILES_LOADED)},function(a,b){!0==g_temp.isFirstPlaced&&g_gallery.triggerEvent(t.events.TILES_FIRST_PLACED),onSingleImageLoad(a,b)})}function getJustifiedData(){var galleryWidth=getParentWidth(),objTiles=g_thumbs.getThumbs(!0),rowHeightOpt=g_options.tiles_justified_row_height,arrWidths=[],totalWidth=0,gap=g_options.tiles_justified_space_between,numTiles=objTiles.length;jQuery.each(objTiles,function(d,a){a=jQuery(a);var b=g_thumbs.getItemByThumb(a),c=b.thumbWidth;b.thumbHeight!==rowHeightOpt&&(c=Math.floor(b.thumbRatioByWidth*rowHeightOpt)),arrWidths[d]=c,totalWidth+=c});var numRows=Math.ceil(totalWidth/galleryWidth);numRows>numTiles&&(numRows=numTiles);var finalRowWidth=totalWidth/numRows,arrRows=[],eachRowWidth=0,rowsWidths=[],row=[],progressWidth=0,numRow=0;jQuery.each(objTiles,function(b,c){var a=arrWidths[b];progressWidth+a/2>(numRow+1)*finalRowWidth&&(rowsWidths[arrRows.length]=eachRowWidth,arrRows.push(row),row=[],eachRowWidth=0,numRow++),progressWidth+=a,eachRowWidth+=a,row.push(c)}),rowsWidths[arrRows.length]=eachRowWidth,arrRows.push(row);var arrRowWidths=[],arrRowHeights=[],totalHeight=0;return jQuery.each(arrRows,function(a,b){b.length;var f=rowsWidths[a],d=(b.length-1)*gap,c=Math.round(rowHeightOpt*((galleryWidth-d)/f));totalHeight+=c,a>0&&(totalHeight+=gap),arrRowHeights.push(c);var h=c/rowHeightOpt,e=[],g=d;jQuery.each(b,function(b,c){var a=Math.round(arrWidths[jQuery(c).index()]*h);e[b]=a,g+=a});var i=g-galleryWidth;jQuery.each(e,function(a,b){if(0==i)return!1;i<0?(e[a]=b+1,i++):(e[a]=b-1,i--),a==e.length-1&&0!=i&&(e[a]-=i)}),arrRowWidths[a]=e}),{arrRows:arrRows,arrRowWidths:arrRowWidths,arrRowHeights:arrRowHeights,gap:gap,totalHeight:totalHeight}}function placeJustified(toShow){if(!toShow)var toShow=!1;var parentWidth=getParentWidth(),objData=getJustifiedData();g_objParent.height(objData.totalHeight),getParentWidth()!=parentWidth&&(objData=getJustifiedData()),doBeforeTransition();var posy=0,totalWidth=0;jQuery.each(objData.arrRows,function(a,b){var d=objData.arrRowWidths[a],c=objData.arrRowHeights[a],e=0;jQuery.each(b,function(g,a){var b=jQuery(a),h=c,f=d[g];g_objTileDesign.resizeTile(b,f,h,g_objTileDesign.resizemode.VISIBLE_ELEMENTS),g_functions.placeElement(b,e,posy),(e+=f)>totalWidth&&(totalWidth=e),e+=objData.gap,!0==toShow&&jQuery(a).show()}),posy+=c+objData.gap}),doAfterTransition()}function runJustifiedType(){var objImages=jQuery(g_objWrapper).find("img.ug-thumb-image"),objTiles=g_thumbs.getThumbs();g_temp.isAllLoaded=!1,objTiles.fadeTo(0,0),g_functions.checkImagesLoaded(objImages,function(){setTimeout(function(){placeJustified(!0),objTiles.fadeTo(0,1),g_gallery.triggerEvent(t.events.TILES_FIRST_PLACED),setTransition(),g_objThis.trigger(t.events.ALL_TILES_LOADED)})},function(a,c){a=jQuery(a);var b=jQuery(a).parent();g_thumbs.triggerImageLoadedEvent(b,a)})}function runNestedType(){var objImages=jQuery(g_objWrapper).find("img.ug-thumb-image"),objTiles=g_thumbs.getThumbs();g_temp.isAllLoaded=!1,objTiles.fadeTo(0,0),g_functions.checkImagesLoaded(objImages,function(){!0==g_gallery.isMobileMode()?placeTiles(!0):placeNestedImages(!0),g_gallery.triggerEvent(t.events.TILES_FIRST_PLACED),setTransition(),g_objThis.trigger(t.events.ALL_TILES_LOADED)},function(a,c){a=jQuery(a);var b=jQuery(a).parent();g_thumbs.triggerImageLoadedEvent(b,a)})}function fillNestedVars(){var galleryWidth=getParentWidth();switch(g_nestedWork.galleryWidth=galleryWidth,g_arrNestedGridRow={},g_nestedWork.colWidth=g_options.tiles_nested_col_width,g_nestedWork.optimalTileWidth=g_options.tiles_nested_optimal_tile_width,g_nestedWork.currentGap=g_options.tiles_space_between_cols,!0==g_gallery.isMobileMode()&&(g_nestedWork.currentGap=g_options.tiles_space_between_cols_mobile),null==g_nestedWork.colWidth?g_nestedWork.colWidth=Math.floor(g_nestedWork.optimalTileWidth/g_nestedWork.nestedOptimalCols):g_nestedWork.optimalTileWidth>g_nestedWork.colWidth?g_nestedWork.nestedOptimalCols=Math.ceil(g_nestedWork.optimalTileWidth/g_nestedWork.colWidth):g_nestedWork.nestedOptimalCols=1,g_nestedWork.maxColumns=g_functions.getNumItemsInSpace(galleryWidth,g_nestedWork.colWidth,g_nestedWork.currentGap),g_nestedWork.colWidth=g_functions.getItemSizeInSpace(galleryWidth,g_nestedWork.maxColumns,g_nestedWork.currentGap),g_nestedWork.gridY=0,g_arrNestedItems=[],g_thumbs.getThumbs(!0).each(function(){var a=jQuery(this),b=setNestedSize(a);g_arrNestedItems.push(b)}),g_nestedWork.optimalTileWidth>g_nestedWork.colWidth?g_nestedWork.nestedOptimalCols=Math.ceil(g_nestedWork.optimalTileWidth/g_nestedWork.colWidth):g_nestedWork.nestedOptimalCols=1,g_nestedWork.totalWidth=g_nestedWork.maxColumns*(g_nestedWork.colWidth+g_nestedWork.currentGap)-g_nestedWork.currentGap,g_options.tiles_align){case"center":default:g_nestedWork.addX=Math.round((g_nestedWork.galleryWidth-g_nestedWork.totalWidth)/2);break;case"left":g_nestedWork.addX=0;break;case"right":g_nestedWork.addX=g_nestedWork.galleryWidth-g_nestedWork.totalWidth}g_nestedWork.maxGridY=0}function placeNestedImages(toShow){var parentWidth=getParentWidth();fillNestedVars(),placeNestedImagesCycle();var totalHeight=g_nestedWork.maxGridY*(g_nestedWork.colWidth+g_nestedWork.currentGap)-g_nestedWork.currentGap;g_objParent.height(totalHeight),getParentWidth()!=parentWidth&&(fillNestedVars(),placeNestedImagesCycle()),!1==g_options.tiles_nested_debug&&drawNestedImages(toShow)}function setNestedSize(objTile){var dimWidth,dimHeight,output={},colWidth=g_nestedWork.colWidth,gapWidth=g_nestedWork.currentGap,objImageSize=g_objTileDesign.getTileImageSize(objTile),maxDim=Math.ceil(getPresettedRandomByWidth(objTile.index())*(1*g_nestedWork.nestedOptimalCols/3)+2*g_nestedWork.nestedOptimalCols/3),imgWidth=objImageSize.width,imgHeight=objImageSize.height,ratio=imgWidth/imgHeight;return imgWidth>imgHeight?0==(dimHeight=Math.round((dimWidth=maxDim)/ratio))&&(dimHeight=1):0==(dimWidth=Math.round((dimHeight=maxDim)*ratio))&&(dimWidth=1),output.dimWidth=dimWidth,output.dimHeight=dimHeight,output.width=dimWidth*colWidth+gapWidth*(dimWidth-1),output.height=dimHeight*colWidth+gapWidth*(dimHeight-1),output.imgWidth=imgWidth,output.imgHeight=imgHeight,output.left=0,output.top=0,output}function getPresettedRandomByWidth(index){return Math.abs(Math.sin(Math.abs(1e3*Math.sin(index))))}function placeNestedImagesDebug(toShow,placeOne){if(!1==placeOne){for(var i=g_nestedWork.currentItem;i<g_arrNestedItems.length;i++)placeNestedImage(i,!0);g_nestedWork.currentItem=g_arrNestedItems.length-1}else placeNestedImage(g_nestedWork.currentItem,!0);for(var i=0;i<=g_nestedWork.currentItem;i++)drawNestedImage(i,!0);g_nestedWork.currentItem++}function placeNestedImagesCycle(placeOne){if(!0==g_options.tiles_nested_debug)return void 0===placeOne&&(placeOne=!0),placeNestedImagesDebug(!0,placeOne),!1;for(var i=0;i<g_arrNestedItems.length;i++)placeNestedImage(i,!0)}function placeNestedImage(tileID,toShow){if(!toShow)var toShow=!1;g_nestedWork.maxColHeight=0;for(var rowsValue=g_functions.getObjectLength(g_arrNestedGridRow),row=g_nestedWork.gridY;row<=rowsValue+1;row++){for(var column=0;column<g_nestedWork.maxColumns;column++)if(!1==isGridRowExists(g_nestedWork.gridY)|| !1==isGridCellTaken(g_nestedWork.gridY,column)){var totalFree=getTotalFreeFromPosition(column);calculateOptimalStretchAndPosition(tileID,totalFree,column);return}g_nestedWork.gridY++}}function calculateOptimalStretchAndPosition(tileID,totalFree,column){var sizes=jQuery.extend(!0,{},g_arrNestedItems[tileID]),currentWidth=sizes.dimWidth,placeForNextImage=totalFree-sizes.dimWidth,optimalWidth=g_nestedWork.nestedOptimalCols;if(totalFree<=sizes.dimWidth||placeForNextImage<=.33*optimalWidth||totalFree<=optimalWidth)resizeToNewWidth(tileID,totalFree);else if(placeForNextImage<=optimalWidth)optimalWidth>=4?!0==isGridImageAligned(Math.floor(totalFree/2),column)?resizeToNewWidth(tileID,Math.floor(totalFree/2)+1):resizeToNewWidth(tileID,Math.floor(totalFree/2)):resizeToNewWidth(objImage,totalFree);else if(!0==isGridImageAligned(currentWidth,column))switch(currentWidth>=optimalWidth){case!0:resizeToNewWidth(tileID,currentWidth-1);break;case!1:resizeToNewWidth(tileID,currentWidth+1)}sizes=jQuery.extend(!0,{},g_arrNestedItems[tileID]);var columnInfo=getGridColumnHeight(tileID,sizes.dimWidth,column);if(g_nestedWork.columnsValueToEnableHeightResize<=columnInfo[0]&&g_nestedWork.maxColumns>=2*g_nestedWork.nestedOptimalCols){var sideHelper=getGridImageVerticalDifference(column,sizes),columnSizes=resizeToNewHeight(tileID,sideHelper.newHeight,!0);g_arrNestedItems[tileID].dimHeight=columnSizes.dimHeight;var columnResizes=redistributeColumnItems(columnInfo,columnSizes.dimWidth,column),columnCrosshairs=getColumnCrosshairsCount(columnResizes),disableColumnResizes=!1;columnCrosshairs>=2&&(disableColumnResizes=!0),sideHelper.newHeight>=sizes.dimHeight&&(sizes=resizeToNewHeight(tileID,sideHelper.newHeight,!0));var sideResizes=getSideResizeInfo(sideHelper.idToResize,sideHelper.newHeight,sizes.dimHeight);sizes.top=g_nestedWork.gridY,sizes.left=column,sideResizes.push({tileID:tileID,sizes:sizes});var sideResizesVal=calcResizeRatio(sideResizes),columnResizesVal=calcResizeRatio(columnResizes);if(sideResizesVal<columnResizesVal|| !0==disableColumnResizes){applyResizes(sideResizes);return}applyResizes(columnResizes);return}sizes.left=column,sizes.top=g_nestedWork.gridY,g_arrNestedItems[tileID]=sizes,putImageToGridRow(tileID,sizes,column,g_nestedWork.gridY),g_nestedWork.maxGridY=sizes.top+sizes.dimHeight}function getColumnCrosshairsCount(tilesAndSizes){for(var crosshairsCountR=0,crosshairsCountL=0,i=0;i<tilesAndSizes.length-1;i++){var sizes=tilesAndSizes[i].sizes,topItem=-1,bottomItem=-1;isGridRowExists(sizes.top+sizes.dimHeight)&&g_nestedWork.maxColumns>sizes.left+sizes.dimWidth&&(topItem=g_arrNestedGridRow[sizes.top+sizes.dimHeight-1][sizes.left+sizes.dimWidth],bottomItem=g_arrNestedGridRow[sizes.top+sizes.dimHeight][sizes.left+sizes.dimWidth]),topItem!=bottomItem&&crosshairsCountR++}for(var i=0;i<tilesAndSizes.length-1;i++){var sizes=tilesAndSizes[i].sizes,topItem=-1,bottomItem=-1;isGridRowExists(sizes.top+sizes.dimHeight)&&sizes.left-1>=0&&(topItem=g_arrNestedGridRow[sizes.top+sizes.dimHeight-1][sizes.left-1],bottomItem=g_arrNestedGridRow[sizes.top+sizes.dimHeight][sizes.left-1]),topItem!=bottomItem&&crosshairsCountL++}return Math.max(crosshairsCountL,crosshairsCountR)}function getSideResizeInfo(idToResize,newHeight,dimHeight){var currentTile=g_arrNestedItems[idToResize],tileHeight=currentTile.dimHeight;currentTile.dimWidth;var tileLeft=currentTile.left,tileTop=currentTile.top;parseInt(tileTop/(g_nestedWork.colWidth+g_nestedWork.currentGap)),parseInt(tileLeft/(g_nestedWork.colWidth+g_nestedWork.currentGap));var newSideHeight=tileHeight-newHeight+dimHeight,sideSizes=resizeToNewHeight(idToResize,newSideHeight,!0),output=[];return output.push({tileID:idToResize,sizes:sideSizes}),output}function applyResizes(resizeTilesAndSizes){for(var i=0;i<resizeTilesAndSizes.length;i++){var sizes=resizeTilesAndSizes[i].sizes,tileID=resizeTilesAndSizes[i].tileID;g_arrNestedItems[tileID]=jQuery.extend(!0,{},sizes),putImageToGridRow(tileID,sizes,sizes.left,sizes.top)}}function redistributeColumnItems(columnInfo,columnWidth){for(var originalHeight=0,columnHeight=0,objTiles=[],cordX=0,cordY=0,i=0;i<columnInfo[1].length;i++){var tileID=columnInfo[1][i],currentTile=g_arrNestedItems[columnInfo[1][i]];if(columnHeight+=currentTile.dimHeight,0==i){var sizes=resizeToNewWidth(tileID,columnWidth,!0);originalHeight+=sizes.dimHeight,objTiles.push([columnInfo[1][i],sizes.dimHeight]);continue}originalHeight+=currentTile.dimHeight,objTiles.push([tileID,currentTile.dimHeight])}cordX=currentTile.left,cordY=currentTile.top;for(var tempHeight=columnHeight,output=[],i=objTiles.length-1;i>=0;i--){var newHeight,tileID=objTiles[i][0];0!=i?(tempHeight-=newHeight=Math.max(Math.round(1*columnHeight/3),Math.floor(objTiles[i][1]*(columnHeight/originalHeight))),sizes=resizeToNewHeight(tileID,newHeight,!0),sizes.left=cordX,sizes.top=cordY,output.push({tileID:tileID,sizes:sizes}),cordY+=sizes.dimHeight):((sizes=resizeToNewHeight(tileID,newHeight=tempHeight,!0)).left=cordX,sizes.top=cordY,output.push({tileID:tileID,sizes:sizes}))}return output}function getGridColumnHeight(tileID,dimWidth,column){var tempY=g_nestedWork.gridY-1,curImage=0,prevImage=0,columnHeight=1,imagesIDs=[],toReturn=[];if(imagesIDs.push(tileID),tempY>=0){for(prevImage=0;tempY>=0&&(curImage=g_arrNestedGridRow[tempY][column],(void 0===g_arrNestedGridRow[tempY][column-1]||g_arrNestedGridRow[tempY][column-1]!=g_arrNestedGridRow[tempY][column])&&(void 0===g_arrNestedGridRow[tempY][column+dimWidth]||g_arrNestedGridRow[tempY][column+dimWidth-1]!=g_arrNestedGridRow[tempY][column+dimWidth])&&g_arrNestedGridRow[tempY][column]==g_arrNestedGridRow[tempY][column+dimWidth-1]);)prevImage!=curImage&&(columnHeight++,imagesIDs.push(curImage)),tempY--,prevImage=curImage;return toReturn.push(columnHeight),toReturn.push(imagesIDs),toReturn}return[0,[]]}function getGridImageVerticalDifference(column,sizes){var newHeightR=0,newHeightL=0,dimWidth=sizes.dimWidth,dimHeight=sizes.dimHeight,leftID=0,rightID=0,array=jQuery.map(g_arrNestedGridRow,function(a,b){return[a]});if(void 0===array[g_nestedWork.gridY]|| void 0===array[g_nestedWork.gridY][column-1])newHeightL=0;else for(var tempY=0;;)if(void 0!==g_arrNestedGridRow[g_nestedWork.gridY+tempY]&& -1!=g_arrNestedGridRow[g_nestedWork.gridY+tempY][column-1])leftID=g_arrNestedGridRow[g_nestedWork.gridY+tempY][column-2],tempY++,newHeightL++;else break;if(void 0===array[g_nestedWork.gridY]|| void 0===array[g_nestedWork.gridY][column+dimWidth])newHeightR=0;else for(tempY=0;;)if(void 0!==g_arrNestedGridRow[g_nestedWork.gridY+tempY]&& -1!=g_arrNestedGridRow[g_nestedWork.gridY+tempY][column+dimWidth])rightID=g_arrNestedGridRow[g_nestedWork.gridY+tempY][column+dimWidth+1],tempY++,newHeightR++;else break;var newHeight=0,idToResize=0;return Math.abs(dimHeight-newHeightL)<Math.abs(dimHeight-newHeightR)&&0!=newHeightL?(newHeight=newHeightL,idToResize=leftID):0!=newHeightR?(newHeight=newHeightR,idToResize=rightID):newHeight=dimHeight,{newHeight:newHeight,idToResize:idToResize}}function resizeToNewWidth(tileID,newDimWidth,toReturn){toReturn||(toReturn=!1);var colWidth=g_nestedWork.colWidth,gapWidth=g_nestedWork.currentGap,currentTile=g_arrNestedItems[tileID],imgWidth=currentTile.imgWidth,imgHeight=currentTile.imgHeight,ratio=imgWidth/imgHeight;if(dimHeight=Math.round((dimWidth=newDimWidth)/ratio),!0==toReturn){var sizes=jQuery.extend(!0,{},currentTile);return sizes.dimWidth=dimWidth,sizes.dimHeight=dimHeight,sizes.width=dimWidth*colWidth+gapWidth*(dimWidth-1),sizes.height=dimHeight*colWidth+gapWidth*(dimHeight-1),sizes}currentTile.dimWidth=dimWidth,currentTile.dimHeight=dimHeight,currentTile.width=dimWidth*colWidth+gapWidth*(dimWidth-1),currentTile.height=dimHeight*colWidth+gapWidth*(dimHeight-1)}function resizeToNewHeight(tileID,newDimHeight,toReturn){toReturn||(toReturn=!1);var currentTile=g_arrNestedItems[tileID],dimWidth=currentTile.dimWidth,colWidth=g_nestedWork.colWidth,gapWidth=g_nestedWork.currentGap;if(!0==toReturn){var sizes=jQuery.extend(!0,{},currentTile);return sizes.dimHeight=newDimHeight,sizes.width=dimWidth*colWidth+gapWidth*(dimWidth-1),sizes.height=newDimHeight*colWidth+gapWidth*(newDimHeight-1),sizes}currentTile.dimHeight=newDimHeight,currentTile.width=dimWidth*colWidth+gapWidth*(dimWidth-1),currentTile.height=newDimHeight*colWidth+gapWidth*(newDimHeight-1)}function calcResizeRatio(objTilesAndSizes){for(var tempResizes=0,tempNum=0,i=0;i<objTilesAndSizes.length;i++){var sizes=g_arrNestedItems[objTilesAndSizes[i].tileID];if(0==sizes.dimHeight||0==sizes.height)return;(resizeVal=sizes.dimWidth/sizes.dimHeight/(sizes.imgWidth/sizes.imgHeight))<1&&(resizeVal=1/resizeVal),tempResizes+=resizeVal,tempNum++}return tempResizes/tempNum}function isGridImageAligned(dimWidth,column){var y=g_nestedWork.gridY-1;return!(y<=0)&& !1!=isGridRowExists(y)&&g_arrNestedGridRow[y][column+dimWidth-1]!=g_arrNestedGridRow[y][column+dimWidth]}function getTotalFreeFromPosition(column){var x=column,totalFree=0;if(!0==isGridRowExists(g_nestedWork.gridY))for(;!1==isGridCellTaken(g_nestedWork.gridY,x);)totalFree++,x++;else totalFree=g_nestedWork.maxColumns;return totalFree}function isGridRowExists(y){return void 0!==g_arrNestedGridRow[y]}function putImageToGridRow(id,sizes,gridX,gridY){for(var y=0;y<sizes.dimHeight;y++)for(var x=0;x<sizes.dimWidth;x++)0==isGridRowExists(gridY+y)&&addGridRow(gridY+y),setGridCellValue(gridY+y,gridX+x,id)}function addGridRow(y){g_arrNestedGridRow[y]=new Object;for(var t=0;t<g_nestedWork.maxColumns;t++)g_arrNestedGridRow[y][t]=-1}function isGridCellTaken(y,x){return -1!=g_arrNestedGridRow[y][x]}function setGridCellValue(y,x,value){g_arrNestedGridRow[y][x]=value}function drawNestedImages(toShow){if(!toShow)var toShow=!1;doBeforeTransition();for(var i=0;i<g_arrNestedItems.length;i++)drawNestedImage(i,toShow);g_objParent.height(g_nestedWork.maxColHeight),doAfterTransition()}function drawNestedImage(i,toShow){var objTile=g_thumbs.getThumbByIndex(i),sizes=g_arrNestedItems[i],newY=sizes.top*(g_nestedWork.colWidth+g_nestedWork.currentGap),newX=g_nestedWork.addX+sizes.left*(g_nestedWork.colWidth+g_nestedWork.currentGap);g_objTileDesign.resizeTile(objTile,sizes.width,sizes.height,g_objTileDesign.resizemode.VISIBLE_ELEMENTS),g_functions.placeElement(objTile,newX,newY),newY+sizes.height>g_nestedWork.maxColHeight&&(g_nestedWork.maxColHeight=newY+sizes.height),!0==toShow&&objTile.fadeTo(0,1)}function onResize(){if(!0==g_temp.isFirstTimeRun)return!0;if(!1==g_temp.isAllLoaded)return!1;switch(g_options.tiles_type){case"columns":placeTiles(!1);break;case"justified":placeJustified(!1);break;case"nested":!0==g_gallery.isMobileMode()?placeTiles(!1):placeNestedImages(!1)}}function initEvents(){g_objThis.on(t.events.ALL_TILES_LOADED,function(){g_temp.isAllLoaded=!0}),g_objGallery.on(g_gallery.events.SIZE_CHANGE,onResize),g_objGallery.on(t.events.TILES_FIRST_PLACED,function(){g_temp.isFirstPlaced=!1}),g_objTileDesign.initEvents()}function run(){switch(g_objWrapper.children(".ug-tile").show(),!0==g_temp.isFirstTimeRun&&initEvents(),g_objTileDesign.run(),g_options.tiles_type){default:case"columns":runColumnsType();break;case"justified":runJustifiedType();break;case"nested":runNestedType()}g_temp.isFirstTimeRun=!1}this.destroy=function(){g_objGallery.off(g_gallery.events.SIZE_CHANGE),g_objTileDesign.destroy(),g_objGallery.off(t.events.TILES_FIRST_PLACED)},this.init=function(a,b){init(a,b)},this.setHtml=function(a){setHtml(a)},this.getObjTileDesign=function(){return g_objTileDesign},this.run=function(){run()},this.runNewItems=function(){if(!g_objParent)throw new Error("Can't run new items - parent not set");if(g_objTileDesign.setHtml(g_objParent,!0),g_objTileDesign.run(!0),"columns"===g_options.tiles_type)runColumnsType();else throw new Error("Tiles type: "+g_options.tiles_type+" not support load more yet")}}function UGAviaControl(){var g_parent,g_gallery,g_objects,g_objStrip,g_objStripInner,g_options,g_isVertical,g_temp={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",isStripMoving:!1,isControlEnabled:!0,maxDpos:1e3};function setScrollType(){}function getMousePos(event){return!1==g_isVertical?event.pageX:event.pageY}function onMouseMove(event){if(!1==g_temp.isControlEnabled)return!0;if(!0==g_temp.touchEnabled)return jQuery("body").off("mousemove"),!0;g_temp.isMouseInsideStrip=g_objStrip.ismouseover();var strip_touch_active=g_parent.isTouchMotionActive();!0==g_temp.isMouseInsideStrip&& !1==strip_touch_active?moveStripToMousePosition(getMousePos(event)):stopStripMovingLoop()}function initEvents(event){jQuery("body").on("touchstart",function(a){if(!1==g_temp.isControlEnabled)return!0;g_temp.touchEnabled=!0}),jQuery("body").mousemove(onMouseMove)}function getInnerPosY(mouseY){var innerOffsetTop=g_options.strip_padding_top;g_options.strip_padding_bottom;var stripHeight=g_objStrip.height(),innerHeight=g_objStripInner.height();if(stripHeight>innerHeight)return null;var posy=mouseY-g_objStrip.offset().top-innerOffsetTop;if(posy<0)return null;var mlineStart=g_options.thumb_height,mlineEnd=stripHeight-g_options.thumb_height,mLineSize=mlineEnd-mlineStart;posy<mlineStart&&(posy=mlineStart),posy>mlineEnd&&(posy=mlineEnd);var ratio=(posy-mlineStart)/mLineSize,innerPosY=(innerHeight-stripHeight)*ratio;return -1*Math.round(innerPosY)+innerOffsetTop}function getInnerPosX(mouseX){var innerOffsetLeft=g_options.strip_padding_left,innerOffsetRight=g_options.strip_padding_right,stripWidth=g_objStrip.width()-innerOffsetLeft-innerOffsetRight,innerWidth=g_objStripInner.width();if(stripWidth>innerWidth)return null;var posx=mouseX-g_objStrip.offset().left-innerOffsetLeft,mlineStart=g_options.thumb_width,mlineEnd=stripWidth-g_options.thumb_width,mLineSize=mlineEnd-mlineStart;posx<mlineStart&&(posx=mlineStart),posx>mlineEnd&&(posx=mlineEnd);var ratio=(posx-mlineStart)/mLineSize,innerPosX=(innerWidth-stripWidth)*ratio;return -1*Math.round(innerPosX)+innerOffsetLeft}function moveStripStep(){if(!1==g_temp.is_strip_moving)return!1;var dpos,maxDpos=g_temp.maxDpos,innerPos=g_parent.getInnerStripPos();Math.floor(innerPos)==Math.floor(g_temp.strip_finalPos)&&stopStripMovingLoop();var diff=Math.abs(g_temp.strip_finalPos-innerPos);diff<1?dpos=diff:(dpos=diff/4)>0&&dpos<1&&(dpos=1),g_temp.strip_finalPos<innerPos&&(dpos*=-1),dpos>maxDpos&&(dpos=maxDpos),dpos< -maxDpos&&(dpos=-maxDpos);var newPos=innerPos+dpos;g_parent.positionInnerStrip(newPos)}function startStripMovingLoop(){if(!0==g_temp.isStripMoving)return!1;g_temp.isStripMoving=!0,g_temp.handle_timeout=setInterval(moveStripStep,10)}function stopStripMovingLoop(){if(!1==g_temp.isStripMoving)return!1;g_temp.isStripMoving=!1,g_temp.handle_timeout=clearInterval(g_temp.handle_timeout)}function getInnerPos(mousePos){return!1==g_isVertical?getInnerPosX(mousePos):getInnerPosY(mousePos)}function moveStripToMousePosition(mousePos){var innerPos=getInnerPos(mousePos);if(null===innerPos)return!1;g_temp.is_strip_moving=!0,g_temp.strip_finalPos=innerPos,startStripMovingLoop()}this.enable=function(){g_temp.isControlEnabled=!0},this.disable=function(){g_temp.isControlEnabled=!1},this.onResize=function(){setScrollType()},this.init=function(a){g_parent=a,g_objects=a.getObjects(),g_gallery=g_objects.g_gallery,g_objStrip=g_objects.g_objStrip,g_objStripInner=g_objects.g_objStripInner,g_options=g_objects.g_options,g_isVertical=g_objects.isVertical,initEvents(),setScrollType()},this.destroy=function(){jQuery("body").off("touchstart"),jQuery("body").off("mousemove")}}function UGSlider(){var g_objGallery,g_objWrapper,g_objThumbs,g_objSlider,g_objInner,g_objSlide1,g_objSlide2,g_objSlide3,g_objArrowLeft,g_objArrowRight,g_objTouchSlider,g_objZoomSlider,g_objZoomPanel,g_optionsPrefix,t=this,g_objThis=jQuery(t),g_gallery=new UniteGalleryMain,g_objButtonPlay=null,g_objButtonFullscreen=null,g_objBullets=null,g_objVideoPlayer=new UGVideoPlayer,g_functions=new UGFunctions,g_objProgress=null,g_objTextPanel=null;this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"};var g_options={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!1,slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_skin:"",slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:10,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:10,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square"},g_defaultsProgressBar={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},g_temp={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};function initSlider(objGallery,objOptions,optionsPrefix){g_gallery=objGallery,optionsPrefix&&(g_optionsPrefix=optionsPrefix,objOptions=g_functions.convertCustomPrefixOptions(objOptions,g_optionsPrefix,"slider")),g_objGallery=jQuery(objGallery);var objects=g_gallery.getObjects();if(g_objWrapper=objects.g_objWrapper,g_objThumbs=objects.g_objThumbs,objOptions.hasOwnProperty("slider_progress_indicator_type")&&(g_options.slider_progress_indicator_type=objOptions.slider_progress_indicator_type),"bar"==g_options.slider_progress_indicator_type&&(g_options=jQuery.extend(g_options,g_defaultsProgressBar)),objOptions&&t.setOptions(objOptions),processOptions(),!0==g_options.slider_enable_bullets){g_objBullets=new UGBullets;var bulletsOptions={bullets_skin:g_options.slider_bullets_skin,bullets_space_between:g_options.slider_bullets_space_between};g_objBullets.init(g_gallery,bulletsOptions)}g_options.slider_enable_text_panel&&(g_objTextPanel=new UGTextPanel).init(g_gallery,g_options,"slider"),g_options.slider_enable_zoom_panel&&(g_objZoomPanel=new UGZoomButtonsPanel).init(t,g_options);var galleryID=g_gallery.getGalleryID();g_objVideoPlayer.init(g_options,!1,galleryID)}function runSlider(){if(!0==g_temp.isRunOnce)return!1;if(g_temp.isRunOnce=!0,g_options.slider_background_color){var bgColor=g_options.slider_background_color;1!=g_options.slider_background_opacity&&(bgColor=g_functions.convertHexToRGB(bgColor,g_options.slider_background_opacity)),g_objSlider.css("background-color",bgColor)}else 1!=g_options.slider_background_opacity&&(bgColor=g_functions.convertHexToRGB("#000000",g_options.slider_background_opacity),g_objSlider.css("background-color",bgColor));!0==g_options.slider_control_swipe&&(g_objTouchSlider=new UGTouchSliderControl).init(t,g_options),!0==g_options.slider_control_zoom&&(g_objZoomSlider=new UGZoomSliderControl).init(t,g_options),g_objTextPanel&&g_objTextPanel.run(),initEvents()}function processOptions(){var galleryOptions=g_gallery.getOptions(),globalSkin=galleryOptions.gallery_skin;""==g_options.slider_bullets_skin&&(g_options.slider_bullets_skin=globalSkin),""==g_options.slider_arrows_skin&&(g_options.slider_arrows_skin=globalSkin),""==g_options.slider_zoompanel_skin&&(g_options.slider_zoompanel_skin=globalSkin),""==g_options.slider_play_button_skin&&(g_options.slider_play_button_skin=globalSkin),""==g_options.slider_fullscreen_button_skin&&(g_options.slider_fullscreen_button_skin=globalSkin),g_options.video_enable_closebutton=g_options.slider_video_enable_closebutton,"zoom"!=galleryOptions.gallery_mousewheel_role&&(g_options.slider_zoom_mousewheel=!1)}function getHtmlSlide(loaderClass,numSlide){var classVideoplay="ug-type-square";"round"==g_options.slider_videoplay_button_type&&(classVideoplay="ug-type-round");var html="";return html+="<div class='ug-slide-wrapper ug-slide"+numSlide+"'>",html+="<div class='ug-item-wrapper'></div>",html+="<div class='ug-slider-preloader "+loaderClass+"'></div>",html+="<div class='ug-button-videoplay "+classVideoplay+"' style='display:none'></div>",html+="</div>"}function setHtmlSlider(objParent){objParent&&(g_objWrapper=objParent);var loaderClass=getLoaderClass();g_gallery.getOptions();var html="<div class='ug-slider-wrapper'>";if(html+="<div class='ug-slider-inner'>",html+=getHtmlSlide(loaderClass,1),html+=getHtmlSlide(loaderClass,2),html+=getHtmlSlide(loaderClass,3),html+="</div>",!0==g_options.slider_enable_arrows){var svgArrowLeft='<svg x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g stroke-width="1" transform="translate(0.5, 0.5)"><polyline fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="square" stroke-miterlimit="10" points="21,2 11,16 21,30 " stroke-linejoin="miter"></polyline></g></svg>',svgArrowRight='<svg x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g stroke-width="1" transform="translate(0.5, 0.5)"><polyline fill="none" stroke="#ffffff" stroke-width="1" stroke-linecap="square" stroke-miterlimit="10" points="11,2 21,16 11,30 " stroke-linejoin="miter"></polyline></g></svg>';html+="<div class='ug-slider-control ug-arrow-left ug-skin-"+g_options.slider_arrows_skin+"'>"+svgArrowLeft+"</div>",html+="<div class='ug-slider-control ug-arrow-right ug-skin-"+g_options.slider_arrows_skin+"'>"+svgArrowRight+"</div>"}!0==g_options.slider_enable_play_button&&(html+="<div class='ug-slider-control ug-button-play ug-skin-"+g_options.slider_play_button_skin+"'></div>"),!0==g_options.slider_enable_fullscreen_button&&(html+="<div class='ug-slider-control ug-button-fullscreen ug-skin-"+g_options.slider_fullscreen_button_skin+"'></div>"),html+="</div>",g_objWrapper.append(html),g_objSlide1=(g_objInner=(g_objSlider=g_objWrapper.children(".ug-slider-wrapper")).children(".ug-slider-inner")).children(".ug-slide1"),g_objSlide2=g_objInner.children(".ug-slide2"),g_objSlide3=g_objInner.children(".ug-slide3"),g_objSlide1.data("slidenum",1),g_objSlide2.data("slidenum",2),g_objSlide3.data("slidenum",3),g_objBullets&&g_objBullets.appendHTML(g_objSlider),!0==g_options.slider_enable_arrows&&(g_objArrowLeft=g_objSlider.children(".ug-arrow-left"),g_objArrowRight=g_objSlider.children(".ug-arrow-right")),!0==g_options.slider_enable_play_button&&(g_objButtonPlay=g_objSlider.children(".ug-button-play")),!0==g_options.slider_enable_fullscreen_button&&(g_objButtonFullscreen=g_objSlider.children(".ug-button-fullscreen")),!0==g_options.slider_enable_progress_indicator&&("bar"==(g_objProgress=g_functions.initProgressIndicator(g_options.slider_progress_indicator_type,g_options,g_objSlider)).getType()&&"pie"==g_options.slider_progress_indicator_type&&(g_options.slider_progress_indicator_type="bar",g_options=jQuery.extend(g_options,g_defaultsProgressBar)),g_gallery.setProgressIndicator(g_objProgress)),!0==g_options.slider_enable_text_panel&&(g_objTextPanel.appendHTML(g_objSlider),!1==g_options.slider_textpanel_always_on)&&(g_objTextPanel.getElement().hide().data("isHidden",!0),g_temp.isTextPanelSaparateHover=!0),!0==g_options.slider_enable_zoom_panel&&g_objZoomPanel.appendHTML(g_objSlider),g_objVideoPlayer.setHtml(g_objInner)}function positionSlideElements(objSlide){var objPreloader=getSlidePreloader(objSlide);g_functions.placeElementInParentCenter(objPreloader);var objVideoPlayButton=getSlideVideoPlayButton(objSlide);g_functions.placeElementInParentCenter(objVideoPlayButton)}function positionElements(){if(g_objBullets&&(objBullets=g_objBullets.getElement(),g_functions.placeElement(objBullets,g_options.slider_bullets_align_hor,g_options.slider_bullets_align_vert,g_options.slider_bullets_offset_hor,g_options.slider_bullets_offset_vert),g_functions.placeElement(objBullets,g_options.slider_bullets_align_hor,g_options.slider_bullets_align_vert,g_options.slider_bullets_offset_hor,g_options.slider_bullets_offset_vert)),!0==g_options.slider_enable_arrows&&(g_functions.placeElement(g_objArrowLeft,g_options.slider_arrow_left_align_hor,g_options.slider_arrow_left_align_vert,g_options.slider_arrow_left_offset_hor,g_options.slider_arrow_left_offset_vert),g_functions.placeElement(g_objArrowRight,g_options.slider_arrow_right_align_hor,g_options.slider_arrow_left_align_vert,g_options.slider_arrow_right_offset_hor,g_options.slider_arrow_right_offset_vert)),!1==g_options.slider_controls_always_on&&hideControls(!0),g_objProgress){var objProgressElement=g_objProgress.getElement();if("bar"==g_options.slider_progress_indicator_type){var sliderWidth=g_objSlider.width();g_objProgress.setSize(sliderWidth),g_functions.placeElement(objProgressElement,"left",g_options.slider_progress_indicator_align_vert,0,g_options.slider_progress_indicator_offset_vert)}else g_functions.placeElement(objProgressElement,g_options.slider_progress_indicator_align_hor,g_options.slider_progress_indicator_align_vert,g_options.slider_progress_indicator_offset_hor,g_options.slider_progress_indicator_offset_vert)}g_objTextPanel&&g_objTextPanel.positionPanel(),placeControlsElements(),positionSlideElements(g_objSlide1),positionSlideElements(g_objSlide2),positionSlideElements(g_objSlide3),checkMobileModify()}function placeControlsElements(){if(g_objButtonPlay&&g_functions.placeElement(g_objButtonPlay,g_options.slider_play_button_align_hor,g_options.slider_play_button_align_vert,g_options.slider_play_button_offset_hor,g_options.slider_play_button_offset_vert),g_objButtonFullscreen&&g_functions.placeElement(g_objButtonFullscreen,g_options.slider_fullscreen_button_align_hor,g_options.slider_fullscreen_button_align_vert,g_options.slider_fullscreen_button_offset_hor,g_options.slider_fullscreen_button_offset_vert),g_objZoomPanel){var zoomPanelElement=g_objZoomPanel.getElement();g_functions.placeElement(zoomPanelElement,g_options.slider_zoompanel_align_hor,g_options.slider_zoompanel_align_vert,g_options.slider_zoompanel_offset_hor,g_options.slider_zoompanel_offset_vert)}}function positionSlides(){var innerWidth,posXNext,nextHasItem,prevHasItem,slides=t.getSlidesReference(),posY=0,posXPrev=0,posXCurrent=0;nextHasItem=t.isSlideHasItem(slides.objNextSlide),prevHasItem=t.isSlideHasItem(slides.objPrevSlide),prevHasItem?(posXCurrent=slides.objPrevSlide.outerWidth(),slides.objPrevSlide.css("z-index",1)):slides.objPrevSlide.hide(),posXNext=posXCurrent+slides.objCurrentSlide.outerWidth(),innerWidth=posXNext,nextHasItem?(innerWidth=posXNext+slides.objNextSlide.outerWidth(),slides.objPrevSlide.css("z-index",2)):slides.objNextSlide.hide(),slides.objCurrentSlide.css("z-index",3),g_functions.placeElement(slides.objCurrentSlide,posXCurrent,posY),g_objInner.css({left:-posXCurrent+"px",width:innerWidth+"px"}),prevHasItem&&(g_functions.placeElement(slides.objPrevSlide,posXPrev,posY),g_functions.showElement(slides.objPrevSlide)),nextHasItem&&(g_functions.showElement(slides.objNextSlide),g_functions.placeElement(slides.objNextSlide,posXNext,posY))}function resizeSlideItem(objSlide){var index=objSlide.data("index");if(void 0===index||null==index)return!1;var objItem=g_gallery.getItem(index);if(!objItem)return!1;setItemToSlide(objSlide,objItem)}function showPreloader(objPreloader){objPreloader.stop(!0).show(100)}function hidePreloader(objPreloader){objPreloader.stop(!0).hide(100)}function getImageBorderWidth(objImage,imageData){var borderWidth=g_options.slider_image_border_width;if(borderWidth<=10)return borderWidth;var imageSize=g_functions.getElementSize(objImage),imageWidth=imageSize.width,imageHeight=imageSize.height;if(imageData&&(imageData.hasOwnProperty("imageWidth")&&(imageWidth=imageData.imageWidth),imageData.hasOwnProperty("imageHeight")&&(imageHeight=imageData.imageHeight)),imageWidth<=0)return borderWidth;var totalSize=imageWidth<imageHeight?imageWidth:imageHeight;if(2*borderWidth/totalSize<g_options.slider_image_border_maxratio)return borderWidth;var borderWidth=totalSize*g_options.slider_image_border_maxratio/2;return Math.round(borderWidth)}function setImageDesign(objImage,slideType,imageData){var css={};if(!0==g_options.slider_image_border){css["border-style"]="solid";var borderWidth=getImageBorderWidth(objImage,imageData);css["border-width"]=borderWidth+"px",css["border-color"]=g_options.slider_image_border_color,css["border-radius"]=g_options.slider_image_border_radius}"image"!=slideType&& !0==g_options.slider_video_constantsize&&(css["background-color"]="#000000"),!0==g_options.slider_image_shadow&&(css["box-shadow"]="3px 3px 10px 0px #353535"),objImage.css(css)}function scaleImageConstantSize(objImage,objItem){var constantWidth=g_options.slider_video_constantsize_width,constantHeight=g_options.slider_video_constantsize_height,scaleMode=g_options.slider_video_constantsize_scalemode,objSize=g_functions.scaleImageExactSizeInParent(objImage,objItem.imageWidth,objItem.imageHeight,constantWidth,constantHeight,scaleMode);return objSize}function setImageToSlide(objSlide,objItem,isForce){var objItemWrapper=objSlide.children(".ug-item-wrapper"),objPreloader=getSlidePreloader(objSlide);if(void 0===objItem.urlImage||""==objItem.urlImage)throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");var urlImage=objItem.urlImage,currentImage=objSlide.data("urlImage");objSlide.data("urlImage",urlImage);var scaleMode=t.getScaleMode(objSlide),slideType=t.getSlideType(objSlide);objPadding=t.getObjImagePadding();var imageAlt="";if("string"==typeof objItem.description&&(imageAlt=objItem.description),currentImage==urlImage&& !0!==isForce){var objImage=objItemWrapper.children("img");objImage.attr("alt",imageAlt),(0==objItem.imageWidth||0==objItem.imageHeight)&&g_gallery.checkFillImageSize(objImage,objItem);var objImageData={};objImageData="image"!=slideType&& !0==g_options.slider_video_constantsize?scaleImageConstantSize(objImage,objItem):g_functions.scaleImageFitParent(objImage,objItem.imageWidth,objItem.imageHeight,scaleMode,objPadding),setImageDesign(objImage,slideType,objImageData),g_objThis.trigger(t.events.AFTER_PUT_IMAGE,objSlide)}else{var objImage=g_functions.placeImageInsideParent(urlImage,objItemWrapper,objItem.imageWidth,objItem.imageHeight,scaleMode,objPadding);if(objImage.attr("alt",imageAlt),!0==objItem.isBigImageLoaded){if(objImage.fadeTo(0,1),hidePreloader(objPreloader),"image"!=slideType&& !0==g_options.slider_video_constantsize)var objImageData=scaleImageConstantSize(objImage,objItem);else var objImageData=g_functions.getImageInsideParentData(objItemWrapper,objItem.imageWidth,objItem.imageHeight,scaleMode,objPadding);objImage.css("width",objImageData.imageWidth+"px"),setImageDesign(objImage,slideType,objImageData),g_objThis.trigger(t.events.AFTER_PUT_IMAGE,objSlide)}else objImage.fadeTo(0,0),showPreloader(objPreloader),objSlide.data("isLoading",!0),t.isSlideCurrent(objSlide)&&g_objThis.trigger(t.events.CURRENTSLIDE_LOAD_START),objImage.data("itemIndex",objItem.index),objImage.on("load",function(){var a=jQuery(this),f=a.data("itemIndex");a.fadeTo(0,1);var b=a.parent().parent(),d=t.getSlideType(b),g=getSlidePreloader(b),h=t.getObjImagePadding(),i=t.getScaleMode(b);hidePreloader(g),b.data("isLoading",!1),t.isSlideCurrent(b)&&g_objThis.trigger(t.events.CURRENTSLIDE_LOAD_END),g_gallery.onItemBigImageLoaded(null,a);var c=g_gallery.getItem(f),e={};"image"!=d&& !0==g_options.slider_video_constantsize?scaleImageConstantSize(a,c):e=g_functions.scaleImageFitParent(a,c.imageWidth,c.imageHeight,i,h),a.fadeTo(0,1),setImageDesign(a,d,e),g_objThis.trigger(t.events.AFTER_PUT_IMAGE,b)})}}function setItemToSlide(objSlide,objItem){try{var objItemWrapper=objSlide.children(".ug-item-wrapper");if(null==objItem)return objItemWrapper.html(""),objSlide.removeData("index"),objSlide.removeData("type"),objSlide.removeData("urlImage"),!1;objSlide.data("index"),objSlide.data("index",objItem.index),objSlide.data("type",objItem.type),!0==g_options.slider_enable_links&&"image"==objItem.type&&(objItem.link?objSlide.addClass("ug-slide-clickable"):objSlide.removeClass("ug-slide-clickable")),setImageToSlide(objSlide,objItem);var objVideoPlayButton=getSlideVideoPlayButton(objSlide);"image"===objItem.type?objVideoPlayButton.hide():objVideoPlayButton.show()}catch(error){throw void 0!==error.fileName&&"showbig"==error.fileName&&g_gallery.showErrorMessageReplaceGallery(error.message),objItemWrapper.html(""),new Error(error)}}function hideTextPanel(){if(!g_objTextPanel|| !0==isTextPanelHidden())return!1;var panelElement=g_objTextPanel.getElement(),animationTime=0;(!0==g_temp.isTextPanelSaparateHover|| !0==g_options.slider_textpanel_always_on)&&(animationTime=g_options.slider_controls_appear_duration),panelElement.stop().fadeTo(animationTime,0),panelElement.data("isHidden",!0)}function showTextPanel(){if(!g_objTextPanel|| !1==isTextPanelHidden())return!1;var panelElement=g_objTextPanel.getElement(),animationTime=0;(!0==g_temp.isTextPanelSaparateHover|| !0==g_options.slider_textpanel_always_on)&&(panelElement.show(),g_objTextPanel.positionElements(),animationTime=g_options.slider_controls_appear_duration),panelElement.stop().show().fadeTo(animationTime,1),panelElement.data("isHidden",!1)}function isTextPanelHidden(){return!1!==g_objTextPanel.getElement().data("isHidden")}function validateSlideType(type,objSlide){if(void 0==objSlide)var objSlide=t.getCurrentSlide();var slideType=t.getSlideType(objSlide);if(slideType!=type)throw new Error("Wrong slide type: "+slideType+", should be: "+type);return!0}function setVideoPlayerPosition(){var objCurrentSlide=t.getCurrentSlide(),objImage=t.getSlideImage(objCurrentSlide),slideSize=g_functions.getElementSize(objCurrentSlide),left=slideSize.left,top=slideSize.top;if(!0==g_options.slider_video_constantsize){var imageSize=g_functions.getElementSize(objImage);left+=imageSize.left,top+=imageSize.top}else left+=g_options.slider_video_padding_left,top+=g_options.slider_video_padding_top;g_objVideoPlayer.setPosition(left,top)}function setVideoPlayerConstantSize(){var videoWidth=g_options.slider_video_constantsize_width,videoHeight=g_options.slider_video_constantsize_height;g_objVideoPlayer.setSize(videoWidth,videoHeight);var videoElement=g_objVideoPlayer.getObject();setImageDesign(videoElement,"video")}function doTransition(direction,objItem,forceTransition){g_objThis.trigger(t.events.TRANSITION_START);var transition=g_options.slider_transition;switch(forceTransition&&(transition=forceTransition),t.stopSlideAction(null,!0),transition){default:case"fade":transitionFade(objItem);break;case"slide":transitionSlide(direction,objItem);break;case"lightbox_open":transitionFade(objItem,!1,!0)}}function transitionSlide(direction,objItem){if(!0==t.isAnimating())return g_temp.itemWaiting=objItem,!0;null!=g_temp.itemWaiting&&(g_temp.itemWaiting=null);var slides=t.getSlidesReference();switch(direction){case"right":setItemToSlide(slides.objPrevSlide,objItem),positionSlides();var destX=-g_functions.getElementSize(slides.objPrevSlide).left;t.switchSlideNums("right");break;case"left":setItemToSlide(slides.objNextSlide,objItem),positionSlides();var destX=-g_functions.getElementSize(slides.objNextSlide).left;t.switchSlideNums("left");break;default:throw new Error("wrong direction: "+direction)}var transSpeed=g_options.slider_transition_speed,transEasing=g_options.slider_transition_easing,animateParams={duration:transSpeed,easing:transEasing,queue:!1,always:function(){if(t.stopSlideAction(),g_objVideoPlayer.hide(),null!=g_temp.itemWaiting){var a=getSlideDirection(g_temp.itemWaiting);transitionSlide(a,g_temp.itemWaiting)}else t.placeNabourItems(),g_objThis.trigger(t.events.TRANSITION_END)}};g_objInner.animate({left:destX+"px"},animateParams)}function animateOpacity(objItem,opacity,completeFunction){completeFunction?objItem.fadeTo(g_options.slider_transition_speed,opacity,completeFunction):objItem.fadeTo(g_options.slider_transition_speed,opacity)}function transitionFade(objItem,noAnimation,noHidePlayer){if(!noAnimation)var noAnimation=!1;var slides=t.getSlidesReference();setItemToSlide(slides.objNextSlide,objItem);var objCurrentPos=g_functions.getElementSize(slides.objCurrentSlide);g_functions.placeElement(slides.objNextSlide,objCurrentPos.left,objCurrentPos.top);var currentNum=g_temp.numCurrent;(g_temp.numCurrent=g_temp.numNext,g_temp.numNext=currentNum,g_objThis.trigger(t.events.ITEM_CHANGED),slides.objNextSlide.stop(!0),slides.objCurrentSlide.stop(!0),!0==noAnimation)?(slides.objCurrentSlide.fadeTo(0,0),slides.objNextSlide.fadeTo(0,1),t.placeNabourItems(),g_objThis.trigger(t.events.TRANSITION_END),!0!==noHidePlayer&&g_objVideoPlayer.hide()):(slides.objNextSlide.fadeTo(0,0),animateOpacity(slides.objCurrentSlide,0,function(){t.placeNabourItems(),g_objThis.trigger(t.events.TRANSITION_END),!0!==noHidePlayer&&g_objVideoPlayer.hide()}),!0==g_objVideoPlayer.isVisible()&&animateOpacity(g_objVideoPlayer.getObject(),0),animateOpacity(slides.objNextSlide,1))}function modifyForMobile(){!0==g_options.slider_fullscreen_button_mobilehide&&g_objButtonFullscreen&&g_objButtonFullscreen.hide(),!0==g_options.slider_play_button_mobilehide&&g_objButtonPlay&&g_objButtonPlay.hide(),!0==g_options.slider_zoompanel_mobilehide&&g_objZoomPanel&&g_objZoomPanel.getElement().hide()}function modifyForDesctop(){!0==g_options.slider_fullscreen_button_mobilehide&&g_objButtonFullscreen&&g_objButtonFullscreen.show(),!0==g_options.slider_play_button_mobilehide&&g_objButtonPlay&&g_objButtonPlay.show(),!0==g_options.slider_zoompanel_mobilehide&&g_objZoomPanel&&g_objZoomPanel.getElement().show()}function checkMobileModify(){g_gallery.isMobileMode()?modifyForMobile():modifyForDesctop()}function getControlsObjects(){return g_objSlider.children(".ug-slider-control")}function hideControls(noAnimation){if(!1==g_functions.isTimePassed("sliderControlsToggle")|| !1==g_temp.isControlsVisible)return!1;if(!noAnimation)var noAnimation=!1;var objControls=getControlsObjects();!0===noAnimation?objControls.stop().fadeTo(0,0).hide():objControls.stop().fadeTo(g_options.slider_controls_appear_duration,0,function(){objControls.hide()}),g_temp.isControlsVisible=!1}function showControls(noAnimation){if(!1==g_functions.isTimePassed("sliderControlsToggle"))return!1;if(!0==g_temp.isControlsVisible)return!0;if(!noAnimation)var noAnimation=!1;var objControls=getControlsObjects();!0===noAnimation?objControls.stop().show():(objControls.stop().show().fadeTo(0,0),objControls.fadeTo(g_options.slider_controls_appear_duration,1)),g_temp.isControlsVisible=!0}function toggleControls(){!1==g_temp.isControlsVisible?showControls():hideControls()}function setControlsMode(mode){if(mode==g_temp.currentControlsMode)return!1;switch(mode){case"image":g_objZoomPanel&&g_objZoomPanel.getElement().show();break;case"video":g_objZoomPanel&&g_objZoomPanel.getElement().hide();break;default:throw new Error("wrong controld mode: "+mode)}g_temp.currentControlsMode=mode}function onItemChange(data,arg_objItem,role){var objItem=g_gallery.getSelectedItem();t.setItem(objItem,!1,role);var itemIndex=objItem.index;g_objBullets&&g_objBullets.setActive(itemIndex),g_objTextPanel&& !1==g_temp.isTextPanelSaparateHover&&showTextPanel(),"image"==objItem.type?setControlsMode("image"):setControlsMode("video")}function onBulletClick(event,bulletIndex){g_gallery.selectItem(bulletIndex)}function onClick(event){if(g_objTouchSlider&& !1==g_objTouchSlider.isTapEventOccured(event))return!0;g_objThis.trigger(t.events.CLICK,event)}function onActualClick(){var isClickable=t.getCurrentSlide().hasClass("ug-slide-clickable"),objItem=t.getCurrentItem();if(isClickable)return!1==g_options.slider_links_newpage?location.href=objItem.link:window.open(objItem.link,"_blank"),!0;!1==g_options.slider_controls_always_on&& !0==g_options.slider_controls_appear_ontap&& !0==t.isCurrentSlideType("image")&&(toggleControls(),g_objTextPanel&& !0==g_options.slider_textpanel_always_on&&t.isCurrentSlideType("image")&&t.isCurrentSlideImageFit()&&showTextPanel())}function onZoomChange(event){g_objTextPanel&&t.isCurrentSlideType("image")&& !1==t.isCurrentSlideImageFit()&&hideTextPanel()}function onMouseEnter(){showControls()}function onMouseLeave(){hideControls()}function objVideoPlayClick(objButton){var objSlide=objButton.parent();t.startSlideAction(objSlide)}function onVideoPlayerShow(){g_gallery.isPlayMode()&&g_gallery.pausePlaying(),g_objThis.trigger(t.events.ACTION_START)}function onVideoPlayerHide(){g_gallery.isPlayMode()&&g_gallery.continuePlaying(),g_objThis.trigger(t.events.ACTION_END)}function onItemImageUpdate(event,index,urlImage){g_objSlide1.data("index")==index&&setImageToSlide(g_objSlide1,objItem=g_gallery.getItem(index),!0),g_objSlide2.data("index")==index&&setImageToSlide(g_objSlide2,objItem=g_gallery.getItem(index),!0),g_objSlide3.data("index")==index&&setImageToSlide(g_objSlide3,objItem=g_gallery.getItem(index),!0)}function onSlideImageLoaded(data,objSlide){objSlide=jQuery(objSlide);var objImage=t.getSlideImage(objSlide),objButtonVideoPlay=getSlideVideoPlayButton(objSlide),objSize=g_functions.getElementSize(objImage);g_functions.placeElement(objButtonVideoPlay,"center","middle",objSize.left,objSize.top,objImage)}function initSlideEvents(objSlide){var objVideoPlayButton=getSlideVideoPlayButton(objSlide);g_functions.addClassOnHover(objVideoPlayButton),g_functions.setButtonOnClick(objVideoPlayButton,objVideoPlayClick)}function initEvents(){g_objGallery.on(g_gallery.events.ITEM_IMAGE_UPDATED,onItemImageUpdate),g_objGallery.on(g_gallery.events.ITEM_CHANGE,onItemChange),g_objBullets&&jQuery(g_objBullets).on(g_objBullets.events.BULLET_CLICK,onBulletClick),!0==g_options.slider_enable_arrows&&(g_functions.addClassOnHover(g_objArrowRight,"ug-arrow-hover"),g_functions.addClassOnHover(g_objArrowLeft,"ug-arrow-hover"),g_gallery.setNextButton(g_objArrowRight),g_gallery.setPrevButton(g_objArrowLeft)),!1==g_options.slider_controls_always_on&&g_objSlider.hover(onMouseEnter,onMouseLeave),g_objSlider.on("touchend click",onClick),g_objThis.on(t.events.CLICK,onActualClick),g_objTextPanel&& !0==g_temp.isTextPanelSaparateHover&&g_objSlider.hover(showTextPanel,hideTextPanel),g_objButtonPlay&&(g_functions.addClassOnHover(g_objButtonPlay,"ug-button-hover"),g_gallery.setPlayButton(g_objButtonPlay)),g_objButtonFullscreen&&(g_functions.addClassOnHover(g_objButtonFullscreen,"ug-button-hover"),g_gallery.setFullScreenToggleButton(g_objButtonFullscreen)),g_objZoomSlider&&g_objThis.on(t.events.ZOOM_CHANGE,onZoomChange),g_objZoomPanel&&g_objZoomPanel.initEvents(),g_objVideoPlayer.initEvents(),jQuery(g_objVideoPlayer).on(g_objVideoPlayer.events.SHOW,onVideoPlayerShow),jQuery(g_objVideoPlayer).on(g_objVideoPlayer.events.HIDE,onVideoPlayerHide),initSlideEvents(g_objSlide1),initSlideEvents(g_objSlide2),initSlideEvents(g_objSlide3),g_objThis.on(t.events.AFTER_PUT_IMAGE,onSlideImageLoaded),g_objSlider.on("mouseenter",".ug-item-wrapper img",function(a){g_objThis.trigger(t.events.IMAGE_MOUSEENTER)}),g_objSlider.on("mouseleave",".ug-item-wrapper img",function(a){!1==t.isMouseInsideSlideImage(a)&&g_objThis.trigger(t.events.IMAGE_MOUSELEAVE)})}function getLoaderClass(){var loaderClass;switch(g_options.slider_loader_type){default:case 1:loaderClass="ug-loader1";break;case 2:loaderClass="ug-loader2";break;case 3:loaderClass="ug-loader3";break;case 4:loaderClass="ug-loader4";break;case 5:loaderClass="ug-loader5";break;case 6:loaderClass="ug-loader6";break;case 7:loaderClass="ug-loader7";break;case 8:loaderClass="ug-loader8";break;case 9:loaderClass="ug-loader9"}return"black"==g_options.slider_loader_color&&(loaderClass+=" ug-loader-black"),loaderClass}function getSlideByNum(num){switch(num){case 1:return g_objSlide1;case 2:return g_objSlide2;case 3:return g_objSlide3;default:throw new Error("wrong num: "+num)}}function getSlideDirection(objItem){var currentIndex=t.getSlidesReference().objCurrentSlide.data("index"),nextIndex=objItem.index,direction="left";return currentIndex>nextIndex&&(direction="right"),direction}function getSlidePreloader(objSlide){if(!objSlide)var objSlide=t.getCurrentSlide();return objSlide.children(".ug-slider-preloader")}function getSlideVideoPlayButton(objSlide){return objSlide.children(".ug-button-videoplay")}function getSlideItem(objSlide){if(!objSlide)var objSlide=t.getCurrentSlide();var index=objSlide.data("index");return void 0==index?null:g_gallery.getItem(index)}this.switchSlideNums=function(b){switch(g_objThis.trigger(t.events.BEFORE_SWITCH_SLIDES),b){case"left":var a=g_temp.numCurrent;g_temp.numCurrent=g_temp.numNext,g_temp.numNext=g_temp.numPrev,g_temp.numPrev=a;break;case"right":var a=g_temp.numCurrent;g_temp.numCurrent=g_temp.numPrev,g_temp.numPrev=g_temp.numNext,g_temp.numNext=a;break;default:throw new Error("wrong direction: "+b)}g_objThis.trigger(t.events.ITEM_CHANGED)},this.destroy=function(){g_objThis.off(t.events.AFTER_PUT_IMAGE),g_objGallery.off(g_gallery.events.ITEM_IMAGE_UPDATED),g_objGallery.off(g_gallery.events.ITEM_CHANGE),g_objBullets&&jQuery(g_objBullets).on(g_objBullets.events.BULLET_CLICK),g_objSlider.off("mouseenter"),g_objSlider.off("mouseleave"),g_objSlider.off("touchend"),g_objSlider.off("click"),g_objThis.off(t.events.CLICK),g_objZoomSlider&&g_objThis.off(t.events.ZOOM_CHANGE),g_objThis.off(t.events.BEFORE_SWITCH_SLIDES),jQuery(g_objVideoPlayer).off(g_objVideoPlayer.events.SHOW),jQuery(g_objVideoPlayer).off(g_objVideoPlayer.events.HIDE),g_objVideoPlayer.destroy(),g_objSlider.off("mouseenter",".ug-item-wrapper img"),g_objSlider.off("mouseleave",".ug-item-wrapper img")},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(a,b,c){initSlider(a,b,c)},this.getSlideImage=function(a){if(!a)var a=t.getCurrentSlide();return a.find(".ug-item-wrapper img")},this.setHtml=function(a){setHtmlSlider(a)},this.run=function(){runSlider()},this.isInnerInPlace=function(){var a=t.getSlidesReference(),b=-g_functions.getElementSize(a.objCurrentSlide).left,c=g_functions.getElementSize(g_objInner);return b==c.left},this.isAnimating=function(){return g_objInner.is(":animated")},this.isSlideCurrent=function(a){var b=a.data("slidenum");return g_temp.numCurrent==b},this.isSlideHasItem=function(a){var b;return null!=a.data("index")},this.getObjImagePadding=function(){return{padding_top:g_options.slider_image_padding_top,padding_bottom:g_options.slider_image_padding_bottom,padding_left:g_options.slider_image_padding_left,padding_right:g_options.slider_image_padding_right}},this.getSlidesReference=function(){return{objPrevSlide:getSlideByNum(g_temp.numPrev),objNextSlide:getSlideByNum(g_temp.numNext),objCurrentSlide:getSlideByNum(g_temp.numCurrent)}},this.getCurrentSlide=function(){return t.getSlidesReference().objCurrentSlide},this.getCurrentItemIndex=function(){var a=t.getSlidesReference().objCurrentSlide.data("index");return null==a&&(a=-1),a},this.getCurrentItem=function(){var a=t.getCurrentItemIndex();return -1==a?null:g_gallery.getItem(a)},this.getSlideType=function(a){return void 0==a&&(a=t.getCurrentSlide()),a.data("type")},this.isMouseInsideSlideImage=function(c){var b=t.getSlideImage(),a=g_functions.getMousePosition(c);void 0===a.pageX&&(a=g_objTouchSlider.getLastMousePos());var d=g_functions.getMouseElementPoint(a,b),e=g_functions.getElementSize(b);return g_functions.isPointInsideElement(d,e)},this.isCurrentSlideType=function(a){return t.getSlideType()==a},this.isCurrentSlideLoadingImage=function(){return!0===t.getCurrentSlide().data("isLoading")},this.setItem=function(c,g,e){var f=t.getSlidesReference(),a=f.objCurrentSlide.data("index"),d=c.index;if(d==a)return!0;if(void 0==a)setItemToSlide(f.objCurrentSlide,c),t.placeNabourItems();else{var b="left";g_gallery.getNumItems(),"next"==e?b="left":"prev"==e||a>d?b="right":a>d&&(b="right"),doTransition(b,c,g)}},this.placeNabourItems=function(){var a=t.getSlidesReference(),b=a.objCurrentSlide.data("index"),c=g_gallery.getPrevItem(b),d=g_gallery.getNextItem(b);setItemToSlide(a.objNextSlide,d),setItemToSlide(a.objPrevSlide,c),positionSlides()},this.________EXTERNAL_API___________=function(){},this.stopSlideAction=function(a,b){a||(a=t.getCurrentSlide()),!0===b?g_objVideoPlayer.pause():g_objVideoPlayer.hide()},this.startSlideAction=function(b){b||(b=t.getCurrentSlide());var a=getSlideItem(b);if("image"==a.type)return!0;switch(!0==g_options.slider_video_constantsize&&setVideoPlayerConstantSize(),setVideoPlayerPosition(),g_objVideoPlayer.show(),a.type){case"youtube":g_objVideoPlayer.playYoutube(a.videoid,!0,a.video_start);break;case"vimeo":g_objVideoPlayer.playVimeo(a.videoid);break;case"html5video":g_objVideoPlayer.playHtml5Video(a.videoogv,a.videowebm,a.videomp4,a.urlImage);break;case"soundcloud":g_objVideoPlayer.playSoundCloud(a.trackid);break;case"wistia":g_objVideoPlayer.playWistia(a.videoid)}},this.getScaleMode=function(a){if(!a)var a=t.getCurrentSlide();return"image"!=t.getSlideType(a)?g_options.slider_scale_mode_media:g_options.slider_scale_mode==g_options.slider_scale_mode_fullscreen?g_options.slider_scale_mode:!0==g_gallery.isFullScreen()?g_options.slider_scale_mode_fullscreen:g_options.slider_scale_mode},this.getObjects=function(){return{g_objSlider:g_objSlider,g_objInner:g_objInner,g_options:g_options,g_objZoomSlider:g_objZoomSlider}},this.getObjZoom=function(){return g_objZoomSlider},this.getOptions=function(){return g_options},this.getElement=function(){return g_objSlider},this.getVideoObject=function(){return g_objVideoPlayer},this.isCurrentSlideImageFit=function(){var a=t.getCurrentSlide();t.getSlideType(a),validateSlideType("image",a);var b=t.getSlideImage(a);return 0!=b.length&&g_functions.isImageFitParent(b)},this.isCurrentImageInPlace=function(){var a=t.getSlideImage();if(0==a.length)return!1;var d=t.getScaleMode(),e=t.getObjImagePadding(),b=getSlideItem(),f=a.parent(),g=g_functions.getImageInsideParentData(f,b.imageWidth,b.imageHeight,d,e),h=g_functions.getElementSize(a),c=!1;return g.imageWidth==h.width&&(c=!0),c},this.isSlideActionActive=function(){return g_objVideoPlayer.isVisible()},this.isSwiping=function(){return!!g_objTouchSlider&&g_objTouchSlider.isTouchActive()},this.isPreloading=function(){return!!getSlidePreloader().is(":visible")},this.setOptions=function(a){g_optionsPrefix&&(a=g_functions.convertCustomPrefixOptions(a,g_optionsPrefix,"slider")),g_options=jQuery.extend(g_options,a)},this.setSize=function(b,a){if(b<0||a<0)return!0;var f={};f.width=b+"px",f.height=a+"px",g_objSlider.css(f);var e={};e.height=a+"px",e.top="0px",e.left="0px",g_objInner.css(e);var c={};c.height=a+"px",c.width=b+"px",g_objSlide1.css(c),g_objSlide2.css(c),g_objSlide3.css(c);var g=b-g_options.slider_item_padding_left-g_options.slider_item_padding_right,h=a-g_options.slider_item_padding_top-g_options.slider_item_padding_bottom,d={};d.width=g+"px",d.height=h+"px",d.top=g_options.slider_item_padding_top+"px",d.left=g_options.slider_item_padding_left+"px",g_objSlider.find(".ug-item-wrapper").css(d),g_objTextPanel&&g_objTextPanel.setSizeByParent(),positionElements(),resizeSlideItem(g_objSlide1),resizeSlideItem(g_objSlide2),resizeSlideItem(g_objSlide3),positionSlides();var i=t.getSlideType();if("image"!=i&& !0==g_options.slider_video_constantsize)setVideoPlayerConstantSize();else{var j=b-g_options.slider_video_padding_left-g_options.slider_video_padding_right,k=a-g_options.slider_video_padding_top-g_options.slider_video_padding_bottom;g_objVideoPlayer.setSize(j,k)}setVideoPlayerPosition()},this.refreshSlideItems=function(){if(!0==t.isAnimating())return!0;resizeSlideItem(g_objSlide1),resizeSlideItem(g_objSlide2),resizeSlideItem(g_objSlide3),positionSlides()},this.isMouseOver=function(){return g_objSlider.ismouseover()},this.setPosition=function(a,b){g_functions.placeElement(g_objSlider,a,b)},this.zoomIn=function(){if(!g_objZoomSlider)return!0;g_objZoomSlider.zoomIn()},this.zoomOut=function(){if(!g_objZoomSlider)return!0;g_objZoomSlider.zoomOut()},this.zoomBack=function(){if(!g_objZoomSlider)return!0;g_objZoomSlider.zoomBack()}}function UGTextPanel(){var g_objPanel,g_objParent,g_objTitle,g_objDesc,g_objBG,g_objTextWrapper,g_gallery,t=this,g_functions=new UGFunctions,g_optionsPrefix="",g_options={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_title_as_link:!1,textpanel_title_link_newtab:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},g_temp={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};function positionElementsTop(animateHeight,startY){if(!startY)var startY=g_options.textpanel_padding_top;var maxy=startY;if(g_objTitle){var titleY=maxy;if(g_functions.placeElement(g_objTitle,0,titleY),!0==g_objTitle.is(":visible")){var maxy=g_functions.getElementSize(g_objTitle).bottom;maxy>0&&(g_temp.lastTitleBottom=maxy)}else{var maxy=20;g_temp.lastTitleBottom>0&&(maxy=g_temp.lastTitleBottom)}}var textDesc="";if(g_objDesc&&(textDesc=jQuery.trim(g_objDesc.text())),""!=textDesc){var descY=maxy;if(g_objTitle&&(descY+=g_options.textpanel_padding_title_description),g_functions.placeElement(g_objDesc,0,descY),!0==jQuery(g_objDesc).is(":visible")){var objDescSize=g_functions.getElementSize(g_objDesc);maxy=objDescSize.bottom,objDescSize.height>0&&(g_temp.lastDescHeight=objDescSize.height)}else{var descHeight=16;g_temp.lastDescHeight>0&&(descHeight=g_temp.lastDescHeight),maxy=descY+descHeight}}g_options.textpanel_height|| !0!=g_temp.setInternalHeight||setHeight(maxy+g_options.textpanel_padding_bottom,animateHeight)}function getTotalTextHeight(){var totalHeight=0;if(g_objTitle&&(totalHeight+=g_objTitle.outerHeight()),g_objDesc){var textDesc="";g_objDesc&&(textDesc=jQuery.trim(g_objDesc.text())),""!=textDesc&&(g_objTitle&&(totalHeight+=g_options.textpanel_padding_title_description),totalHeight+=g_objDesc.outerHeight())}return totalHeight}function positionElementsMiddle(){var totalTextHeight=getTotalTextHeight();positionElementsTop(!1,(g_objTextWrapper.height()-totalTextHeight)/2)}function positionElementBottom(){var totalTextHeight=getTotalTextHeight();positionElementsTop(!1,g_objTextWrapper.height()-totalTextHeight-g_options.textpanel_padding_bottom)}function setHeight(height,animateHeight){if(!animateHeight)var animateHeight=!1;if(!0==animateHeight){g_objBG&&height>g_objBG.height()&&g_objBG.height(height);var objCss={height:height+"px"};g_objPanel.add(g_objTextWrapper).animate(objCss,g_options.textpanel_fade_duration)}else g_objBG&&g_objBG.height(height),g_objPanel.add(g_objTextWrapper).height(height)}function setCss(){if(!0==g_options.textpanel_enable_bg){(g_objBG=g_objPanel.children(".ug-textpanel-bg")).fadeTo(0,g_options.textpanel_bg_opacity);var objCssBG={"background-color":g_options.textpanel_bg_color};objCssBG=jQuery.extend(objCssBG,g_options.textpanel_bg_css),g_objBG.css(objCssBG)}if(!0==g_options.textpanel_enable_title){g_objTitle=g_objTextWrapper.children(".ug-textpanel-title");var objCssTitle={};null!==g_options.textpanel_title_color&&(objCssTitle.color=g_options.textpanel_title_color),null!==g_options.textpanel_title_font_family&&(objCssTitle["font-family"]=g_options.textpanel_title_font_family),null!==g_options.textpanel_title_text_align&&(objCssTitle["text-align"]=g_options.textpanel_title_text_align),null!==g_options.textpanel_title_font_size&&(objCssTitle["font-size"]=g_options.textpanel_title_font_size+"px"),null!==g_options.textpanel_title_bold&&(!0===g_options.textpanel_title_bold?objCssTitle["font-weight"]="bold":objCssTitle["font-weight"]="normal"),g_options.textpanel_css_title&&(objCssTitle=jQuery.extend(objCssTitle,g_options.textpanel_css_title)),g_objTitle.css(objCssTitle)}if(!0==g_options.textpanel_enable_description){g_objDesc=g_objTextWrapper.children(".ug-textpanel-description");var objCssDesc={};null!==g_options.textpanel_desc_color&&(objCssDesc.color=g_options.textpanel_desc_color),null!==g_options.textpanel_desc_font_family&&(objCssDesc["font-family"]=g_options.textpanel_desc_font_family),null!==g_options.textpanel_desc_text_align&&(objCssDesc["text-align"]=g_options.textpanel_desc_text_align),null!==g_options.textpanel_desc_font_size&&(objCssDesc["font-size"]=g_options.textpanel_desc_font_size+"px"),null!==g_options.textpanel_desc_bold&&(!0===g_options.textpanel_desc_bold?objCssDesc["font-weight"]="bold":objCssDesc["font-weight"]="normal"),g_options.textpanel_css_title&&(objCssDesc=jQuery.extend(objCssDesc,g_options.textpanel_css_description)),g_objDesc.css(objCssDesc)}}function onItemChange(){var objItem=g_gallery.getSelectedItem();t.setText(objItem.title,objItem.description,objItem.link)}function initEvents(){jQuery(g_gallery).on(g_gallery.events.ITEM_CHANGE,onItemChange)}this.positionElements=function(a){if(!g_options.textpanel_height||"top"==g_options.textpanel_text_valign)return positionElementsTop(a),!1;switch(g_options.textpanel_text_valign){default:case"top":positionElementsTop(!1);break;case"bottom":positionElementBottom();break;case"center":case"middle":positionElementsMiddle()}},this.init=function(c,a,b){if(g_gallery=c,b&&(g_optionsPrefix=b,a=g_functions.convertCustomPrefixOptions(a,g_optionsPrefix,"textpanel")),a&&(g_options=jQuery.extend(g_options,a)),!1==g_options.textpanel_enable_title&& !1==g_options.textpanel_enable_description)throw new Error("Textpanel Error: The title or description must be enabled");g_options.textpanel_height&&g_options.textpanel_height<0&&(g_options.textpanel_height=null),!0!=g_options.textpanel_desc_style_as_title||(g_options.textpanel_desc_color||(g_options.textpanel_desc_color=g_options.textpanel_title_color),g_options.textpanel_desc_bold||(g_options.textpanel_desc_bold=g_options.textpanel_title_bold),g_options.textpanel_desc_font_family||(g_options.textpanel_desc_font_family=g_options.textpanel_title_font_family),g_options.textpanel_desc_font_size||(g_options.textpanel_desc_font_size=g_options.textpanel_title_font_size),g_options.textpanel_desc_text_align||(g_options.textpanel_desc_text_align=g_options.textpanel_title_text_align))},this.appendHTML=function(c,a){g_objParent=c;var b="<div class='ug-textpanel"+(a=a?" "+a:"")+"'>";!0==g_options.textpanel_enable_bg&&(b+="<div class='ug-textpanel-bg"+a+"'></div>"),b+="<div class='ug-textpanel-textwrapper"+a+"'>",!0==g_options.textpanel_enable_title&&(b+="<div class='ug-textpanel-title"+a+"'></div>"),!0==g_options.textpanel_enable_description&&(b+="<div class='ug-textpanel-description"+a+"'></div>"),b+="</div></div>",c.append(b),g_objTextWrapper=(g_objPanel=c.children(".ug-textpanel")).children(".ug-textpanel-textwrapper"),setCss()},this.destroy=function(){jQuery(g_gallery).off(g_gallery.events.ITEM_CHANGE)},this.run=function(){t.setSizeByParent(),initEvents()},this.setPanelSize=function(b,a){if(g_temp.setInternalHeight=!0,a)g_temp.setInternalHeight=!1;else var a=80;g_options.textpanel_height&&(a=g_options.textpanel_height),g_objPanel.width(b),g_objPanel.height(a),g_objBG&&(g_objBG.width(b),g_objBG.height(a));var c=b-g_options.textpanel_padding_left-g_options.textpanel_padding_right,d=g_options.textpanel_padding_left;g_functions.setElementSizeAndPosition(g_objTextWrapper,d,0,c,a),g_objTitle&&g_objTitle.width(c),g_objDesc&&g_objDesc.width(c),!1==g_temp.isFirstTime&&t.positionElements(!1)},this.setSizeByParent=function(){var a=g_functions.getElementSize(g_objParent);t.setPanelSize(a.width)},this.setTextPlain=function(a,d,b){if(!0==g_options.textpanel_title_as_link&&a&&b){var c="";!0==g_options.textpanel_title_link_newtab&&(c+=' target="blank"'),a='<a class="ug-textpanel-link" href="'+b+'" '+c+">"+a+"</a>"}g_objTitle&&g_objTitle.html(a),g_objDesc&&g_objDesc.html(d)},this.setText=function(a,b,c){!0==g_temp.isFirstTime?(t.setTextPlain(a,b,c),g_temp.isFirstTime=!1,t.positionElements(!1)):g_objTextWrapper.stop().fadeTo(g_options.textpanel_fade_duration,0,function(){t.setTextPlain(a,b,c),t.positionElements(!0),jQuery(this).fadeTo(g_options.textpanel_fade_duration,1)})},this.positionPanel=function(b,c){var a={};if(null!=b)a.top=b,a.bottom="auto";else switch(g_options.textpanel_align){case"top":a.top=g_options.textpanel_margin+"px";break;case"bottom":a.top="auto",a.bottom=g_options.textpanel_margin+"px";break;case"middle":a.top=g_functions.getElementRelativePos(g_objPanel,"middle",g_options.textpanel_margin)}null!=c&&(a.left=c),g_objPanel.css(a)},this.setOptions=function(a){g_optionsPrefix&&(a=g_functions.convertCustomPrefixOptions(a,g_optionsPrefix,"textpanel")),g_options=jQuery.extend(g_options,a)},this.getElement=function(){return g_objPanel},this.getSize=function(){return g_functions.getElementSize(g_objPanel)},this.refresh=function(b,c,a,d){setCss(),a?t.setPanelSize(a,d):t.setSizeByParent(),t.positionElements(!1),!0!==c&&t.positionPanel(),!0===b&&t.show()},this.hide=function(){g_objPanel.hide()},this.show=function(){g_objPanel.show()},this.getOptions=function(){return g_options},this.getOption=function(a){return!1==g_options.hasOwnProperty(a)?null:g_options[a]}}function UGZoomButtonsPanel(){var g_objPanel,g_objParent,g_objButtonPlus,g_objButtonMinus,g_objButtonReturn,t=this,g_slider=new UGSlider,g_functions=new UGFunctions,g_options={slider_zoompanel_skin:""};function isButtonDisabled(objButton){return!!(!objButton||objButton.hasClass("ug-zoompanel-button-disabled"))}function disableButton(objButton){objButton&&objButton.addClass("ug-zoompanel-button-disabled")}function enableButton(objButton){objButton&&objButton.removeClass("ug-zoompanel-button-disabled")}function onZoomChange(){if(!1==g_slider.isCurrentSlideType("image"))return!0;!0==g_slider.isCurrentSlideImageFit()?!1==isButtonDisabled(g_objButtonMinus)&&(disableButton(g_objButtonMinus),disableButton(g_objButtonReturn)):!0==isButtonDisabled(g_objButtonMinus)&&(enableButton(g_objButtonMinus),enableButton(g_objButtonReturn))}this.init=function(b,a){g_slider=b,a&&(g_options=jQuery.extend(g_options,a))},this.appendHTML=function(b){g_objParent=b;var a="<div class='ug-slider-control ug-zoompanel ug-skin-"+g_options.slider_zoompanel_skin+"'>";a+="<div class='ug-zoompanel-button ug-zoompanel-plus'></div>",a+="<div class='ug-zoompanel-button ug-zoompanel-minus ug-zoompanel-button-disabled'></div>",a+="<div class='ug-zoompanel-button ug-zoompanel-return ug-zoompanel-button-disabled'></div>",a+="</div>",b.append(a),g_objButtonPlus=(g_objPanel=b.children(".ug-zoompanel")).children(".ug-zoompanel-plus"),g_objButtonMinus=g_objPanel.children(".ug-zoompanel-minus"),g_objButtonReturn=g_objPanel.children(".ug-zoompanel-return")},this.setObjects=function(a,b,c){g_objButtonPlus=a,g_objButtonMinus=b,g_objButtonReturn=c,g_objButtonMinus&&g_objButtonMinus.addClass("ug-zoompanel-button-disabled"),g_objButtonReturn&&g_objButtonReturn.addClass("ug-zoompanel-button-disabled")},this.getElement=function(){return g_objPanel},t.initEvents=function(){g_functions.addClassOnHover(g_objButtonPlus,"ug-button-hover"),g_functions.addClassOnHover(g_objButtonMinus,"ug-button-hover"),g_functions.addClassOnHover(g_objButtonReturn,"ug-button-hover"),g_functions.setButtonOnClick(g_objButtonPlus,function(){if(!0==isButtonDisabled(g_objButtonPlus))return!0;g_slider.zoomIn()}),g_functions.setButtonOnClick(g_objButtonMinus,function(){if(!0==isButtonDisabled(g_objButtonMinus))return!0;g_slider.zoomOut()}),g_functions.setButtonOnClick(g_objButtonReturn,function(){if(!0==isButtonDisabled(g_objButtonReturn))return!0;g_slider.zoomBack()}),jQuery(g_slider).on(g_slider.events.ZOOM_CHANGE,onZoomChange),jQuery(g_slider).on(g_slider.events.ITEM_CHANGED,onZoomChange)}}function UGBullets(){var g_objBullets,g_objParent,g_bulletWidth,t=this,g_numBullets=0,g_gallery=new UniteGalleryMain,g_activeIndex=-1,g_functions=new UGFunctions,g_temp={isInited:!1},g_options={bullets_skin:"",bullets_addclass:"",bullets_space_between:-1};function setHtmlBullets(){var html="",addHtml="";-1!=g_options.bullets_space_between&&(addHtml=" style='margin-left:"+g_options.bullets_space_between+"px'");for(var i=0;i<g_numBullets;i++)0==i?html+="<div class='ug-bullet'></div>":html+="<div class='ug-bullet'"+addHtml+"></div>";if(g_objBullets.html(html),!g_bulletWidth){var objBullet=g_objBullets.find(".ug-bullet:first-child");objBullet.length&&(g_bulletWidth=objBullet.width())}}function onBulletClick(objBullet){if(!0==t.isActive(objBullet))return!0;var index=objBullet.index();jQuery(t).trigger(t.events.BULLET_CLICK,index)}function initEvents(){var objBullets=g_objBullets.children(".ug-bullet");g_functions.setButtonOnClick(objBullets,onBulletClick),objBullets.on("mousedown mouseup",function(a){return!1})}function validateIndex(index){if(index<0||index>=g_numBullets)throw new Error("wrong bullet index: "+index)}function validateInited(){if(!0==g_temp.isInited)return!0;throw new Error("The bullets are not inited!")}this.events={BULLET_CLICK:"bullet_click"},this.init=function(a,b,c){g_gallery=a,g_numBullets=c||g_gallery.getNumItems(),g_temp.isInited=!0,""==(g_options=jQuery.extend(g_options,b)).bullets_skin&&(g_options.bullets_skin=g_options.gallery_skin)},this.getBulletsWidth=function(){return 0!=g_numBullets&&g_bulletWidth?g_numBullets*g_bulletWidth+(g_numBullets-1)*g_options.bullets_space_between:0},this.appendHTML=function(a){g_objParent=a,validateInited();var b="";""!=g_options.bullets_addclass&&(b=" "+g_options.bullets_addclass);var c="<div class='ug-slider-control ug-bullets ug-skin-"+g_options.bullets_skin+b+"'>";c+="</div>",g_objBullets=jQuery(c),a.append(g_objBullets),setHtmlBullets(),initEvents()},this.updateNumBullets=function(a){g_numBullets=a,setHtmlBullets(),initEvents()},this.getElement=function(){return g_objBullets},this.setActive=function(a){validateInited(),validateIndex(a);var b=g_objBullets.children(".ug-bullet");b.removeClass("ug-bullet-active"),jQuery(b[a]).addClass("ug-bullet-active"),g_activeIndex=a},this.isActive=function(a){if(validateIndex(a),"number"!=typeof a)var b=a;else var b=g_objBullets.children(".ug-bullet")[a];return!!b.hasClass("ug-bullet-active")},this.getNumBullets=function(){return g_numBullets}}function UGProgressBar(){var g_objBar,g_objInner,t=this,g_percent=0,g_functions=new UGFunctions,g_options={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(a,b){b&&(g_options=jQuery.extend(g_options,b)),a.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'></div></div>"),(g_objInner=(g_objBar=a.children(".ug-progress-bar")).children(".ug-progress-bar-inner")).css("background-color",g_options.slider_progressbar_color),g_objBar.height(g_options.slider_progressbar_line_width),g_objInner.height(g_options.slider_progressbar_line_width),g_objInner.width("0%");var c=g_options.slider_progressbar_opacity,d=g_objInner[0];d.style.opacity=c,d.style.filter="alpha(opacity="+100*c+")"},this.putHidden=function(a,b){t.put(a,b),g_objBar.hide()},this.getElement=function(){return g_objBar},this.setSize=function(a){g_objBar.width(a),g_objInner.width(a),t.draw()},this.setPosition=function(a,b,c,d){g_functions.placeElement(g_objBar,a,b,c,d)},this.draw=function(){var a=100*g_percent;g_objInner.width(a+"%")},this.setProgress=function(a){g_percent=g_functions.normalizePercent(a),t.draw()},this.getType=function(){return"bar"}}function UGProgressPie(){var g_percent,g_objPie,t=this,g_isInited=!1,g_functions=new UGFunctions,g_options={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};function draw(percent){if(!percent)var percent=0;var radius=Math.min(g_options.slider_progresspie_width,g_options.slider_progresspie_height)/2,ctx=g_objPie[0].getContext("2d");!1==g_isInited&&(g_isInited=!0,ctx.rotate(1.5*Math.PI),ctx.translate(-2*radius,0)),ctx.clearRect(0,0,g_options.slider_progresspie_width,g_options.slider_progresspie_height);var centerX=g_options.slider_progresspie_width/2,centerY=g_options.slider_progresspie_height/2,startPoint=0,endPoint=percent*Math.PI*2;if(!0==g_options.slider_progresspie_type_fill)ctx.beginPath(),ctx.moveTo(centerX,centerY),ctx.arc(centerX,centerY,radius,startPoint,endPoint),ctx.lineTo(centerX,centerY),ctx.fillStyle=g_options.slider_progresspie_color1,ctx.fill(),ctx.closePath();else{ctx.globalCompositeOperation="source-over",ctx.beginPath(),ctx.moveTo(centerX,centerY),ctx.arc(centerX,centerY,radius,startPoint,endPoint),ctx.lineTo(centerX,centerY),ctx.fillStyle=g_options.slider_progresspie_color1,ctx.fill(),ctx.closePath(),ctx.globalCompositeOperation="destination-out";var radius2=radius-g_options.slider_progresspie_stroke_width;ctx.beginPath(),ctx.moveTo(centerX,centerY),ctx.arc(centerX,centerY,radius2,startPoint,endPoint),ctx.lineTo(centerX,centerY),ctx.fillStyle=g_options.slider_progresspie_color1,ctx.fill(),ctx.closePath()}!0==g_options.slider_progresspie_type_fill&&(startPoint=endPoint,endPoint=2*Math.PI,ctx.beginPath(),ctx.arc(centerX,centerY,radius,startPoint,endPoint),ctx.lineTo(centerX,centerY),ctx.fillStyle=g_options.slider_progresspie_color2,ctx.fill(),ctx.closePath())}this.put=function(a,b){b&&(g_options=jQuery.extend(g_options,b)),a.append("<canvas class='ug-canvas-pie' width='"+g_options.slider_progresspie_width+"' height='"+g_options.slider_progresspie_height+"'></canvas>"),g_objPie=a.children(".ug-canvas-pie")},this.putHidden=function(a,b){t.put(a,b),draw(.1),g_objPie.hide()},this.getElement=function(){return g_objPie},this.setPosition=function(a,b){g_functions.placeElement(g_objPie,a,b)},this.getSize=function(){return{width:g_options.slider_progresspie_width,height:g_options.slider_progresspie_height}},this.setProgress=function(a){g_percent=a=g_functions.normalizePercent(a),draw(a)},this.getType=function(){return"pie"}}function UGTouchSliderControl(){var g_objSlider,g_objInner,g_objParent,g_options,g_parent=new UGSlider,g_functions=new UGFunctions,g_options={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},g_temp={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};function getDiffPosFromCurrentItem(slides){if(!slides)var slides=g_parent.getSlidesReference();var inPlaceX=-g_functions.getElementSize(slides.objCurrentSlide).left,objInnerSize=g_functions.getElementSize(g_objInner),diffPos=inPlaceX-objInnerSize.left;return diffPos}function isMovementValidForChange(){var slides=g_parent.getSlidesReference(),diffPos=getDiffPosFromCurrentItem(slides),breakSize=Math.round(3*slides.objCurrentSlide.width()/8);if(Math.abs(diffPos)>=breakSize)return!0;var diffX=Math.abs(g_temp.lastMouseX-g_temp.startMouseX);return g_temp.lastMouseY,g_temp.startMouseY,!(diffX<20)&&jQuery.now()-g_temp.startTime<500}function returnToPlace(slides){if(!0==g_parent.isInnerInPlace())return!1;if(g_objParent.trigger(g_parent.events.BEFORE_RETURN),!slides)var slides=g_parent.getSlidesReference();var destX=-g_functions.getElementSize(slides.objCurrentSlide).left;g_objInner.animate({left:destX+"px"},{duration:g_options.slider_transition_return_speed,easing:g_options.slider_transition_continuedrag_easing,queue:!1,progress:function(c,d,e){if(!0==g_temp.isDragVideo){var a=g_functions.getElementSize(g_objInner).left-destX,b=g_temp.videoStartX+a;g_temp.videoObject.css("left",b)}},complete:function(){g_objParent.trigger(g_parent.events.AFTER_RETURN)}})}function changeItem(direction){g_parent.getVideoObject().hide(),g_parent.switchSlideNums(direction),g_parent.placeNabourItems()}function continueSlideDragChange(){var slides=g_parent.getSlidesReference(),diffPos=getDiffPosFromCurrentItem(slides);if(0==diffPos)return!1;var direction=diffPos>0?"left":"right",isReturn=!1;switch(direction){case"right":if(g_parent.isSlideHasItem(slides.objPrevSlide))var destX=-g_functions.getElementSize(slides.objPrevSlide).left;else isReturn=!0;break;case"left":if(g_parent.isSlideHasItem(slides.objNextSlide))var destX=-g_functions.getElementSize(slides.objNextSlide).left;else isReturn=!0}!0==isReturn?returnToPlace(slides):g_objInner.stop().animate({left:destX+"px"},{duration:g_options.slider_transition_continuedrag_speed,easing:g_options.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(!0==g_temp.isDragVideo){var a=g_functions.getElementSize(g_objInner).left-g_temp.startPosx,b=g_temp.videoStartX+a;g_temp.videoObject.css("left",b)}},always:function(){changeItem(direction),g_objParent.trigger(g_parent.events.AFTER_DRAG_CHANGE)}})}function handleSliderDrag(event){var diff=g_temp.lastMouseX-g_temp.startMouseX;if(0==diff)return!0;var direction=diff<0?"left":"right",objZoomSlider=g_parent.getObjZoom();if(objZoomSlider){if(!0==objZoomSlider.isPanEnabled(event,direction))return g_temp.isInitDataValid=!1,!0;if(!1==g_temp.isInitDataValid)return storeInitTouchData(event),!0}var currentPosx=g_temp.startPosx+diff;if(diff>0&&currentPosx>0?currentPosx/=3:diff<0&&currentPosx+g_objInner.width()<g_objSlider.width()&&(currentPosx=g_temp.startPosx+diff/3),!1==g_temp.isDragging&&(g_temp.isDragging=!0,g_objParent.trigger(g_parent.events.START_DRAG)),g_objInner.css("left",currentPosx+"px"),!0==g_temp.isDragVideo){var posDiff=currentPosx-g_temp.startPosx,videoPosX=g_temp.videoStartX+posDiff;g_temp.videoObject.css("left",videoPosX)}}function storeInitTouchData(event){var mousePos=g_functions.getMousePosition(event);g_temp.startMouseX=mousePos.pageX,g_temp.startMouseY=mousePos.pageY,g_temp.lastMouseX=g_temp.startMouseX,g_temp.lastMouseY=g_temp.startMouseY,g_temp.startTime=jQuery.now();var arrTouches=g_functions.getArrTouches(event);g_temp.startArrTouches=g_functions.getArrTouchPositions(arrTouches);var objPos=g_functions.getElementSize(g_objInner);g_temp.startPosx=objPos.left,g_temp.isInitDataValid=!0,g_temp.isDragVideo=!1,g_functions.storeEventData(event,g_temp.storedEventID)}function disableTouchActive(who){g_temp.touch_active=!1}function enableTouchActive(who,event){g_temp.touch_active=!0,storeInitTouchData(event)}function onTouchStart(event){return(event.preventDefault(),g_temp.isDragging=!1,!0==g_parent.isAnimating()&&g_objInner.stop(!0,!0),g_functions.getArrTouches(event).length>1)?(!0==g_temp.touch_active&&disableTouchActive("1"),!0):!0==g_temp.touch_active||void enableTouchActive("1",event)}function onTouchMove(event){if(!1==g_temp.touch_active)return!0;if(0==event.buttons)return disableTouchActive("2"),continueSlideDragChange(),!0;g_functions.updateStoredEventData(event,g_temp.storedEventID),event.preventDefault();var mousePos=g_functions.getMousePosition(event);g_temp.lastMouseX=mousePos.pageX,g_temp.lastMouseY=mousePos.pageY;var scrollDir=null;!0==g_options.slider_vertical_scroll_ondrag&&(scrollDir=g_functions.handleScrollTop(g_temp.storedEventID)),"vert"!==scrollDir&&handleSliderDrag(event)}function onTouchEnd(event){var numTouches=g_functions.getArrTouches(event).length;if(!0==g_parent.isInnerInPlace()&& !1==g_temp.touch_active&&0==numTouches)return!0;if(0==numTouches&& !0==g_temp.touch_active){disableTouchActive("3");var isValid=!1;!1==g_functions.wasVerticalScroll(g_temp.storedEventID)&&(isValid=isMovementValidForChange()),!0==isValid?continueSlideDragChange():returnToPlace()}else 1==numTouches&& !1==g_temp.touch_active&&enableTouchActive("2",event)}function initEvents(){g_objSlider.bind("mousedown touchstart",onTouchStart),jQuery("body").bind("mousemove touchmove",onTouchMove),jQuery(window).add("body").bind("mouseup touchend",onTouchEnd)}this.isTapEventOccured=function(b){var a=g_functions.getArrTouches(b).length;if(0!=a||0!=g_temp.lastNumTouches)return g_temp.lastNumTouches=a,!1;g_temp.lastNumTouches=a,getDiffPosFromCurrentItem(g_parent.getSlidesReference());var c=Math.abs(g_temp.lastMouseX-g_temp.startMouseX),d=Math.abs(g_temp.lastMouseY-g_temp.startMouseY),e=jQuery.now(),f=e-g_temp.startTime;return c<20&&d<50&&f<500},this.init=function(a,b){g_objParent=jQuery(g_parent=a),g_objects=a.getObjects(),g_objSlider=g_objects.g_objSlider,g_objInner=g_objects.g_objInner,g_options=jQuery.extend(g_options,b),initEvents()},this.getLastMousePos=function(){return{pageX:g_temp.lastMouseX,pageY:g_temp.lastMouseY}},this.isTouchActive=function(){return g_temp.touch_active}}function UGZoomSliderControl(){var g_objSlider,g_objInner,g_objParent,g_parent=new UGSlider,g_functions=new UGFunctions,g_options={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},g_temp={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};function initObject(objSlider,customOptions){g_objParent=jQuery(g_parent=objSlider),g_objects=objSlider.getObjects(),g_objSlider=g_objects.g_objSlider,g_objInner=g_objects.g_objInner,g_options=jQuery.extend(g_options,customOptions),initEvents()}function getFitScaleMode(){var scaleMode=g_parent.getScaleMode();return"down"!=scaleMode&&(scaleMode="fit"),scaleMode}function storeCurrentImage(){var currentTime=jQuery.now();if(currentTime-g_temp.storeImageLastTime<20)return!1;var slides=g_parent.getSlidesReference();if(g_temp.objSlide=slides.objCurrentSlide,g_temp.objImage=slides.objCurrentSlide.find("img"),0==g_temp.objImage.length)return!1;g_temp.objImageSize=g_functions.getElementSize(g_temp.objImage),g_temp.objParent=g_temp.objImage.parent(),g_temp.objParentSize=g_functions.getElementSize(g_temp.objParent);var scaleMode=getFitScaleMode();objPadding=g_parent.getObjImagePadding(),g_temp.objFitImageSize=g_functions.getImageInsideParentDataByImage(g_temp.objImage,scaleMode,objPadding);var currentTime=jQuery.now();return g_temp.storeImageLastTime=currentTime,!0}function zoomCurrentImage(mode,mousePos){var objImage=g_parent.getSlidesReference().objCurrentSlide.find("img"),scaleMode=getFitScaleMode();g_objParent.trigger(g_parent.events.ZOOM_START);var isZoomed=!0,objPadding=g_parent.getObjImagePadding();if("back"==mode){var objOriginalSize=g_functions.getImageOriginalSize(objImage);g_functions.scaleImageFitParent(objImage,objOriginalSize.width,objOriginalSize.height,scaleMode,objPadding)}else{var zoomIn="in"==mode;isZoomed=g_functions.zoomImageInsideParent(objImage,zoomIn,g_options.slider_zoom_step,mousePos,scaleMode,g_options.slider_zoom_max_ratio,objPadding)}!0==isZoomed&&(g_objParent.trigger(g_parent.events.ZOOMING),g_objParent.trigger(g_parent.events.ZOOM_CHANGE),g_objParent.trigger(g_parent.events.ZOOM_END))}function isPanPosible(objImage,event,stictTouchesCheck){var arrTouches=g_functions.getArrTouches(event);if(!0===stictTouchesCheck){if(1!=arrTouches.length)return!1}else if(arrTouches.length>1)return!1;return!!g_functions.isElementBiggerThenParent(objImage)}function storePanInitValues(event){var mousePos=g_functions.getMousePosition(event);g_temp.startMouseX=mousePos.pageX,g_temp.startMouseY=mousePos.pageY,g_temp.lastMouseX=g_temp.startMouseX,g_temp.lastMouseY=g_temp.startMouseY,g_temp.startImageX=g_temp.objImageSize.left,g_temp.startImageY=g_temp.objImageSize.top,g_temp.panXActive=g_temp.objImageSize.width>g_temp.objParentSize.width,g_temp.panYActive=g_temp.objImageSize.height>g_temp.objParentSize.height}function startPan(event){g_temp.isPanActive=!0,storePanInitValues(event)}function panImage(event){if(void 0==g_temp.objImage||0==g_temp.objImage.length)return!0;var mousePos=g_functions.getMousePosition(event);mousePos.pageX,g_temp.startMouseX,mousePos.pageY,g_temp.startMouseY;var diffLastX=mousePos.pageX-g_temp.lastMouseX,diffLastY=mousePos.pageY-g_temp.lastMouseY,directionX=diffLastX<0?"left":"right",directionY=diffLastY<0?"up":"down";g_temp.lastMouseX=mousePos.pageX,g_temp.lastMouseY=mousePos.pageY;var posImage=g_functions.getElementSize(g_temp.objImage);!1==g_temp.panYActive?diffLastY=0:"down"==directionY&&posImage.top>0?diffLastY/=3:"up"==directionY&&posImage.bottom<g_temp.objParentSize.height&&(diffLastY/=3),!1==g_temp.panXActive|| !1==g_parent.isInnerInPlace()?diffLastX=0:"right"==directionX&&posImage.left>0?diffLastX/=3:"left"==directionX&&posImage.right<g_temp.objParentSize.width&&(diffLastX/=3);var imageX=posImage.left+diffLastX,imageY=posImage.top+diffLastY;g_functions.placeElement(g_temp.objImage,imageX,imageY)}function checkReturnAfterPan(){var isReturnX=!1,isReturnY=!1,newX=0,newY=0,objSize=g_functions.getElementSize(g_temp.objImage),objImagePadding=g_parent.getObjImagePadding(),objCenterPos=g_functions.getElementCenterPosition(g_temp.objImage,objImagePadding);g_temp.panXActive=g_temp.objImageSize.width>g_temp.objParentSize.width,g_temp.panYActive=g_temp.objImageSize.height>g_temp.objParentSize.height,!0==g_temp.panYActive?objSize.top>0?(newY=0,isReturnY=!0):objSize.bottom<g_temp.objParentSize.height&&(newY=g_temp.objParentSize.height-objSize.height,isReturnY=!0):objSize.top!=objCenterPos.top&&(isReturnY=!0,newY=objCenterPos.top),!0==g_temp.panXActive?objSize.left>0?(newX=0,isReturnX=!0):objSize.right<g_temp.objParentSize.width&&(newX=g_temp.objParentSize.width-objSize.width,isReturnX=!0):objSize.left!=objCenterPos.left&&(isReturnX=!0,newX=objCenterPos.left);var objCss={};!0==isReturnY&&(objCss.top=newY+"px"),!0==isReturnX&&(objCss.left=newX+"px"),(!0==isReturnY|| !0==isReturnX)&&g_temp.objImage.animate(objCss,{duration:g_options.slider_zoom_return_pan_duration,easing:g_options.slider_zoom_return_pan_easing,queue:!1})}function isImageAnimating(){return!!(g_temp.objImage&&g_temp.objImage.is(":animated"))}function startTouchZoom(arrTouches){g_temp.isZoomActive=!0,g_temp.startDistance=g_functions.getDistance(arrTouches[0].pageX,arrTouches[0].pageY,arrTouches[1].pageX,arrTouches[1].pageY),0==g_temp.startDistance&&(g_temp.startDistance=1),g_temp.startMiddlePoint=g_functions.getMiddlePoint(arrTouches[0].pageX,arrTouches[0].pageY,arrTouches[1].pageX,arrTouches[1].pageY),g_temp.objImageSize=g_functions.getElementSize(g_temp.objImage),g_temp.startImageX=g_temp.objImageSize.left,g_temp.startImageY=g_temp.objImageSize.top,g_temp.imageOrientPoint=g_functions.getElementLocalPoint(g_temp.startMiddlePoint,g_temp.objImage),!1==g_functions.isPointInsideElement(g_temp.imageOrientPoint,g_temp.objImageSize)&&(g_temp.imageOrientPoint=g_functions.getElementCenterPoint(g_temp.objImage)),g_objParent.trigger(g_parent.events.ZOOM_START)}function checkTouchZoomEnd(event){if(!1==g_temp.isZoomActive)return!1;2!=g_functions.getArrTouches(event).length&&(g_temp.isZoomActive=!1,g_objParent.trigger(g_parent.events.ZOOM_END))}function checkTouchZoomStart(event){if(!0==g_temp.isZoomActive)return!0;var arrTouches=g_functions.getArrTouches(event);if(2!=arrTouches.length)return!0;startTouchZoom(arrTouches)}function doTouchZoom(event){var arrTouches=g_functions.getArrTouches(event),zoomRatio=g_functions.getDistance(arrTouches[0].pageX,arrTouches[0].pageY,arrTouches[1].pageX,arrTouches[1].pageY)/g_temp.startDistance,middlePoint=g_functions.getMiddlePoint(arrTouches[0].pageX,arrTouches[0].pageY,arrTouches[1].pageX,arrTouches[1].pageY),newWidth=g_temp.objImageSize.width*zoomRatio,newHeight=g_temp.objImageSize.height*zoomRatio,objOriginalSize=g_functions.getImageOriginalSize(g_temp.objImage),expectedZoomRatio=1;if(objOriginalSize.width>0&&(expectedZoomRatio=newWidth/objOriginalSize.width),expectedZoomRatio>g_options.slider_zoom_max_ratio)return!0;panX=-(g_temp.imageOrientPoint.x*zoomRatio-g_temp.imageOrientPoint.x),panY=-(g_temp.imageOrientPoint.y*zoomRatio-g_temp.imageOrientPoint.y);var diffMiddleX=middlePoint.x-g_temp.startMiddlePoint.x,diffMiddleY=middlePoint.y-g_temp.startMiddlePoint.y,posx=g_temp.startImageX+panX+diffMiddleX,posy=g_temp.startImageY+panY+diffMiddleY;g_functions.setElementSizeAndPosition(g_temp.objImage,posx,posy,newWidth,newHeight),g_objParent.trigger(g_parent.events.ZOOMING),g_objParent.trigger(g_parent.events.ZOOM_CHANGE)}function checkReturnFromZoom(){if(void 0==g_temp.objImage||0==g_temp.objImage.length)return!0;if(g_functions.getElementSize(g_temp.objImage).width<g_temp.objFitImageSize.imageWidth){g_temp.objImage.css({position:"absolute",margin:"none"});var objCss={top:g_temp.objFitImageSize.imageTop+"px",left:g_temp.objFitImageSize.imageLeft+"px",width:g_temp.objFitImageSize.imageWidth+"px",height:g_temp.objFitImageSize.imageHeight+"px"};g_temp.objImage.animate(objCss,{duration:g_options.slider_zoom_return_pan_duration,easing:g_options.slider_zoom_return_pan_easing,queue:!1})}else checkReturnAfterPan()}function onTouchStart(event){return!1==g_parent.isCurrentSlideType("image")||(storeCurrentImage(),void 0==g_temp.objImage||0==g_temp.objImage.length||void(event.preventDefault(),!0==isImageAnimating()&&g_temp.objImage.stop(!0),!0==g_temp.isZoomActive?checkTouchZoomEnd(event):checkTouchZoomStart(event),!0==g_temp.isZoomActive?g_temp.isPanActive=!1:!0==isPanPosible(g_temp.objImage,event)&& !0==g_temp.isZoomedOnce&&startPan(event)))}function onTouchEnd(event){if(!1==g_parent.isCurrentSlideType("image"))return!0;if(!0==jQuery(event.target).data("ug-button"))return!1;if(storeCurrentImage(),void 0==g_temp.objImage||0==g_temp.objImage.length)return!0;var panWasActive=g_temp.isPanActive,zoomWasActive=g_temp.isZoomActive;if(!1==g_parent.isInnerInPlace())return g_temp.isZoomActive=!1,g_temp.isPanActive=!1,!0;if(!0==g_temp.isZoomActive?checkTouchZoomEnd(event):checkTouchZoomStart(event),!0==g_temp.isZoomActive)g_temp.isPanActive=!1;else{var panPosible=isPanPosible(g_temp.objImage,event,!0);!0==g_temp.isPanActive?g_temp.isPanActive=!1:!0==panPosible&&startPan(event)}(panWasActive||zoomWasActive)&& !1==g_temp.isZoomActive&& !1==g_temp.isPanActive&&checkReturnFromZoom()}function onTouchMove(event){if(!1==g_parent.isCurrentSlideType("image"))return!0;!0==g_temp.isZoomActive?doTouchZoom(event):!0==g_temp.isPanActive&&panImage(event)}function onSliderMouseWheel(event,delta,deltaX,deltaY){if(!1==g_options.slider_zoom_mousewheel|| !1==g_parent.isCurrentSlideType("image"))return!0;event.preventDefault();var zoomIn=delta>0,mousePos=g_functions.getMousePosition(event);zoomCurrentImage(!0==zoomIn?"in":"out",mousePos)}function initEvents(){g_objSlider.on("mousewheel",onSliderMouseWheel),g_objSlider.bind("mousedown touchstart",onTouchStart),jQuery("body").bind("mousemove touchmove",onTouchMove),jQuery(window).add("body").bind("mouseup touchend",onTouchEnd),g_objParent.bind(g_parent.events.BEFORE_RETURN,function(){checkReturnFromZoom()}),g_objParent.bind(g_parent.events.ITEM_CHANGED,function(){g_temp.isZoomedOnce=!1}),g_objParent.bind(g_parent.events.ZOOM_CHANGE,function(){g_temp.isZoomedOnce=!0})}this.________EXTERNAL_____________=function(){},this.isPanEnabled=function(a,b){if(storeCurrentImage(),void 0==g_temp.objImage||0==g_temp.objImage.length|| !1==g_temp.isZoomedOnce|| !1==isPanPosible(g_temp.objImage,a)|| !1==g_parent.isInnerInPlace())return!1;if("left"==b){if(g_temp.objImageSize.right<=g_temp.objParentSize.width)return!1}else if(g_temp.objImageSize.left>=0)return!1;return!0},this.init=function(a,b){initObject(a,b)},this.zoomIn=function(){zoomCurrentImage("in")},this.zoomOut=function(){zoomCurrentImage("out")},this.zoomBack=function(){zoomCurrentImage("back")}}function UGWistiaAPI(){this.isAPILoaded=!1;var g_intHandle,g_player,t=this,g_objThis=jQuery(this),g_isPlayerReady=!1;function isWistiaActive(){return"undefined"!=typeof Wistia}function putVideoActually(divID,videoID,width,height,isAutoplay){g_player=null,g_isPlayerReady=!1;var htmlID=divID+"_video",html="<div id='"+htmlID+"' class='wistia_embed' style='width:"+width+";height:"+height+";' data-video-width='"+width+"' data-video-height='"+height+"'>&nbsp;</div>";jQuery("#"+divID).html(html),g_player=Wistia.embed(videoID,{version:"v1",videoWidth:width,videoHeight:height,container:htmlID,autoPlay:isAutoplay}),g_isPlayerReady=!0,initEvents()}function initEvents(){g_player.bind("play",function(){g_objThis.trigger(t.events.START_PLAYING)}),g_player.bind("pause",function(){g_objThis.trigger(t.events.STOP_PLAYING)}),g_player.bind("end",function(){g_objThis.trigger(t.events.STOP_PLAYING),g_objThis.trigger(t.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(a){return!0==g_ugWistiaAPI.isAPILoaded||(isWistiaActive()?(g_ugWistiaAPI.isAPILoaded=!0,!0):void(!0!==a&&g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0),g_ugWistiaAPI.isAPILoaded=!0))},this.doCommand=function(a){if(null==g_player|| !1==g_isPlayerReady)return!1;switch(a){case"play":g_player.play();break;case"pause":g_player.pause()}},this.pause=function(){t.doCommand("pause")},this.play=function(){t.doCommand("play")},this.putVideo=function(a,b,c,d,e,f){if(isWistiaActive())return putVideoActually(a,b,c,d,e,f),!0;this.loadAPI(),g_intHandle=setInterval(function(){isWistiaActive()&&(putVideoActually(a,b,c,d,e,f),clearInterval(g_intHandle))},500)},this.isPlayerReady=function(){return!!g_isPlayerReady&&!!g_player}}function UGSoundCloudAPI(){this.isAPILoaded=!1;var g_player,g_lastContainerID,g_intHandle,t=this,g_objThis=jQuery(this);function isSCActive(){return"undefined"!=typeof SC}function putSoundActually(divID,trackID,width,height,isAutoplay){g_player=null,g_isPlayerReady=!1;var iframeID=divID+"_iframe",url=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+trackID;url+="&amp;buying=false&amp;liking=false&amp;download=false&amp;sharing=false&amp;show_artwork=true&show_comments=false&amp;show_playcount=true&amp;show_user=false&amp;hide_related=true&amp;visual=true&amp;start_track=0&amp;callback=true",!0===isAutoplay?url+="&amp;auto_play=true":url+="&amp;auto_play=false";var html="<iframe id='"+iframeID+"' src="+url+" width='"+width+"' height='"+height+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+divID).html(html),(g_player=SC.Widget(iframeID)).bind(SC.Widget.Events.READY,function(){g_player&&(g_isPlayerReady=!0,initEvents())}),g_lastContainerID=divID}function initEvents(){g_player.bind(SC.Widget.Events.PLAY,function(){g_objThis.trigger(t.events.START_PLAYING)}),g_player.bind(SC.Widget.Events.PAUSE,function(){g_objThis.trigger(t.events.STOP_PLAYING)}),g_player.bind(SC.Widget.Events.FINISH,function(){g_objThis.trigger(t.events.STOP_PLAYING),g_objThis.trigger(t.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(a){return!0==g_ugSoundCloudAPI.isAPILoaded||(isSCActive()?(g_ugSoundCloudAPI.isAPILoaded=!0,!0):void(!0!==a&&g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0),g_ugSoundCloudAPI.isAPILoaded=!0))},this.putSound=function(a,b,c,d,e){if(isSCActive())return putSoundActually(a,b,c,d,e),!0;this.loadAPI(),g_intHandle=setInterval(function(){isSCActive()&&(putSoundActually(a,b,c,d,e),clearInterval(g_intHandle))},500)},this.doCommand=function(a){if(null==g_player|| !1==g_isPlayerReady)return!1;switch(a){case"play":g_player.play();break;case"pause":g_player.pause()}},this.pause=function(){t.doCommand("pause")},this.play=function(){t.doCommand("play")},this.destroy=function(){g_isPlayerReady=!1,g_player=null,g_lastContainerID&&(jQuery("#"+g_lastContainerID).html(""),g_lastContainerID=null)}}function UGHtml5MediaAPI(){this.isAPILoaded=!1;var g_player,g_intHandle,t=this,g_objThis=jQuery(this);function isMediaElementActive(){return"undefined"!=typeof mejs}function putVideoActually(divID,data,width,height,isAutoplay){g_player=null,g_isPlayerReady=!1;var urlFlash=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",urlSilverlight=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",htmlID=divID+"_video",htmlAutoplay="";isAutoplay&& !0===isAutoplay&&(htmlAutoplay="autoplay='autoplay'");var htmlPoster="";data.posterImage&&(htmlPoster="poster='"+data.posterImage+"'");var html="<video id='"+htmlID+"' width='"+width+"' height='"+height+"' controls='controls' controlsList='nodownload' preload='none' "+htmlAutoplay+" "+htmlPoster+">";""!=data.mp4&&(html+="<source type='video/mp4' src='"+data.mp4+"' />"),""!=data.webm&&(html+="<source type='video/webm' src='"+data.webm+"' />"),""!=data.ogv&&(html+="<source type='video/ogg' src='"+data.ogv+"' />"),html+="<object width='"+width+"' height='"+height+"' type='application/x-shockwave-flash' data='"+urlFlash+"'>",html+="<param name='movie' value='"+urlFlash+"' />",html+="<param name='flashvars' value='controls=true&file="+data.mp4+"' />",html+="</object>",html+="</video>",jQuery("#"+divID).html(html),jQuery("#"+htmlID).on("contextmenu",function(){return!1}),new MediaElement(htmlID,{enablePluginDebug:!1,flashName:urlFlash,silverlightName:urlSilverlight,success:function(a,b){g_isPlayerReady=!0,g_player=a,!1==isAutoplay&&g_player.pause(),initEvents()},error:function(a){trace(a)}})}function initEvents(){g_ugFunctions.addEvent(g_player,"play",function(){g_objThis.trigger(t.events.START_PLAYING)}),g_ugFunctions.addEvent(g_player,"pause",function(){g_objThis.trigger(t.events.STOP_PLAYING)}),g_ugFunctions.addEvent(g_player,"ended",function(){g_objThis.trigger(t.events.STOP_PLAYING),g_objThis.trigger(t.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(a){return!0==g_ugHtml5MediaAPI.isAPILoaded||(isMediaElementActive()?(g_ugHtml5MediaAPI.isAPILoaded=!0,!0):void(!0!==a&&(g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0),g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0)),g_ugHtml5MediaAPI.isAPILoaded=!0))},this.putVideo=function(a,b,c,d,e){if(isMediaElementActive())return putVideoActually(a,b,c,d,e),!0;this.loadAPI(),g_intHandle=setInterval(function(){isMediaElementActive()&&(putVideoActually(a,b,c,d,e),clearInterval(g_intHandle))},500)},this.doCommand=function(a){if(null==g_player|| !1==g_isPlayerReady)return!1;switch(a){case"play":g_player.play();break;case"pause":g_player.pause()}},this.pause=function(){t.doCommand("pause")},this.play=function(){t.doCommand("play")}}function UGVimeoAPI(){this.isAPILoaded=!1;var g_intHandle,g_lastCotnainerID,t=this,g_objThis=jQuery(this),g_player=null,g_isPlayerReady=!1,g_cueChangeAutoplay=!1;function isFroogaloopActive(){return"undefined"!=typeof Froogaloop}function putVideoActually(divID,videoID,width,height,isAutoplay){g_player=null,g_isPlayerReady=!1;var url=location.protocol+"//player.vimeo.com/video/"+videoID+"?api=1";!0===isAutoplay&&(url+="&amp;byline=0&amp;autoplay=1&amp;title=0&amp;portrait=0");var html="<iframe src="+url+" width='"+width+"' height='"+height+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+divID).html(html);var iframe=jQuery("#"+divID+" iframe")[0];(g_player=Froogaloop(iframe)).addEvent("ready",function(){g_player&&(g_isPlayerReady=!0,initEvents())}),g_lastCotnainerID=divID}function initEvents(){if(!g_player)return!1;g_player.addEvent("cuechange",function(){!0==g_cueChangeAutoplay&&t.play()}),g_player.addEvent("play",function(){g_objThis.trigger(t.events.START_PLAYING)}),g_player.addEvent("pause",function(){g_objThis.trigger(t.events.STOP_PLAYING)}),g_player.addEvent("finish",function(){g_objThis.trigger(t.events.STOP_PLAYING),g_objThis.trigger(t.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(a){return!0==g_ugVimeoAPI.isAPILoaded||(isFroogaloopActive()?(g_ugVimeoAPI.isAPILoaded=!0,!0):void(!0!==a&&g_ugFunctions.loadJs("f.vimeocdn.com/js/froogaloop2.min.js",!0),g_ugVimeoAPI.isAPILoaded=!0))},this.doCommand=function(a){if(null==g_player|| !1==g_isPlayerReady)return!1;g_player.api(a)},this.pause=function(){t.doCommand("pause")},this.play=function(){t.doCommand("play")},this.destroy=function(){g_player&&(g_player.api("unload"),g_player=null,g_isPlayerReady=!1),g_lastCotnainerID&&jQuery("#"+g_lastCotnainerID).html("")},this.putVideo=function(a,b,c,d,e){if(isFroogaloopActive())return putVideoActually(a,b,c,d,e),!0;this.loadAPI(),g_intHandle=setInterval(function(){isFroogaloopActive()&&(putVideoActually(a,b,c,d,e),clearInterval(g_intHandle))},500)},this.isPlayerReady=function(){return!!g_isPlayerReady&&!!g_player},this.changeVideo=function(a,b){if(!1==t.isPlayerReady())return!1;g_cueChangeAutoplay=b,g_player.api("loadVideo",a)},this.getVideoImages=function(a,c,d){var b=location.protocol+"//vimeo.com/api/v2/video/"+a+".json";jQuery.get(b,{},function(b){var a={};a.preview=b[0].thumbnail_large,a.thumb=b[0].thumbnail_medium,d(c,a)})}}function UGYoutubeAPI(){this.isAPILoaded=!1;var g_intHandle,g_lastContainerID,t=this,g_player=null,g_isPlayerReady=!1,g_objThis=jQuery(this),g_prevState=-1,g_functions=new UGFunctions,g_options={video_youtube_showinfo:!0};function putVideoActually(divID,videoID,width,height,isAutoplay,addOptions){g_player&&g_isPlayerReady&&g_player.destroy();var playerVars={controls:1,showinfo:g_options.video_youtube_showinfo,start:0,rel:0};!0===isAutoplay&&(playerVars.autoplay=1);var start=g_functions.getVal(addOptions,"start");start&&jQuery.isNumeric(start)&&(playerVars.start=start),g_isPlayerReady=!1,g_player=new YT.Player(divID,{height:height,width:width,videoId:videoID,playerVars:playerVars,events:{onReady:onPlayerReady,onStateChange:onPlayerStateChange}}),g_lastContainerID=divID}function isYTActive(){return"undefined"!=typeof YT&& void 0!==YT.Player}function onPlayerReady(){g_isPlayerReady=!0}function onPlayerStateChange(){if("function"!=typeof g_player.getPlayerState)return trace("Youtube API error: can't get player state"),!1;var state=g_player.getPlayerState();switch(state){case YT.PlayerState.PLAYING:g_objThis.trigger(t.events.START_PLAYING);break;case YT.PlayerState.ENDED:g_objThis.trigger(t.events.STOP_PLAYING),g_objThis.trigger(t.events.VIDEO_ENDED);break;default:g_prevState==YT.PlayerState.PLAYING&&g_objThis.trigger(t.events.STOP_PLAYING)}g_prevState=state}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.setOptions=function(a){g_options=jQuery.extend(g_options,a)},this.putVideo=function(a,b,c,d,e,f){if(isYTActive())return putVideoActually(a,b,c,d,e,f),!0;this.loadAPI(),g_intHandle=setInterval(function(){isYTActive()&&(putVideoActually(a,b,c,d,e,f),clearInterval(g_intHandle))},500)},this.loadAPI=function(a){return!0==g_ugYoutubeAPI.isAPILoaded||("undefined"!=typeof YT?(g_ugYoutubeAPI.isAPILoaded=!0,!0):void(!0!==a&&g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1),g_ugYoutubeAPI.isAPILoaded=!0))},this.doCommand=function(a,b){if(!g_player)return!0;if(!1==g_isPlayerReady)return!1;switch(a){case"play":if("function"!=typeof g_player.playVideo)return!1;g_player.playVideo();break;case"pause":if("function"!=typeof g_player.pauseVideo)return!1;g_player.pauseVideo();break;case"seek":if("function"!=typeof g_player.seekTo)return!1;g_player.seekTo(b);break;case"stopToBeginning":var c=g_player.getPlayerState();switch(g_player.pauseVideo(),c){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:g_player.seekTo(0)}}},this.play=function(){t.doCommand("play")},this.pause=function(){t.doCommand("pause")},this.destroy=function(){try{g_player&&(g_isPlayerReady=!1,g_player.clearVideo(),g_player.destroy())}catch(a){jQuery("#"+g_lastContainerID).html("")}},this.stopToBeginning=function(){t.doCommand("stopToBeginning")},this.changeVideo=function(a,b){if(!1==t.isPlayerReady())return!1;b&& !0==b?g_player.loadVideoById(a,0,"large"):g_player.cueVideoById(a,0,"large")},this.isPlayerReady=function(){return!!g_isPlayerReady&&!!g_player},this.getVideoImages=function(b){var a={};return a.preview="https://i.ytimg.com/vi/"+b+"/sddefault.jpg",a.thumb="https://i.ytimg.com/vi/"+b+"/default.jpg",a}}function UGVideoPlayer(){var g_objPlayer,g_objYoutube,g_objVimeo,g_objHtml5,g_objButtonClose,g_objSoundCloud,g_objWistia,g_galleryID,t=this,g_objThis=jQuery(this),g_functions=new UGFunctions,g_youtubeAPI=new UGYoutubeAPI,g_vimeoAPI=new UGVimeoAPI,g_html5API=new UGHtml5MediaAPI,g_soundCloudAPI=new UGSoundCloudAPI,g_wistiaAPI=new UGWistiaAPI,g_activePlayerType=null,g_options={video_enable_closebutton:!0};this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"};var g_temp={standAloneMode:!1,youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",soundCloudPlayerID:""};function onCloseButtonClick(){t.hide()}function onPlayStart(){g_objThis.trigger(t.events.PLAY_START),g_objButtonClose&&g_objButtonClose.hide()}function onPlayStop(){g_objThis.trigger(t.events.PLAY_STOP),g_objButtonClose&&g_objButtonClose.show()}function onVideoEnded(){g_objThis.trigger(t.events.VIDEO_ENDED)}function initEvents(){g_objButtonClose&&(g_functions.setButtonMobileReady(g_objButtonClose),g_functions.setButtonOnClick(g_objButtonClose,onCloseButtonClick)),jQuery(g_youtubeAPI).on(g_youtubeAPI.events.START_PLAYING,onPlayStart),jQuery(g_youtubeAPI).on(g_youtubeAPI.events.STOP_PLAYING,onPlayStop),jQuery(g_youtubeAPI).on(g_youtubeAPI.events.VIDEO_ENDED,onVideoEnded),jQuery(g_vimeoAPI).on(g_vimeoAPI.events.START_PLAYING,onPlayStart),jQuery(g_vimeoAPI).on(g_vimeoAPI.events.STOP_PLAYING,onPlayStop),jQuery(g_vimeoAPI).on(g_vimeoAPI.events.VIDEO_ENDED,onVideoEnded),jQuery(g_html5API).on(g_html5API.events.START_PLAYING,onPlayStart),jQuery(g_html5API).on(g_html5API.events.STOP_PLAYING,onPlayStop),jQuery(g_html5API).on(g_html5API.events.VIDEO_ENDED,onVideoEnded),jQuery(g_soundCloudAPI).on(g_soundCloudAPI.events.START_PLAYING,onPlayStart),jQuery(g_soundCloudAPI).on(g_soundCloudAPI.events.STOP_PLAYING,onPlayStop),jQuery(g_soundCloudAPI).on(g_soundCloudAPI.events.VIDEO_ENDED,onVideoEnded),jQuery(g_wistiaAPI).on(g_wistiaAPI.events.START_PLAYING,onPlayStart),jQuery(g_wistiaAPI).on(g_wistiaAPI.events.STOP_PLAYING,onPlayStop),jQuery(g_wistiaAPI).on(g_wistiaAPI.events.VIDEO_ENDED,onVideoEnded)}function stopAndHidePlayers(except){var arrPlayers=["youtube","vimeo","html5","soundcloud","wistia"];for(var index in arrPlayers){var player=arrPlayers[index];if(player!=except)switch(player){case"youtube":g_youtubeAPI.pause(),g_youtubeAPI.destroy(),g_objYoutube.hide();break;case"vimeo":g_vimeoAPI.pause(),g_vimeoAPI.destroy(),g_objVimeo.hide();break;case"html5":g_html5API.pause(),g_objHtml5.hide();break;case"soundcloud":g_soundCloudAPI.pause(),g_soundCloudAPI.destroy(),g_objSoundCloud.hide();break;case"wistia":g_wistiaAPI.pause(),g_objWistia.hide()}}}this.init=function(b,a,c){if(!(g_galleryID=c))throw new Error("missing gallery ID for video player, it's a must!");g_options=jQuery.extend(g_options,b),g_youtubeAPI.setOptions(g_options),a&& !0==a&&(g_temp.standAloneMode=!0)},this.setHtml=function(b){g_temp.youtubeInnerID=g_galleryID+"_youtube_inner",g_temp.vimeoPlayerID=g_galleryID+"_videoplayer_vimeo",g_temp.html5PlayerID=g_galleryID+"_videoplayer_html5",g_temp.wistiaPlayerID=g_galleryID+"_videoplayer_wistia",g_temp.soundCloudPlayerID=g_galleryID+"_videoplayer_soundcloud";var a="<div class='ug-videoplayer' style='display:none'>";a+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+g_temp.youtubeInnerID+"'></div></div>",a+="<div id='"+g_temp.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'></div>",a+="<div id='"+g_temp.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'></div>",a+="<div id='"+g_temp.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'></div>",a+="<div id='"+g_temp.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'></div>",!1==g_temp.standAloneMode&& !0==g_options.video_enable_closebutton&&(a+="<div class='ug-videoplayer-button-close'></div>"),a+="</div>",b.append(a),g_objPlayer=b.children(".ug-videoplayer"),g_objYoutube=g_objPlayer.children(".ug-videoplayer-youtube"),g_objVimeo=g_objPlayer.children(".ug-videoplayer-vimeo"),g_objHtml5=g_objPlayer.children(".ug-videoplayer-html5"),g_objSoundCloud=g_objPlayer.children(".ug-videoplayer-soundcloud"),g_objWistia=g_objPlayer.children(".ug-videoplayer-wistia"),!1==g_temp.standAloneMode&& !0==g_options.video_enable_closebutton&&(g_objButtonClose=g_objPlayer.children(".ug-videoplayer-button-close"))},this.destroy=function(){g_objButtonClose&&(g_objButtonClose.off("click"),g_objButtonClose.off("touchend")),jQuery(g_youtubeAPI).off(g_youtubeAPI.events.START_PLAYING),jQuery(g_youtubeAPI).off(g_youtubeAPI.events.STOP_PLAYING),jQuery(g_vimeoAPI).off(g_vimeoAPI.events.START_PLAYING),jQuery(g_vimeoAPI).off(g_vimeoAPI.events.STOP_PLAYING),jQuery(g_html5API).off(g_html5API.events.START_PLAYING),jQuery(g_html5API).off(g_html5API.events.STOP_PLAYING),jQuery(g_soundCloudAPI).off(g_soundCloudAPI.events.START_PLAYING,onPlayStart),jQuery(g_soundCloudAPI).off(g_soundCloudAPI.events.STOP_PLAYING,onPlayStop),jQuery(g_wistiaAPI).off(g_wistiaAPI.events.START_PLAYING,onPlayStart),jQuery(g_wistiaAPI).off(g_wistiaAPI.events.STOP_PLAYING,onPlayStop),g_activePlayerType=null},this.initEvents=function(){initEvents()},this.setSize=function(a,b){g_functions.setElementSize(g_objPlayer,a,b),g_objButtonClose&&g_functions.placeElement(g_objButtonClose,"right","top")},this.setPosition=function(a,b){g_functions.placeElement(g_objPlayer,a,b)},this.getObject=function(){return g_objPlayer},this.show=function(){if(!0==t.isVisible())return!0;g_objPlayer.show(),g_objPlayer.fadeTo(0,1),g_objButtonClose&&g_objButtonClose.show(),g_objThis.trigger(t.events.SHOW)},this.hide=function(){if(!1==t.isVisible())return!0;stopAndHidePlayers(),g_activePlayerType=null,g_objPlayer.hide(),g_objThis.trigger(t.events.HIDE)},this.getActiveAPI=function(){switch(g_activePlayerType){case"youtube":return g_youtubeAPI;case"vimeo":return g_vimeoAPI;case"wistia":return g_wistiaAPI;case"soundcloud":return g_soundCloudAPI;case"html5":return g_html5API;default:return null}},this.pause=function(){var a=t.getActiveAPI();if(null==a)return!1;"function"==typeof a.pause&&a.pause()},this.isVisible=function(){return g_objPlayer.is(":visible")},this.playYoutube=function(c,a,b){if(void 0===a)var a=!0;if(!b)var b=null;stopAndHidePlayers("youtube"),g_objYoutube.show(),0==g_objYoutube.children("#"+g_temp.youtubeInnerID).length&&g_objYoutube.append("<div id='"+g_temp.youtubeInnerID+"'></div>");var d={};b&&(d.start=b),!0==g_youtubeAPI.isPlayerReady()&& !0==g_temp.standAloneMode?g_youtubeAPI.changeVideo(c,a):g_youtubeAPI.putVideo(g_temp.youtubeInnerID,c,"100%","100%",a,d),g_activePlayerType="youtube"},this.playVimeo=function(b,a){if(void 0===a)var a=!0;stopAndHidePlayers("vimeo"),g_objVimeo.show(),g_vimeoAPI.putVideo(g_temp.vimeoPlayerID,b,"100%","100%",a),g_activePlayerType="vimeo"},this.playHtml5Video=function(b,c,d,e,a){if(void 0===a)var a=!0;stopAndHidePlayers("html5"),g_objHtml5.show();var f={ogv:b,webm:c,mp4:d,posterImage:e};g_html5API.putVideo(g_temp.html5PlayerID,f,"100%","100%",a),g_activePlayerType="html5"},this.playSoundCloud=function(b,a){if(void 0===a)var a=!0;stopAndHidePlayers("soundcloud"),g_objSoundCloud.show(),g_soundCloudAPI.putSound(g_temp.soundCloudPlayerID,b,"100%","100%",a),g_activePlayerType="soundcloud"},this.playWistia=function(b,a){if(void 0===a)var a=!0;stopAndHidePlayers("wistia"),g_objWistia.show(),g_wistiaAPI.putVideo(g_temp.wistiaPlayerID,b,"100%","100%",a),g_activePlayerType="wistia"}}var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI;function ugCheckForMinJQueryVersion(){if(!1==g_ugFunctions.checkMinJqueryVersion("1.8.0"))throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.")}function ugCheckForErrors(galleryID,type){function checkForJqueryPresents(){if("undefined"==typeof jQuery)throw new Error("jQuery library not included")}function checkForDoubleJQuery(){if("function"==typeof jQuery.fn.unitegallery)return!0;var errorMessage="You have some jquery.js library include that comes after the gallery files js include.";throw errorMessage+="<br> This include eliminates the gallery libraries, and make it not work.","cms"==type?(errorMessage+="<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Gallery Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true.",errorMessage+="<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it."):errorMessage+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.",new Error(errorMessage)}try{"jquery"==type?(checkForJqueryPresents(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),checkForDoubleJQuery())}catch(objError){var message=objError.message;if(message="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+(message="Unite Gallery Error: "+message)+"</div>","jquery"==type){var objGallery=document.getElementById(galleryID);objGallery.innerHTML=message,objGallery.style.display="block"}else jQuery(galleryID).show().html(message);return!1}return!0}function UniteGalleryMain(){var g_galleryID,g_objWrapper,g_objParent,g_objThumbs,g_objSlider,g_objLightbox,g_objTabs,g_objLoadMore,g_numItems,g_objTheme,t=this,g_objGallery=jQuery(t),g_functions=new UGFunctions,g_arrItems=[],g_selectedItem=null,g_selectedItemIndex=-1,g_objCache={};this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"};var g_options={gallery_width:900,gallery_height:500,gallery_height_mobile:null,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!1,gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:"",load_api_externally:!1},g_temp={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};function __________INIT_GALLERY_______(){}function getThemeFunction(themeName){var themeFunction=themeName;return -1==themeFunction.indexOf("UGTheme_")&&(themeFunction="UGTheme_"+themeFunction),themeFunction}function initTheme(objCustomOptions){if(objCustomOptions.hasOwnProperty("gallery_theme"))g_options.gallery_theme=objCustomOptions.gallery_theme;else{var defaultTheme=g_options.gallery_theme;!1==g_ugFunctions.isThemeRegistered(defaultTheme)&&(g_options.gallery_theme=g_ugFunctions.getFirstRegisteredTheme())}var themeFunction=getThemeFunction(g_options.gallery_theme);try{g_options.gallery_theme=eval(themeFunction)}catch(e){}g_options.gallery_theme=eval(themeFunction),(g_objTheme=new g_options.gallery_theme).init(t,objCustomOptions)}function resetOptions(){g_options=jQuery.extend({},g_temp.originalOptions),g_selectedItemIndex=-1,g_selectedItem=null,g_objSlider=void 0,g_objThumbs=void 0,g_objLightbox=void 0}function checkForStartupErrors(){try{ugCheckForMinJQueryVersion()}catch(e){throwErrorShowMessage(e.message)}"object"==typeof g_objWrapper.outerWidth()&&throwErrorShowMessage("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version."),setTimeout(function(){ugCheckForErrors(g_galleryID,"cms")},5e3)}function runGallery(galleryID,objCustomOptions,htmlItems,cacheID){var isCustomOptions="object"==typeof objCustomOptions;if(isCustomOptions&&(g_temp.objCustomOptions=objCustomOptions),!0==g_temp.isRunFirstTime){if(0==(g_objWrapper=jQuery(g_galleryID=galleryID)).length)return trace("div with id: "+g_galleryID+" not found"),!1;g_objParent=g_objWrapper.parent(),checkForStartupErrors(),g_temp.originalOptions=jQuery.extend({},g_options),isCustomOptions&&(g_options=jQuery.extend(g_options,objCustomOptions)),!0==g_options.gallery_enable_cache&&g_options.gallery_initial_catid&&cacheItems(g_options.gallery_initial_catid),t.setSizeClass();var objItems=g_objWrapper.children();fillItemsArray(objItems),loadAPIs(),g_objWrapper.find("img").fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}else if(t.destroy(),resetOptions(),g_options=jQuery.extend(g_options,g_temp.objCustomOptions),htmlItems){if(cacheID&& !0==g_options.gallery_enable_cache&&cacheItems(cacheID,htmlItems),"noitems"==htmlItems)return showErrorMessage("No items in this category",""),!1;g_objWrapper.html(htmlItems);var objItems=g_objWrapper.children();fillItemsArray(objItems),loadAPIs(),g_objWrapper.children().fadeTo(0,0).hide(),g_objWrapper.show(),clearInitData()}!0==g_temp.isRunFirstTime&& !0==g_options.gallery_enable_tabs&&(g_objTabs=new UGTabs).init(t,g_options),!0==g_temp.isRunFirstTime&& !0==g_options.gallery_enable_loadmore&&(g_objLoadMore=new UGLoadMore).init(t,g_options),isCustomOptions&&modifyInitParams(g_temp.objCustomOptions),validateParams(),!0==g_options.gallery_shuffle&&t.shuffleItems(),initTheme(g_temp.objCustomOptions),setGalleryHtml(),setHtmlObjectsProperties(),0==g_objWrapper.width()?g_functions.waitForWidth(g_objWrapper,runGalleryActually):runGalleryActually()}function runGalleryActually(){t.setSizeClass(),!1==g_temp.isFreestyleMode&& !0==g_options.gallery_preserve_ratio&&setHeightByOriginalRatio(),g_objTheme.run(),g_objTabs&&g_temp.isRunFirstTime&&g_objTabs.run(),preloadBigImages(),initEvents(),g_numItems>0&&t.selectItem(0),!0==g_options.gallery_autoplay&&t.startPlayMode(),g_temp.isRunFirstTime=!1}function showErrorMessage(message,prefix){if(void 0===prefix)var prefix="<b>Unite Gallery Error: </b>";else prefix="<b>"+prefix+": </b>";var html="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+(message=prefix+message)+"</div></div>";g_objWrapper.children().remove(),g_objWrapper.html(html),g_objWrapper.show()}function throwErrorShowMessage(message){throw showErrorMessage(message),new Error(message)}function modifyInitParams(){g_options.gallery_images_preload_type||(g_options.gallery_images_preload_type="minimal"),(void 0==g_options.gallery_min_height||g_options.gallery_height<g_options.gallery_min_height)&&(g_options.gallery_min_height=0),(void 0==g_options.gallery_min_width||g_options.gallery_width<g_options.gallery_min_width)&&(g_options.gallery_min_width=0)}function validateParams(){if(!g_options.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(g_options.gallery_height)&&g_options.gallery_height<g_options.gallery_min_height)throw new Error("The <b>gallery_height</b> option must be bigger then <b>gallery_min_height option</b>");if(g_options.gallery_width<g_options.gallery_min_width)throw new Error("The <b>gallery_width</b> option must be bigger then <b>gallery_min_width option</b>")}function setGalleryHtml(){g_objWrapper.addClass("ug-gallery-wrapper"),g_objWrapper.append("<div class='ug-overlay-disabled' style='display:none'></div>"),t.setSizeClass()}function clearInitData(){g_objWrapper.children().remove()}function storeLastSize(){var objSize=t.getSize();g_temp.lastWidth=objSize.width,g_temp.lastHeight=objSize.height}function setHeightByOriginalRatio(){var objSize=t.getSize();if(objSize.width/objSize.height!=objSize.orig_ratio){var newHeight=objSize.width/objSize.orig_ratio;(newHeight=Math.round(newHeight))<g_options.gallery_min_height&&(newHeight=g_options.gallery_min_height),g_objWrapper.height(newHeight)}}function setHtmlObjectsProperties(){var objCss={"max-width":g_functions.getCssSizeParam(g_options.gallery_width),"min-width":g_functions.getCssSizeParam(g_options.gallery_min_width)};if(!1==g_temp.isFreestyleMode){var galleryHeight=g_functions.getCssSizeParam(g_options.gallery_height);!0==t.isMobileMode()&&g_options.gallery_height_mobile&&(galleryHeight=g_functions.getCssSizeParam(g_options.gallery_height_mobile)),objCss.height=galleryHeight}else objCss.overflow="visible";g_options.gallery_background_color&&(objCss["background-color"]=g_options.gallery_background_color),g_objWrapper.css(objCss)}function fillItemByChild(objChild){var isMobile=t.isMobileMode(),tagname=objChild.prop("tagName").toLowerCase();if("noscript"==tagname)return null;if("picture"==tagname){var objImage=objChild.find("img");if(0==objImage.length)return null;objChild=objImage,tagname="img"}var srcLazy=objChild.data("lazy-src");srcLazy&&objChild.attr("src",srcLazy);var itemLink="";if("a"==tagname){itemLink=objChild.attr("href");var objChildren=objChild.children();if(0==(objChild=objChild.find("img")).length)return null;tagname="img"}var itemType=objChild.data("type");void 0==itemType&&(itemType="image");var objItem={};if(objItem.type=itemType,"img"==tagname){var lasyLoadSrc=objChild.data("lazyload-src");if(!lasyLoadSrc)var lasyLoadSrc=objChild.data("lazy-src");lasyLoadSrc&&""!=lasyLoadSrc&&(objChild.attr("src",lasyLoadSrc),jQuery.removeData(objChild,"lazyload-src"));var urlImage=objChild.data("image"),urlThumb=objChild.data("thumb"),titleFromData=objChild.data("title");void 0===urlImage&&(urlImage=null),void 0===urlThumb&&(urlThumb=null);var imageSrc=objChild.attr("src");urlImage||(urlImage=imageSrc),urlThumb||(urlThumb=imageSrc),urlThumb||(urlThumb=urlImage),urlImage||(urlImage=urlThumb),objItem.urlThumb=urlThumb,objItem.urlImage=urlImage,objItem.title=objChild.attr("alt"),titleFromData&&(objItem.title=titleFromData),objItem.objThumbImage=objChild,objItem.objThumbImage.attr("src",objItem.urlThumb)}else{if("image"==itemType)throw trace("Problematic gallery item found:"),trace(objChild),trace("Please look for some third party js script that could add this item to the gallery"),new Error("The item should not be image type");objItem.urlThumb=objChild.data("thumb"),objItem.title=objChild.data("title"),objItem.objThumbImage=null,objItem.urlImage=objChild.data("image")}if(!0==isMobile){var urlThumbMobile=objChild.data("thumb-mobile");void 0!==urlThumbMobile&&""!=urlThumbMobile&&(objItem.urlThumb=urlThumbMobile,"img"==tagname&&objChild.attr("src",objItem.urlThumb));var urlImageMobile=objChild.data("image-mobile");void 0!==urlImageMobile&&""!=urlImageMobile&&(objItem.urlImage=urlImageMobile)}objItem.link=itemLink,objItem.description=objChild.attr("title"),objItem.description||(objItem.description=objChild.data("description")),objItem.description||(objItem.description=""),objItem.isNewAdded=!1,objItem.isLoaded=!1,objItem.isThumbImageLoaded=!1,objItem.objPreloadImage=null,objItem.isBigImageLoadStarted=!1,objItem.isBigImageLoaded=!1,objItem.isBigImageLoadError=!1,objItem.imageWidth=0,objItem.imageHeight=0,objItem.thumbWidth=0,objItem.thumbHeight=0,objItem.thumbRatioByWidth=0,objItem.thumbRatioByHeight=0;var dataWidth=objChild.data("width"),dataHeight=objChild.data("height");dataWidth&&"number"==typeof dataWidth&&dataHeight&&"number"==typeof dataHeight&&(objItem.thumbWidth=dataWidth,objItem.thumbHeight=dataHeight,objItem.thumbRatioByWidth=dataWidth/dataHeight,objItem.thumbRatioByHeight=dataHeight/dataWidth),objItem.addHtml=null;var isImageMissing=void 0==objItem.urlImage||""==objItem.urlImage,isThumbMissing=void 0==objItem.urlThumb||""==objItem.urlThumb;switch(objItem.type){case"youtube":if(objItem.videoid=objChild.data("videoid"),objItem.video_start=objChild.data("start"),isImageMissing||isThumbMissing){var objImages=g_ugYoutubeAPI.getVideoImages(objItem.videoid);isImageMissing&&(objItem.urlImage=objImages.preview),isThumbMissing&&(objItem.urlThumb=objImages.thumb,"img"==tagname&&objChild.attr("src",objItem.urlThumb))}g_temp.isYoutubePresent=!0;break;case"vimeo":objItem.videoid=objChild.data("videoid"),g_temp.isVimeoPresent=!0;break;case"html5video":objItem.videoogv=objChild.data("videoogv"),objItem.videowebm=objChild.data("videowebm"),objItem.videomp4=objChild.data("videomp4"),g_temp.isHtml5VideoPresent=!0;break;case"soundcloud":objItem.trackid=objChild.data("trackid"),g_temp.isSoundCloudPresent=!0;break;case"wistia":objItem.videoid=objChild.data("videoid"),g_temp.isWistiaPresent=!0;break;case"custom":var objChildImage=objChild.children("img");objChildImage.length&&(objChildImage=jQuery(objChildImage[0]),objItem.urlThumb=objChildImage.attr("src"),objItem.title=objChildImage.attr("alt"),objItem.objThumbImage=objChildImage);var objChildren=objChild.children().not("img:first-child");objChildren.length&&(objItem.addHtml=objChildren.clone())}return objItem.objThumbImage&&(objItem.objThumbImage.removeAttr("data-description",""),objItem.objThumbImage.removeAttr("data-image",""),objItem.objThumbImage.removeAttr("data-thumb",""),objItem.objThumbImage.removeAttr("title","")),objItem}function fillItemsArray(arrChildren,isAppend){if(!0!==isAppend)g_arrItems=[];else for(var i=0;i<g_numItems;i++)g_arrItems[i].isNewAdded=!1;for(var i=0;i<arrChildren.length;i++){var objChild=jQuery(arrChildren[i]),objItem=fillItemByChild(objChild);if(null===objItem){objChild.remove();continue}numIndex=g_arrItems.length,objItem.index=numIndex,!0===isAppend&&(objItem.isNewAdded=!0),g_arrItems.push(objItem)}g_numItems=g_arrItems.length}function loadAPIs(){var isLoadExternally=g_options.load_api_externally;g_temp.isYoutubePresent&&g_ugYoutubeAPI.loadAPI(isLoadExternally),g_temp.isVimeoPresent&&g_ugVimeoAPI.loadAPI(isLoadExternally),g_temp.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI(isLoadExternally),g_temp.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI(isLoadExternally),g_temp.isWistiaPresent&&g_ugWistiaAPI.loadAPI(isLoadExternally)}function preloadBigImages(){if("visible"!=g_options.gallery_images_preload_type||g_objThumbs||(g_options.gallery_images_preload_type="minimal"),!0==g_temp.isAllItemsPreloaded)return!0;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":jQuery(g_arrItems).each(function(){preloadItemImage(this)});break;case"visible":jQuery(g_arrItems).each(function(){var a=this;!0==g_objThumbs.isItemThumbVisible(a)&&preloadItemImage(a)})}}function checkPreloadItemImage(objItem){if(!0==objItem.isBigImageLoadStarted|| !0==objItem.isBigImageLoaded|| !0==objItem.isBigImageLoadError)return!1;switch(g_options.gallery_images_preload_type){default:case"minimal":break;case"all":preloadItemImage(objItem);break;case"visible":!0==g_objThumbs.isItemThumbVisible(objItem)&&preloadItemImage(objItem)}}function preloadItemImage(objItem){if(!0==objItem.isBigImageLoadStarted|| !0==objItem.isBigImageLoaded|| !0==objItem.isBigImageLoadError)return!0;var imageUrl=objItem.urlImage;if(""==imageUrl|| void 0==imageUrl)return objItem.isBigImageLoadError=!0,!1;objItem.isBigImageLoadStarted=!0,objItem.objPreloadImage=jQuery("<img/>").attr("src",imageUrl),objItem.objPreloadImage.data("itemIndex",objItem.index),objItem.objPreloadImage.on("load",t.onItemBigImageLoaded),objItem.objPreloadImage.on("error",function(){var b=jQuery(this).data("itemIndex"),a=g_arrItems[b];a.isBigImageLoadError=!0,a.isBigImageLoaded=!1;var c=jQuery(this).attr("src");console.log("Can't load image: "+c),g_objGallery.trigger(t.events.ITEM_IMAGE_UPDATED,[b,a.urlImage]),a.objThumbImage.attr("src",a.urlThumb)}),checkAllItemsStartedPreloading()}function preloadNearBigImages(objItem){if(!0==g_temp.isAllItemsPreloaded)return!1;if(!objItem)var objItem=g_selectedItem;if(!objItem)return!0;var currentIndex=objItem.index,lastItemIndex=currentIndex-1,nextItemIndex=currentIndex+1;lastItemIndex>0&&preloadItemImage(g_arrItems[lastItemIndex]),nextItemIndex<g_numItems&&preloadItemImage(g_arrItems[nextItemIndex])}function checkAllItemsStartedPreloading(){if(!0==g_temp.isAllItemsPreloaded)return!1;for(var index in g_arrItems)if(!1==g_arrItems[index].isBigImageLoadStarted)return!1;g_temp.isAllItemsPreloaded=!0}function __________END_INIT_GALLERY_______(){}function __________EVENTS_____________(){}function onSliderMouseEnter(event){!0==g_options.gallery_pause_on_mouseover&& !1==t.isFullScreen()&& !0==g_temp.isPlayMode&&g_objSlider&& !1==g_objSlider.isSlideActionActive()&&t.pausePlaying()}function onSliderMouseLeave(event){!0==g_options.gallery_pause_on_mouseover&& !0==g_temp.isPlayMode&&g_objSlider&& !1==g_objSlider.isSlideActionActive()&& !1==g_objSlider.isCurrentSlideLoadingImage()&&t.continuePlaying()}function isThisGalleryForKeyAction(){if(!window.ugArrGalleriesObjects||(window.ugArrGalleriesObjects.length,1==window.ugArrGalleriesObjects.length))return!0;var currentScore,maxScore=0,currentGalleryID=t.getGalleryID();return jQuery.each(window.ugArrGalleriesObjects,function(d,b){var c=b.getGalleryID(),a=b.getKeyPressScore();a>maxScore&&(maxScore=a),c==currentGalleryID&&(currentScore=a)}),currentScore==maxScore}function onKeyPress(event){var obj=jQuery(event.target);if(obj.is("textarea")||obj.is("select")||obj.is("input"))return!0;var keyCode=event.charCode?event.charCode:event.keyCode?event.keyCode:event.which?event.which:0,wasAction=!1;switch(keyCode){case 39:var isGalleryForKeyAction=isThisGalleryForKeyAction();!0==isGalleryForKeyAction&&(t.nextItem(),wasAction=!0);break;case 37:var isGalleryForKeyAction=isThisGalleryForKeyAction();!0==isGalleryForKeyAction&&(t.prevItem(),wasAction=!0);break;default:wasAction=!1}!0==wasAction&&(event.preventDefault(),event.stopPropagation(),event.stopImmediatePropagation()),g_objGallery.trigger(t.events.GALLERY_KEYPRESS,[keyCode,event])}function onGalleryResized(){var objSize=t.getSize();if(0==objSize.width)return!0;t.setSizeClass();var objSize=t.getSize();if(objSize.width!=g_temp.lastWidth|| !1==g_temp.isFreestyleMode&&objSize.height!=g_temp.lastHeight){var heightWasSet=!1;if(g_temp.funcCustomHeight){var newHeight=g_temp.funcCustomHeight(objSize);newHeight&&(g_objWrapper.height(newHeight),heightWasSet=!0)}!1==heightWasSet&& !0==g_options.gallery_preserve_ratio&& !1==g_temp.isFreestyleMode&&setHeightByOriginalRatio(),storeLastSize(),g_objGallery.trigger(t.events.SIZE_CHANGE)}}function onThumbsChange(event){"visible"==g_options.gallery_images_preload_type&& !1==g_temp.isAllItemsPreloaded&&preloadBigImages()}function onFullScreenChange(){var isFullscreen=g_functions.isFullScreen(),event=isFullscreen?t.events.ENTER_FULLSCREEN:t.events.EXIT_FULLSCREEN;if(g_galleryID!==g_functions.getGlobalData("fullscreenID"))return!0;isFullscreen?g_objWrapper.addClass("ug-fullscreen"):g_objWrapper.removeClass("ug-fullscreen"),g_objGallery.trigger(event),onGalleryResized()}function onItemImageUpdated(event,index){var objItem=t.getItem(index);checkPreloadItemImage(objItem)}function onCurrentSlideImageLoadEnd(){!0==t.isPlayMode()&&t.continuePlaying()}function initEvents(){if(g_objWrapper.on("dragstart",function(a){a.preventDefault()}),g_objGallery.on(t.events.ITEM_IMAGE_UPDATED,onItemImageUpdated),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).on(g_objThumbs.events.STRIP_MOVE,onThumbsChange);break;case"grid":jQuery(g_objThumbs).on(g_objThumbs.events.PANE_CHANGE,onThumbsChange)}"advance"==g_options.gallery_mousewheel_role&& !1==g_temp.isFreestyleMode&&g_objWrapper.on("mousewheel",t.onGalleryMouseWheel),storeLastSize(),jQuery(window).resize(function(){g_objWrapper.css("width","auto"),g_functions.whenContiniousEventOver("gallery_resize",onGalleryResized,g_temp.resizeDelay)}),setTimeout(function(){setInterval(onGalleryResized,2e3)},1e4),g_functions.addFullScreenChangeEvent(onFullScreenChange),g_objSlider&&(jQuery(g_objSlider).on(g_objSlider.events.ITEM_CHANGED,function(){var a=g_objSlider.getCurrentItemIndex();-1!=a&&t.selectItem(a)}),!0==g_options.gallery_pause_on_mouseover&&(g_objSlider.getElement().hover(onSliderMouseEnter,onSliderMouseLeave),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){onSliderMouseLeave()})),retriggerEvent(g_objSlider,g_objSlider.events.ACTION_START,t.events.SLIDER_ACTION_START),retriggerEvent(g_objSlider,g_objSlider.events.ACTION_END,t.events.SLIDER_ACTION_END),jQuery(g_objSlider).on(g_objSlider.events.CURRENTSLIDE_LOAD_END,onCurrentSlideImageLoadEnd)),!0==g_options.gallery_control_keyboard&&jQuery(document).keydown(onKeyPress)}function __________GENERAL_______(){}function cacheItems(cacheID,htmlItemsArg){if(htmlItemsArg){var htmlItems=htmlItemsArg;"noitems"!=htmlItems&&(htmlItems=jQuery(htmlItemsArg).clone())}else var htmlItems=g_objWrapper.children().clone();g_objCache[cacheID]=htmlItems}function removeAllSizeClasses(objWrapper){objWrapper||(objWrapper=g_objWrapper),objWrapper.removeClass("ug-under-480"),objWrapper.removeClass("ug-under-780"),objWrapper.removeClass("ug-under-960")}function retriggerEvent(object,originalEvent,newEvent){jQuery(object).on(originalEvent,function(a){g_objGallery.trigger(newEvent,[this])})}function advanceNextStep(){var timeNow=jQuery.now(),timeDiff=timeNow-g_temp.playTimeLastStep;g_temp.playTimeLastStep=timeNow;var isVisible=t.isGalleryVisible();if(!1==isVisible)return!1;if(g_temp.playTimePassed+=timeDiff,g_temp.objProgress){var percent=g_temp.playTimePassed/g_options.gallery_play_interval;g_temp.objProgress.setProgress(percent)}g_temp.playTimePassed>=g_options.gallery_play_interval&&(t.nextItem(),g_temp.playTimePassed=0)}function unselectSeletedItem(){if(null==g_selectedItem)return!0;g_objThumbs&&g_objThumbs.setThumbUnselected(g_selectedItem.objThumbWrapper),g_selectedItem=null,g_selectedItemIndex=-1}function toFakeFullScreen(){jQuery("body").addClass("ug-body-fullscreen"),g_objWrapper.addClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!0,g_objGallery.trigger(t.events.ENTER_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}function exitFakeFullscreen(){jQuery("body").removeClass("ug-body-fullscreen"),g_objWrapper.removeClass("ug-fake-fullscreen"),g_temp.isFakeFullscreen=!1,g_objGallery.trigger(t.events.EXIT_FULLSCREEN),g_objGallery.trigger(t.events.SIZE_CHANGE)}this.onItemBigImageLoaded=function(d,a){if(!a)var a=jQuery(this);var b=g_arrItems[a.data("itemIndex")];b.isBigImageLoaded=!0;var c=g_functions.getImageOriginalSize(a);b.imageWidth=c.width,b.imageHeight=c.height},this.checkFillImageSize=function(b,a){if(!a){var c=b.data("itemIndex");if(void 0===c)throw new Error("Wrong image given to gallery.checkFillImageSize");var a=g_arrItems[c]}var d=g_functions.getImageOriginalSize(b);a.imageWidth=d.width,a.imageHeight=d.height},this.setFreestyleMode=function(){g_temp.isFreestyleMode=!0},this.attachThumbsPanel=function(a,b){g_temp.thumbsType=a,g_objThumbs=b},this.initSlider=function(a,b){if(!a)var a={};a=jQuery.extend(g_temp.objCustomOptions,a),(g_objSlider=new UGSlider).init(t,a,b)},this.onGalleryMouseWheel=function(a,b,c,d){a.preventDefault(),b>0?t.prevItem():t.nextItem()},this.getKeyPressScore=function(){return t.isGalleryInsideScreen()?1:g_objLightbox&& !0==g_objLightbox.isOpened()?2:0},this.getGalleryID=function(){return g_galleryID},this.destroy=function(){if(g_objWrapper.off("dragstart"),g_objGallery.off(t.events.ITEM_IMAGE_UPDATED),g_objThumbs)switch(g_temp.thumbsType){case"strip":jQuery(g_objThumbs).off(g_objThumbs.events.STRIP_MOVE);break;case"grid":jQuery(g_objThumbs).off(g_objThumbs.events.PANE_CHANGE)}if(g_objWrapper.off("mousewheel"),jQuery(window).off("resize"),g_functions.destroyFullScreenChangeEvent(),g_objSlider){jQuery(g_objSlider).off(g_objSlider.events.ITEM_CHANGED);var a=g_objSlider.getElement();a.off("mouseenter"),a.off("mouseleave"),g_objGallery.off(t.events.ENTER_FULLSCREEN),jQuery(g_objSlider).off(g_objSlider.events.ACTION_START),jQuery(g_objSlider).off(g_objSlider.events.ACTION_END),jQuery(g_objSlider).off(g_objSlider.events.CURRENTSLIDE_LOAD_END)}!0==g_options.gallery_control_keyboard&&jQuery(document).off("keydown"),g_objTheme&&"function"==typeof g_objTheme.destroy&&g_objTheme.destroy(),g_objWrapper.html("")},this.getArrItems=function(){return g_arrItems},this.getObjects=function(){return{g_galleryID:g_galleryID,g_objWrapper:g_objWrapper,g_objThumbs:g_objThumbs,g_objSlider:g_objSlider,g_options:g_options,g_arrItems:g_arrItems,g_numItems:g_numItems}},this.getObjSlider=function(){return g_objSlider},this.getItem=function(a){if(a<0||a>=g_numItems)throw new Error("item with index: "+a+" not found");return g_arrItems[a]},this.getWidth=function(){return t.getSize().width},this.getHeight=function(){return t.getSize().height},this.getSize=function(){var a=g_functions.getElementSize(g_objWrapper);return a.orig_width=g_options.gallery_width,a.orig_height=g_options.gallery_height,a.orig_ratio=a.orig_width/a.orig_height,a},this.getGalleryID=function(){return g_galleryID.replace("#","")},this.getNextItem=function(a,c){"object"==typeof a&&(a=a.index);var b=a+1;if(!0!==c&&1==g_numItems)return null;if(b>=g_numItems){if(!0!=g_options.gallery_carousel&& !0!==c)return null;b=0}return g_arrItems[b]},this.getPrevItem=function(a){"object"==typeof a&&(a=a.index);var b=a-1;if(b<0){if(!0!=g_options.gallery_carousel&& !0!==forceCarousel)return null;b=g_numItems-1}return g_arrItems[b]},this.getSelectedItem=function(){return g_selectedItem},this.getSelectedItemIndex=function(){return g_selectedItemIndex},this.getNumItems=function(){return g_numItems},this.isLastItem=function(){return g_selectedItemIndex==g_numItems-1},this.isFirstItem=function(){return 0==g_selectedItemIndex},this.getOptions=function(){return g_options},this.getElement=function(){return g_objWrapper},this.___________SET_CONTROLS___________=function(){},this.setNextButton=function(a){a.data("ug-button",!0),g_functions.setButtonOnClick(a,t.nextItem)},this.setPrevButton=function(a){a.data("ug-button",!0),g_functions.setButtonOnClick(a,t.prevItem)},this.setFullScreenToggleButton=function(a){a.data("ug-button",!0),g_functions.setButtonOnTap(a,t.toggleFullscreen),g_objGallery.on(t.events.ENTER_FULLSCREEN,function(){a.addClass("ug-fullscreenmode")}),g_objGallery.on(t.events.EXIT_FULLSCREEN,function(){a.removeClass("ug-fullscreenmode")})},this.destroyFullscreenButton=function(a){g_functions.destroyButton(a),g_objGallery.off(t.events.ENTER_FULLSCREEN),g_objGallery.off(t.events.EXIT_FULLSCREEN)},this.setPlayButton=function(a){a.data("ug-button",!0),g_functions.setButtonOnClick(a,t.togglePlayMode),g_objGallery.on(t.events.START_PLAY,function(){a.addClass("ug-stop-mode")}),g_objGallery.on(t.events.STOP_PLAY,function(){a.removeClass("ug-stop-mode")})},this.destroyPlayButton=function(a){g_functions.destroyButton(a),g_objGallery.off(t.events.START_PLAY),g_objGallery.off(t.events.STOP_PLAY)},this.setProgressIndicator=function(a){g_temp.objProgress=a},this.setTextContainers=function(a,b){g_objGallery.on(t.events.ITEM_CHANGE,function(){var c=t.getSelectedItem();a.html(c.title),b.html(c.description)})},this.showDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").show()},this.hideDisabledOverlay=function(){g_objWrapper.children(".ug-overlay-disabled").hide()},this.___________END_SET_CONTROLS___________=function(){},this.___________PLAY_MODE___________=function(){},this.startPlayMode=function(){if(g_temp.isPlayMode=!0,g_temp.isPlayModePaused=!1,g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval),g_temp.objProgress){var a=g_temp.objProgress.getElement();g_temp.objProgress.setProgress(0),a.show()}g_objGallery.trigger(t.events.START_PLAY),g_objSlider&& !0==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying()},this.resetPlaying=function(){if(!1==g_temp.isPlayMode)return!0;g_temp.playTimePassed=0,g_temp.playTimeLastStep=jQuery.now()},this.pausePlaying=function(){if(!0==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!0,clearInterval(g_temp.playHandle),g_objGallery.trigger(t.events.PAUSE_PLAYING)},this.continuePlaying=function(){if(!1==g_temp.isPlayModePaused)return!0;g_temp.isPlayModePaused=!1,g_temp.playTimeLastStep=jQuery.now(),g_temp.playHandle=setInterval(advanceNextStep,g_temp.playStepInterval)},this.stopPlayMode=function(){g_temp.isPlayMode=!1,clearInterval(g_temp.playHandle),g_temp.playTimePassed=0,g_temp.objProgress&&g_temp.objProgress.getElement().hide(),g_objGallery.trigger(t.events.STOP_PLAY)},this.isPlayMode=function(){return g_temp.isPlayMode},this.togglePlayMode=function(){!1==t.isPlayMode()?t.startPlayMode():t.stopPlayMode()},this.___________GENERAL_EXTERNAL___________=function(){},this.getCurrentNumItem=function(){return g_selectedItemIndex},this.shuffleItems=function(){for(var a in g_arrItems=g_functions.arrayShuffle(g_arrItems))g_arrItems[a].index=parseInt(a)},this.setOptions=function(a){g_options=jQuery.extend(g_options,a)},this.selectItem=function(a,c){"number"==typeof a&&(a=t.getItem(a));var b=a.index;if(b==g_selectedItemIndex)return!0;unselectSeletedItem(),g_selectedItem=a,g_selectedItemIndex=b,g_objGallery.trigger(t.events.ITEM_CHANGE,[a,c]),!0==g_temp.isPlayMode&&(t.resetPlaying(),!0==g_objSlider.isCurrentSlideLoadingImage()&&t.pausePlaying())},this.nextItem=function(){var a=g_selectedItemIndex+1;if(0==g_numItems|| !1==g_options.gallery_carousel&&a>=g_numItems)return!0;a>=g_numItems&&(a=0),t.selectItem(a,"next")},this.prevItem=function(){var a=g_selectedItemIndex-1;if(-1==g_selectedItemIndex&&(a=0),0==g_numItems|| !1==g_options.gallery_carousel&&a<0)return!0;a<0&&(a=g_numItems-1),t.selectItem(a,"prev")},this.isFullScreen=function(){return!0==g_temp.isFakeFullscreen|| !0==g_functions.isFullScreen()},this.isFakeFullscreen=function(){return g_temp.isFakeFullscreen},this.toFullScreen=function(){g_functions.setGlobalData("fullscreenID",g_galleryID);var a=g_objWrapper.get(0);!1==g_functions.toFullscreen(a)&&toFakeFullScreen()},this.exitFullScreen=function(){!0==g_temp.isFakeFullscreen?exitFakeFullscreen():g_functions.exitFullscreen()},this.toggleFullscreen=function(){!1==t.isFullScreen()?t.toFullScreen():t.exitFullScreen()},this.resize=function(c,a,b){g_objWrapper.css("width","auto"),g_objWrapper.css("max-width",c+"px"),a&&g_objWrapper.height(a),b|| !0===b||onGalleryResized()},this.setSizeClass=function(c,a){if(!c)var c=g_objWrapper;if(!a)var a=t.getSize().width;if(0==a)var a=jQuery(window).width();var b="";if(a<=480?b="ug-under-480":a<=780?b="ug-under-780":a<960&&(b="ug-under-960"),!0==c.hasClass(b))return!0;removeAllSizeClasses(c),""!=b&&c.addClass(b)},this.isMobileMode=function(){return!!(g_objWrapper.hasClass("ug-under-780")||g_objWrapper.hasClass("ug-under-480"))},this.isSmallWindow=function(){var a=jQuery(window).width();return!a||a<=480},this.isGalleryVisible=function(){return g_objWrapper.is(":visible")},this.isGalleryInsideScreen=function(){return!0!=g_temp.isFreestyleMode&&!!g_objSlider&&g_functions.isElementInsideScreen(g_objWrapper)},this.changeItems=function(a,b){if(!a)var a="noitems";runGallery(g_galleryID,"nochange",a,b)},this.addItems=function(b){if(!b||0==b.length)return!1;var a=g_objWrapper.children(".ug-newitems-wrapper");0==a.length&&g_objWrapper.append("<div class='ug-newitems-wrapper' style='display:none'></div>"),(a=g_objWrapper.children(".ug-newitems-wrapper")).append(b);var c=jQuery(a.children());if(fillItemsArray(c,!0),loadAPIs(),!g_objTheme||"function"!=typeof g_objTheme.addItems)throw new Error("addItems function not found in the theme");a.remove(),g_objTheme.addItems()},this.getNewAddedItemsIndexes=function(){var a=[];return jQuery.each(g_arrItems,function(b,c){!0==c.isNewAdded&&a.push(b)}),a},this.showErrorMessageReplaceGallery=function(a){showErrorMessage(a)},this.setFuncCustomHeight=function(a){g_temp.funcCustomHeight=a},this.setObjLightbox=function(a){g_objLightbox=a},this.__________EXTERNAL_EVENTS_______=function(){},this.triggerEvent=function(b,a){a?("array"!=jQuery.type(a)&&(a=[a]),g_objGallery.trigger(b,a)):g_objGallery.trigger(b)},this.onEvent=function(a,b){g_objGallery.on(a,b)},this.destroyEvent=function(a){g_objGallery.off(a)},this.__________AJAX_REQUEST_______=function(){},this.ajaxRequest=function(d,a,b,f){if(!b||"function"!=typeof b)throw new Error("ajaxRequest error: success function should be passed");var c=g_options.gallery_urlajax;if(!c||""==c)throw new Error("ajaxRequest error: Ajax url don't passed");if(void 0===a)var a={};var e={action:"unitegallery_ajax_action",client_action:d,galleryID:g_galleryID,data:a};jQuery.ajax({type:"post",url:g_options.gallery_urlajax,dataType:"json",data:e,success:function(a){if(!a)throw new Error("Empty ajax response!");if(-1==a||0===a|| void 0===a.success)throw new Error("ajax error!!!");if(!1==a.success)return showErrorMessage(a.message,"ajax error"),!1;b(a)},error:function(a,b,c){console.log("Ajax Error!!! "+b),responseText=a.responseText,f&&"function"==typeof f?f(responseText):trace(responseText)}})},this.requestNewItems=function(b,d,a){var c=g_options.gallery_enable_cache;if(a||(a=b),!0==d&&(c=!1),!0==c&&g_objCache.hasOwnProperty(a)){var e=g_objCache[a];t.changeItems(e,a)}else g_objGallery.trigger(t.events.GALLERY_BEFORE_REQUEST_ITEMS),t.ajaxRequest("front_get_cat_items",{catid:b},function(b){var c=b.html;t.changeItems(c,a)})},this.run=function(d,b){if(b&&b.hasOwnProperty("gallery_debug_errors")&&(g_options.gallery_debug_errors=b.gallery_debug_errors),!0==g_options.gallery_debug_errors)try{runGallery(d,b)}catch(a){if("object"==typeof a){var c=a.message,e=a.lineNumber,f=a.fileName,g=a.stack;c+=" <br><br> in file: "+f,c+=" <b> line "+e+"</b>",trace(a)}else var c=a;showErrorMessage(c=c.replace("Error:",""))}else runGallery(d,b)}}function UGLightbox(){var g_objTopPanel,g_objGallery,g_objWrapper,g_objOverlay,g_objArrowLeft,g_objArrowRight,g_objButtonClose,g_objNumbers,t=this,g_objThis=jQuery(this),g_gallery=new UniteGalleryMain,g_objSlider=new UGSlider,g_functions=new UGFunctions,g_objTextPanel=new UGTextPanel,g_options={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0};this.events={LIGHTBOX_INIT:"lightbox_init"};var g_temp={topPanelHeight:44,initTextPanelHeight:26,isOpened:!1,isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},g_defaults={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:g_temp.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:38,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},g_defaultsCompact={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};function initLightbox(gallery,customOptions){g_gallery=gallery,g_objGallery=jQuery(gallery),g_gallery.setObjLightbox(t),g_options=jQuery.extend(g_options,g_defaults),g_options=jQuery.extend(g_options,customOptions),g_temp.originalOptions=jQuery.extend({},g_options),"compact"==g_options.lightbox_type&&(g_temp.isCompact=!0,g_options=jQuery.extend(g_options,g_defaultsCompact),g_options=jQuery.extend(g_options,customOptions)),modifyOptions(),!0==g_temp.putSlider?(g_gallery.initSlider(g_options,"lightbox"),g_objSlider=(g_objects=gallery.getObjects()).g_objSlider):g_objSlider=null,!0==g_options.lightbox_show_textpanel?g_objTextPanel.init(g_gallery,g_options,"lightbox"):g_objTextPanel=null}function modifyOptions(){!0==g_temp.isCompact&& !0==g_options.lightbox_show_textpanel&&(g_options.lightbox_slider_image_padding_bottom=g_temp.initTextPanelHeight),!0==g_temp.isCompact&&"inside"==g_options.lightbox_arrows_position&&(g_temp.isArrowsInside=!0),!0==g_temp.isArrowsInside&& !1==g_options.lightbox_arrows_inside_alwayson&&(g_temp.isArrowsOnHoverMode=!0),!1==g_options.lightbox_show_textpanel&&(g_temp.isTopPanelEnabled=!1,g_temp.topPanelHeight=0,g_options.lightbox_slider_image_padding_top=0)}function putLightboxHtml(){var html="",classAddition="";!0==g_temp.isCompact&&(classAddition=" ug-lightbox-compact"),html+="<div class='ug-gallery-wrapper ug-lightbox"+classAddition+"' >",html+="<div class='ug-lightbox-overlay'></div>",!1==g_temp.isCompact&&g_temp.isTopPanelEnabled?(html+="<div class='ug-lightbox-top-panel'>",html+="<div class='ug-lightbox-top-panel-overlay'></div>",g_options.lightbox_show_numbers&&(html+="<div class='ug-lightbox-numbers'></div>"),html+="</div>"):g_options.lightbox_show_numbers&&(html+="<div class='ug-lightbox-numbers'></div>"),html+="<div href=\"javascript:void(0)\" class='ug-lightbox-button-close'></div>",html+="<div class='ug-lightbox-arrow-left'></div>",html+="<div class='ug-lightbox-arrow-right'></div>",html+="</div>",g_objWrapper=jQuery(html),jQuery("body").append(g_objWrapper),g_objSlider&&g_objSlider.setHtml(g_objWrapper),g_objOverlay=g_objWrapper.children(".ug-lightbox-overlay"),!1==g_temp.isCompact&& !0==g_temp.isTopPanelEnabled&&0==(g_objTopPanel=g_objWrapper.children(".ug-lightbox-top-panel")).length&&(g_objTopPanel=null),g_objButtonClose=g_objWrapper.find(".ug-lightbox-button-close"),g_options.lightbox_show_numbers&&(g_objNumbers=g_objWrapper.find(".ug-lightbox-numbers")),g_objArrowLeft=g_objWrapper.children(".ug-lightbox-arrow-left"),g_objArrowRight=g_objWrapper.children(".ug-lightbox-arrow-right"),g_objTextPanel&&(g_objTopPanel?g_objTextPanel.appendHTML(g_objTopPanel):g_objTextPanel.appendHTML(g_objWrapper))}function setProperties(){if(null!==g_options.lightbox_overlay_color&&g_objOverlay.css("background-color",g_options.lightbox_overlay_color),null!==g_options.lightbox_overlay_opacity&&g_objOverlay.fadeTo(0,g_options.lightbox_overlay_opacity),g_objTopPanel&&null!==g_options.lightbox_top_panel_opacity&&g_objTopPanel.children(".ug-lightbox-top-panel-overlay").fadeTo(0,g_options.lightbox_top_panel_opacity),g_objNumbers){var cssNumbers={};null!==g_options.lightbox_numbers_size&&(cssNumbers["font-size"]=g_options.lightbox_numbers_size+"px"),g_options.lightbox_numbers_color&&(cssNumbers.color=g_options.lightbox_numbers_color),null!==g_options.lightbox_numbers_padding_right&&(cssNumbers["padding-right"]=g_options.lightbox_numbers_padding_right+"px"),null!==g_options.lightbox_numbers_padding_top&&(cssNumbers["padding-top"]=g_options.lightbox_numbers_padding_top+"px"),g_objNumbers.css(cssNumbers)}}function refreshSliderItem(newHeight){if(!g_objSlider)return!0;var objOptions={slider_image_padding_top:newHeight};g_objSlider.setOptions(objOptions),g_objSlider.refreshSlideItems()}function handlePanelHeight(fromWhere){if(!g_objTopPanel||!g_objTextPanel)return!1;var panelHeight=g_objTopPanel.height();if(0==panelHeight|| !1==g_objTopPanel.is(":visible"))return!1;var newPanelHeight=panelHeight,textPanelHeight=g_objTextPanel.getSize().height;panelHeight!=g_temp.topPanelHeight&&(newPanelHeight=g_temp.topPanelHeight),textPanelHeight>newPanelHeight&&(newPanelHeight=textPanelHeight),panelHeight!=newPanelHeight&&(g_objTopPanel.height(newPanelHeight),g_objSlider&& !1==g_objSlider.isAnimating()&&refreshSliderItem(newPanelHeight))}function positionTextPanelWide(size){var objOptions={},textWidth=g_options.lightbox_textpanel_width,minPaddingLeft=47,minPaddingRight=40;textWidth>size.width-minPaddingLeft-minPaddingRight?(objOptions.textpanel_padding_left=minPaddingLeft,objOptions.textpanel_padding_right=minPaddingRight,objOptions.textpanel_title_text_align="center",objOptions.textpanel_desc_text_align="center"):(objOptions.textpanel_padding_left=Math.floor((size.width-textWidth)/2),objOptions.textpanel_padding_right=objOptions.textpanel_padding_left,objOptions.textpanel_title_text_align="left",objOptions.textpanel_desc_text_align="left",g_options.lightbox_textpanel_title_text_align&&(objOptions.textpanel_title_text_align=g_options.lightbox_textpanel_desc_text_align),g_options.lightbox_textpanel_desc_text_align&&(objOptions.textpanel_desc_text_align=g_options.lightbox_textpanel_desc_text_align)),g_objTextPanel.setOptions(objOptions),g_objTextPanel.refresh(!0,!0),handlePanelHeight("positionTextPanelWide"),g_objTextPanel.positionPanel()}function hideTopPanel(){if(!g_objTopPanel)return!1;g_objTopPanel.hide()}function showTopPanel(){if(!g_objTopPanel)return!1;g_objTopPanel.show()}function handleCompactHeight(objImageSize){if(!1==g_temp.isOpened||!g_objTextPanel||!g_objSlider)return!1;var wrapperSize=g_functions.getElementSize(g_objWrapper),textPanelSize=g_objTextPanel.getSize();if(0==textPanelSize.width||textPanelSize.height>120)return!1;if(!objImageSize)var objImage=g_objSlider.getSlideImage(),objImageSize=g_functions.getElementSize(objImage);if(0==objImageSize.height||0==objImageSize.width||objImageSize.bottom+textPanelSize.height<wrapperSize.height)return!1;var sliderOptions=g_objSlider.getOptions(),imagePaddingBottom=textPanelSize.height;if(imagePaddingBottom!=sliderOptions.slider_image_padding_bottom){var objOptions={slider_image_padding_bottom:imagePaddingBottom};if(!1==g_objSlider.isAnimating())return g_objSlider.setOptions(objOptions),g_objSlider.refreshSlideItems(),!0}return!1}function setCompactTextpanelTop(objImageSize,positionPanel){if(!objImageSize)var objImage=g_objSlider.getSlideImage(),objImageSize=g_functions.getElementSize(objImage);g_temp.textPanelTop=objImageSize.bottom,!0===positionPanel&&g_objTextPanel.positionPanel(g_temp.textPanelTop,g_temp.textPanelLeft)}function handleCompactTextpanelSizes(showTextpanel){g_functions.getElementSize(g_objWrapper);var objImage=g_objSlider.getSlideImage(),objImageSize=g_functions.getElementSize(objImage);if(0==objImageSize.width)return!1;g_temp.textPanelLeft=objImageSize.left,g_temp.textPanelTop=objImageSize.bottom;var textPanelWidth=objImageSize.width;if(g_objNumbers){var objNumbersSize=g_functions.getElementSize(g_objNumbers);textPanelWidth-=objNumbersSize.width;var numbersLeft=objImageSize.right-objNumbersSize.width;g_functions.placeElement(g_objNumbers,numbersLeft,g_temp.textPanelTop)}g_objTextPanel&&(g_objTextPanel.show(),g_objTextPanel.refresh(!0,!0,textPanelWidth),setCompactTextpanelTop(objImageSize)),!1==handleCompactHeight(objImageSize)&&(g_temp.positionFrom="handleCompactTextpanelSizes",g_objTextPanel&&(g_objTextPanel.positionPanel(g_temp.textPanelTop,g_temp.textPanelLeft),!0===showTextpanel&&(showTextpanel(),showNumbers())))}function isSliderImageInPlace(){return!1==g_objSlider.isCurrentSlideType("image")|| !0==g_objSlider.isCurrentImageInPlace()}function positionArrowsInside(toShow,isAnimation){if(!1==g_temp.isArrowsInside||!g_objArrowLeft)return!1;var isImageInPlace=isSliderImageInPlace();if(g_objArrowLeft.show(),g_objArrowRight.show(),g_temp.positionFrom="positionArrowsInside",!0==g_temp.isArrowsOnHoverMode&& !0==isImageInPlace&& !1==isMouseInsideImage()&&hideArrows(!0),!1==isImageInPlace)var leftArrowLeft=g_functions.getElementRelativePos(g_objArrowLeft,"left",g_options.lightbox_arrows_offset),leftArrowTop=g_functions.getElementRelativePos(g_objArrowLeft,"middle"),rightArrowLeft=g_functions.getElementRelativePos(g_objArrowRight,"right",g_options.lightbox_arrows_offset),rightArrowTop=leftArrowTop;else{var objImage=g_objSlider.getSlideImage(),objImageSize=g_functions.getElementSize(objImage);g_functions.getElementSize(g_objSlider.getElement());var leftArrowLeft=g_functions.getElementRelativePos(g_objArrowLeft,"left",0,objImage)+objImageSize.left+g_options.lightbox_arrows_inside_offset,leftArrowTop=g_functions.getElementRelativePos(g_objArrowLeft,"middle",0,objImage)+objImageSize.top,rightArrowLeft=g_functions.getElementRelativePos(g_objArrowLeft,"right",0,objImage)+objImageSize.left-g_options.lightbox_arrows_inside_offset,rightArrowTop=leftArrowTop}if(!0===isAnimation){var objCssLeft={left:leftArrowLeft,top:leftArrowTop},objCssRight={left:rightArrowLeft,top:rightArrowTop};g_objArrowLeft.stop().animate(objCssLeft,{duration:g_temp.fadeDuration}),g_objArrowRight.stop().animate(objCssRight,{duration:g_temp.fadeDuration})}else g_objArrowLeft.stop(),g_objArrowRight.stop(),g_functions.placeElement(g_objArrowLeft,leftArrowLeft,leftArrowTop),g_functions.placeElement(g_objArrowRight,rightArrowLeft,rightArrowTop);!0==toShow&&showArrows(isAnimation)}function positionCloseButton(toShow,isAnimation){g_temp.positionFrom=null;var isImageInPlace=isSliderImageInPlace(),minButtonTop=2,maxButtonLeft=g_functions.getElementRelativePos(g_objButtonClose,"right",2,g_objWrapper);if(!1==isImageInPlace)var closeButtonTop=minButtonTop,closeButtonLeft=maxButtonLeft;else{var objImage=g_objSlider.getSlideImage(),objImageSize=g_functions.getElementSize(objImage),objSliderSize=g_functions.getElementSize(g_objSlider.getElement()),objButtonSize=g_functions.getElementSize(g_objButtonClose);objSliderSize.top==objSliderSize.height&&(objSliderSize.top=0);var closeButtonLeft=objSliderSize.left+objImageSize.right-objButtonSize.width/2+g_options.lightbox_compact_closebutton_offsetx,closeButtonTop=objSliderSize.top+objImageSize.top-objButtonSize.height/2-g_options.lightbox_compact_closebutton_offsety;closeButtonTop<minButtonTop&&(closeButtonTop=minButtonTop),closeButtonLeft>maxButtonLeft&&(closeButtonLeft=maxButtonLeft)}if(!0===isAnimation){var objCss={left:closeButtonLeft,top:closeButtonTop};g_objButtonClose.stop().animate(objCss,{duration:g_temp.fadeDuration})}else g_objButtonClose.stop(),g_functions.placeElement(g_objButtonClose,closeButtonLeft,closeButtonTop);!0===toShow&&showCloseButton(isAnimation)}function hideCompactElements(){g_objButtonClose&&g_objButtonClose.stop().fadeTo(g_temp.fadeDuration,0),hideTextPanel(),hideNumbers(),g_temp.positionFrom="hideCompactElements",!0==g_temp.isArrowsInside&&hideArrows()}function actualHideCompactElements(){g_objButtonClose&&g_objButtonClose.hide(),g_objArrowLeft&& !0==g_temp.isArrowsInside&&(g_objArrowLeft.hide(),g_objArrowRight.hide()),g_objNumbers&&g_objNumbers.hide(),g_objTextPanel&&g_objTextPanel.hide()}function positionElements(){var size=g_functions.getElementSize(g_objWrapper);g_objTopPanel&&g_functions.setElementSizeAndPosition(g_objTopPanel,0,0,size.width,g_temp.topPanelHeight),g_objArrowLeft&& !1==g_temp.isArrowsInside&&(!0==g_options.lightbox_hide_arrows_onvideoplay&&(g_objArrowLeft.show(),g_objArrowRight.show()),g_functions.placeElement(g_objArrowLeft,"left","middle",g_options.lightbox_arrows_offset),g_functions.placeElement(g_objArrowRight,"right","middle",g_options.lightbox_arrows_offset)),!1==g_temp.isCompact&&g_functions.placeElement(g_objButtonClose,"right","top",2,2),g_objTextPanel&&(g_temp.positionFrom="positionElements",!1==g_temp.isCompact?positionTextPanelWide(size):(showTextPanel(),showNumbers()));var sliderWidth=size.width,sliderHeight=size.height,sliderTop=0,sliderLeft=0;if(g_objSlider){if(g_objTopPanel){var objOptions={slider_image_padding_top:g_objTopPanel.height()};g_objSlider.setOptions(objOptions)}g_objSlider.setSize(sliderWidth,sliderHeight),g_objSlider.setPosition(sliderLeft,sliderTop)}}function hideTextPanel(){g_objTextPanel&&g_objTextPanel.getElement().stop().fadeTo(g_temp.fadeDuration,0)}function hideNumbers(){g_objNumbers&&g_objNumbers.stop().fadeTo(g_temp.fadeDuration,0)}function isMouseInsideImage(){if(!g_temp.lastMouseX)return!0;var obj={pageX:g_temp.lastMouseX,pageY:g_temp.lastMouseY};return g_objSlider.isMouseInsideSlideImage(obj)}function hideArrows(noAnimation,isForce){return!!g_objArrowLeft&&(!0==g_temp.isArrowsOnHoverMode&& !1===isForce?(isMouseInsideImage(),!0):void(!0===noAnimation?(g_objArrowLeft.stop().fadeTo(0,0),g_objArrowRight.stop().fadeTo(0,0)):(g_objArrowLeft.stop().fadeTo(g_temp.fadeDuration,0),g_objArrowRight.stop().fadeTo(g_temp.fadeDuration,0))))}function isArrowsHidden(){return!g_objArrowLeft|| !1==g_objArrowLeft.is(":visible")||1!=g_objArrowLeft.css("opacity")}function showArrows(noStop,fromHover){return!!g_objArrowLeft&&(!0==g_temp.isArrowsOnHoverMode&& !0!==fromHover&& !0==isSliderImageInPlace()|| !0==g_objSlider.isSwiping()||void(!0!==noStop&&(g_objArrowLeft.stop(),g_objArrowRight.stop()),g_objArrowLeft.fadeTo(g_temp.fadeDuration,1),g_objArrowRight.fadeTo(g_temp.fadeDuration,1)))}function showCloseButton(noStop){!0!==noStop&&g_objButtonClose.stop(),g_objButtonClose.fadeTo(g_temp.fadeDuration,1)}function updateTextPanelText(currentItem){if(!g_objTextPanel)return!1;if(!currentItem)var currentItem=g_objSlider.getCurrentItem();g_objTextPanel.setTextPlain(currentItem.title,currentItem.description)}function updateNumbersText(currentItem){if(!g_objNumbers)return!1;if(!currentItem)var currentItem=g_objSlider.getCurrentItem();var numItems=g_gallery.getNumItems(),numCurrentItem=currentItem.index+1;g_objNumbers.html(numCurrentItem+" / "+numItems)}function showTextPanel(){if(!g_objTextPanel)return!1;g_objTextPanel.getElement().show().stop().fadeTo(g_temp.fadeDuration,1)}function showNumbers(){g_objNumbers&&g_objNumbers.stop().fadeTo(g_temp.fadeDuration,1)}function onSliderDragStart(){if(!1==g_temp.isCompact)return!0;hideCompactElements()}function onZoomChange(){if(!1==g_temp.isCompact)return!0;g_temp.positionFrom="onZoomChange",positionCloseButton(!1,!0),positionArrowsInside(!1,!0),!0==g_temp.isCompact&&(!1==(g_objSlider.isCurrentSlideType("image")&& !0==g_objSlider.isCurrentImageInPlace())?(hideTextPanel(),hideNumbers()):(g_temp.positionFrom="onZoomChange",showTextPanel(),showNumbers()))}function onSliderAfterReturn(){if(!1==g_temp.isCompact)return!0;g_temp.positionFrom="onSliderAfterReturn",positionCloseButton(!0),positionArrowsInside(!0),!1==handleCompactHeight()&&handleCompactTextpanelSizes(),showTextPanel(),showNumbers()}function onSliderAfterPutImage(data,objSlide){if(objSlide=jQuery(objSlide),!1==g_temp.isCompact|| !1==g_objSlider.isSlideCurrent(objSlide))return!0;g_temp.positionFrom="onSliderAfterPutImage",positionCloseButton(!0),positionArrowsInside(!0),handleCompactTextpanelSizes()}function onSliderTransitionEnd(){var imagePaddingTop=g_objSlider.getOptions().slider_image_padding_top;if(g_objTopPanel){var panelHeight=g_objTopPanel.height();panelHeight!=imagePaddingTop&&refreshSliderItem(panelHeight)}!0==g_temp.isCompact&&(updateTextPanelText(),updateNumbersText(),g_temp.positionFrom="onSliderTransitionEnd",positionCloseButton(!0),positionArrowsInside(!0),!1==g_objSlider.isSlideActionActive()&& !1==handleCompactHeight()&&handleCompactTextpanelSizes(),showTextPanel(),showNumbers())}function onItemChange(data,currentItem){!1==g_temp.isCompact?(g_objNumbers&&updateNumbersText(currentItem),g_objTextPanel&&(updateTextPanelText(currentItem),!1==g_temp.isRightNowOpened&&(g_objTextPanel.positionElements(!1),handlePanelHeight("onchange"),g_objTextPanel.positionPanel()))):!1==g_objSlider.isAnimating()&&(g_objTextPanel&&updateTextPanelText(currentItem),g_objNumbers&&updateNumbersText(currentItem)),!1==g_temp.isSliderChangedOnce&&(g_temp.isSliderChangedOnce=!0,g_objThis.trigger(t.events.LIGHTBOX_INIT))}function onSliderClick(data,event){return!!("image"!=g_objSlider.getSlideType()&& !1==g_temp.isCompact&&g_objSlider.isSlideActionActive())||(!0==g_objSlider.isPreloading()?(t.close("slider"),!0):void(!0==g_options.lightbox_close_on_emptyspace&& !1==g_objSlider.isMouseInsideSlideImage(event)&&t.close("slider_inside")))}function onResize(){positionElements()}function onPlayVideo(){g_objTopPanel?hideTopPanel():g_objNumbers&&g_objNumbers.hide(),g_objArrowLeft&& !0==g_options.lightbox_hide_arrows_onvideoplay&&(g_objArrowLeft.hide(),g_objArrowRight.hide())}function onStopVideo(){g_objTopPanel?(showTopPanel(),handlePanelHeight("onStopVideo")):g_objNumbers&&g_objNumbers.show(),g_objArrowLeft&& !0==g_options.lightbox_hide_arrows_onvideoplay&&(g_objArrowLeft.show(),g_objArrowRight.show())}function onKeyPress(data,key,event){var isScrollKey=!1;switch(key){case 27:!0==g_temp.isOpened&&t.close("keypress");break;case 38:case 40:case 33:case 34:isScrollKey=!0}!0==g_temp.isOpened&& !0==isScrollKey&&event.preventDefault()}function onImageMouseEnter(){!0==g_temp.isArrowsOnHoverMode&&showArrows(!1,!0)}function onImageMouseLeave(event){g_temp.positionFrom="hideCompactElements",!0==g_temp.isArrowsOnHoverMode&& !0==isSliderImageInPlace()&&hideArrows(!1,!0)}function onMouseMove(event){g_temp.lastMouseX=event.pageX,g_temp.lastMouseY=event.pageY,!0==isArrowsHidden()&&isMouseInsideImage()&& !1==g_objSlider.isAnimating()&&(g_temp.positionFrom="onMouseMove",g_objArrowLeft&& !1==g_objArrowLeft.is(":animated")&&showArrows(!1,!0))}function onMouseWheel(event,delta,deltaX,deltaY){if(!1==g_temp.isOpened)return!0;switch(g_options.gallery_mousewheel_role){default:case"zoom":"image"!=g_objSlider.getSlideType()&&event.preventDefault();break;case"none":event.preventDefault();break;case"advance":g_gallery.onGalleryMouseWheel(event,delta,deltaX,deltaY)}}function initEvents(){if(g_objOverlay.on("touchstart",function(a){a.preventDefault()}),g_objOverlay.on("touchend",function(a){t.close("overlay")}),g_functions.addClassOnHover(g_objArrowRight,"ug-arrow-hover"),g_functions.addClassOnHover(g_objArrowLeft,"ug-arrow-hover"),g_functions.addClassOnHover(g_objButtonClose),g_gallery.setNextButton(g_objArrowRight),g_gallery.setPrevButton(g_objArrowLeft),g_objButtonClose.on("click",function(){t.close("button")}),g_objGallery.on(g_gallery.events.ITEM_CHANGE,onItemChange),g_objSlider){jQuery(g_objSlider).on(g_objSlider.events.TRANSITION_END,onSliderTransitionEnd),jQuery(g_objSlider).on(g_objSlider.events.CLICK,onSliderClick);var objVideo=g_objSlider.getVideoObject();jQuery(objVideo).on(objVideo.events.PLAY_START,onPlayVideo),jQuery(objVideo).on(objVideo.events.PLAY_STOP,onStopVideo),jQuery(g_objSlider).on(g_objSlider.events.START_DRAG,onSliderDragStart),jQuery(g_objSlider).on(g_objSlider.events.TRANSITION_START,onSliderDragStart),jQuery(g_objSlider).on(g_objSlider.events.AFTER_DRAG_CHANGE,onSliderAfterReturn),jQuery(g_objSlider).on(g_objSlider.events.AFTER_RETURN,onSliderAfterReturn),jQuery(g_objSlider).on(g_objSlider.events.AFTER_PUT_IMAGE,onSliderAfterPutImage),jQuery(g_objSlider).on(g_objSlider.events.ZOOM_CHANGE,onZoomChange),jQuery(g_objSlider).on(g_objSlider.events.IMAGE_MOUSEENTER,onImageMouseEnter),jQuery(g_objSlider).on(g_objSlider.events.IMAGE_MOUSELEAVE,onImageMouseLeave)}jQuery(window).resize(function(){if(!1==g_temp.isOpened)return!0;g_functions.whenContiniousEventOver("lightbox_resize",onResize,100)}),g_objGallery.on(g_gallery.events.GALLERY_KEYPRESS,onKeyPress),!0==g_temp.isArrowsOnHoverMode&&jQuery(document).bind("mousemove",onMouseMove),g_objWrapper.on("mousewheel",onMouseWheel)}function switchToWide(){g_temp.isCompact=!1,modifyOptions(),g_temp.isArrowsInside=!1,g_temp.isArrowsOnHoverMode=!1,(g_options=jQuery.extend({},g_temp.originalOptions)).lightbox_arrows_position="sides",g_objSlider.setOptions(g_options)}this.destroy=function(){if(jQuery(document).unbind("mousemove"),g_objOverlay.off("touchstart"),g_objOverlay.off("touchend"),g_objButtonClose.off("click"),g_objGallery.off(g_gallery.events.ITEM_CHANGE),g_objSlider){jQuery(g_objSlider).off(g_objSlider.events.TRANSITION_END),jQuery(g_objSlider).off(g_objSlider.events.CLICK),jQuery(g_objSlider).off(g_objSlider.events.START_DRAG),jQuery(g_objSlider).off(g_objSlider.events.TRANSITION_START),jQuery(g_objSlider).off(g_objSlider.events.AFTER_DRAG_CHANGE),jQuery(g_objSlider).off(g_objSlider.events.AFTER_RETURN);var a=g_objSlider.getVideoObject();jQuery(a).off(a.events.PLAY_START),jQuery(a).off(a.events.PLAY_STOP),jQuery(g_objSlider).on(g_objSlider.events.IMAGE_MOUSEENTER,onImageMouseEnter),jQuery(g_objSlider).on(g_objSlider.events.IMAGE_MOUSELEAVE,onImageMouseLeave),g_objSlider.destroy()}jQuery(window).unbind("resize"),g_objGallery.off(g_gallery.events.GALLERY_KEYPRESS,onKeyPress),g_objWrapper.off("mousewheel"),g_objWrapper.remove()},this.isOpened=function(){return g_temp.isOpened},this.open=function(b){var a=g_gallery.getItem(b);g_temp.isOpened=!0,g_temp.isRightNowOpened=!0,setTimeout(function(){g_temp.isRightNowOpened=!1},100),g_objSlider&&g_objSlider.setItem(a,"lightbox_open"),g_objTextPanel&&g_objTextPanel.setTextPlain(a.title,a.description),g_objOverlay.stop().fadeTo(0,0),g_objWrapper.show(),g_objWrapper.fadeTo(0,1),g_objOverlay.stop().fadeTo(g_temp.fadeDuration,g_options.lightbox_overlay_opacity),positionElements(),!0==g_temp.isCompact&&(!0==g_objSlider.isPreloading()?actualHideCompactElements():!0==g_temp.isArrowsInside&&(g_objArrowLeft.hide(),g_objArrowRight.hide())),g_objSlider&&g_objSlider.startSlideAction(),g_objGallery.trigger(g_gallery.events.OPEN_LIGHTBOX,a)},this.close=function(a){g_temp.isOpened=!1,!0==g_temp.isCompact&&hideCompactElements(),g_objSlider&&g_objSlider.stopSlideAction(),"image"!=g_objSlider.getSlideType()?g_objWrapper.hide():g_objWrapper.fadeTo(g_temp.fadeDuration,0,function(){g_objWrapper.hide()}),g_objGallery.trigger(g_gallery.events.CLOSE_LIGHTBOX)},this.init=function(a,b){initLightbox(a,b)},this.putHtml=function(){g_gallery.isSmallWindow()&& !0==g_temp.isCompact&&switchToWide(),putLightboxHtml()},this.run=function(){setProperties(),g_objSlider&&g_objSlider.run(),initEvents()}}function UGCarousel(){var g_objGallery,g_objWrapper,g_arrItems,g_objCarouselWrapper,g_objInner,t=this,g_objThis=jQuery(this),g_gallery=new UniteGalleryMain,g_functions=new UGFunctions,g_objTileDesign=new UGTileDesign,g_thumbs=new UGThumbsGeneral,g_options={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1};this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"};var g_temp={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!1,startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};function init(gallery,customOptions){g_objects=gallery.getObjects(),g_gallery=gallery,g_objGallery=jQuery(gallery),g_objWrapper=g_objects.g_objWrapper,g_arrItems=g_objects.g_arrItems,g_options=jQuery.extend(g_options,customOptions),g_objTileDesign.setFixedMode(),g_objTileDesign.setApproveClickFunction(isApproveTileClick),g_objTileDesign.init(gallery,g_options),g_thumbs=g_objTileDesign.getObjThumbs(),g_options=g_objTileDesign.getOptions(),g_temp.initTileWidth=g_options.tile_width,g_temp.initTileHeight=g_options.tile_height,g_temp.tileWidth=g_options.tile_width}function setHtml(objParent){if(!objParent)var objParent=g_objWrapper;var html="<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'></div></div>";g_objWrapper.append(html),g_objInner=(g_objCarouselWrapper=g_objWrapper.children(".ug-carousel-wrapper")).children(".ug-carousel-inner"),g_objTileDesign.setHtml(g_objInner),g_thumbs.getThumbs().fadeTo(0,1)}function resizeTiles(newTileWidth,newTileHeight){if(!newTileHeight)var newTileHeight=g_temp.initTileHeight/g_temp.initTileWidth*newTileWidth;g_temp.tileWidth=newTileWidth;var optUpdate={tile_width:newTileWidth,tile_height:newTileHeight};g_objTileDesign.setOptions(optUpdate),g_options.tile_width=newTileWidth,g_options.tile_height=newTileHeight,g_objTileDesign.resizeAllTiles(newTileWidth),positionTiles(!0)}function run(){if(null===g_temp.carouselMaxWidth)throw new Error("The carousel width not set");if(g_temp.tileWidth<g_temp.initTileWidth){var newTileWidth=g_temp.carouselMaxWidth-2*g_options.carousel_padding;newTileWidth>g_temp.initTileWidth&&(newTileWidth=g_temp.initTileWidth),resizeTiles(newTileWidth);var numTiles=g_functions.getNumItemsInSpace(g_temp.carouselMaxWidth,newTileWidth,g_options.carousel_space_between_tiles)}else{var numTiles=g_functions.getNumItemsInSpace(g_temp.carouselMaxWidth,g_temp.tileWidth,g_options.carousel_space_between_tiles);if(numTiles<=0){numTiles=1;var newTileWidth=g_temp.carouselMaxWidth-2*g_options.carousel_padding;resizeTiles(newTileWidth)}}var realWidth=g_functions.getSpaceByNumItems(numTiles,g_temp.tileWidth,g_options.carousel_space_between_tiles);realWidth+=2*g_options.carousel_padding,g_objCarouselWrapper.width(realWidth),!0==g_temp.isFirstTimeRun?(initEvents(),g_objTileDesign.run(),jQuery.each(g_arrItems,function(b,a){a.objThumbWrapper.data("index",b),g_objWrapper.trigger(g_temp.eventSizeChange,[a.objThumbWrapper,!0]),a.objTileOriginal=a.objThumbWrapper.clone(!0,!0)}),positionTiles(!0),!0==g_options.carousel_autoplay&&t.startAutoplay()):(!0==g_options.carousel_autoplay&&t.pauseAutoplay(),scrollToTile(0,!1),!0==g_options.carousel_autoplay&&t.startAutoplay()),positionElements(),g_temp.isFirstTimeRun=!1}function getInnerPos(){return g_functions.getElementSize(g_objInner).left}function getMousePos(event){return g_functions.getMousePosition(event).pageX}function getTiles(){return g_objInner.children(".ug-thumb-wrapper")}function getNumTilesInSpace(space){return g_functions.getNumItemsInSpace(space,g_temp.tileWidth,g_options.carousel_space_between_tiles)}function getNumTiles(){return getTiles().length}function getTile(numTile){validateTileNum(numTile);var objTiles=getTiles();return jQuery(objTiles[numTile])}function getFirstTile(){return g_objInner.children(".ug-thumb-wrapper").first()}function getLastTile(){return g_objInner.children(".ug-thumb-wrapper").last()}function getTileClones(objTile,numClones,dir){var index=objTile.data("index");if(void 0==index)throw new Error("every tile should have index!");for(var arrClonedItems=[],i=0;i<numClones;i++){if("prev"==dir)var itemToAdd=g_gallery.getPrevItem(index,!0);else var itemToAdd=g_gallery.getNextItem(index,!0);if(!itemToAdd)throw new Error("the item to add is empty");var clonedTile=itemToAdd.objTileOriginal.clone(!0,!0);index=itemToAdd.index,clonedTile.addClass("cloned"),arrClonedItems.push(clonedTile)}return arrClonedItems}function getRemainSpaceRight(){var wrapperSize=g_functions.getElementSize(g_objCarouselWrapper),innerSize=g_functions.getElementSize(g_objInner),spaceTaken=innerSize.width-wrapperSize.width+innerSize.left,spaceRemain=g_temp.sideSpace-spaceTaken;return spaceRemain}function getRemainSpaceLeft(){var spaceTaken=-getInnerPos();return g_temp.sideSpace-spaceTaken}function getCarouselWidth(){return g_functions.getElementSize(g_objCarouselWrapper).width}function getNumTilesInCarousel(){var width=getCarouselWidth();return getNumTilesInSpace(width)}function positionTiles(setHeight){if(!setHeight)var setHeight=!1;var totalWidth,objTiles=getTiles(),posx=0,maxHeight=0;return jQuery.each(objTiles,function(c,a){a=jQuery(a),g_functions.placeElement(a,posx,0);var b=g_functions.getElementSize(a);posx+=b.width+g_options.carousel_space_between_tiles,maxHeight=Math.max(maxHeight,b.height),c==objTiles.length-1&&(totalWidth=b.right)}),g_objInner.width(totalWidth),maxHeight+=2*g_options.carousel_padding,!0===setHeight&&(g_objInner.height(maxHeight),g_objCarouselWrapper.height(maxHeight)),scrollToTile(g_temp.numCurrent,!1),totalWidth}function validateTileNum(numTile){if(numTile>getTiles().length-1)throw new Error("Wrogn tile number: "+numTile)}function addTiles(numTiles,dir){if("left"==dir)var anchorTile=getFirstTile();else var anchorTile=getLastTile();var arrNewTiles=getTileClones(anchorTile,numTiles,"left"==dir?"prev":"next");jQuery.each(arrNewTiles,function(b,a){"left"==dir?g_objInner.prepend(a):g_objInner.append(a),g_objWrapper.trigger(g_temp.eventSizeChange,a),g_objTileDesign.loadTileImage(a)})}function removeTiles(numTilesToRemove,direction){validateTileNum(numTiles);for(var arrTiles=getTiles(),numTiles=arrTiles.length,i=0;i<numTilesToRemove;i++)"left"==direction?jQuery(arrTiles[i]).remove():jQuery(arrTiles[numTiles-1-i]).remove()}function setInnerPos(pos){var objCss={left:pos+"px"};g_objInner.css(objCss)}function scrollToTile(numTile,isAnimation,isShort){if(void 0===isAnimation){var isAnimation=!0;if(g_objInner.is(":animated"))return!0}var objTile=getTile(numTile),objCss={left:-g_functions.getElementSize(objTile).left+g_options.carousel_padding+"px"};if(!0===isAnimation){var duration=g_options.carousel_scroll_duration,easing=g_options.carousel_scroll_easing;!0===isShort&&(duration=g_temp.scrollShortDuration,easing=g_temp.scrollShortEasing),g_objInner.stop(!0).animate(objCss,{duration:duration,easing:easing,queue:!1,complete:function(){g_temp.numCurrent=numTile,fillSidesWithTiles(!0)}})}else g_temp.numCurrent=numTile,g_objInner.css(objCss)}function getNeerestTileNum(){var innerPos=-getInnerPos(),numTiles=getNumTilesInSpace(innerPos),tile1Pos=g_functions.getElementSize(getTile(numTiles)).left,tile2Pos=g_functions.getElementSize(getTile(numTiles+1)).left;return Math.abs(tile1Pos-innerPos)<Math.abs(tile2Pos-innerPos)?numTiles:numTiles+1}function scrollToNeerestTile(){var tileNum=getNeerestTileNum();scrollToTile(tileNum,!0,!0)}function fillSidesWithTiles(){var spaceLeft=getRemainSpaceLeft(),spaceRight=getRemainSpaceRight(),numItemsLeft=0,numItemsRight=0,numItemsRemoveLeft=0,numItemsRemoveRight=0,numTiles=getNumTiles();if(spaceLeft>g_temp.spaceActionSize)numItemsLeft=getNumTilesInSpace(spaceLeft),addTiles(numItemsLeft,"left"),g_temp.numCurrent+=numItemsLeft;else if(spaceLeft< -g_temp.spaceActionSize){var numItemsRemoveLeft=getNumTilesInSpace(Math.abs(spaceLeft));removeTiles(numItemsRemoveLeft,"left"),g_temp.numCurrent-=numItemsRemoveLeft}if(spaceRight>g_temp.spaceActionSize?(numItemsRight=getNumTilesInSpace(spaceRight),addTiles(numItemsRight,"right")):spaceRight< -g_temp.spaceActionSize&&(numItemsRemoveRight=getNumTilesInSpace(Math.abs(spaceRight)),removeTiles(numItemsRemoveRight,"right")),numItemsRemoveRight>numTiles)throw new Error("Can't remove more then num tiles");var isPositioned=!1;return(numItemsLeft||numItemsRight||numItemsRemoveLeft||numItemsRemoveRight)&&(positionTiles(),isPositioned=!0),isPositioned}function positionElements(isFirstTime){g_functions.placeElement(g_objInner,0,g_options.carousel_padding),fillSidesWithTiles()}function autoplayStep(){"left"==g_options.carousel_autoplay_direction?t.scrollRight(1):t.scrollLeft(1)}function onTouchStart(event){if(!0==g_temp.touchActive)return!0;g_temp.touchActive=!0,t.pauseAutoplay(),g_temp.startTime=jQuery.now(),g_temp.startMousePos=getMousePos(event),g_temp.startInnerPos=getInnerPos(),g_temp.lastTime=g_temp.startTime,g_temp.lastMousePos=g_temp.startMousePos,g_functions.storeEventData(event,g_temp.storedEventID)}function onTouchMove(event){if(!1==g_temp.touchActive)return!0;g_functions.updateStoredEventData(event,g_temp.storedEventID),event.preventDefault();var scrollDir=null;if(!0==g_options.carousel_vertical_scroll_ondrag&&(scrollDir=g_functions.handleScrollTop(g_temp.storedEventID)),"vert"===scrollDir)return!0;g_temp.lastMousePos=getMousePos(event);var diff=g_temp.lastMousePos-g_temp.startMousePos,innerPos=g_temp.startInnerPos+diff,direction=diff>0?"prev":"next",innerSize=g_functions.getElementSize(g_objInner).width;innerPos>0&&"prev"==direction&&(innerPos/=3),innerPos< -innerSize&&"next"==direction&&(innerPos=g_temp.startInnerPos+diff/3),setInnerPos(innerPos)}function onTouchEnd(event){if(!1==g_temp.touchActive)return!0;g_temp.touchActive=!1,scrollToNeerestTile(),t.unpauseAutoplay()}function onMouseEnter(event){if(!1==g_options.carousel_autoplay_pause_onhover)return!0;!0==g_temp.isPlayMode&& !1==g_temp.isPaused&&t.pauseAutoplay()}function onMouseLeave(event){if(!1==g_options.carousel_autoplay_pause_onhover)return!0;t.unpauseAutoplay()}function initEvents(){g_objTileDesign.initEvents(),g_objCarouselWrapper.bind("mousedown touchstart",onTouchStart),jQuery("body").bind("mousemove touchmove",onTouchMove),jQuery(window).add("body").bind("mouseup touchend",onTouchEnd),g_objCarouselWrapper.hover(onMouseEnter,onMouseLeave)}function isApproveTileClick(){var passedTime=g_temp.lastTime-g_temp.startTime,passedDistanceAbs=Math.abs(g_temp.lastMousePos-g_temp.startMousePos);return!(passedTime>300)&&!(passedDistanceAbs>30)}this.startAutoplay=function(){g_temp.isPlayMode=!0,g_temp.isPaused=!1,g_objThis.trigger(t.events.START_PLAY),g_temp.handle&&clearInterval(g_temp.handle),g_temp.handle=setInterval(autoplayStep,g_options.carousel_autoplay_timeout)},this.unpauseAutoplay=function(){if(!1==g_temp.isPlayMode|| !1==g_temp.isPaused)return!0;t.startAutoplay()},this.pauseAutoplay=function(){if(!1==g_temp.isPlayMode)return!0;g_temp.isPaused=!0,g_temp.handle&&clearInterval(g_temp.handle),g_objThis.trigger(t.events.PAUSE_PLAY)},this.stopAutoplay=function(){if(!1==g_temp.isPlayMode)return!0;g_temp.isPaused=!1,g_temp.isPlayMode=!1,g_temp.handle&&clearInterval(g_temp.handle),g_objThis.trigger(t.events.STOP_PLAY)},this.destroy=function(){g_temp.handle&&clearInterval(g_temp.handle),g_objThis.off(t.events.START_PLAY),g_objThis.off(t.events.STOP_PLAY),g_objCarouselWrapper.unbind("mousedown"),g_objCarouselWrapper.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),g_objCarouselWrapper.off("mouseenter").off("mouseleave"),g_objTileDesign.destroy()},this.init=function(b,c,a){a&&this.setMaxWidth(a),init(b,c)},this.setMaxWidth=function(a){g_temp.carouselMaxWidth=a},this.setHtml=function(a){setHtml(a)},this.getElement=function(){return g_objCarouselWrapper},this.getObjTileDesign=function(){return g_objTileDesign},this.getEstimatedHeight=function(){return g_options.tile_height+2*g_options.carousel_padding},this.run=function(){run()},this.scrollRight=function(a){if(!a||"object"==typeof a)var a=g_options.carousel_navigation_numtiles;var c=getNumTilesInCarousel();a>c&&(a=c);var b=g_temp.numCurrent-a;b<=0&&(b=0),scrollToTile(b)},this.scrollLeft=function(a){if(!a||"object"==typeof a)var a=g_options.carousel_navigation_numtiles;var c=getNumTilesInCarousel();a>c&&(a=c);var d=getNumTiles(),b=g_temp.numCurrent+a;b>=d&&(b=d-1),scrollToTile(b)},this.setScrollLeftButton=function(a){g_functions.setButtonMobileReady(a),g_functions.setButtonOnClick(a,t.scrollLeft)},this.setScrollRightButton=function(a){g_functions.setButtonMobileReady(a),g_functions.setButtonOnClick(a,t.scrollRight)},this.setPlayPauseButton=function(a){g_functions.setButtonMobileReady(a),!0==g_temp.isPlayMode&& !1==g_temp.isPaused&&a.addClass("ug-pause-icon"),g_objThis.on(t.events.START_PLAY,function(){a.addClass("ug-pause-icon")}),g_objThis.on(t.events.STOP_PLAY,function(){a.removeClass("ug-pause-icon")}),g_functions.setButtonOnClick(a,function(){!1==g_temp.isPlayMode|| !0==g_temp.isPaused?t.startAutoplay():t.stopAutoplay()})}}function UGLoadMore(){jQuery(this);var g_objWrapper,g_objButton,g_objLoader,g_objError,g_objGallery,g_gallery=new UniteGalleryMain;new UGFunctions;var g_temp={isInited:!1},g_options={loadmore_container:"ug_loadmore_wrapper"};function initObjects(){if(0==(g_objWrapper=jQuery("#"+g_options.loadmore_container)).length||0==(g_objButton=g_objWrapper.find(".ug-loadmore-button")).length||0==(g_objLoader=g_objWrapper.find(".ug-loadmore-loader")).length||0==(g_objError=g_objWrapper.find(".ug-loadmore-error")).length)return!1;g_temp.isInited=!0}function showLoadmore(){g_objWrapper.show()}function onLoadmoreClick(){g_objButton.hide(),g_objLoader.show();var data={numitems:g_gallery.getNumItems()};g_gallery.ajaxRequest("front_loadmore",data,function(a){g_objLoader.hide();var b=a.html_items,c=a.show_loadmore;!0==c?(g_objButton.blur().show(),g_objLoader.hide()):g_objWrapper.hide(),g_gallery.addItems(b)},function(a){a="Ajax Error!"+a,g_objLoader.hide(),g_objError.show(),g_objError.html(a)})}function initEvents(){g_gallery.onEvent("tiles_first_placed",showLoadmore),g_objButton.click(onLoadmoreClick)}this.events={},this.destroy=function(){if(!1==g_temp.isInited)return!1},this.init=function(a,b){if(g_objGallery=jQuery(g_gallery=a),g_options=jQuery.extend(g_options,b),initObjects(),!1==g_temp.isInited)return trace("load more not inited, something is wrong"),!1;initEvents()}}function UGTabs(){jQuery(this);var g_objTabs,g_objSelect,g_objGallery,g_gallery=new UniteGalleryMain;new UGFunctions;var g_options={tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"};function initTabs(gallery,customOptions){g_objGallery=jQuery(g_gallery=gallery),g_options=jQuery.extend(g_options,customOptions),"select"==g_options.tabs_type?g_objSelect=jQ