-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlytebox.js
1988 lines (1968 loc) · 93.3 KB
/
lytebox.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//**************************************************************************************************/
// Lytebox v5.5
//
// Author: Markus F. Hay
// Website: http://lytebox.com (http://dolem.com/lytebox)
// Date: January 26, 2012
// License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
//**************************************************************************************************/
function Lytebox(bInitialize, aHttp) {
/*** Language Configuration ***/
// English - configure for your language or customize as needed.
// Note that these values will be seen by users when mousing over buttons.
this.label = new Object();
this.label['close'] = 'Close (Esc)';
this.label['prev'] = 'Previous (\u2190)'; // Previous (left arrow)
this.label['next'] = 'Next (\u2192)'; // Next (right arrow)
this.label['play'] = 'Play (spacebar)';
this.label['pause'] = 'Pause (spacebar)';
this.label['print'] = 'Print';
this.label['image'] = 'Image %1 of %2'; // %1 = active image, %2 = total images
this.label['page'] = 'Page %1 of %2'; // %1 = active page, %2 = total pages
/*** Configure Lytebox ***/
this.theme = (typeof lyteboxTheme !== 'undefined') && /^(black|grey|red|green|blue|gold|orange)$/i.test(lyteboxTheme) ? lyteboxTheme : 'black'; // themes: black (default), grey, red, green, blue, gold, orange
this.roundedBorder = true; // controls whether or not the viewer uses rounded corners (false = square corners)
this.innerBorder = true; // controls whether to show the inner border around image/html content
this.outerBorder = true; // controls whether to show the outer grey (or theme) border
this.resizeSpeed = 5; // controls the speed of the image resizing (1=slowest and 10=fastest)
this.maxOpacity = 80; // higher opacity = darker overlay, lower opacity = lighter overlay
this.borderSize = 12; // if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
this.appendQS = false; // if true, will append request_from=lytebox to the QS. Use this with caution as it may cause pages to not render
this.fixedPosition = this.isMobile() ? false : true; // if true, viewer will remain in a fixed position, otherwise page scrolling will be allowed
this.inherit = true; // controls whether or not data-lyte-options are inherited from the first link in a grouped set
this.__hideObjects = true; // controls whether or not objects (such as Flash, Java, etc.) should be hidden when the viewer opens
this.__autoResize = true; // controls whether or not images should be resized if larger than the browser window dimensions
this.__doAnimations = true; // controls ALL animation effects (i.e. overlay fade in/out, image resize transition, etc.)
this.__animateOverlay = false; // controls ONLY the overlay (background darkening) effects, and whether or not to fade in/out
this.__forceCloseClick = false; // if true, users are forced to click on the "Close" button when viewing content
this.__refreshPage = false; // force page refresh after closing Lytebox
this.__showPrint = false; // true to show print button, false to hide
this.__navType = 3; // 1 = "Prev/Next" buttons on top left and left
// 2 = "Prev/Next" buttons in navigation bar
// 3 = navType_1 + navType_2 (show both)
// These two options control the position of the title/counter and navigation buttons. Note that for mobile devices,
// the title is displayed on top and the navigation on the bottom. This is due to the view area being limited.
// You can customize this for non-mobile devices by changing the 2nd condition (: false) to true (: true)
this.__navTop = this.isMobile() ? false : false; // true to show the buttons on the top right, false to show them on bottom right (default)
this.__titleTop = this.isMobile() ? true : false; // true to show the title on the top left, false to show it on the bottom left (default)
/*** Configure HTML Content / Media Viewer Options ***/
this.__width = '80%'; // default width of content viewer
this.__height = '80%'; // default height of content viewer
this.__scrolling = 'auto'; // controls whether or not scrolling is allowed in the content viewer -- options are auto|yes|no
this.__loopPlayback = false; // controls whether or not embedded media is looped (swf, avi, mov, etc.)
this.__autoPlay = true; // controls whether or not to autoplay embedded media
this.__autoEmbed = true; // controls whether or not to automatically embed media in an object tag
/*** Configure Slideshow Options ***/
this.__slideInterval = 4000; // change value (milliseconds) to increase/decrease the time between "slides"
this.__showNavigation = false; // true to display Next/Prev buttons/text during slideshow, false to hide
this.__showClose = true; // true to display the Close button, false to hide
this.__showDetails = true; // true to display image details (caption, count), false to hide
this.__showPlayPause = true; // true to display pause/play buttons next to close button, false to hide
this.__autoEnd = true; // true to automatically close Lytebox after the last image is reached, false to keep open
this.__pauseOnNextClick = false; // true to pause the slideshow when the "Next" button is clicked
this.__pauseOnPrevClick = true; // true to pause the slideshow when the "Prev" button is clicked
this.__loopSlideshow = false; // true to continuously loop through slides, false otherwise
/*** Configure Event Callbacks ***/
this.__beforeStart = ''; // function to call before the viewer starts
this.__afterStart = ''; // function to call after the viewer starts
this.__beforeEnd = ''; // function to call before the viewer ends (after close click)
this.__afterEnd = ''; // function to call after the viewer ends
/*** Configure Lytetip (tooltips) Options ***/
this.__changeTipCursor = true; // true to change the cursor to 'help', false to leave default (inhereted)
this.__tipDecoration = 'dotted'; // controls the text-decoration (underline) of the tip link (dotted|solid|none)
this.__tipStyle = 'classic'; // sets the default tip style if none is specified via data-lyte-options. Possible values are classic, info, help, warning, error
this.__tipRelative = true; // if true, tips will be positioned relative to the element. if false, tips will be absolutely positioned on the page.
// if you are having issues with tooltips not being properly positioned, then set this to false
this.navTypeHash = new Object();
this.navTypeHash['Hover_by_type_1'] = true;
this.navTypeHash['Display_by_type_1'] = false;
this.navTypeHash['Hover_by_type_2'] = false;
this.navTypeHash['Display_by_type_2'] = true;
this.navTypeHash['Hover_by_type_3'] = true;
this.navTypeHash['Display_by_type_3'] = true;
this.resizeWTimerArray = new Array();
this.resizeWTimerCount = 0;
this.resizeHTimerArray = new Array();
this.resizeHTimerCount = 0;
this.changeContentTimerArray= new Array();
this.changeContentTimerCount= 0;
this.overlayTimerArray = new Array();
this.overlayTimerCount = 0;
this.imageTimerArray = new Array();
this.imageTimerCount = 0;
this.timerIDArray = new Array();
this.timerIDCount = 0;
this.slideshowIDArray = new Array();
this.slideshowIDCount = 0;
this.imageArray = new Array();
this.slideArray = new Array();
this.frameArray = new Array();
this.contentNum = null;
this.aPageSize = new Array();
this.overlayLoaded = false;
this.checkFrame();
this.isSlideshow = false;
this.isLyteframe = false;
this.tipSet = false;
this.ieVersion = this.ffVersion = this.chromeVersion = this.operaVersion = this.safariVersion = -1;
this.ie = this.ff = this.chrome = this.opera = this.safari = false;
this.setBrowserInfo();
this.classAttribute = (((this.ie && this.doc.compatMode == 'BackCompat') || (this.ie && this.ieVersion <= 7)) ? 'className' : 'class');
this.classAttribute = (this.ie && (document.documentMode == 8 || document.documentMode == 9)) ? 'class' : this.classAttribute;
this.isReady = false;
if (bInitialize) {
this.http = aHttp;
this.bodyOnscroll = document.body.onscroll;
if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
if(this.resizeSpeed < 1) { this.resizeSpeed = 1; }
var ie8Duration = 2;
var isWinXP = (navigator.userAgent.match(/windows nt 5.1/i) || navigator.userAgent.match(/windows nt 5.2/i) ? true : false);
this.resizeDuration = (11 - this.resizeSpeed) * (this.ie ? (this.ieVersion >= 9 ? 6 : (this.ieVersion == 8 ? (this.doc.compatMode == 'BackCompat' ? ie8Duration : ie8Duration - 1) : 3)) : 7);
this.resizeDuration = this.ff ? (11 - this.resizeSpeed) * (this.ffVersion < 6 ? 3 : (isWinXP ? 6 : 12)) : this.resizeDuration;
this.resizeDuration = this.chrome ? (11 - this.resizeSpeed) * 5 : this.resizeDuration;
this.resizeDuration = this.safari ? (11 - this.resizeSpeed) * 20 : this.resizeDuration;
this.resizeDuration = this.isMobile() ? (11 - this.resizeSpeed) * 2 : this.resizeDuration;
if (window.name != 'lbIframe') {
this.initialize();
}
} else {
this.http = new Array();
if (typeof $ == 'undefined') {
$ = function (id) {
if ($.cache[id] === undefined) {
$.cache[id] = document.getElementById(id) || false;
}
return $.cache[id];
};
$.cache = {};
}
}
}
Lytebox.prototype.setBrowserInfo = function() {
var ua = navigator.userAgent.toLowerCase();
this.chrome = ua.indexOf('chrome') > -1;
this.ff = ua.indexOf('firefox') > -1;
this.safari = !this.chrome && ua.indexOf('safari') > -1;
this.opera = ua.indexOf('opera') > -1;
this.ie = /*@cc_on!@*/false;
if (this.chrome) {
var re = new RegExp("chrome/([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
this.chromeVersion = parseInt( RegExp.$1 );
}
}
if (this.ff) {
var re = new RegExp("firefox/([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
this.ffVersion = parseInt( RegExp.$1 );
}
}
if (this.ie) {
var re = new RegExp("msie ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
this.ieVersion = parseInt( RegExp.$1 );
}
}
if (this.opera) {
var re = new RegExp("opera/([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
this.operaVersion = parseInt( RegExp.$1 );
}
}
if (this.safari) {
var re = new RegExp("version/([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
this.safariVersion = parseInt( RegExp.$1 );
}
}
};
Lytebox.prototype.initialize = function() {
this.updateLyteboxItems();
var oBody = this.doc.getElementsByTagName('body').item(0);
if (this.doc.$('lbOverlay')) { oBody.removeChild(this.doc.$('lbOverlay')); }
if (this.doc.$('lbMain')) { oBody.removeChild(this.doc.$('lbMain')); }
if (this.doc.$('lbLauncher')) { oBody.removeChild(this.doc.$('lbLauncher')); }
var oLauncher = this.doc.createElement('a');
oLauncher.setAttribute('id','lbLauncher');
oLauncher.setAttribute(this.classAttribute, 'lytebox');
oLauncher.style.display = 'none';
oBody.appendChild(oLauncher);
var oOverlay = this.doc.createElement('div');
oOverlay.setAttribute('id','lbOverlay');
oOverlay.setAttribute(this.classAttribute, this.theme);
if (this.ie && (this.ieVersion <= 6 || (this.ieVersion <= 9 && this.doc.compatMode == 'BackCompat'))) {
oOverlay.style.position = 'absolute';
}
oOverlay.style.display = 'none';
oBody.appendChild(oOverlay);
var oLytebox = this.doc.createElement('div');
oLytebox.setAttribute('id','lbMain');
oLytebox.style.display = 'none';
oBody.appendChild(oLytebox);
var oOuterContainer = this.doc.createElement('div');
oOuterContainer.setAttribute('id','lbOuterContainer');
oOuterContainer.setAttribute(this.classAttribute, this.theme);
if (this.roundedBorder) {
oOuterContainer.style.MozBorderRadius = '8px';
oOuterContainer.style.borderRadius = '8px';
}
oLytebox.appendChild(oOuterContainer);
var oTopContainer = this.doc.createElement('div');
oTopContainer.setAttribute('id','lbTopContainer');
oTopContainer.setAttribute(this.classAttribute, this.theme);
if (this.roundedBorder) {
oTopContainer.style.MozBorderRadius = '8px';
oTopContainer.style.borderRadius = '8px';
}
oOuterContainer.appendChild(oTopContainer);
var oTopData = this.doc.createElement('div');
oTopData.setAttribute('id','lbTopData');
oTopData.setAttribute(this.classAttribute, this.theme);
oTopContainer.appendChild(oTopData);
var oTitleTop = this.doc.createElement('span');
oTitleTop.setAttribute('id','lbTitleTop');
oTopData.appendChild(oTitleTop);
var oNumTop = this.doc.createElement('span');
oNumTop.setAttribute('id','lbNumTop');
oTopData.appendChild(oNumTop);
var oTopNav = this.doc.createElement('div');
oTopNav.setAttribute('id','lbTopNav');
oTopContainer.appendChild(oTopNav);
var oCloseTop = this.doc.createElement('a');
oCloseTop.setAttribute('id','lbCloseTop');
oCloseTop.setAttribute('title', this.label['close']);
oCloseTop.setAttribute(this.classAttribute, this.theme);
oCloseTop.setAttribute('href','javascript:void(0)');
oTopNav.appendChild(oCloseTop);
var oPrintTop = this.doc.createElement('a');
oPrintTop.setAttribute('id','lbPrintTop')
oPrintTop.setAttribute('title', this.label['print']);
oPrintTop.setAttribute(this.classAttribute, this.theme);
oPrintTop.setAttribute('href','javascript:void(0)');
oTopNav.appendChild(oPrintTop);
var oNextTop = this.doc.createElement('a');
oNextTop.setAttribute('id','lbNextTop');
oNextTop.setAttribute('title', this.label['next']);
oNextTop.setAttribute(this.classAttribute, this.theme);
oNextTop.setAttribute('href','javascript:void(0)');
oTopNav.appendChild(oNextTop);
var oPauseTop = this.doc.createElement('a');
oPauseTop.setAttribute('id','lbPauseTop');
oPauseTop.setAttribute('title', this.label['pause']);
oPauseTop.setAttribute(this.classAttribute, this.theme);
oPauseTop.setAttribute('href','javascript:void(0)');
oPauseTop.style.display = 'none';
oTopNav.appendChild(oPauseTop);
var oPlayTop = this.doc.createElement('a');
oPlayTop.setAttribute('id','lbPlayTop');
oPlayTop.setAttribute('title', this.label['play']);
oPlayTop.setAttribute(this.classAttribute, this.theme);
oPlayTop.setAttribute('href','javascript:void(0)');
oPlayTop.style.display = 'none';
oTopNav.appendChild(oPlayTop);
var oPrevTop = this.doc.createElement('a');
oPrevTop.setAttribute('id','lbPrevTop');
oPrevTop.setAttribute('title', this.label['prev']);
oPrevTop.setAttribute(this.classAttribute, this.theme);
oPrevTop.setAttribute('href','javascript:void(0)');
oTopNav.appendChild(oPrevTop);
var oIframeContainer = this.doc.createElement('div');
oIframeContainer.setAttribute('id','lbIframeContainer');
oIframeContainer.style.display = 'none';
oOuterContainer.appendChild(oIframeContainer);
var oIframe = this.doc.createElement('iframe');
oIframe.setAttribute('id','lbIframe');
oIframe.setAttribute('name','lbIframe')
oIframe.setAttribute('frameBorder','0');
if (this.innerBorder) {
oIframe.setAttribute(this.classAttribute, this.theme);
}
oIframe.style.display = 'none';
oIframeContainer.appendChild(oIframe);
var oImageContainer = this.doc.createElement('div');
oImageContainer.setAttribute('id','lbImageContainer');
oOuterContainer.appendChild(oImageContainer);
var oLyteboxImage = this.doc.createElement('img');
oLyteboxImage.setAttribute('id','lbImage');
if (this.innerBorder) {
oLyteboxImage.setAttribute(this.classAttribute, this.theme);
}
oImageContainer.appendChild(oLyteboxImage);
var oLoading = this.doc.createElement('div');
oLoading.setAttribute('id','lbLoading');
oLoading.setAttribute(this.classAttribute, this.theme);
oOuterContainer.appendChild(oLoading);
var oBottomContainer = this.doc.createElement('div');
oBottomContainer.setAttribute('id','lbBottomContainer');
oBottomContainer.setAttribute(this.classAttribute, this.theme);
if (this.roundedBorder) {
oBottomContainer.style.MozBorderRadius = '8px';
oBottomContainer.style.borderRadius = '8px';
}
oOuterContainer.appendChild(oBottomContainer);
var oDetailsBottom = this.doc.createElement('div');
oDetailsBottom.setAttribute('id','lbBottomData');
oDetailsBottom.setAttribute(this.classAttribute, this.theme);
oBottomContainer.appendChild(oDetailsBottom);
var oTitleBottom = this.doc.createElement('span');
oTitleBottom.setAttribute('id','lbTitleBottom');
oDetailsBottom.appendChild(oTitleBottom);
var oNumBottom = this.doc.createElement('span');
oNumBottom.setAttribute('id','lbNumBottom');
oDetailsBottom.appendChild(oNumBottom);
var oDescBottom = this.doc.createElement('span');
oDescBottom.setAttribute('id','lbDescBottom');
oDetailsBottom.appendChild(oDescBottom);
var oHoverNav = this.doc.createElement('div');
oHoverNav.setAttribute('id','lbHoverNav');
oImageContainer.appendChild(oHoverNav);
var oBottomNav = this.doc.createElement('div');
oBottomNav.setAttribute('id','lbBottomNav');
oBottomContainer.appendChild(oBottomNav);
var oPrevHov = this.doc.createElement('a');
oPrevHov.setAttribute('id','lbPrevHov');
oPrevHov.setAttribute('title', this.label['prev']);
oPrevHov.setAttribute(this.classAttribute, this.theme);
oPrevHov.setAttribute('href','javascript:void(0)');
oHoverNav.appendChild(oPrevHov);
var oNextHov = this.doc.createElement('a');
oNextHov.setAttribute('id','lbNextHov');
oNextHov.setAttribute('title', this.label['next']);
oNextHov.setAttribute(this.classAttribute, this.theme);
oNextHov.setAttribute('href','javascript:void(0)');
oHoverNav.appendChild(oNextHov);
var oClose = this.doc.createElement('a');
oClose.setAttribute('id','lbClose');
oClose.setAttribute('title', this.label['close']);
oClose.setAttribute(this.classAttribute, this.theme);
oClose.setAttribute('href','javascript:void(0)');
oBottomNav.appendChild(oClose);
var oPrint = this.doc.createElement('a');
oPrint.setAttribute('id','lbPrint');
oPrint.setAttribute('title', this.label['print']);
oPrint.setAttribute(this.classAttribute, this.theme);
oPrint.setAttribute('href','javascript:void(0)');
oPrint.style.display = 'none';
oBottomNav.appendChild(oPrint);
var oNext = this.doc.createElement('a');
oNext.setAttribute('id','lbNext');
oNext.setAttribute('title', this.label['next']);
oNext.setAttribute(this.classAttribute, this.theme);
oNext.setAttribute('href','javascript:void(0)');
oBottomNav.appendChild(oNext);
var oPause = this.doc.createElement('a');
oPause.setAttribute('id','lbPause');
oPause.setAttribute('title', this.label['pause']);
oPause.setAttribute(this.classAttribute, this.theme);
oPause.setAttribute('href','javascript:void(0)');
oPause.style.display = 'none';
oBottomNav.appendChild(oPause);
var oPlay = this.doc.createElement('a');
oPlay.setAttribute('id','lbPlay');
oPlay.setAttribute('title', this.label['play']);
oPlay.setAttribute(this.classAttribute, this.theme);
oPlay.setAttribute('href','javascript:void(0)');
oPlay.style.display = 'none';
oBottomNav.appendChild(oPlay);
var oPrev = this.doc.createElement('a');
oPrev.setAttribute('id','lbPrev');
oPrev.setAttribute('title', this.label['prev']);
oPrev.setAttribute(this.classAttribute, this.theme);
oPrev.setAttribute('href','javascript:void(0)');
oBottomNav.appendChild(oPrev);
var iframes = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('iframe') : document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
if (/youtube/i.test(iframes[i].src)) {
iframes[i].src += ((/\?/.test(iframes[i].src)) ? '&' : '?') + 'wmode=transparent';
}
}
this.isReady = true;
};
Lytebox.prototype.updateLyteboxItems = function() {
var anchors = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
anchors = (this.isFrame) ? anchors : document.getElementsByTagName('a');
var areas = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('area') : document.getElementsByTagName('area');
var lyteLinks = this.combine(anchors, areas);
var myLink = relAttribute = revAttribute = classAttribute = dataOptions = dataTip = tipDecoration = tipStyle = tipImage = tipHtml = aSetting = sName = sValue = sExt = aUrl = null;
var bImage = bRelative = false;
for (var i = 0; i < lyteLinks.length; i++) {
myLink = lyteLinks[i];
relAttribute = String(myLink.getAttribute('rel'));
classAttribute = String(myLink.getAttribute(this.classAttribute));
if (myLink.getAttribute('href')) {
sType = classAttribute.match(/lytebox|lyteshow|lyteframe/i);
sType = this.isEmpty(sType) ? relAttribute.match(/lytebox|lyteshow|lyteframe/i) : sType;
dataOptions = String(myLink.getAttribute('data-lyte-options'));
dataOptions = this.isEmpty(dataOptions) ? String(myLink.getAttribute('rev')) : dataOptions;
aUrl = myLink.getAttribute('href').split('?');
sExt = aUrl[0].split('.').pop().toLowerCase();
bImage = (sExt == 'png' || sExt == 'jpg' || sExt == 'jpeg' || sExt == 'gif' || sExt == 'bmp');
if (sType && sType.length >= 1) {
if (this.isMobile() && /youtube/i.test(myLink.getAttribute('href'))) {
myLink.target = '_blank';
} else if (bImage && (dataOptions.match(/slide:true/i) || sType[0].toLowerCase() == 'lyteshow')) {
myLink.onclick = function () { $lb.start(this, true, false); return false; }
} else if (bImage) {
myLink.onclick = function () { $lb.start(this, false, false); return false; }
} else {
myLink.onclick = function () { $lb.start(this, false, true); return false; }
}
}
dataTip = String(myLink.getAttribute('data-tip'));
dataTip = this.isEmpty(dataTip) ? myLink.getAttribute('title') : dataTip;
if (classAttribute.toLowerCase().match('lytetip') && !this.isEmpty(dataTip) && !this.tipsSet) {
if (this.__changeTipCursor) { myLink.style.cursor = 'help'; }
tipDecoration = this.__tipDecoration;
tipStyle = this.__tipStyle;
bRelative = this.__tipRelative;
if (!this.isEmpty(dataOptions)) {
aOptions = dataOptions.split(' ');
for (var j = 0; j < aOptions.length; j++) {
aSetting = aOptions[j].split(':');
sName = (aSetting.length > 1 ? this.trim(aSetting[0]).toLowerCase() : '');
sValue = (aSetting.length > 1 ? this.trim(aSetting[1]) : '');
switch(sName) {
case 'tipstyle':
tipStyle = (/classic|info|help|warning|error/.test(sValue) ? sValue : tipStyle); break;
case 'changetipcursor':
myLink.style.cursor = (/true|false/.test(sValue) ? (sValue == 'true' ? 'help' : '') : myLink.style.cursor); break;
case 'tiprelative':
bRelative = (/true|false/.test(sValue) ? (sValue == 'true') : bRelative); break;
case 'tipdecoration':
tipDecoration = (/dotted|solid|none/.test(sValue) ? sValue : tipDecoration); break;
}
}
}
if (tipDecoration != 'dotted') {
myLink.style.borderBottom = (tipDecoration == 'solid' ? '1px solid' : 'none');
}
switch(tipStyle) {
case 'info': tipStyle = 'lbCustom lbInfo'; tipImage = 'lbTipImg lbInfoImg'; break;
case 'help': tipStyle = 'lbCustom lbHelp'; tipImage = 'lbTipImg lbHelpImg'; break;
case 'warning': tipStyle = 'lbCustom lbWarning'; tipImage = 'lbTipImg lbWarningImg'; break;
case 'error': tipStyle = 'lbCustom lbError'; tipImage = 'lbTipImg lbErrorImg'; break;
case 'classic': tipStyle = 'lbClassic'; tipImage = ''; break;
default: tipStyle = 'lbClassic'; tipImage = '';
}
if ((this.ie && this.ieVersion <= 7) || (this.ieVersion == 8 && this.doc.compatMode == 'BackCompat')) {
tipImage = '';
if (tipStyle != 'lbClassic' && !this.isEmpty(tipStyle)) {
tipStyle += ' lbIEFix';
}
}
var aLinkPos = this.findPos(myLink);
if ((this.ie && (this.ieVersion <= 6 || this.doc.compatMode == 'BackCompat')) || bRelative) {
myLink.style.position = 'relative';
}
tipHtml = myLink.innerHTML;
myLink.innerHTML = '';
if ((this.ie && this.ieVersion <= 6 && this.doc.compatMode != 'BackCompat') || bRelative) {
myLink.innerHTML = tipHtml + '<span class="' + tipStyle + '">' + (tipImage ? '<div class="' + tipImage + '"></div>' : '') + dataTip + '</span>';
} else {
myLink.innerHTML = tipHtml + '<span class="' + tipStyle + '" style="left:'+aLinkPos[0]+'px;top:'+(aLinkPos[1]+aLinkPos[2])+'px;">' + (tipImage ? '<div class="' + tipImage + '"></div>' : '') + dataTip + '</span>';
}
if (classAttribute.match(/lytebox|lyteshow|lyteframe/i) == null) {
myLink.setAttribute('title','');
}
}
}
}
this.tipsSet = true;
};
Lytebox.prototype.launch = function(args) {
var sUrl = this.isEmpty(args.url) ? '' : String(args.url);
var sOptions = this.isEmpty(args.options) ? '' : String(args.options);
var sTitle = this.isEmpty(args.title) ? '' : args.title;
var sDesc = this.isEmpty(args.description) ? '' : args.description;
var bSlideshow = /slide:true/i.test(sOptions);
if (this.isEmpty(sUrl)) {
return false;
}
if (!this.isReady) {
this.timerIDArray[this.timerIDCount++] = setTimeout("$lb.launch({ url: '" + sUrl + "', options: '" + sOptions + "', title: '" + sTitle + "', description: '" + sDesc + "' })", 100);
return;
} else {
for (var i = 0; i < this.timerIDCount; i++) { window.clearTimeout(this.timerIDArray[i]); }
}
var aUrl = sUrl.split('?');
var sExt = aUrl[0].split('.').pop().toLowerCase();
var bImage = (sExt == 'png' || sExt == 'jpg' || sExt == 'jpeg' || sExt == 'gif' || sExt == 'bmp');
var oLauncher = this.doc.$('lbLauncher');
oLauncher.setAttribute('href', sUrl);
oLauncher.setAttribute('data-lyte-options', sOptions);
oLauncher.setAttribute('data-title', sTitle);
oLauncher.setAttribute('data-description', sDesc);
this.updateLyteboxItems();
this.start(oLauncher, bSlideshow, (bImage ? false : true));
};
Lytebox.prototype.start = function(oLink, bSlideshow, bFrame) {
var dataOptions = String(oLink.getAttribute('data-lyte-options'));
dataOptions = this.isEmpty(dataOptions) ? String(oLink.getAttribute('rev')) : dataOptions;
this.setOptions(dataOptions);
this.isSlideshow = (bSlideshow ? true : false);
this.isLyteframe = (bFrame ? true : false);
if (!this.isEmpty(this.beforeStart)) {
var callback = window[this.beforeStart];
if (typeof callback === 'function') {
if (!callback(this.args)) { return; }
}
}
if (this.ie && this.ieVersion <= 6) { this.toggleSelects('hide'); }
if (this.hideObjects) { this.toggleObjects('hide'); }
if (this.isFrame && window.parent.frames[window.name].document) {
window.parent.$lb.printId = (this.isLyteframe ? 'lbIframe' : 'lbImage');
} else {
this.printId = (this.isLyteframe ? 'lbIframe' : 'lbImage');
}
this.aPageSize = this.getPageSize();
var objOverlay = this.doc.$('lbOverlay');
var objBody = this.doc.getElementsByTagName("body").item(0);
objOverlay.style.height = this.aPageSize[1] + "px";
objOverlay.style.display = '';
this.fadeIn({ id: 'lbOverlay', opacity: (this.doAnimations && this.animateOverlay && (!this.ie || this.ieVersion >= 9) ? 0 : this.maxOpacity) });
var anchors = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
anchors = (this.isFrame) ? anchors : document.getElementsByTagName('a');
var areas = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('area') : document.getElementsByTagName('area');
var lyteLinks = this.combine(anchors, areas);
var sType = sExt = aUrl = null;
this.frameArray = [];
this.frameNum = 0;
this.imageArray = [];
this.imageNum = 0;
this.slideArray = [];
this.slideNum = 0;
if (this.isEmpty(this.group)) {
dataOptions = String(oLink.getAttribute('data-lyte-options'));
dataOptions = this.isEmpty(dataOptions) ? String(oLink.getAttribute('rev')) : dataOptions;
if (this.isLyteframe) {
this.frameArray.push(new Array(oLink.getAttribute('href'), (!this.isEmpty(oLink.getAttribute('data-title')) ? oLink.getAttribute('data-title') : oLink.getAttribute('title')), oLink.getAttribute('data-description'), dataOptions));
} else {
this.imageArray.push(new Array(oLink.getAttribute('href'), (!this.isEmpty(oLink.getAttribute('data-title')) ? oLink.getAttribute('data-title') : oLink.getAttribute('title')), oLink.getAttribute('data-description'), dataOptions));
}
} else {
for (var i = 0; i < lyteLinks.length; i++) {
var myLink = lyteLinks[i];
dataOptions = String(myLink.getAttribute('data-lyte-options'));
dataOptions = this.isEmpty(dataOptions) ? String(myLink.getAttribute('rev')) : dataOptions;
if (myLink.getAttribute('href') && dataOptions.toLowerCase().match('group:' + this.group)) {
sType = String(myLink.getAttribute(this.classAttribute)).match(/lytebox|lyteshow|lyteframe/i);
sType = this.isEmpty(sType) ? myLink.getAttribute('rel').match(/lytebox|lyteshow|lyteframe/i) : sType;
aUrl = myLink.getAttribute('href').split('?');
sExt = aUrl[0].split('.').pop().toLowerCase();
bImage = (sExt == 'png' || sExt == 'jpg' || sExt == 'jpeg' || sExt == 'gif' || sExt == 'bmp');
if (sType && sType.length >= 1) {
if (bImage && (dataOptions.match(/slide:true/i) || sType[0].toLowerCase() == 'lyteshow')) {
this.slideArray.push(new Array(myLink.getAttribute('href'), (!this.isEmpty(myLink.getAttribute('data-title')) ? myLink.getAttribute('data-title') : myLink.getAttribute('title')), myLink.getAttribute('data-description'), dataOptions));
} else if (bImage) {
this.imageArray.push(new Array(myLink.getAttribute('href'), (!this.isEmpty(myLink.getAttribute('data-title')) ? myLink.getAttribute('data-title') : myLink.getAttribute('title')), myLink.getAttribute('data-description'), dataOptions));
} else {
this.frameArray.push(new Array(myLink.getAttribute('href'), (!this.isEmpty(myLink.getAttribute('data-title')) ? myLink.getAttribute('data-title') : myLink.getAttribute('title')), myLink.getAttribute('data-description'), dataOptions));
}
}
}
}
if (this.isLyteframe) {
this.frameArray = this.removeDuplicates(this.frameArray);
while(this.frameArray[this.frameNum][0] != oLink.getAttribute('href')) { this.frameNum++; }
} else if (bSlideshow) {
this.slideArray = this.removeDuplicates(this.slideArray);
try {
while(this.slideArray[this.slideNum][0] != oLink.getAttribute('href')) { this.slideNum++; }
} catch(e) {
}
} else {
this.imageArray = this.removeDuplicates(this.imageArray);
while(this.imageArray[this.imageNum][0] != oLink.getAttribute('href')) { this.imageNum++; }
}
}
this.changeContent(this.isLyteframe ? this.frameNum : (this.isSlideshow ? this.slideNum : this.imageNum));
};
Lytebox.prototype.changeContent = function(iContentNum) {
this.contentNum = iContentNum;
if (!this.overlayLoaded) {
this.changeContentTimerArray[this.changeContentTimerCount++] = setTimeout("$lb.changeContent(" + this.contentNum + ")", 250);
return;
} else {
for (var i = 0; i < this.changeContentTimerCount; i++) { window.clearTimeout(this.changeContentTimerArray[i]); }
}
var sDataLyteOptions = (this.isLyteframe) ? this.frameArray[this.contentNum][3] : (this.isSlideshow ? this.slideArray[this.contentNum][3] : this.imageArray[this.contentNum][3]);
if (!this.inherit || /inherit:false/i.test(sDataLyteOptions)) {
this.setOptions(String(sDataLyteOptions));
} else {
var sDataLyteOptions1 = String((this.isLyteframe) ? this.frameArray[0][3] : (this.isSlideshow ? this.slideArray[0][3] : this.imageArray[0][3]));
if (this.isLyteframe) {
var sWidth = sHeight = null;
try { sWidth = sDataLyteOptions.match(/width:\d+(%|px|)/i)[0]; } catch(e) { }
try { sHeight = sDataLyteOptions.match(/height:\d+(%|px|)/i)[0]; } catch(e) { }
if (!this.isEmpty(sWidth)) {
sDataLyteOptions1 = sDataLyteOptions1.replace(/width:\d+(%|px|)/i, sWidth);
}
if (!this.isEmpty(sHeight)) {
sDataLyteOptions1 = sDataLyteOptions1.replace(/height:\d+(%|px|)/i, sHeight);
}
}
this.setOptions(sDataLyteOptions1);
}
var object = this.doc.$('lbMain');
object.style.display = '';
var iDivisor = 40;
if (this.autoResize && this.fixedPosition) {
if (this.ie && (this.ieVersion <= 7 || this.doc.compatMode == 'BackCompat')) {
object.style.top = (this.getPageScroll() + (this.aPageSize[3] / iDivisor)) + "px";
var ps = (this.aPageSize[3] / iDivisor);
this.scrollHandler = function(){
$lb.doc.$('lbMain').style.top = ($lb.getPageScroll() + ps) + 'px';
}
this.bodyOnscroll = document.body.onscroll;
if (window.addEventListener) {
window.addEventListener('scroll', this.scrollHandler);
} else if (window.attachEvent) {
window.attachEvent('onscroll', this.scrollHandler);
}
object.style.position = "absolute";
} else {
object.style.top = ((this.aPageSize[3] / iDivisor)) + "px";
object.style.position = "fixed";
}
} else {
object.style.position = "absolute";
object.style.top = (this.getPageScroll() + (this.aPageSize[3] / iDivisor)) + "px";
}
this.doc.$('lbOuterContainer').style.paddingBottom = '0';
if (!this.outerBorder) {
this.doc.$('lbOuterContainer').style.border = 'none';
} else {
this.doc.$('lbOuterContainer').setAttribute(this.classAttribute, this.theme);
}
if (this.forceCloseClick) {
this.doc.$('lbOverlay').onclick = '';
} else {
this.doc.$('lbOverlay').onclick = function() { $lb.end(); return false; }
}
this.doc.$('lbMain').onclick = function(e) {
var e = e;
if (!e) {
if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
e = window.parent.window.event;
} else {
e = window.event;
}
}
var id = (e.target ? e.target.id : e.srcElement.id);
if ((id == 'lbMain') && (!$lb.forceCloseClick)) { $lb.end(); return false; }
}
this.doc.$('lbPrintTop').onclick = this.doc.$('lbPrint').onclick = function() { $lb.printWindow(); return false; }
this.doc.$('lbCloseTop').onclick = this.doc.$('lbClose').onclick = function() { $lb.end(); return false; }
this.doc.$('lbPauseTop').onclick = function() { $lb.togglePlayPause("lbPauseTop", "lbPlayTop"); return false; }
this.doc.$('lbPause').onclick = function() { $lb.togglePlayPause("lbPause", "lbPlay"); return false; }
this.doc.$('lbPlayTop').onclick = function() { $lb.togglePlayPause("lbPlayTop", "lbPauseTop"); return false; }
this.doc.$('lbPlay').onclick = function() { $lb.togglePlayPause("lbPlay", "lbPause"); return false; }
if (this.isSlideshow && this.showPlayPause && this.isPaused) {
this.doc.$('lbPlay').style.display = '';
this.doc.$('lbPause').style.display = 'none';
}
if (this.isSlideshow) {
for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
}
if (!this.outerBorder) {
this.doc.$('lbOuterContainer').style.border = 'none';
} else {
this.doc.$('lbOuterContainer').setAttribute(this.classAttribute, this.theme);
}
var iDecreaseMargin = 10;
if (this.titleTop || this.navTop) {
this.doc.$('lbTopContainer').style.visibility = 'hidden';
iDecreaseMargin += this.doc.$('lbTopContainer').offsetHeight;
} else {
this.doc.$('lbTopContainer').style.display = 'none';
}
this.doc.$('lbBottomContainer').style.display = 'none';
this.doc.$('lbImage').style.display = 'none';
this.doc.$('lbIframe').style.display = 'none';
this.doc.$('lbPrevHov').style.display = 'none';
this.doc.$('lbNextHov').style.display = 'none';
this.doc.$('lbIframeContainer').style.display = 'none';
this.doc.$('lbLoading').style.marginTop = '-' + iDecreaseMargin + 'px';
this.doc.$('lbLoading').style.display = '';
if (this.isLyteframe) {
var iframe = $lb.doc.$('lbIframe');
iframe.src = 'about:blank';
var w = this.trim(this.width);
var h = this.trim(this.height);
if (/\%/.test(w)) {
var percent = parseInt(w);
w = parseInt((this.aPageSize[2]-50)*percent/100);
w = w+'px';
}
if (/\%/.test(h)) {
var percent = parseInt(h);
h = parseInt((this.aPageSize[3]-150)*percent/100);
h = h+'px';
}
if (this.autoResize) {
var x = this.aPageSize[2] - 50;
var y = this.aPageSize[3] - 150;
w = (parseInt(w) > x ? x : w) + 'px';
h = (parseInt(h) > y ? y : h) + 'px';
}
iframe.height = this.height = h;
iframe.width = this.width = w;
iframe.scrolling = this.scrolling;
var oDoc = iframe.contentWindow || iframe.contentDocument;
try {
if (oDoc.document) {
oDoc = oDoc.document;
}
oDoc.body.style.margin = 0;
oDoc.body.style.padding = 0;
if (this.ie && this.ieVersion <= 8) {
oDoc.body.scroll = this.scrolling;
oDoc.body.overflow = this.scrolling = 'no' ? 'hidden' : 'auto';
}
} catch(e) { }
this.resizeContainer(parseInt(this.width), parseInt(this.height));
} else {
this.imgPreloader = new Image();
this.imgPreloader.onload = function() {
var imageWidth = $lb.imgPreloader.width;
var imageHeight = $lb.imgPreloader.height;
if ($lb.autoResize) {
var x = $lb.aPageSize[2] - 50;
var y = $lb.aPageSize[3] - 150;
if (imageWidth > x) {
imageHeight = Math.round(imageHeight * (x / imageWidth));
imageWidth = x;
if (imageHeight > y) {
imageWidth = Math.round(imageWidth * (y / imageHeight));
imageHeight = y;
}
} else if (imageHeight > y) {
imageWidth = Math.round(imageWidth * (y / imageHeight));
imageHeight = y;
if (imageWidth > x) {
imageHeight = Math.round(imageHeight * (x / imageWidth));
imageWidth = x;
}
}
}
var lbImage = $lb.doc.$('lbImage');
lbImage.src = $lb.imgPreloader.src;
lbImage.width = imageWidth;
lbImage.height = imageHeight;
$lb.resizeContainer(imageWidth, imageHeight);
$lb.imgPreloader.onload = function() {};
}
this.imgPreloader.src = (this.isSlideshow ? this.slideArray[this.contentNum][0] : this.imageArray[this.contentNum][0]);
}
};
Lytebox.prototype.resizeContainer = function(iWidth, iHeight) {
this.resizeWidth = iWidth;
this.resizeHeight = iHeight;
this.wCur = this.doc.$('lbOuterContainer').offsetWidth;
this.hCur = this.doc.$('lbOuterContainer').offsetHeight;
this.xScale = ((this.resizeWidth + (this.borderSize * 2)) / this.wCur) * 100;
this.yScale = ((this.resizeHeight + (this.borderSize * 2)) / this.hCur) * 100;
var wDiff = (this.wCur - this.borderSize * 2) - this.resizeWidth;
var hDiff = (this.hCur - this.borderSize * 2) - this.resizeHeight;
this.wDone = (wDiff == 0);
if (!(hDiff == 0)) {
this.hDone = false;
this.resizeH('lbOuterContainer', this.hCur, this.resizeHeight + this.borderSize * 2, this.getPixelRate(this.hCur, this.resizeHeight));
} else {
this.hDone = true;
if (!this.wDone) {
this.resizeW('lbOuterContainer', this.wCur, this.resizeWidth + this.borderSize * 2, this.getPixelRate(this.wCur, this.resizeWidth));
}
}
if ((hDiff == 0) && (wDiff == 0)) {
if (this.ie){ this.pause(250); } else { this.pause(100); }
}
this.doc.$('lbPrevHov').style.height = this.resizeHeight + "px";
this.doc.$('lbNextHov').style.height = this.resizeHeight + "px";
if (this.hDone && this.wDone) {
if (this.isLyteframe) {
this.loadContent();
} else {
this.showContent();
}
}
};
Lytebox.prototype.loadContent = function() {
try {
var iframe = this.doc.$('lbIframe');
var uri = this.frameArray[this.contentNum][0];
if (!this.inline && this.appendQS) {
uri += ((/\?/.test(uri)) ? '&' : '?') + 'request_from=lytebox';
}
if (this.autoPlay && /youtube/i.test(uri)) {
uri += ((/\?/.test(uri)) ? '&' : '?') + 'autoplay=1';
}
if (!this.autoEmbed || (this.ff && (uri.match(/.pdf|.mov|.wmv/i)))) {
this.frameSource = uri;
this.showContent();
return;
}
if (this.ie) {
iframe.onreadystatechange = function() {
if ($lb.doc.$('lbIframe').readyState == "complete") {
$lb.showContent();
$lb.doc.$('lbIframe').onreadystatechange = null;
}
};
} else {
iframe.onload = function() {
$lb.showContent();
$lb.doc.$('lbIframe').onload = null;
};
}
if (this.inline || (uri.match(/.mov|.avi|.wmv|.mpg|.mpeg|.swf/i))) {
iframe.src = 'about:blank';
this.frameSource = '';
var sHtml = (this.inline) ? this.doc.$(uri.substr(uri.indexOf('#') + 1, uri.length)).innerHTML : this.buildObject(parseInt(this.width), parseInt(this.height), uri);
var oDoc = iframe.contentWindow || iframe.contentDocument;
if (oDoc.document) {
oDoc = oDoc.document;
}
oDoc.open();
oDoc.write(sHtml);
oDoc.close();
oDoc.body.style.margin = 0;
oDoc.body.style.padding = 0;
if (!this.inline) {
oDoc.body.style.backgroundColor = '#fff';
oDoc.body.style.fontFamily = 'Verdana, Helvetica, sans-serif';
oDoc.body.style.fontSize = '0.9em';
}
this.frameSource = '';
} else {
this.frameSource = uri;
iframe.src = uri;
}
} catch(e) { }
};
Lytebox.prototype.showContent = function() {
if (this.isSlideshow) {
if(this.contentNum == (this.slideArray.length - 1)) {
if (this.loopSlideshow) {
this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("$lb.changeContent(0)", this.slideInterval);
} else if (this.autoEnd) {
this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("$lb.end('slideshow')", this.slideInterval);
}
} else {
if (!this.isPaused) {
this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("$lb.changeContent("+(this.contentNum+1)+")", this.slideInterval);
}
}
this.doc.$('lbHoverNav').style.display = (this.ieVersion != 6 && this.showNavigation && this.navTypeHash['Hover_by_type_' + this.navType] ? '' : 'none');
this.doc.$('lbCloseTop').style.display = (this.showClose && this.navTop ? '' : 'none');
this.doc.$('lbClose').style.display = (this.showClose && !this.navTop ? '' : 'none');
this.doc.$('lbBottomData').style.display = (this.showDetails ? '' : 'none');
this.doc.$('lbPauseTop').style.display = (this.showPlayPause && this.navTop ? (!this.isPaused ? '' : 'none') : 'none');
this.doc.$('lbPause').style.display = (this.showPlayPause && !this.navTop ? (!this.isPaused ? '' : 'none') : 'none');
this.doc.$('lbPlayTop').style.display = (this.showPlayPause && this.navTop ? (!this.isPaused ? 'none' : '') : 'none');
this.doc.$('lbPlay').style.display = (this.showPlayPause && !this.navTop ? (!this.isPaused ? 'none' : '') : 'none');
this.doc.$('lbPrevTop').style.display = (this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none');
this.doc.$('lbPrev').style.display = (!this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none');
this.doc.$('lbNextTop').style.display = (this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none');
this.doc.$('lbNext').style.display = (!this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none');
} else {
this.doc.$('lbHoverNav').style.display = (this.ieVersion != 6 && this.navTypeHash['Hover_by_type_' + this.navType] && !this.isLyteframe ? '' : 'none');
if ((this.navTypeHash['Display_by_type_' + this.navType] && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
this.doc.$('lbPrevTop').style.display = (this.navTop ? '' : 'none');
this.doc.$('lbPrev').style.display = (!this.navTop ? '' : 'none');
this.doc.$('lbNextTop').style.display = (this.navTop ? '' : 'none');
this.doc.$('lbNext').style.display = (!this.navTop ? '' : 'none');
} else {
this.doc.$('lbPrevTop').style.display = 'none';
this.doc.$('lbPrev').style.display = 'none';
this.doc.$('lbNextTop').style.display = 'none';
this.doc.$('lbNext').style.display = 'none';
}
this.doc.$('lbCloseTop').style.display = (this.navTop ? '' : 'none');
this.doc.$('lbClose').style.display = (!this.navTop ? '' : 'none');
this.doc.$('lbBottomData').style.display = '';
this.doc.$('lbPauseTop').style.display = 'none';
this.doc.$('lbPause').style.display = 'none';
this.doc.$('lbPlayTop').style.display = 'none';
this.doc.$('lbPlay').style.display = 'none';
}
this.doc.$('lbPrintTop').style.display = (this.showPrint && this.navTop ? '' : 'none');
this.doc.$('lbPrint').style.display = (this.showPrint && !this.navTop ? '' : 'none');
this.updateDetails();
this.doc.$('lbLoading').style.display = 'none';
this.doc.$('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
this.doc.$('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
if (this.isLyteframe) {
if (!this.isEmpty(this.frameSource)) {
this.doc.$('lbIframe').src = this.frameSource;
}
this.doc.$('lbIframe').style.display = '';
this.fadeIn({ id: 'lbIframe', opacity: (this.doAnimations && (!this.ie || this.ieVersion >= 9) ? 0 : 100) });
} else {
this.doc.$('lbImage').style.display = '';
this.fadeIn({ id: 'lbImage', opacity: (this.doAnimations && (!this.ie || this.ieVersion >= 9) ? 0 : 100) });
this.preloadNeighborImages();
}
if (!this.isEmpty(this.afterStart)) {
var callback = window[this.afterStart];
if (typeof callback === 'function') {
callback(this.args);
}
}
};
Lytebox.prototype.updateDetails = function() {
var sTitle = (this.isSlideshow ? this.slideArray[this.contentNum][1] : (this.isLyteframe ? this.frameArray[this.contentNum][1] : this.imageArray[this.contentNum][1]));
var sDesc = (this.isSlideshow ? this.slideArray[this.contentNum][2] : (this.isLyteframe ? this.frameArray[this.contentNum][2] : this.imageArray[this.contentNum][2]));
if (this.ie && this.ieVersion <= 7 || (this.ieVersion >= 8 && this.doc.compatMode == 'BackCompat')) {
this.doc.$(this.titleTop ? 'lbTitleBottom' : 'lbTitleTop').style.display = 'none';
this.doc.$(this.titleTop ? 'lbTitleTop' : 'lbTitleBottom').style.display = (this.isEmpty(sTitle) ? 'none' : 'block');
}
this.doc.$('lbDescBottom').style.display = (this.isEmpty(sDesc) ? 'none' : '');
this.doc.$(this.titleTop ? 'lbTitleTop' : 'lbTitleBottom').innerHTML = (this.isEmpty(sTitle) ? '' : sTitle);
this.doc.$(this.titleTop ? 'lbTitleBottom' : 'lbTitleTop').innerHTML = '';
this.doc.$(this.titleTop ? 'lbNumBottom' : 'lbNumTop').innerHTML = '';
this.updateNav();
if (this.titleTop || this.navTop) {
this.doc.$('lbTopContainer').style.display = 'block';
this.doc.$('lbTopContainer').style.visibility = 'visible';
} else {
this.doc.$('lbTopContainer').style.display = 'none';
}
var object = (this.titleTop ? this.doc.$('lbNumTop') : this.doc.$('lbNumBottom'));
if (this.isSlideshow && this.slideArray.length > 1) {
object.innerHTML = this.label['image'].replace('%1', this.contentNum + 1).replace('%2', this.slideArray.length);
} else if (this.imageArray.length > 1 && !this.isLyteframe) {
object.innerHTML = this.label['image'].replace('%1', this.contentNum + 1).replace('%2', this.imageArray.length);
} else if (this.frameArray.length > 1 && this.isLyteframe) {
object.innerHTML = this.label['page'].replace('%1', this.contentNum + 1).replace('%2', this.frameArray.length);
} else {
object.innerHTML = '';
}
var bAddSpacer = !(this.titleTop || (this.isEmpty(sTitle) && this.isEmpty(object.innerHTML)));
this.doc.$('lbDescBottom').innerHTML = (this.isEmpty(sDesc) ? '' : (bAddSpacer ? '<br style="line-height:0.6em;" />' : '') + sDesc);
var iNavWidth = 0;
if (this.ie && this.ieVersion <= 7 || (this.ieVersion >= 8 && this.doc.compatMode == 'BackCompat')) {
iNavWidth = 39 + (this.showPrint ? 39 : 0) + (this.isSlideshow && this.showPlayPause ? 39 : 0);
if ((this.isSlideshow && this.slideArray.length > 1 && this.showNavigation && this.navType != 1) ||
(this.frameArray.length > 1 && this.isLyteframe) ||
(this.imageArray.length > 1 && !this.isLyteframe && this.navType != 1)) {
iNavWidth += 39*2;
}
}
this.doc.$('lbBottomContainer').style.display = (!(this.titleTop && this.navTop) || !this.isEmpty(sDesc) ? 'block' : 'none');
if (this.titleTop && this.navTop) {
if (iNavWidth > 0) {
this.doc.$('lbTopNav').style.width = iNavWidth + 'px';
}
this.doc.$('lbTopData').style.width = (this.doc.$('lbTopContainer').offsetWidth - this.doc.$('lbTopNav').offsetWidth - 15) + 'px';
if (!this.isEmpty(sDesc)) {
this.doc.$('lbDescBottom').style.width = (this.doc.$('lbBottomContainer').offsetWidth - 15) + 'px';
}
} else if ((!this.titleTop || !this.isEmpty(sDesc)) && !this.navTop) {
if (iNavWidth > 0) {
this.doc.$('lbBottomNav').style.width = iNavWidth + 'px';
}
this.doc.$('lbBottomData').style.width = (this.doc.$('lbBottomContainer').offsetWidth - this.doc.$('lbBottomNav').offsetWidth - 15) + 'px';
this.doc.$('lbDescBottom').style.width = this.doc.$('lbBottomData').style.width;
}
this.fixBottomPadding();
this.aPageSize = this.getPageSize();
var iMainTop = parseInt(this.doc.$('lbMain').style.top);
if ((this.ie && this.ieVersion <= 7) || (this.ieVersion >= 8 && this.doc.compatMode == 'BackCompat')) {
iMainTop = (this.ie ? parseInt(this.doc.$('lbMain').style.top) - this.getPageScroll() : parseInt(this.doc.$('lbMain').style.top));
}
var iOverlap = (this.doc.$('lbOuterContainer').offsetHeight + iMainTop) - this.aPageSize[3];
var iDivisor = 40;
if (iOverlap > 0 && this.autoResize && this.fixedPosition) {
if (this.ie && (this.ieVersion <= 7 || this.doc.compatMode == 'BackCompat')) {
document.body.onscroll = this.bodyOnscroll;
if (window.removeEventListener) {
window.removeEventListener('scroll', this.scrollHandler);
} else if (window.detachEvent) {