root / src / gr / grnet / pithos / web / public / lytebox.js @ c01daba6
History | View | Annotate | Download (38.6 kB)
1 | a57faaf0 | Christos Stathis | //***********************************************************************************************************************************/
|
---|---|---|---|
2 | a57faaf0 | Christos Stathis | // LyteBox v3.22
|
3 | a57faaf0 | Christos Stathis | //
|
4 | a57faaf0 | Christos Stathis | // Author: Markus F. Hay
|
5 | a57faaf0 | Christos Stathis | // Website: http://www.dolem.com/lytebox
|
6 | a57faaf0 | Christos Stathis | // Date: October 2, 2007
|
7 | a57faaf0 | Christos Stathis | // License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
|
8 | a57faaf0 | Christos Stathis | // Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
|
9 | a57faaf0 | Christos Stathis | // * Firefox: 2.0.0.7, 1.5.0.12
|
10 | a57faaf0 | Christos Stathis | // * Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
|
11 | a57faaf0 | Christos Stathis | // * Opera: 9.23
|
12 | a57faaf0 | Christos Stathis | //
|
13 | a57faaf0 | Christos Stathis | // Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62
|
14 | a57faaf0 | Christos Stathis | // * v3.22 (10/02/07)
|
15 | a57faaf0 | Christos Stathis | // * v3.21 (09/30/07)
|
16 | a57faaf0 | Christos Stathis | // * v3.20 (07/12/07)
|
17 | a57faaf0 | Christos Stathis | // * v3.10 (05/28/07)
|
18 | a57faaf0 | Christos Stathis | // * v3.00 (05/15/07)
|
19 | a57faaf0 | Christos Stathis | // * v2.02 (11/13/06)
|
20 | a57faaf0 | Christos Stathis | //
|
21 | a57faaf0 | Christos Stathis | // Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
|
22 | a57faaf0 | Christos Stathis | // information please visit http://huddletogether.com/projects/lightbox2/
|
23 | a57faaf0 | Christos Stathis | //***********************************************************************************************************************************/
|
24 | a57faaf0 | Christos Stathis | Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } } |
25 | a57faaf0 | Christos Stathis | Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } } |
26 | a57faaf0 | Christos Stathis | String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); } |
27 | a57faaf0 | Christos Stathis | |
28 | a57faaf0 | Christos Stathis | function LyteBox() { |
29 | a57faaf0 | Christos Stathis | /*** Start Global Configuration ***/
|
30 | a57faaf0 | Christos Stathis | this.theme = 'grey'; // themes: grey (default), red, green, blue, gold |
31 | a57faaf0 | Christos Stathis | this.hideFlash = true; // controls whether or not Flash objects should be hidden |
32 | a57faaf0 | Christos Stathis | this.outerBorder = true; // controls whether to show the outer grey (or theme) border |
33 | a57faaf0 | Christos Stathis | this.resizeSpeed = 8; // controls the speed of the image resizing (1=slowest and 10=fastest) |
34 | a57faaf0 | Christos Stathis | this.maxOpacity = 80; // higher opacity = darker overlay, lower opacity = lighter overlay |
35 | a57faaf0 | Christos Stathis | this.navType = 1; // 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number |
36 | a57faaf0 | Christos Stathis | this.autoResize = true; // controls whether or not images should be resized if larger than the browser window dimensions |
37 | a57faaf0 | Christos Stathis | this.doAnimations = true; // controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc. |
38 | a57faaf0 | Christos Stathis | |
39 | a57faaf0 | Christos Stathis | this.borderSize = 12; // if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone... |
40 | a57faaf0 | Christos Stathis | /*** End Global Configuration ***/
|
41 | a57faaf0 | Christos Stathis | |
42 | a57faaf0 | Christos Stathis | /*** Configure Slideshow Options ***/
|
43 | a57faaf0 | Christos Stathis | this.slideInterval = 4000; // Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds) |
44 | a57faaf0 | Christos Stathis | this.showNavigation = true; // true to display Next/Prev buttons/text during slideshow, false to hide |
45 | a57faaf0 | Christos Stathis | this.showClose = true; // true to display the Close button, false to hide |
46 | a57faaf0 | Christos Stathis | this.showDetails = true; // true to display image details (caption, count), false to hide |
47 | a57faaf0 | Christos Stathis | this.showPlayPause = true; // true to display pause/play buttons next to close button, false to hide |
48 | a57faaf0 | Christos Stathis | this.autoEnd = true; // true to automatically close Lytebox after the last image is reached, false to keep open |
49 | a57faaf0 | Christos Stathis | this.pauseOnNextClick = false; // true to pause the slideshow when the "Next" button is clicked |
50 | a57faaf0 | Christos Stathis | this.pauseOnPrevClick = true; // true to pause the slideshow when the "Prev" button is clicked |
51 | a57faaf0 | Christos Stathis | /*** End Slideshow Configuration ***/
|
52 | a57faaf0 | Christos Stathis | |
53 | a57faaf0 | Christos Stathis | if(this.resizeSpeed > 10) { this.resizeSpeed = 10; } |
54 | a57faaf0 | Christos Stathis | if(this.resizeSpeed < 1) { resizeSpeed = 1; } |
55 | a57faaf0 | Christos Stathis | this.resizeDuration = (11 - this.resizeSpeed) * 0.15; |
56 | a57faaf0 | Christos Stathis | this.resizeWTimerArray = new Array(); |
57 | a57faaf0 | Christos Stathis | this.resizeWTimerCount = 0; |
58 | a57faaf0 | Christos Stathis | this.resizeHTimerArray = new Array(); |
59 | a57faaf0 | Christos Stathis | this.resizeHTimerCount = 0; |
60 | a57faaf0 | Christos Stathis | this.showContentTimerArray = new Array(); |
61 | a57faaf0 | Christos Stathis | this.showContentTimerCount = 0; |
62 | a57faaf0 | Christos Stathis | this.overlayTimerArray = new Array(); |
63 | a57faaf0 | Christos Stathis | this.overlayTimerCount = 0; |
64 | a57faaf0 | Christos Stathis | this.imageTimerArray = new Array(); |
65 | a57faaf0 | Christos Stathis | this.imageTimerCount = 0; |
66 | a57faaf0 | Christos Stathis | this.timerIDArray = new Array(); |
67 | a57faaf0 | Christos Stathis | this.timerIDCount = 0; |
68 | a57faaf0 | Christos Stathis | this.slideshowIDArray = new Array(); |
69 | a57faaf0 | Christos Stathis | this.slideshowIDCount = 0; |
70 | a57faaf0 | Christos Stathis | this.imageArray = new Array(); |
71 | a57faaf0 | Christos Stathis | this.activeImage = null; |
72 | a57faaf0 | Christos Stathis | this.slideArray = new Array(); |
73 | a57faaf0 | Christos Stathis | this.activeSlide = null; |
74 | a57faaf0 | Christos Stathis | this.frameArray = new Array(); |
75 | a57faaf0 | Christos Stathis | this.activeFrame = null; |
76 | a57faaf0 | Christos Stathis | this.checkFrame();
|
77 | a57faaf0 | Christos Stathis | this.isSlideshow = false; |
78 | a57faaf0 | Christos Stathis | this.isLyteframe = false; |
79 | a57faaf0 | Christos Stathis | /*@cc_on
|
80 | a57faaf0 | Christos Stathis | /*@if (@_jscript)
|
81 | a57faaf0 | Christos Stathis | this.ie = (document.all && !window.opera) ? true : false;
|
82 | a57faaf0 | Christos Stathis | /*@else @*/
|
83 | a57faaf0 | Christos Stathis | this.ie = false; |
84 | a57faaf0 | Christos Stathis | /*@end
|
85 | a57faaf0 | Christos Stathis | @*/
|
86 | a57faaf0 | Christos Stathis | this.ie7 = (this.ie && window.XMLHttpRequest); |
87 | a57faaf0 | Christos Stathis | this.initialize();
|
88 | a57faaf0 | Christos Stathis | } |
89 | a57faaf0 | Christos Stathis | LyteBox.prototype.initialize = function() { |
90 | a57faaf0 | Christos Stathis | this.updateLyteboxItems();
|
91 | a57faaf0 | Christos Stathis | var objBody = this.doc.getElementsByTagName("body").item(0); |
92 | a57faaf0 | Christos Stathis | if (this.doc.getElementById('lbOverlay')) { |
93 | a57faaf0 | Christos Stathis | objBody.removeChild(this.doc.getElementById("lbOverlay")); |
94 | a57faaf0 | Christos Stathis | objBody.removeChild(this.doc.getElementById("lbMain")); |
95 | a57faaf0 | Christos Stathis | } |
96 | a57faaf0 | Christos Stathis | var objOverlay = this.doc.createElement("div"); |
97 | a57faaf0 | Christos Stathis | objOverlay.setAttribute('id','lbOverlay'); |
98 | a57faaf0 | Christos Stathis | objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
99 | a57faaf0 | Christos Stathis | if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) { |
100 | a57faaf0 | Christos Stathis | objOverlay.style.position = 'absolute';
|
101 | a57faaf0 | Christos Stathis | } |
102 | a57faaf0 | Christos Stathis | objOverlay.style.display = 'none';
|
103 | a57faaf0 | Christos Stathis | objBody.appendChild(objOverlay); |
104 | a57faaf0 | Christos Stathis | var objLytebox = this.doc.createElement("div"); |
105 | a57faaf0 | Christos Stathis | objLytebox.setAttribute('id','lbMain'); |
106 | a57faaf0 | Christos Stathis | objLytebox.style.display = 'none';
|
107 | a57faaf0 | Christos Stathis | objBody.appendChild(objLytebox); |
108 | a57faaf0 | Christos Stathis | var objOuterContainer = this.doc.createElement("div"); |
109 | a57faaf0 | Christos Stathis | objOuterContainer.setAttribute('id','lbOuterContainer'); |
110 | a57faaf0 | Christos Stathis | objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
111 | a57faaf0 | Christos Stathis | objLytebox.appendChild(objOuterContainer); |
112 | a57faaf0 | Christos Stathis | var objIframeContainer = this.doc.createElement("div"); |
113 | a57faaf0 | Christos Stathis | objIframeContainer.setAttribute('id','lbIframeContainer'); |
114 | a57faaf0 | Christos Stathis | objIframeContainer.style.display = 'none';
|
115 | a57faaf0 | Christos Stathis | objOuterContainer.appendChild(objIframeContainer); |
116 | a57faaf0 | Christos Stathis | var objIframe = this.doc.createElement("iframe"); |
117 | a57faaf0 | Christos Stathis | objIframe.setAttribute('id','lbIframe'); |
118 | a57faaf0 | Christos Stathis | objIframe.setAttribute('name','lbIframe'); |
119 | a57faaf0 | Christos Stathis | objIframe.style.display = 'none';
|
120 | a57faaf0 | Christos Stathis | objIframeContainer.appendChild(objIframe); |
121 | a57faaf0 | Christos Stathis | var objImageContainer = this.doc.createElement("div"); |
122 | a57faaf0 | Christos Stathis | objImageContainer.setAttribute('id','lbImageContainer'); |
123 | a57faaf0 | Christos Stathis | objOuterContainer.appendChild(objImageContainer); |
124 | a57faaf0 | Christos Stathis | var objLyteboxImage = this.doc.createElement("img"); |
125 | a57faaf0 | Christos Stathis | objLyteboxImage.setAttribute('id','lbImage'); |
126 | a57faaf0 | Christos Stathis | objImageContainer.appendChild(objLyteboxImage); |
127 | a57faaf0 | Christos Stathis | var objLoading = this.doc.createElement("div"); |
128 | a57faaf0 | Christos Stathis | objLoading.setAttribute('id','lbLoading'); |
129 | a57faaf0 | Christos Stathis | objOuterContainer.appendChild(objLoading); |
130 | a57faaf0 | Christos Stathis | var objDetailsContainer = this.doc.createElement("div"); |
131 | a57faaf0 | Christos Stathis | objDetailsContainer.setAttribute('id','lbDetailsContainer'); |
132 | a57faaf0 | Christos Stathis | objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
133 | a57faaf0 | Christos Stathis | objLytebox.appendChild(objDetailsContainer); |
134 | a57faaf0 | Christos Stathis | var objDetailsData =this.doc.createElement("div"); |
135 | a57faaf0 | Christos Stathis | objDetailsData.setAttribute('id','lbDetailsData'); |
136 | a57faaf0 | Christos Stathis | objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
137 | a57faaf0 | Christos Stathis | objDetailsContainer.appendChild(objDetailsData); |
138 | a57faaf0 | Christos Stathis | var objDetails = this.doc.createElement("div"); |
139 | a57faaf0 | Christos Stathis | objDetails.setAttribute('id','lbDetails'); |
140 | a57faaf0 | Christos Stathis | objDetailsData.appendChild(objDetails); |
141 | a57faaf0 | Christos Stathis | var objCaption = this.doc.createElement("span"); |
142 | a57faaf0 | Christos Stathis | objCaption.setAttribute('id','lbCaption'); |
143 | a57faaf0 | Christos Stathis | objDetails.appendChild(objCaption); |
144 | a57faaf0 | Christos Stathis | var objHoverNav = this.doc.createElement("div"); |
145 | a57faaf0 | Christos Stathis | objHoverNav.setAttribute('id','lbHoverNav'); |
146 | a57faaf0 | Christos Stathis | objImageContainer.appendChild(objHoverNav); |
147 | a57faaf0 | Christos Stathis | var objBottomNav = this.doc.createElement("div"); |
148 | a57faaf0 | Christos Stathis | objBottomNav.setAttribute('id','lbBottomNav'); |
149 | a57faaf0 | Christos Stathis | objDetailsData.appendChild(objBottomNav); |
150 | a57faaf0 | Christos Stathis | var objPrev = this.doc.createElement("a"); |
151 | a57faaf0 | Christos Stathis | objPrev.setAttribute('id','lbPrev'); |
152 | a57faaf0 | Christos Stathis | objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
153 | a57faaf0 | Christos Stathis | objPrev.setAttribute('href','#'); |
154 | a57faaf0 | Christos Stathis | objHoverNav.appendChild(objPrev); |
155 | a57faaf0 | Christos Stathis | var objNext = this.doc.createElement("a"); |
156 | a57faaf0 | Christos Stathis | objNext.setAttribute('id','lbNext'); |
157 | a57faaf0 | Christos Stathis | objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
158 | a57faaf0 | Christos Stathis | objNext.setAttribute('href','#'); |
159 | a57faaf0 | Christos Stathis | objHoverNav.appendChild(objNext); |
160 | a57faaf0 | Christos Stathis | var objNumberDisplay = this.doc.createElement("span"); |
161 | a57faaf0 | Christos Stathis | objNumberDisplay.setAttribute('id','lbNumberDisplay'); |
162 | a57faaf0 | Christos Stathis | objDetails.appendChild(objNumberDisplay); |
163 | a57faaf0 | Christos Stathis | var objNavDisplay = this.doc.createElement("span"); |
164 | a57faaf0 | Christos Stathis | objNavDisplay.setAttribute('id','lbNavDisplay'); |
165 | a57faaf0 | Christos Stathis | objNavDisplay.style.display = 'none';
|
166 | a57faaf0 | Christos Stathis | objDetails.appendChild(objNavDisplay); |
167 | a57faaf0 | Christos Stathis | var objClose = this.doc.createElement("a"); |
168 | a57faaf0 | Christos Stathis | objClose.setAttribute('id','lbClose'); |
169 | a57faaf0 | Christos Stathis | objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
170 | a57faaf0 | Christos Stathis | objClose.setAttribute('href','#'); |
171 | a57faaf0 | Christos Stathis | objBottomNav.appendChild(objClose); |
172 | a57faaf0 | Christos Stathis | var objPause = this.doc.createElement("a"); |
173 | a57faaf0 | Christos Stathis | objPause.setAttribute('id','lbPause'); |
174 | a57faaf0 | Christos Stathis | objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
175 | a57faaf0 | Christos Stathis | objPause.setAttribute('href','#'); |
176 | a57faaf0 | Christos Stathis | objPause.style.display = 'none';
|
177 | a57faaf0 | Christos Stathis | objBottomNav.appendChild(objPause); |
178 | a57faaf0 | Christos Stathis | var objPlay = this.doc.createElement("a"); |
179 | a57faaf0 | Christos Stathis | objPlay.setAttribute('id','lbPlay'); |
180 | a57faaf0 | Christos Stathis | objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme); |
181 | a57faaf0 | Christos Stathis | objPlay.setAttribute('href','#'); |
182 | a57faaf0 | Christos Stathis | objPlay.style.display = 'none';
|
183 | a57faaf0 | Christos Stathis | objBottomNav.appendChild(objPlay); |
184 | a57faaf0 | Christos Stathis | }; |
185 | a57faaf0 | Christos Stathis | LyteBox.prototype.updateLyteboxItems = function() { |
186 | a57faaf0 | Christos Stathis | var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a'); |
187 | a57faaf0 | Christos Stathis | for (var i = 0; i < anchors.length; i++) { |
188 | a57faaf0 | Christos Stathis | var anchor = anchors[i];
|
189 | a57faaf0 | Christos Stathis | var relAttribute = String(anchor.getAttribute('rel')); |
190 | a57faaf0 | Christos Stathis | if (anchor.getAttribute('href')) { |
191 | a57faaf0 | Christos Stathis | if (relAttribute.toLowerCase().match('lytebox')) { |
192 | a57faaf0 | Christos Stathis | anchor.onclick = function () { myLytebox.start(this, false, false); return false; } |
193 | a57faaf0 | Christos Stathis | } else if (relAttribute.toLowerCase().match('lyteshow')) { |
194 | a57faaf0 | Christos Stathis | anchor.onclick = function () { myLytebox.start(this, true, false); return false; } |
195 | a57faaf0 | Christos Stathis | } else if (relAttribute.toLowerCase().match('lyteframe')) { |
196 | a57faaf0 | Christos Stathis | anchor.onclick = function () { myLytebox.start(this, false, true); return false; } |
197 | a57faaf0 | Christos Stathis | } |
198 | a57faaf0 | Christos Stathis | } |
199 | a57faaf0 | Christos Stathis | } |
200 | a57faaf0 | Christos Stathis | }; |
201 | a57faaf0 | Christos Stathis | LyteBox.prototype.start = function(imageLink, doSlide, doFrame) { |
202 | a57faaf0 | Christos Stathis | if (this.ie && !this.ie7) { this.toggleSelects('hide'); } |
203 | a57faaf0 | Christos Stathis | if (this.hideFlash) { this.toggleFlash('hide'); } |
204 | a57faaf0 | Christos Stathis | this.isLyteframe = (doFrame ? true : false); |
205 | a57faaf0 | Christos Stathis | var pageSize = this.getPageSize(); |
206 | a57faaf0 | Christos Stathis | var objOverlay = this.doc.getElementById('lbOverlay'); |
207 | a57faaf0 | Christos Stathis | var objBody = this.doc.getElementsByTagName("body").item(0); |
208 | a57faaf0 | Christos Stathis | objOverlay.style.height = pageSize[1] + "px"; |
209 | a57faaf0 | Christos Stathis | objOverlay.style.display = '';
|
210 | a57faaf0 | Christos Stathis | this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity)); |
211 | a57faaf0 | Christos Stathis | var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a'); |
212 | a57faaf0 | Christos Stathis | if (this.isLyteframe) { |
213 | a57faaf0 | Christos Stathis | this.frameArray = [];
|
214 | a57faaf0 | Christos Stathis | this.frameNum = 0; |
215 | a57faaf0 | Christos Stathis | if ((imageLink.getAttribute('rel') == 'lyteframe')) { |
216 | a57faaf0 | Christos Stathis | var rev = imageLink.getAttribute('rev'); |
217 | a57faaf0 | Christos Stathis | this.frameArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev))); |
218 | a57faaf0 | Christos Stathis | } else {
|
219 | a57faaf0 | Christos Stathis | if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) { |
220 | a57faaf0 | Christos Stathis | for (var i = 0; i < anchors.length; i++) { |
221 | a57faaf0 | Christos Stathis | var anchor = anchors[i];
|
222 | a57faaf0 | Christos Stathis | if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) { |
223 | a57faaf0 | Christos Stathis | var rev = anchor.getAttribute('rev'); |
224 | a57faaf0 | Christos Stathis | this.frameArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev))); |
225 | a57faaf0 | Christos Stathis | } |
226 | a57faaf0 | Christos Stathis | } |
227 | a57faaf0 | Christos Stathis | this.frameArray.removeDuplicates();
|
228 | a57faaf0 | Christos Stathis | while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('href')) { this.frameNum++; } |
229 | a57faaf0 | Christos Stathis | } |
230 | a57faaf0 | Christos Stathis | } |
231 | a57faaf0 | Christos Stathis | } else {
|
232 | a57faaf0 | Christos Stathis | this.imageArray = [];
|
233 | a57faaf0 | Christos Stathis | this.imageNum = 0; |
234 | a57faaf0 | Christos Stathis | this.slideArray = [];
|
235 | a57faaf0 | Christos Stathis | this.slideNum = 0; |
236 | a57faaf0 | Christos Stathis | if ((imageLink.getAttribute('rel') == 'lytebox')) { |
237 | a57faaf0 | Christos Stathis | this.imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'))); |
238 | a57faaf0 | Christos Stathis | } else {
|
239 | a57faaf0 | Christos Stathis | if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) { |
240 | a57faaf0 | Christos Stathis | for (var i = 0; i < anchors.length; i++) { |
241 | a57faaf0 | Christos Stathis | var anchor = anchors[i];
|
242 | a57faaf0 | Christos Stathis | if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) { |
243 | a57faaf0 | Christos Stathis | this.imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'))); |
244 | a57faaf0 | Christos Stathis | } |
245 | a57faaf0 | Christos Stathis | } |
246 | a57faaf0 | Christos Stathis | this.imageArray.removeDuplicates();
|
247 | a57faaf0 | Christos Stathis | while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('href')) { this.imageNum++; } |
248 | a57faaf0 | Christos Stathis | } |
249 | a57faaf0 | Christos Stathis | if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) { |
250 | a57faaf0 | Christos Stathis | for (var i = 0; i < anchors.length; i++) { |
251 | a57faaf0 | Christos Stathis | var anchor = anchors[i];
|
252 | a57faaf0 | Christos Stathis | if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) { |
253 | a57faaf0 | Christos Stathis | this.slideArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'))); |
254 | a57faaf0 | Christos Stathis | } |
255 | a57faaf0 | Christos Stathis | } |
256 | a57faaf0 | Christos Stathis | this.slideArray.removeDuplicates();
|
257 | a57faaf0 | Christos Stathis | while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('href')) { this.slideNum++; } |
258 | a57faaf0 | Christos Stathis | } |
259 | a57faaf0 | Christos Stathis | } |
260 | a57faaf0 | Christos Stathis | } |
261 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById('lbMain'); |
262 | a57faaf0 | Christos Stathis | object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px"; |
263 | a57faaf0 | Christos Stathis | object.style.display = '';
|
264 | a57faaf0 | Christos Stathis | if (!this.outerBorder) { |
265 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOuterContainer').style.border = 'none'; |
266 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbDetailsContainer').style.border = 'none'; |
267 | a57faaf0 | Christos Stathis | } else {
|
268 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOuterContainer').style.borderBottom = ''; |
269 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme); |
270 | a57faaf0 | Christos Stathis | } |
271 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; } |
272 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbMain').onclick = function(e) { |
273 | a57faaf0 | Christos Stathis | var e = e;
|
274 | a57faaf0 | Christos Stathis | if (!e) {
|
275 | a57faaf0 | Christos Stathis | if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) { |
276 | a57faaf0 | Christos Stathis | e = window.parent.window.event; |
277 | a57faaf0 | Christos Stathis | } else {
|
278 | a57faaf0 | Christos Stathis | e = window.event; |
279 | a57faaf0 | Christos Stathis | } |
280 | a57faaf0 | Christos Stathis | } |
281 | a57faaf0 | Christos Stathis | var id = (e.target ? e.target.id : e.srcElement.id);
|
282 | a57faaf0 | Christos Stathis | if (id == 'lbMain') { myLytebox.end(); return false; } |
283 | a57faaf0 | Christos Stathis | } |
284 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; } |
285 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; } |
286 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; } |
287 | a57faaf0 | Christos Stathis | this.isSlideshow = doSlide;
|
288 | a57faaf0 | Christos Stathis | this.isPaused = (this.slideNum != 0 ? true : false); |
289 | a57faaf0 | Christos Stathis | if (this.isSlideshow && this.showPlayPause && this.isPaused) { |
290 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPlay').style.display = ''; |
291 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPause').style.display = 'none'; |
292 | a57faaf0 | Christos Stathis | } |
293 | a57faaf0 | Christos Stathis | if (this.isLyteframe) { |
294 | a57faaf0 | Christos Stathis | this.changeContent(this.frameNum); |
295 | a57faaf0 | Christos Stathis | } else {
|
296 | a57faaf0 | Christos Stathis | if (this.isSlideshow) { |
297 | a57faaf0 | Christos Stathis | this.changeContent(this.slideNum); |
298 | a57faaf0 | Christos Stathis | } else {
|
299 | a57faaf0 | Christos Stathis | this.changeContent(this.imageNum); |
300 | a57faaf0 | Christos Stathis | } |
301 | a57faaf0 | Christos Stathis | } |
302 | a57faaf0 | Christos Stathis | }; |
303 | a57faaf0 | Christos Stathis | LyteBox.prototype.changeContent = function(imageNum) { |
304 | a57faaf0 | Christos Stathis | if (this.isSlideshow) { |
305 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } |
306 | a57faaf0 | Christos Stathis | } |
307 | a57faaf0 | Christos Stathis | this.activeImage = this.activeSlide = this.activeFrame = imageNum; |
308 | a57faaf0 | Christos Stathis | if (!this.outerBorder) { |
309 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOuterContainer').style.border = 'none'; |
310 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbDetailsContainer').style.border = 'none'; |
311 | a57faaf0 | Christos Stathis | } else {
|
312 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOuterContainer').style.borderBottom = ''; |
313 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme); |
314 | a57faaf0 | Christos Stathis | } |
315 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbLoading').style.display = ''; |
316 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbImage').style.display = 'none'; |
317 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbIframe').style.display = 'none'; |
318 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPrev').style.display = 'none'; |
319 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNext').style.display = 'none'; |
320 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbIframeContainer').style.display = 'none'; |
321 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbDetailsContainer').style.display = 'none'; |
322 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNumberDisplay').style.display = 'none'; |
323 | a57faaf0 | Christos Stathis | if (this.navType == 2 || this.isLyteframe) { |
324 | a57faaf0 | Christos Stathis | object = this.doc.getElementById('lbNavDisplay'); |
325 | a57faaf0 | Christos Stathis | object.innerHTML = ' <span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">« prev</span><a href="#" id="lbPrev2" class="' + this.theme + '" style="display: none;">« prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b> <span id="lbNext2_Off" style="display: none;" class="' + this.theme + '">next »</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next »</a>'; |
326 | a57faaf0 | Christos Stathis | object.style.display = 'none';
|
327 | a57faaf0 | Christos Stathis | } |
328 | a57faaf0 | Christos Stathis | if (this.isLyteframe) { |
329 | a57faaf0 | Christos Stathis | var iframe = myLytebox.doc.getElementById('lbIframe'); |
330 | a57faaf0 | Christos Stathis | var styles = this.frameArray[this.activeFrame][2]; |
331 | a57faaf0 | Christos Stathis | var aStyles = styles.split(';'); |
332 | a57faaf0 | Christos Stathis | for (var i = 0; i < aStyles.length; i++) { |
333 | a57faaf0 | Christos Stathis | if (aStyles[i].indexOf('width:') >= 0) { |
334 | a57faaf0 | Christos Stathis | var w = aStyles[i].replace('width:', ''); |
335 | a57faaf0 | Christos Stathis | iframe.width = w.trim(); |
336 | a57faaf0 | Christos Stathis | } else if (aStyles[i].indexOf('height:') >= 0) { |
337 | a57faaf0 | Christos Stathis | var h = aStyles[i].replace('height:', ''); |
338 | a57faaf0 | Christos Stathis | iframe.height = h.trim(); |
339 | a57faaf0 | Christos Stathis | } else if (aStyles[i].indexOf('scrolling:') >= 0) { |
340 | a57faaf0 | Christos Stathis | var s = aStyles[i].replace('scrolling:', ''); |
341 | a57faaf0 | Christos Stathis | iframe.scrolling = s.trim(); |
342 | a57faaf0 | Christos Stathis | } else if (aStyles[i].indexOf('border:') >= 0) { |
343 | a57faaf0 | Christos Stathis | // Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
|
344 | a57faaf0 | Christos Stathis | //var b = aStyles[i].replace('border:', '');
|
345 | a57faaf0 | Christos Stathis | //iframe.style.border = b.trim();
|
346 | a57faaf0 | Christos Stathis | } |
347 | a57faaf0 | Christos Stathis | } |
348 | a57faaf0 | Christos Stathis | this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
|
349 | a57faaf0 | Christos Stathis | } else {
|
350 | a57faaf0 | Christos Stathis | imgPreloader = new Image();
|
351 | a57faaf0 | Christos Stathis | imgPreloader.onload = function() { |
352 | a57faaf0 | Christos Stathis | var imageWidth = imgPreloader.width;
|
353 | a57faaf0 | Christos Stathis | var imageHeight = imgPreloader.height;
|
354 | a57faaf0 | Christos Stathis | if (myLytebox.autoResize) {
|
355 | a57faaf0 | Christos Stathis | var pagesize = myLytebox.getPageSize();
|
356 | a57faaf0 | Christos Stathis | var x = pagesize[2] - 150; |
357 | a57faaf0 | Christos Stathis | var y = pagesize[3] - 150; |
358 | a57faaf0 | Christos Stathis | if (imageWidth > x) {
|
359 | a57faaf0 | Christos Stathis | imageHeight = Math.round(imageHeight * (x / imageWidth)); |
360 | a57faaf0 | Christos Stathis | imageWidth = x; |
361 | a57faaf0 | Christos Stathis | if (imageHeight > y) {
|
362 | a57faaf0 | Christos Stathis | imageWidth = Math.round(imageWidth * (y / imageHeight)); |
363 | a57faaf0 | Christos Stathis | imageHeight = y; |
364 | a57faaf0 | Christos Stathis | } |
365 | a57faaf0 | Christos Stathis | } else if (imageHeight > y) { |
366 | a57faaf0 | Christos Stathis | imageWidth = Math.round(imageWidth * (y / imageHeight)); |
367 | a57faaf0 | Christos Stathis | imageHeight = y; |
368 | a57faaf0 | Christos Stathis | if (imageWidth > x) {
|
369 | a57faaf0 | Christos Stathis | imageHeight = Math.round(imageHeight * (x / imageWidth)); |
370 | a57faaf0 | Christos Stathis | imageWidth = x; |
371 | a57faaf0 | Christos Stathis | } |
372 | a57faaf0 | Christos Stathis | } |
373 | a57faaf0 | Christos Stathis | } |
374 | a57faaf0 | Christos Stathis | var lbImage = myLytebox.doc.getElementById('lbImage') |
375 | a57faaf0 | Christos Stathis | lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]); |
376 | a57faaf0 | Christos Stathis | lbImage.width = imageWidth; |
377 | a57faaf0 | Christos Stathis | lbImage.height = imageHeight; |
378 | a57faaf0 | Christos Stathis | myLytebox.resizeContainer(imageWidth, imageHeight); |
379 | a57faaf0 | Christos Stathis | imgPreloader.onload = function() {}; |
380 | a57faaf0 | Christos Stathis | } |
381 | a57faaf0 | Christos Stathis | imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]); |
382 | a57faaf0 | Christos Stathis | } |
383 | a57faaf0 | Christos Stathis | }; |
384 | a57faaf0 | Christos Stathis | LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) { |
385 | a57faaf0 | Christos Stathis | this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth; |
386 | a57faaf0 | Christos Stathis | this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight; |
387 | a57faaf0 | Christos Stathis | this.xScale = ((imgWidth + (this.borderSize * 2)) / this.wCur) * 100; |
388 | a57faaf0 | Christos Stathis | this.yScale = ((imgHeight + (this.borderSize * 2)) / this.hCur) * 100; |
389 | a57faaf0 | Christos Stathis | var wDiff = (this.wCur - this.borderSize * 2) - imgWidth; |
390 | a57faaf0 | Christos Stathis | var hDiff = (this.hCur - this.borderSize * 2) - imgHeight; |
391 | a57faaf0 | Christos Stathis | if (!(hDiff == 0)) { |
392 | a57faaf0 | Christos Stathis | this.hDone = false; |
393 | a57faaf0 | Christos Stathis | this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight)); |
394 | a57faaf0 | Christos Stathis | } else {
|
395 | a57faaf0 | Christos Stathis | this.hDone = true; |
396 | a57faaf0 | Christos Stathis | } |
397 | a57faaf0 | Christos Stathis | if (!(wDiff == 0)) { |
398 | a57faaf0 | Christos Stathis | this.wDone = false; |
399 | a57faaf0 | Christos Stathis | this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth)); |
400 | a57faaf0 | Christos Stathis | } else {
|
401 | a57faaf0 | Christos Stathis | this.wDone = true; |
402 | a57faaf0 | Christos Stathis | } |
403 | a57faaf0 | Christos Stathis | if ((hDiff == 0) && (wDiff == 0)) { |
404 | a57faaf0 | Christos Stathis | if (this.ie){ this.pause(250); } else { this.pause(100); } |
405 | a57faaf0 | Christos Stathis | } |
406 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPrev').style.height = imgHeight + "px"; |
407 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNext').style.height = imgHeight + "px"; |
408 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px"; |
409 | a57faaf0 | Christos Stathis | this.showContent();
|
410 | a57faaf0 | Christos Stathis | }; |
411 | a57faaf0 | Christos Stathis | LyteBox.prototype.showContent = function() { |
412 | a57faaf0 | Christos Stathis | if (this.wDone && this.hDone) { |
413 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); } |
414 | a57faaf0 | Christos Stathis | if (this.outerBorder) { |
415 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none'; |
416 | a57faaf0 | Christos Stathis | } |
417 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbLoading').style.display = 'none'; |
418 | a57faaf0 | Christos Stathis | if (this.isLyteframe) { |
419 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbIframe').style.display = ''; |
420 | a57faaf0 | Christos Stathis | this.appear('lbIframe', (this.doAnimations ? 0 : 100)); |
421 | a57faaf0 | Christos Stathis | } else {
|
422 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbImage').style.display = ''; |
423 | a57faaf0 | Christos Stathis | this.appear('lbImage', (this.doAnimations ? 0 : 100)); |
424 | a57faaf0 | Christos Stathis | this.preloadNeighborImages();
|
425 | a57faaf0 | Christos Stathis | } |
426 | a57faaf0 | Christos Stathis | if (this.isSlideshow) { |
427 | a57faaf0 | Christos Stathis | if(this.activeSlide == (this.slideArray.length - 1)) { |
428 | a57faaf0 | Christos Stathis | if (this.autoEnd) { |
429 | a57faaf0 | Christos Stathis | this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval); |
430 | a57faaf0 | Christos Stathis | } |
431 | a57faaf0 | Christos Stathis | } else {
|
432 | a57faaf0 | Christos Stathis | if (!this.isPaused) { |
433 | a57faaf0 | Christos Stathis | this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval); |
434 | a57faaf0 | Christos Stathis | } |
435 | a57faaf0 | Christos Stathis | } |
436 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none'); |
437 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none'); |
438 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none'); |
439 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none'); |
440 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : ''); |
441 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none'); |
442 | a57faaf0 | Christos Stathis | } else {
|
443 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none'); |
444 | a57faaf0 | Christos Stathis | if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) { |
445 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNavDisplay').style.display = ''; |
446 | a57faaf0 | Christos Stathis | } else {
|
447 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNavDisplay').style.display = 'none'; |
448 | a57faaf0 | Christos Stathis | } |
449 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbClose').style.display = ''; |
450 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbDetails').style.display = ''; |
451 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPause').style.display = 'none'; |
452 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPlay').style.display = 'none'; |
453 | a57faaf0 | Christos Stathis | } |
454 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : ''); |
455 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none'); |
456 | a57faaf0 | Christos Stathis | try {
|
457 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0]; |
458 | a57faaf0 | Christos Stathis | } catch(e) { }
|
459 | a57faaf0 | Christos Stathis | } else {
|
460 | a57faaf0 | Christos Stathis | this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200); |
461 | a57faaf0 | Christos Stathis | } |
462 | a57faaf0 | Christos Stathis | }; |
463 | a57faaf0 | Christos Stathis | LyteBox.prototype.updateDetails = function() { |
464 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById('lbCaption'); |
465 | a57faaf0 | Christos Stathis | var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1])); |
466 | a57faaf0 | Christos Stathis | object.style.display = '';
|
467 | a57faaf0 | Christos Stathis | object.innerHTML = (sTitle == null ? '' : sTitle); |
468 | a57faaf0 | Christos Stathis | this.updateNav();
|
469 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbDetailsContainer').style.display = ''; |
470 | a57faaf0 | Christos Stathis | object = this.doc.getElementById('lbNumberDisplay'); |
471 | a57faaf0 | Christos Stathis | if (this.isSlideshow && this.slideArray.length > 1) { |
472 | a57faaf0 | Christos Stathis | object.style.display = '';
|
473 | a57faaf0 | Christos Stathis | object.innerHTML = "Image " + eval(this.activeSlide + 1) + " of " + this.slideArray.length; |
474 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none'); |
475 | a57faaf0 | Christos Stathis | } else if (this.imageArray.length > 1 && !this.isLyteframe) { |
476 | a57faaf0 | Christos Stathis | object.style.display = '';
|
477 | a57faaf0 | Christos Stathis | object.innerHTML = "Image " + eval(this.activeImage + 1) + " of " + this.imageArray.length; |
478 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none'); |
479 | a57faaf0 | Christos Stathis | } else if (this.frameArray.length > 1 && this.isLyteframe) { |
480 | a57faaf0 | Christos Stathis | object.style.display = '';
|
481 | a57faaf0 | Christos Stathis | object.innerHTML = "Page " + eval(this.activeFrame + 1) + " of " + this.frameArray.length; |
482 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNavDisplay').style.display = ''; |
483 | a57faaf0 | Christos Stathis | } else {
|
484 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNavDisplay').style.display = 'none'; |
485 | a57faaf0 | Christos Stathis | } |
486 | a57faaf0 | Christos Stathis | this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100)); |
487 | a57faaf0 | Christos Stathis | }; |
488 | a57faaf0 | Christos Stathis | LyteBox.prototype.updateNav = function() { |
489 | a57faaf0 | Christos Stathis | if (this.isSlideshow) { |
490 | a57faaf0 | Christos Stathis | if (this.activeSlide != 0) { |
491 | a57faaf0 | Christos Stathis | var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev')); |
492 | a57faaf0 | Christos Stathis | object.style.display = '';
|
493 | a57faaf0 | Christos Stathis | object.onclick = function() { |
494 | a57faaf0 | Christos Stathis | if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); } |
495 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeSlide - 1); return false; |
496 | a57faaf0 | Christos Stathis | } |
497 | a57faaf0 | Christos Stathis | } else {
|
498 | a57faaf0 | Christos Stathis | if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; } |
499 | a57faaf0 | Christos Stathis | } |
500 | a57faaf0 | Christos Stathis | if (this.activeSlide != (this.slideArray.length - 1)) { |
501 | a57faaf0 | Christos Stathis | var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext')); |
502 | a57faaf0 | Christos Stathis | object.style.display = '';
|
503 | a57faaf0 | Christos Stathis | object.onclick = function() { |
504 | a57faaf0 | Christos Stathis | if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); } |
505 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeSlide + 1); return false; |
506 | a57faaf0 | Christos Stathis | } |
507 | a57faaf0 | Christos Stathis | } else {
|
508 | a57faaf0 | Christos Stathis | if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; } |
509 | a57faaf0 | Christos Stathis | } |
510 | a57faaf0 | Christos Stathis | } else if (this.isLyteframe) { |
511 | a57faaf0 | Christos Stathis | if(this.activeFrame != 0) { |
512 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById('lbPrev2'); |
513 | a57faaf0 | Christos Stathis | object.style.display = '';
|
514 | a57faaf0 | Christos Stathis | object.onclick = function() { |
515 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeFrame - 1); return false; |
516 | a57faaf0 | Christos Stathis | } |
517 | a57faaf0 | Christos Stathis | } else {
|
518 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbPrev2_Off').style.display = ''; |
519 | a57faaf0 | Christos Stathis | } |
520 | a57faaf0 | Christos Stathis | if(this.activeFrame != (this.frameArray.length - 1)) { |
521 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById('lbNext2'); |
522 | a57faaf0 | Christos Stathis | object.style.display = '';
|
523 | a57faaf0 | Christos Stathis | object.onclick = function() { |
524 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeFrame + 1); return false; |
525 | a57faaf0 | Christos Stathis | } |
526 | a57faaf0 | Christos Stathis | } else {
|
527 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbNext2_Off').style.display = ''; |
528 | a57faaf0 | Christos Stathis | } |
529 | a57faaf0 | Christos Stathis | } else {
|
530 | a57faaf0 | Christos Stathis | if(this.activeImage != 0) { |
531 | a57faaf0 | Christos Stathis | var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev')); |
532 | a57faaf0 | Christos Stathis | object.style.display = '';
|
533 | a57faaf0 | Christos Stathis | object.onclick = function() { |
534 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeImage - 1); return false; |
535 | a57faaf0 | Christos Stathis | } |
536 | a57faaf0 | Christos Stathis | } else {
|
537 | a57faaf0 | Christos Stathis | if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; } |
538 | a57faaf0 | Christos Stathis | } |
539 | a57faaf0 | Christos Stathis | if(this.activeImage != (this.imageArray.length - 1)) { |
540 | a57faaf0 | Christos Stathis | var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext')); |
541 | a57faaf0 | Christos Stathis | object.style.display = '';
|
542 | a57faaf0 | Christos Stathis | object.onclick = function() { |
543 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeImage + 1); return false; |
544 | a57faaf0 | Christos Stathis | } |
545 | a57faaf0 | Christos Stathis | } else {
|
546 | a57faaf0 | Christos Stathis | if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; } |
547 | a57faaf0 | Christos Stathis | } |
548 | a57faaf0 | Christos Stathis | } |
549 | a57faaf0 | Christos Stathis | this.enableKeyboardNav();
|
550 | a57faaf0 | Christos Stathis | }; |
551 | a57faaf0 | Christos Stathis | LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; }; |
552 | a57faaf0 | Christos Stathis | LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; }; |
553 | a57faaf0 | Christos Stathis | LyteBox.prototype.keyboardAction = function(e) { |
554 | a57faaf0 | Christos Stathis | var keycode = key = escape = null; |
555 | a57faaf0 | Christos Stathis | keycode = (e == null) ? event.keyCode : e.which;
|
556 | a57faaf0 | Christos Stathis | key = String.fromCharCode(keycode).toLowerCase(); |
557 | a57faaf0 | Christos Stathis | escape = (e == null) ? 27 : e.DOM_VK_ESCAPE; |
558 | a57faaf0 | Christos Stathis | if ((key == 'x') || (key == 'c') || (keycode == escape)) { |
559 | a57faaf0 | Christos Stathis | myLytebox.end(); |
560 | a57faaf0 | Christos Stathis | } else if ((key == 'p') || (keycode == 37)) { |
561 | a57faaf0 | Christos Stathis | if (myLytebox.isSlideshow) {
|
562 | a57faaf0 | Christos Stathis | if(myLytebox.activeSlide != 0) { |
563 | a57faaf0 | Christos Stathis | myLytebox.disableKeyboardNav(); |
564 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeSlide - 1);
|
565 | a57faaf0 | Christos Stathis | } |
566 | a57faaf0 | Christos Stathis | } else if (myLytebox.isLyteframe) { |
567 | a57faaf0 | Christos Stathis | if(myLytebox.activeFrame != 0) { |
568 | a57faaf0 | Christos Stathis | myLytebox.disableKeyboardNav(); |
569 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeFrame - 1);
|
570 | a57faaf0 | Christos Stathis | } |
571 | a57faaf0 | Christos Stathis | } else {
|
572 | a57faaf0 | Christos Stathis | if(myLytebox.activeImage != 0) { |
573 | a57faaf0 | Christos Stathis | myLytebox.disableKeyboardNav(); |
574 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeImage - 1);
|
575 | a57faaf0 | Christos Stathis | } |
576 | a57faaf0 | Christos Stathis | } |
577 | a57faaf0 | Christos Stathis | } else if ((key == 'n') || (keycode == 39)) { |
578 | a57faaf0 | Christos Stathis | if (myLytebox.isSlideshow) {
|
579 | a57faaf0 | Christos Stathis | if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) { |
580 | a57faaf0 | Christos Stathis | myLytebox.disableKeyboardNav(); |
581 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeSlide + 1);
|
582 | a57faaf0 | Christos Stathis | } |
583 | a57faaf0 | Christos Stathis | } else if (myLytebox.isLyteframe) { |
584 | a57faaf0 | Christos Stathis | if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) { |
585 | a57faaf0 | Christos Stathis | myLytebox.disableKeyboardNav(); |
586 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeFrame + 1);
|
587 | a57faaf0 | Christos Stathis | } |
588 | a57faaf0 | Christos Stathis | } else {
|
589 | a57faaf0 | Christos Stathis | if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) { |
590 | a57faaf0 | Christos Stathis | myLytebox.disableKeyboardNav(); |
591 | a57faaf0 | Christos Stathis | myLytebox.changeContent(myLytebox.activeImage + 1);
|
592 | a57faaf0 | Christos Stathis | } |
593 | a57faaf0 | Christos Stathis | } |
594 | a57faaf0 | Christos Stathis | } |
595 | a57faaf0 | Christos Stathis | }; |
596 | a57faaf0 | Christos Stathis | LyteBox.prototype.preloadNeighborImages = function() { |
597 | a57faaf0 | Christos Stathis | if (this.isSlideshow) { |
598 | a57faaf0 | Christos Stathis | if ((this.slideArray.length - 1) > this.activeSlide) { |
599 | a57faaf0 | Christos Stathis | preloadNextImage = new Image();
|
600 | a57faaf0 | Christos Stathis | preloadNextImage.src = this.slideArray[this.activeSlide + 1][0]; |
601 | a57faaf0 | Christos Stathis | } |
602 | a57faaf0 | Christos Stathis | if(this.activeSlide > 0) { |
603 | a57faaf0 | Christos Stathis | preloadPrevImage = new Image();
|
604 | a57faaf0 | Christos Stathis | preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0]; |
605 | a57faaf0 | Christos Stathis | } |
606 | a57faaf0 | Christos Stathis | } else {
|
607 | a57faaf0 | Christos Stathis | if ((this.imageArray.length - 1) > this.activeImage) { |
608 | a57faaf0 | Christos Stathis | preloadNextImage = new Image();
|
609 | a57faaf0 | Christos Stathis | preloadNextImage.src = this.imageArray[this.activeImage + 1][0]; |
610 | a57faaf0 | Christos Stathis | } |
611 | a57faaf0 | Christos Stathis | if(this.activeImage > 0) { |
612 | a57faaf0 | Christos Stathis | preloadPrevImage = new Image();
|
613 | a57faaf0 | Christos Stathis | preloadPrevImage.src = this.imageArray[this.activeImage - 1][0]; |
614 | a57faaf0 | Christos Stathis | } |
615 | a57faaf0 | Christos Stathis | } |
616 | a57faaf0 | Christos Stathis | }; |
617 | a57faaf0 | Christos Stathis | LyteBox.prototype.togglePlayPause = function(hideID, showID) { |
618 | a57faaf0 | Christos Stathis | if (this.isSlideshow && hideID == "lbPause") { |
619 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } |
620 | a57faaf0 | Christos Stathis | } |
621 | a57faaf0 | Christos Stathis | this.doc.getElementById(hideID).style.display = 'none'; |
622 | a57faaf0 | Christos Stathis | this.doc.getElementById(showID).style.display = ''; |
623 | a57faaf0 | Christos Stathis | if (hideID == "lbPlay") { |
624 | a57faaf0 | Christos Stathis | this.isPaused = false; |
625 | a57faaf0 | Christos Stathis | if (this.activeSlide == (this.slideArray.length - 1)) { |
626 | a57faaf0 | Christos Stathis | this.end();
|
627 | a57faaf0 | Christos Stathis | } else {
|
628 | a57faaf0 | Christos Stathis | this.changeContent(this.activeSlide + 1); |
629 | a57faaf0 | Christos Stathis | } |
630 | a57faaf0 | Christos Stathis | } else {
|
631 | a57faaf0 | Christos Stathis | this.isPaused = true; |
632 | a57faaf0 | Christos Stathis | } |
633 | a57faaf0 | Christos Stathis | }; |
634 | a57faaf0 | Christos Stathis | LyteBox.prototype.end = function(caller) { |
635 | a57faaf0 | Christos Stathis | var closeClick = (caller == 'slideshow' ? false : true); |
636 | a57faaf0 | Christos Stathis | if (this.isSlideshow && this.isPaused && !closeClick) { return; } |
637 | a57faaf0 | Christos Stathis | this.disableKeyboardNav();
|
638 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbMain').style.display = 'none'; |
639 | a57faaf0 | Christos Stathis | this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0)); |
640 | a57faaf0 | Christos Stathis | this.toggleSelects('visible'); |
641 | a57faaf0 | Christos Stathis | if (this.hideFlash) { this.toggleFlash('visible'); } |
642 | a57faaf0 | Christos Stathis | if (this.isSlideshow) { |
643 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } |
644 | a57faaf0 | Christos Stathis | } |
645 | a57faaf0 | Christos Stathis | if (this.isLyteframe) { |
646 | a57faaf0 | Christos Stathis | this.initialize();
|
647 | a57faaf0 | Christos Stathis | } |
648 | a57faaf0 | Christos Stathis | }; |
649 | a57faaf0 | Christos Stathis | LyteBox.prototype.checkFrame = function() { |
650 | a57faaf0 | Christos Stathis | if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) { |
651 | a57faaf0 | Christos Stathis | this.isFrame = true; |
652 | a57faaf0 | Christos Stathis | this.lytebox = "window.parent." + window.name + ".myLytebox"; |
653 | a57faaf0 | Christos Stathis | this.doc = parent.document;
|
654 | a57faaf0 | Christos Stathis | } else {
|
655 | a57faaf0 | Christos Stathis | this.isFrame = false; |
656 | a57faaf0 | Christos Stathis | this.lytebox = "myLytebox"; |
657 | a57faaf0 | Christos Stathis | this.doc = document;
|
658 | a57faaf0 | Christos Stathis | } |
659 | a57faaf0 | Christos Stathis | }; |
660 | a57faaf0 | Christos Stathis | LyteBox.prototype.getPixelRate = function(cur, img) { |
661 | a57faaf0 | Christos Stathis | var diff = (img > cur) ? img - cur : cur - img;
|
662 | a57faaf0 | Christos Stathis | if (diff >= 0 && diff <= 100) { return 10; } |
663 | a57faaf0 | Christos Stathis | if (diff > 100 && diff <= 200) { return 15; } |
664 | a57faaf0 | Christos Stathis | if (diff > 200 && diff <= 300) { return 20; } |
665 | a57faaf0 | Christos Stathis | if (diff > 300 && diff <= 400) { return 25; } |
666 | a57faaf0 | Christos Stathis | if (diff > 400 && diff <= 500) { return 30; } |
667 | a57faaf0 | Christos Stathis | if (diff > 500 && diff <= 600) { return 35; } |
668 | a57faaf0 | Christos Stathis | if (diff > 600 && diff <= 700) { return 40; } |
669 | a57faaf0 | Christos Stathis | if (diff > 700) { return 45; } |
670 | a57faaf0 | Christos Stathis | }; |
671 | a57faaf0 | Christos Stathis | LyteBox.prototype.appear = function(id, opacity) { |
672 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById(id).style; |
673 | a57faaf0 | Christos Stathis | object.opacity = (opacity / 100);
|
674 | a57faaf0 | Christos Stathis | object.MozOpacity = (opacity / 100);
|
675 | a57faaf0 | Christos Stathis | object.KhtmlOpacity = (opacity / 100);
|
676 | a57faaf0 | Christos Stathis | object.filter = "alpha(opacity=" + (opacity + 10) + ")"; |
677 | a57faaf0 | Christos Stathis | if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) { |
678 | a57faaf0 | Christos Stathis | try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */ |
679 | a57faaf0 | Christos Stathis | this.updateDetails();
|
680 | a57faaf0 | Christos Stathis | } else if (opacity >= this.maxOpacity && id == 'lbOverlay') { |
681 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); } |
682 | a57faaf0 | Christos Stathis | return;
|
683 | a57faaf0 | Christos Stathis | } else if (opacity >= 100 && id == 'lbDetailsContainer') { |
684 | a57faaf0 | Christos Stathis | try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */ |
685 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); } |
686 | a57faaf0 | Christos Stathis | this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px"; |
687 | a57faaf0 | Christos Stathis | } else {
|
688 | a57faaf0 | Christos Stathis | if (id == 'lbOverlay') { |
689 | a57faaf0 | Christos Stathis | this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1); |
690 | a57faaf0 | Christos Stathis | } else {
|
691 | a57faaf0 | Christos Stathis | this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1); |
692 | a57faaf0 | Christos Stathis | } |
693 | a57faaf0 | Christos Stathis | } |
694 | a57faaf0 | Christos Stathis | }; |
695 | a57faaf0 | Christos Stathis | LyteBox.prototype.fade = function(id, opacity) { |
696 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById(id).style; |
697 | a57faaf0 | Christos Stathis | object.opacity = (opacity / 100);
|
698 | a57faaf0 | Christos Stathis | object.MozOpacity = (opacity / 100);
|
699 | a57faaf0 | Christos Stathis | object.KhtmlOpacity = (opacity / 100);
|
700 | a57faaf0 | Christos Stathis | object.filter = "alpha(opacity=" + opacity + ")"; |
701 | a57faaf0 | Christos Stathis | if (opacity <= 0) { |
702 | a57faaf0 | Christos Stathis | try {
|
703 | a57faaf0 | Christos Stathis | object.display = 'none';
|
704 | a57faaf0 | Christos Stathis | } catch(err) { }
|
705 | a57faaf0 | Christos Stathis | } else if (id == 'lbOverlay') { |
706 | a57faaf0 | Christos Stathis | this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1); |
707 | a57faaf0 | Christos Stathis | } else {
|
708 | a57faaf0 | Christos Stathis | this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1); |
709 | a57faaf0 | Christos Stathis | } |
710 | a57faaf0 | Christos Stathis | }; |
711 | a57faaf0 | Christos Stathis | LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) { |
712 | a57faaf0 | Christos Stathis | if (!this.hDone) { |
713 | a57faaf0 | Christos Stathis | this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100); |
714 | a57faaf0 | Christos Stathis | return;
|
715 | a57faaf0 | Christos Stathis | } |
716 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById(id); |
717 | a57faaf0 | Christos Stathis | var timer = speed ? speed : (this.resizeDuration/2); |
718 | a57faaf0 | Christos Stathis | var newW = (this.doAnimations ? curW : maxW); |
719 | a57faaf0 | Christos Stathis | object.style.width = (newW) + "px";
|
720 | a57faaf0 | Christos Stathis | if (newW < maxW) {
|
721 | a57faaf0 | Christos Stathis | newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate; |
722 | a57faaf0 | Christos Stathis | } else if (newW > maxW) { |
723 | a57faaf0 | Christos Stathis | newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate; |
724 | a57faaf0 | Christos Stathis | } |
725 | a57faaf0 | Christos Stathis | this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02); |
726 | a57faaf0 | Christos Stathis | if (parseInt(object.style.width) == maxW) {
|
727 | a57faaf0 | Christos Stathis | this.wDone = true; |
728 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); } |
729 | a57faaf0 | Christos Stathis | } |
730 | a57faaf0 | Christos Stathis | }; |
731 | a57faaf0 | Christos Stathis | LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) { |
732 | a57faaf0 | Christos Stathis | var timer = speed ? speed : (this.resizeDuration/2); |
733 | a57faaf0 | Christos Stathis | var object = this.doc.getElementById(id); |
734 | a57faaf0 | Christos Stathis | var newH = (this.doAnimations ? curH : maxH); |
735 | a57faaf0 | Christos Stathis | object.style.height = (newH) + "px";
|
736 | a57faaf0 | Christos Stathis | if (newH < maxH) {
|
737 | a57faaf0 | Christos Stathis | newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate; |
738 | a57faaf0 | Christos Stathis | } else if (newH > maxH) { |
739 | a57faaf0 | Christos Stathis | newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate; |
740 | a57faaf0 | Christos Stathis | } |
741 | a57faaf0 | Christos Stathis | this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02); |
742 | a57faaf0 | Christos Stathis | if (parseInt(object.style.height) == maxH) {
|
743 | a57faaf0 | Christos Stathis | this.hDone = true; |
744 | a57faaf0 | Christos Stathis | for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); } |
745 | a57faaf0 | Christos Stathis | } |
746 | a57faaf0 | Christos Stathis | }; |
747 | a57faaf0 | Christos Stathis | LyteBox.prototype.getPageScroll = function() { |
748 | a57faaf0 | Christos Stathis | if (self.pageYOffset) {
|
749 | a57faaf0 | Christos Stathis | return this.isFrame ? parent.pageYOffset : self.pageYOffset; |
750 | a57faaf0 | Christos Stathis | } else if (this.doc.documentElement && this.doc.documentElement.scrollTop){ |
751 | a57faaf0 | Christos Stathis | return this.doc.documentElement.scrollTop; |
752 | a57faaf0 | Christos Stathis | } else if (document.body) { |
753 | a57faaf0 | Christos Stathis | return this.doc.body.scrollTop; |
754 | a57faaf0 | Christos Stathis | } |
755 | a57faaf0 | Christos Stathis | }; |
756 | a57faaf0 | Christos Stathis | LyteBox.prototype.getPageSize = function() { |
757 | a57faaf0 | Christos Stathis | var xScroll, yScroll, windowWidth, windowHeight;
|
758 | a57faaf0 | Christos Stathis | if (window.innerHeight && window.scrollMaxY) {
|
759 | a57faaf0 | Christos Stathis | xScroll = this.doc.scrollWidth;
|
760 | a57faaf0 | Christos Stathis | yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY); |
761 | a57faaf0 | Christos Stathis | } else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){ |
762 | a57faaf0 | Christos Stathis | xScroll = this.doc.body.scrollWidth;
|
763 | a57faaf0 | Christos Stathis | yScroll = this.doc.body.scrollHeight;
|
764 | a57faaf0 | Christos Stathis | } else {
|
765 | a57faaf0 | Christos Stathis | xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth; |
766 | a57faaf0 | Christos Stathis | yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight; |
767 | a57faaf0 | Christos Stathis | xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll; |
768 | a57faaf0 | Christos Stathis | yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll; |
769 | a57faaf0 | Christos Stathis | } |
770 | a57faaf0 | Christos Stathis | if (self.innerHeight) {
|
771 | a57faaf0 | Christos Stathis | windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
|
772 | a57faaf0 | Christos Stathis | windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
|
773 | a57faaf0 | Christos Stathis | } else if (document.documentElement && document.documentElement.clientHeight) { |
774 | a57faaf0 | Christos Stathis | windowWidth = this.doc.documentElement.clientWidth;
|
775 | a57faaf0 | Christos Stathis | windowHeight = this.doc.documentElement.clientHeight;
|
776 | a57faaf0 | Christos Stathis | } else if (document.body) { |
777 | a57faaf0 | Christos Stathis | windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth; |
778 | a57faaf0 | Christos Stathis | windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight; |
779 | a57faaf0 | Christos Stathis | windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth; |
780 | a57faaf0 | Christos Stathis | windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight; |
781 | a57faaf0 | Christos Stathis | } |
782 | a57faaf0 | Christos Stathis | var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
|
783 | a57faaf0 | Christos Stathis | var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
|
784 | a57faaf0 | Christos Stathis | return new Array(pageWidth, pageHeight, windowWidth, windowHeight); |
785 | a57faaf0 | Christos Stathis | }; |
786 | a57faaf0 | Christos Stathis | LyteBox.prototype.toggleFlash = function(state) { |
787 | a57faaf0 | Christos Stathis | var objects = this.doc.getElementsByTagName("object"); |
788 | a57faaf0 | Christos Stathis | for (var i = 0; i < objects.length; i++) { |
789 | a57faaf0 | Christos Stathis | objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible'; |
790 | a57faaf0 | Christos Stathis | } |
791 | a57faaf0 | Christos Stathis | var embeds = this.doc.getElementsByTagName("embed"); |
792 | a57faaf0 | Christos Stathis | for (var i = 0; i < embeds.length; i++) { |
793 | a57faaf0 | Christos Stathis | embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible'; |
794 | a57faaf0 | Christos Stathis | } |
795 | a57faaf0 | Christos Stathis | if (this.isFrame) { |
796 | a57faaf0 | Christos Stathis | for (var i = 0; i < parent.frames.length; i++) { |
797 | a57faaf0 | Christos Stathis | try {
|
798 | a57faaf0 | Christos Stathis | objects = parent.frames[i].window.document.getElementsByTagName("object");
|
799 | a57faaf0 | Christos Stathis | for (var j = 0; j < objects.length; j++) { |
800 | a57faaf0 | Christos Stathis | objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible'; |
801 | a57faaf0 | Christos Stathis | } |
802 | a57faaf0 | Christos Stathis | } catch(e) { }
|
803 | a57faaf0 | Christos Stathis | try {
|
804 | a57faaf0 | Christos Stathis | embeds = parent.frames[i].window.document.getElementsByTagName("embed");
|
805 | a57faaf0 | Christos Stathis | for (var j = 0; j < embeds.length; j++) { |
806 | a57faaf0 | Christos Stathis | embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible'; |
807 | a57faaf0 | Christos Stathis | } |
808 | a57faaf0 | Christos Stathis | } catch(e) { }
|
809 | a57faaf0 | Christos Stathis | } |
810 | a57faaf0 | Christos Stathis | } |
811 | a57faaf0 | Christos Stathis | }; |
812 | a57faaf0 | Christos Stathis | LyteBox.prototype.toggleSelects = function(state) { |
813 | a57faaf0 | Christos Stathis | var selects = this.doc.getElementsByTagName("select"); |
814 | a57faaf0 | Christos Stathis | for (var i = 0; i < selects.length; i++ ) { |
815 | a57faaf0 | Christos Stathis | selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible'; |
816 | a57faaf0 | Christos Stathis | } |
817 | a57faaf0 | Christos Stathis | if (this.isFrame) { |
818 | a57faaf0 | Christos Stathis | for (var i = 0; i < parent.frames.length; i++) { |
819 | a57faaf0 | Christos Stathis | try {
|
820 | a57faaf0 | Christos Stathis | selects = parent.frames[i].window.document.getElementsByTagName("select");
|
821 | a57faaf0 | Christos Stathis | for (var j = 0; j < selects.length; j++) { |
822 | a57faaf0 | Christos Stathis | selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible'; |
823 | a57faaf0 | Christos Stathis | } |
824 | a57faaf0 | Christos Stathis | } catch(e) { }
|
825 | a57faaf0 | Christos Stathis | } |
826 | a57faaf0 | Christos Stathis | } |
827 | a57faaf0 | Christos Stathis | }; |
828 | a57faaf0 | Christos Stathis | LyteBox.prototype.pause = function(numberMillis) { |
829 | a57faaf0 | Christos Stathis | var now = new Date(); |
830 | a57faaf0 | Christos Stathis | var exitTime = now.getTime() + numberMillis;
|
831 | a57faaf0 | Christos Stathis | while (true) { |
832 | a57faaf0 | Christos Stathis | now = new Date();
|
833 | a57faaf0 | Christos Stathis | if (now.getTime() > exitTime) { return; } |
834 | a57faaf0 | Christos Stathis | } |
835 | a57faaf0 | Christos Stathis | }; |
836 | a57faaf0 | Christos Stathis | if (window.addEventListener) {
|
837 | a57faaf0 | Christos Stathis | window.addEventListener("load",initLytebox,false); |
838 | a57faaf0 | Christos Stathis | } else if (window.attachEvent) { |
839 | a57faaf0 | Christos Stathis | window.attachEvent("onload",initLytebox);
|
840 | a57faaf0 | Christos Stathis | } else {
|
841 | a57faaf0 | Christos Stathis | window.onload = function() {initLytebox();} |
842 | a57faaf0 | Christos Stathis | } |
843 | a57faaf0 | Christos Stathis | function initLytebox() { myLytebox = new LyteBox(); } |