Index: trunk/extensions/SemanticForms/libs/floatbox.js |
— | — | @@ -1,1011 +0,0 @@ |
2 | | -/*************************************************************************************************** |
3 | | -* Floatbox v2.39 |
4 | | -* |
5 | | -* Image and IFrame viewer by Byron McGregor |
6 | | -* May 23, 2008 |
7 | | -* Website: http://randomous.com |
8 | | -* License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/) |
9 | | -* Credit: Derived from Lytebox v3.22, the original work of Markus F. Hay |
10 | | -* Website: http://www.dolem.com/lytebox |
11 | | -* Lytebox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar |
12 | | -* Website: http://huddletogether.com/projects/lightbox2/ |
13 | | -****************************************************************************************************/ |
14 | | - |
15 | | -function Floatbox() { |
16 | | -this.defaultOptions = { |
17 | | - |
18 | | -/***** BEGIN OPTIONS CONFIGURATION *****/ |
19 | | -// see docs/options.html for detailed descriptions |
20 | | - |
21 | | -/*** <General Options> ***/ |
22 | | -'theme': 'white' ,// 'black'|'white'|'blue'|'yellow'|'red'|'custom' |
23 | | -'padding': 12 ,// pixels |
24 | | -'panelPadding': 8 ,// pixels |
25 | | -'outerBorder': 4 ,// pixels |
26 | | -'innerBorder': 1 ,// pixels |
27 | | -'autoResize': true ,// true|false |
28 | | -'overlayOpacity': 25 ,// 0-100 |
29 | | -'upperOpacity': 65 ,// 0-100 |
30 | | -'showResize': true ,// true|false |
31 | | -'showCaption': true ,// true|false |
32 | | -'showItemNumber': true ,// true|false |
33 | | -'showClose': true ,// true|false |
34 | | -'hideFlash': true ,// true|false |
35 | | -'disableScroll': false ,// true|false |
36 | | -'enableCookies': false ,// true|false |
37 | | -'url404Image': '/floatbox/images/404.jpg' ,// change this if you install in another location |
38 | | -/*** </General Options> ***/ |
39 | | - |
40 | | -/*** <Navigation Options> ***/ |
41 | | -'navType': 'both' ,// 'upper'|'lower'|'both'|'none' |
42 | | -'upperNavWidth': 42 ,// 0-50 |
43 | | -'upperNavPos': 20 ,// 0-100 |
44 | | -'showUpperNav': 'once' ,// 'always'|'once'|'never' |
45 | | -'showHints': 'once' ,// 'always'|'once'|'never' |
46 | | -'enableKeyboardNav': true ,// true|false |
47 | | -'outsideClickCloses': true ,// true|false |
48 | | -/*** </Navigation Options> ***/ |
49 | | - |
50 | | -/*** <Animation Options> ***/ |
51 | | -'resizeOrder': 'both' ,// 'both'|'width'|'height'|'random' |
52 | | -'resizeDuration': 0 ,// 0-10 |
53 | | -'imageFadeDuration': 0 ,// 0-10 |
54 | | -'overlayFadeDuration': 0 ,// 0-10 |
55 | | -/*** </Animation Options> ***/ |
56 | | - |
57 | | -/*** <Slideshow Options> ***/ |
58 | | -'slideInterval': 4.1 ,// seconds |
59 | | -'endTask': 'exit' ,// 'stop'|'exit'|'loop' |
60 | | -'showPlayPause': true ,// true|false |
61 | | -'startPaused': false ,// true|false |
62 | | -'pauseOnPrev': true ,// true|false |
63 | | -'pauseOnNext': false ,// true|false |
64 | | -/*** </Slideshow Options> ***/ |
65 | | - |
66 | | -/*** <String Localization> ***/ |
67 | | -'strHintClose': 'exit (kbd: esc)' , |
68 | | -'strHintPrev': 'prev (kbd: lt.arrow)' , |
69 | | -'strHintNext': 'next (kbd: rt.arrow)' , |
70 | | -'strHintPlay': 'play (kbd: spacebar)' , |
71 | | -'strHintPause': 'pause (kbd: spacebar)' , |
72 | | -'strHintResize': 'resize (kbd: tab)' , |
73 | | -'strImageCount': 'image %1 of %2' , |
74 | | -'strIframeCount': 'page %1 of %2' |
75 | | -/*** </String Localization> ***/ |
76 | | - |
77 | | -/***** END OPTIONS CONFIGURATION *****/ |
78 | | -}; |
79 | | -this.doc = top.document; |
80 | | -this.body = this.doc.body; |
81 | | -this.arrAnchors = new Array(); |
82 | | -this.arrImageHrefs = new Array(); |
83 | | -this.arrItems = new Array(); |
84 | | -this.arrResize1 = new Array(); |
85 | | -this.arrResize2 = new Array(); |
86 | | -this.objTimeouts = new Object(); |
87 | | -this.objImagePreloads = new Object(); |
88 | | -this.lowerPanelSpace = 24; |
89 | | -this.resizeSpace = 6; |
90 | | -this.initialSize = 300; |
91 | | -var ie = !!document.all && !window.opera; |
92 | | -this.ie6 = ie && /*@cc_on @if(@_jscript_version < 5.7) ! @end @*/ false; |
93 | | -this.ieQuirks = ie && this.doc.compatMode == 'BackCompat'; |
94 | | -this.operaQuirks = !!window.opera && this.doc.compatMode == 'BackCompat'; |
95 | | -this.ff2 = /firefox\/[12]/i.test(navigator.userAgent); |
96 | | -this.ff3 = /firefox\/3/i.test(navigator.userAgent); |
97 | | -this.tagAnchors = function(doc) { |
98 | | - var reIsFbxd = new RegExp('^(gallery|iframe|slideshow|lytebox|lyteshow|lyteframe|lightbox)', 'i'); |
99 | | - var reIsImg = new RegExp('\.(jpg|jpeg|png|gif|bmp)\s*$', 'i'); |
100 | | - var reAuto = new RegExp('autoStart\s*[:=]\s*true', 'i'); |
101 | | - var click = function () { fb.start(this); return false; }; |
102 | | - function tagAnchor(anchor) { |
103 | | - var href = anchor.getAttribute('href') || ''; |
104 | | - var rel = anchor.getAttribute('rel') || ''; |
105 | | - var rev = anchor.getAttribute('rev') || ''; |
106 | | - if (reIsFbxd.test(rel)) { |
107 | | - anchor.onclick = click; |
108 | | - fb.arrAnchors.push(anchor); |
109 | | - if (reIsImg.test(href)) fb.arrImageHrefs.push(href); |
110 | | - if (reAuto.test(rev)) fb.autoStart = anchor; |
111 | | - } |
112 | | - }; |
113 | | - var anchors = doc.getElementsByTagName('a'); |
114 | | - for (var i = 0, len = anchors.length; i < len; i++) { |
115 | | - tagAnchor(anchors[i]); |
116 | | - } |
117 | | - anchors = doc.getElementsByTagName('area'); |
118 | | - for (var i = 0, len = anchors.length; i < len; i++) { |
119 | | - tagAnchor(anchors[i]); |
120 | | - } |
121 | | -}; |
122 | | -this.preloadNextImage = function(href) { |
123 | | - if (!href && !this.blockPreloadChain) { |
124 | | - for (var i = 0, len = this.arrImageHrefs.length; i < len; i++) { |
125 | | - var h = this.arrImageHrefs[i]; |
126 | | - if (!this.objImagePreloads[h]) { |
127 | | - var href = h; |
128 | | - break; |
129 | | - } |
130 | | - } |
131 | | - } |
132 | | - if (href) { |
133 | | - this.objImagePreloads[href] = new Image(); |
134 | | - this.objImagePreloads[href].onload = this.objImagePreloads[href].onerror = |
135 | | - function() { fb.preloadNextImage() }; |
136 | | - this.objImagePreloads[href].src = href; |
137 | | - } |
138 | | -}; |
139 | | -this.setNode = function(nodeType, id, parentNode, title) { |
140 | | - var node = this.doc.getElementById(id); |
141 | | - if (!node) { |
142 | | - node = this.doc.createElement(nodeType); |
143 | | - if (id) node.id = id; |
144 | | - if (nodeType == 'a') node.setAttribute('href', '#'); |
145 | | - if (title && this.showHints != 'never') node.setAttribute('title', title); |
146 | | - if (nodeType == 'iframe') { |
147 | | - node.setAttribute('scrolling', this.itemScrolling); |
148 | | - node.setAttribute('frameBorder', '0'); |
149 | | - node.setAttribute('align', 'middle'); |
150 | | - } |
151 | | - parentNode.appendChild(node); |
152 | | - } |
153 | | - node.className = id + '_' + this.theme; |
154 | | - node.style.display = 'none'; |
155 | | - return node; |
156 | | -}; |
157 | | -this.buildDOM = function() { |
158 | | - this.fbOverlay = this.setNode('div', 'fbOverlay', this.body); |
159 | | - this.fbFloatbox = this.setNode('div', 'fbFloatbox', this.body); |
160 | | - this.fbLoader = this.setNode('div', 'fbLoader', this.fbFloatbox); |
161 | | - this.fbContentPanel = this.setNode('div', 'fbContentPanel', this.fbFloatbox); |
162 | | - if (this.upperNav) { |
163 | | - this.fbLeftNav = this.setNode('a', 'fbLeftNav', this.fbContentPanel); |
164 | | - this.fbRightNav = this.setNode('a', 'fbRightNav', this.fbContentPanel); |
165 | | - this.fbUpperPrev = this.setNode('a', 'fbUpperPrev', this.fbContentPanel, this.strHintPrev); |
166 | | - this.fbUpperNext = this.setNode('a', 'fbUpperNext', this.fbContentPanel, this.strHintNext); |
167 | | - } |
168 | | - this.fbResize = this.setNode('a', 'fbResize', this.fbContentPanel, this.strHintResize); |
169 | | - this.fbInfoPanel = this.setNode('div', 'fbInfoPanel', this.fbContentPanel); |
170 | | - this.fbCaption = this.setNode('span', 'fbCaption', this.fbInfoPanel); |
171 | | - this.fbItemNumber = this.setNode('span', 'fbItemNumber', this.fbInfoPanel); |
172 | | - this.fbControlPanel = this.setNode('div', 'fbControlPanel', this.fbContentPanel); |
173 | | - this.fbLowerNav = this.setNode('div', 'fbLowerNav', this.fbControlPanel); |
174 | | - this.fbLowerPrev = this.setNode('a', 'fbLowerPrev', this.fbLowerNav, this.strHintPrev); |
175 | | - this.fbLowerNext = this.setNode('a', 'fbLowerNext', this.fbLowerNav, this.strHintNext); |
176 | | - this.fbControls = this.setNode('div', 'fbControls', this.fbControlPanel); |
177 | | - this.fbClose = this.setNode('a', 'fbClose', this.fbControls, this.strHintClose); |
178 | | - this.fbPlayPause = this.setNode('div', 'fbPlayPause', this.fbControls); |
179 | | - this.fbPlay = this.setNode('a', 'fbPlay', this.fbPlayPause, this.strHintPlay); |
180 | | - this.fbPause = this.setNode('a', 'fbPause', this.fbPlayPause, this.strHintPause); |
181 | | -}; |
182 | | -this.parseOptionString = function(str) { |
183 | | - if (!str) return {}; |
184 | | - var pairs = new Object(); |
185 | | - str = str.replace(/\s*[:=]\s*/g, ':'); |
186 | | - str = str.replace(/\s*[;&]\s*/g, ' '); |
187 | | - str = str.replace(/^\s+|\s+$/g, ''); |
188 | | - var aVars = str.split(/\s+/); |
189 | | - var i = aVars.length; while (i--) { |
190 | | - var aThisVar = aVars[i].split(':'); |
191 | | - pairs[aThisVar[0]] = aThisVar[1].toLowerCase(); |
192 | | - } |
193 | | - return pairs; |
194 | | -}; |
195 | | -this.setOptions = function(pairs) { |
196 | | - for (var name in pairs) { |
197 | | - var value = pairs[name]; |
198 | | - if (typeof(value) == 'string') { |
199 | | - if (name.indexOf('str') != 0) value = value.toLowerCase(); |
200 | | - if (isNaN(value)) { |
201 | | - if (value == 'true') { |
202 | | - this[name] = true; |
203 | | - } else if (value == 'false') { |
204 | | - this[name] = false; |
205 | | - } else if (value) { |
206 | | - this[name] = value; |
207 | | - } |
208 | | - } else { |
209 | | - this[name] = +value; |
210 | | - } |
211 | | - } else { |
212 | | - this[name] = value; |
213 | | - } |
214 | | - } |
215 | | -}; |
216 | | -this.start = function(anchor) { |
217 | | - this.itemCount = this.arrItems.length = this.itemsShown = this.resizeCounter = 0; |
218 | | - this.currentItem = -1; |
219 | | - var href = anchor.getAttribute('href') || ''; |
220 | | - var rel = anchor.getAttribute('rel') || ''; |
221 | | - var rev = anchor.getAttribute('rev') || ''; |
222 | | - this.isIframe = /^(iframe|lyteframe)/i.test(rel); |
223 | | - if (!this.isIframe) { |
224 | | - this.blockPreloadChain = true; |
225 | | - this.preloadNextImage(href); |
226 | | - } |
227 | | - if (/^(gallery|iframe|lytebox|lyteframe|lightbox)$/i.test(rel)) { |
228 | | - if (href && rev.indexOf('showThis:false') == -1) { |
229 | | - this.arrItems.push( {'href': href, 'title': anchor.getAttribute('title'), 'rev': rev, 'seen': false} ); |
230 | | - } |
231 | | - } else { |
232 | | - for (var i = 0, len = this.arrAnchors.length; i < len; i++) { |
233 | | - var href_i = this.arrAnchors[i].getAttribute('href') || ''; |
234 | | - var rev_i = this.arrAnchors[i].getAttribute('rev') || ''; |
235 | | - if (this.arrAnchors[i].getAttribute('rel') == rel) { |
236 | | - if (href_i && rev_i.indexOf('showThis:false') == -1) { |
237 | | - this.arrItems.push( { |
238 | | - 'href': this.arrAnchors[i].getAttribute('href'), |
239 | | - 'title': this.arrAnchors[i].getAttribute('title') || '', |
240 | | - 'rev': rev_i, 'seen': false |
241 | | - } ); |
242 | | - } |
243 | | - } |
244 | | - } |
245 | | - } |
246 | | - this.itemCount = this.arrItems.length; |
247 | | - this.modal = this.doSlideshow = this.loadPageOnClose = false; |
248 | | - this.setOptions(this.defaultOptions); |
249 | | - if (typeof(top.setFloatboxOptions) == 'function') top.setFloatboxOptions(); |
250 | | - if (this.enableCookies) { |
251 | | - var match = /fbOptions=(.+?)(;|$)/.exec(this.doc.cookie); |
252 | | - if (match) this.setOptions(this.parseOptionString(match[1])); |
253 | | - var strOptions = ''; |
254 | | - for (var name in this.defaultOptions) { |
255 | | - if (name.indexOf('str') != 0) strOptions += ' ' + name + ':' + this[name]; |
256 | | - } |
257 | | - var tlp = top.location.pathname; |
258 | | - this.doc.cookie = 'fbOptions=' + strOptions + '; path=' + tlp.substring(0, tlp.lastIndexOf('/') + 1); |
259 | | - } |
260 | | - this.setOptions(this.parseOptionString(rev)); |
261 | | - this.setOptions(this.parseOptionString(window.location.search.substring(1))); |
262 | | - if (this.endTask == 'cont') this.endTask = 'loop'; |
263 | | - if (this.theme == 'grey') this.theme = 'white'; |
264 | | - if (!/^(black|white|blue|yellow|red|custom)$/.test(this.theme)) this.theme='black'; |
265 | | - this.isSlideshow = this.itemCount > 1 && (/^(slideshow|lyteshow)/i.test(rel) || this.doSlideshow); |
266 | | - this.isPaused = this.startPaused; |
267 | | - if (this.isIframe) { |
268 | | - this.autoResize = this.showResize = false; |
269 | | - if (this.ff2) this.disableScroll = true; |
270 | | - } |
271 | | - if (this.modal && (this.isSlideshow || this.isIframe)) { |
272 | | - this.navType = 'none'; |
273 | | - this.showClose = false; |
274 | | - this.showPlayPause = false; |
275 | | - this.enableKeyboardNav = false; |
276 | | - this.outsideClickCloses = false; |
277 | | - this.showHints = 'never'; |
278 | | - } |
279 | | - if (!/^(upper|lower|both|none)$/i.test(this.navType)) this.navType = 'both'; |
280 | | - if (this.itemCount <= 1) { |
281 | | - this.navType = 'none'; |
282 | | - this.showItemNumber = false; |
283 | | - } else if (this.isIframe && /upper|both/i.test(this.navType)) { |
284 | | - this.navType = 'lower'; |
285 | | - } |
286 | | - this.upperNav = /upper|both/i.test(this.navType); |
287 | | - this.lowerNav = /lower|both/i.test(this.navType); |
288 | | - if (this.upperNav) { |
289 | | - if (this.upperNavWidth < 0) this.upperNavWidth = 0; |
290 | | - if (this.upperNavWidth > 50) this.upperNavWidth = 50; |
291 | | - } |
292 | | - if (this.showHints == 'once') { |
293 | | - this.hideHint = function(id) { |
294 | | - if (this[id].title) this.objTimeouts[id] = setTimeout(function() { fb[id].title = ''; }, 1600); |
295 | | - }; |
296 | | - } else { |
297 | | - this.hideHint = function() { return; }; |
298 | | - } |
299 | | - this.buildDOM(); |
300 | | - this.fbResize.onclick = function() { fb.scaleItem = this.scaleItem; fb.loadItem(fb.currentItem); return false; }; |
301 | | - this.fbPlay.onclick = function() { fb.setPause(false); return false; }; |
302 | | - this.fbPause.onclick = function() { fb.setPause(true); return false; }; |
303 | | - this.fbClose.onclick = function() { fb.end(); return false; }; |
304 | | - if (this.outsideClickCloses) this.fbOverlay.onclick = function() { fb.end(); return false; }; |
305 | | - this.fbLowerPrev.onclick = function() { |
306 | | - fb.loadItem((fb.currentItem == 0)? fb.itemCount - 1 : fb.currentItem - 1); |
307 | | - if (fb.isSlideshow && fb.pauseOnPrev && !fb.isPaused && fb.showPlayPause) { |
308 | | - fb.setPause(true); |
309 | | - } |
310 | | - return false; |
311 | | - }; |
312 | | - this.fbLowerNext.onclick = function() { |
313 | | - fb.loadItem((fb.currentItem == fb.itemCount - 1)? 0 : fb.currentItem + 1); |
314 | | - if (fb.isSlideshow && fb.pauseOnNext && !fb.isPaused && fb.showPlayPause) { |
315 | | - fb.setPause(true); |
316 | | - } |
317 | | - return false; |
318 | | - }; |
319 | | - if (this.upperNav) { |
320 | | - this.fbLeftNav.onclick = this.fbUpperPrev.onclick = this.fbLowerPrev.onclick; |
321 | | - this.fbRightNav.onclick = this.fbUpperNext.onclick = this.fbLowerNext.onclick; |
322 | | - this.fbLeftNav.onmouseover = this.fbLeftNav.onmousemove = |
323 | | - this.fbUpperPrev.onmousemove = function() { |
324 | | - if (!fb.objTimeouts.fbContentPanel) fb.fbUpperPrev.style.visibility = 'visible'; |
325 | | - if (fb.lowerNav && !fb.showUpperNav) fb.fbLowerPrev.style.backgroundPosition = 'bottom'; |
326 | | - return true; |
327 | | - }; |
328 | | - this.fbRightNav.onmouseover = this.fbRightNav.onmousemove = |
329 | | - this.fbUpperNext.onmousemove = function() { |
330 | | - if (!fb.objTimeouts.fbContentPanel) fb.fbUpperNext.style.visibility = 'visible'; |
331 | | - if (fb.lowerNav && !fb.showUpperNav) fb.fbLowerNext.style.backgroundPosition = 'bottom'; |
332 | | - return true; |
333 | | - }; |
334 | | - this.fbUpperPrev.onmouseover = this.fbUpperNext.onmouseover = function() { |
335 | | - this.onmousemove(); |
336 | | - fb.hideHint(this.id); |
337 | | - return true; |
338 | | - }; |
339 | | - this.fbLeftNav.onmouseout = function() { |
340 | | - fb.fbUpperPrev.style.visibility = 'hidden'; |
341 | | - if (fb.lowerNav) fb.fbLowerPrev.style.backgroundPosition = 'top'; |
342 | | - }; |
343 | | - this.fbRightNav.onmouseout = function() { |
344 | | - fb.fbUpperNext.style.visibility = 'hidden'; |
345 | | - if (fb.lowerNav) fb.fbLowerNext.style.backgroundPosition = 'top'; |
346 | | - }; |
347 | | - this.fbUpperPrev.onmouseout = this.fbUpperNext.onmouseout = function() { |
348 | | - this.style.visibility = 'hidden'; |
349 | | - fb.clearTimeout(this.id); |
350 | | - }; |
351 | | - this.fbLeftNav.onmouseup = this.fbRightNav.onmouseup = function(evt) { |
352 | | - var e = evt || window.event; |
353 | | - if (e.button == 2) { |
354 | | - fb.fbLeftNav.style.display = fb.fbRightNav.style.display = 'none'; |
355 | | - setTimeout(function() { fb.fbLeftNav.style.display = fb.fbRightNav.style.display = ''; }, 10); |
356 | | - } |
357 | | - }; |
358 | | - } |
359 | | -/* |
360 | | - this.fbPlay.onmouseover = this.fbPause.onmouseover = |
361 | | - this.fbClose.onmouseover = this.fbLowerPrev.onmouseover = |
362 | | - this.fbLowerNext.onmouseover = this.fbResize.onmouseover = function() { |
363 | | - if (this.id != 'fbResize') this.style.backgroundPosition = 'bottom'; |
364 | | - fb.hideHint(this.id); |
365 | | - return true; |
366 | | - }; |
367 | | - this.fbPlay.onmouseout = this.fbPause.onmouseout = |
368 | | - this.fbClose.onmouseout = this.fbLowerPrev.onmouseout = |
369 | | - this.fbLowerNext.onmouseout = this.fbResize.onmouseout = function() { |
370 | | - if (this.id != 'fbResize') this.style.backgroundPosition = 'top'; |
371 | | - fb.clearTimeout(this.id); |
372 | | - }; |
373 | | -*/ |
374 | | - if (this.enableKeyboardNav) { |
375 | | - this.priorOnkeydown = document.onkeydown; |
376 | | - document.onkeydown = this.keyboardAction; |
377 | | - } |
378 | | - if (window.opera) { |
379 | | - this.priorOnkeypress = document.onkeypress; |
380 | | - document.onkeypress = function() { return false; }; |
381 | | - } |
382 | | - if (this.ie6 || this.ieQuirks) { |
383 | | - this.setVisibility('select', 'hidden'); |
384 | | - this.fbOverlay.style.position = 'absolute'; |
385 | | - top.attachEvent('onresize', fb.stretchOverlay); |
386 | | - top.attachEvent('onscroll', fb.stretchOverlay); |
387 | | - } |
388 | | - if (this.ie6 && this.isIframe) this.innerBorder = 0; |
389 | | - if (this.hideFlash) { |
390 | | - this.setVisibility('object', 'hidden'); |
391 | | - this.setVisibility('embed', 'hidden'); |
392 | | - } |
393 | | - var callback = function() { |
394 | | - setTimeout(function() { fb.turnOn(href); }, 20); |
395 | | - }; |
396 | | - this.fade(this.fbOverlay, 10, this.overlayOpacity, callback); |
397 | | -}; |
398 | | -this.turnOn = function(href) { |
399 | | - this.fbFloatbox.style.position = 'absolute'; |
400 | | - this.fbFloatbox.style.width = this.fbFloatbox.style.height = this.fbFloatbox.style.borderWidth = '0'; |
401 | | - this.fbFloatbox.style.left = (this.getDisplayWidth() / 2 + this.getXScroll()) + 'px'; |
402 | | - this.fbFloatbox.style.top = (this.getDisplayHeight() / 3 + this.getYScroll()) + 'px'; |
403 | | - this.fbFloatbox.style.display = this.fbContentPanel.style.display = this.fbLoader.style.display = ''; |
404 | | - if (this.upperNav) { |
405 | | - this.fbLeftNav.style.display = this.fbRightNav.style.display = ''; |
406 | | - this.fbLeftNav.style.top = this.fbRightNav.style.top = |
407 | | - this.fbLeftNav.style.left = this.fbRightNav.style.right = |
408 | | - this.fbUpperPrev.style.left = this.fbUpperNext.style.right = |
409 | | - (this.padding + this.innerBorder) + 'px'; |
410 | | - if (this.showUpperNav == 'never' || (this.showUpperNav == 'once' && this.upperNavShown)) { |
411 | | - this.showUpperNav = false; |
412 | | - } else { |
413 | | - this.fade(this.fbUpperPrev, this.upperOpacity); |
414 | | - this.fade(this.fbUpperNext, this.upperOpacity); |
415 | | - } |
416 | | - } |
417 | | - if (this.lowerNav) { |
418 | | - this.fbLowerNav.style.display = this.fbLowerPrev.style.display = this.fbLowerNext.style.display = ''; |
419 | | - } |
420 | | - this.fbResize.style.left = this.fbResize.style.top = (this.padding + this.innerBorder) + 'px'; |
421 | | - if (!this.isSlideshow) this.showPlayPause = false; |
422 | | - if (this.showClose || this.showPlayPause || this.lowerNav) { |
423 | | - this.fbControlPanel.style.display = ''; |
424 | | - this.fbControlPanel.style.right = Math.max(this.padding, 8) + 'px'; |
425 | | - } |
426 | | - var controlsWidth = 0; |
427 | | - if (this.showClose) { |
428 | | - this.fbControls.style.display = ''; |
429 | | - this.fbClose.style.display = ''; |
430 | | - controlsWidth = this.fbClose.offsetWidth; |
431 | | - } |
432 | | - if (this.showPlayPause) { |
433 | | - this.fbControls.style.display = ''; |
434 | | - this.fbPlayPause.style.display = ''; |
435 | | - this[this.isPaused? 'fbPause' : 'fbPlay'].style.display = ''; |
436 | | - controlsWidth += this.fbPlayPause.offsetWidth; |
437 | | - } |
438 | | - this.fbControls.style.width = controlsWidth + 'px'; |
439 | | - this.fbControlPanel.style.width = (this.fbLowerNav.offsetWidth + this.fbControls.offsetWidth) + 'px'; |
440 | | - this.xFramework = 2*(this.outerBorder + this.innerBorder + this.padding); |
441 | | - this.yFramework = this.xFramework - this.padding; |
442 | | - for (i = this.itemCount - 1; i > 0; i--) if (this.arrItems[i].href == href) break; |
443 | | - this.loadItem(i); |
444 | | -}; |
445 | | -this.loadItem = function(newItem) { |
446 | | - this.clearTimeout('slideshow'); |
447 | | - this.clearTimeout('resizeGroup'); |
448 | | - this.blockPreloadChain = true; |
449 | | - self.focus(); |
450 | | - this.isFirstItem = (this.currentItem == -1); |
451 | | - if (this.currentItem != newItem) { |
452 | | - this.resizeActive = false; |
453 | | - if (this.showUpperNav == 'once' && this.upperNavShown) this.showUpperNav = false; |
454 | | - this.currentItem = newItem; |
455 | | - } |
456 | | - this.currentHref = this.arrItems[this.currentItem].href; |
457 | | - if (this.displayWidth != (this.displayWidth = this.getDisplayWidth())) this.resizeActive = false; |
458 | | - if (this.displayHeight != (this.displayHeight = this.getDisplayHeight())) this.resizeActive = false; |
459 | | - this.fbContentPanel.style.visibility = 'hidden'; |
460 | | - this.fbResize.style.display = 'none'; |
461 | | - if (this.fbItem) { |
462 | | - this.fbContentPanel.removeChild(this.fbItem); |
463 | | - delete this.fbItem; |
464 | | - }; |
465 | | - if (this.upperNav) { |
466 | | - this.fbUpperPrev.style.visibility = this.fbUpperNext.style.visibility = 'hidden'; |
467 | | - this.fbLeftNav.style.height = this.fbRightNav.style.height = '0'; |
468 | | - if (!this.showUpperNav) this.fbUpperPrev.style.display = this.fbUpperNext.style.display = 'none'; |
469 | | - } |
470 | | - if (this.fbFloatbox.style.position == 'fixed') { |
471 | | - this.fbFloatbox.style.left = (this.fbFloatbox.offsetLeft + this.getXScroll()) + 'px'; |
472 | | - this.fbFloatbox.style.top = (this.fbFloatbox.offsetTop + this.getYScroll()) + 'px'; |
473 | | - this.fbFloatbox.style.position = 'absolute'; |
474 | | - } |
475 | | - this.fbCaption.style.display = this.fbItemNumber.style.display = 'none'; |
476 | | - if (this.showCaption) { |
477 | | - var sCaption = this.arrItems[this.currentItem].title || ''; |
478 | | - if (sCaption == 'href') sCaption = this.currentHref; |
479 | | - this.fbCaption.innerHTML = sCaption; |
480 | | - if (sCaption) this.fbCaption.style.display = ''; |
481 | | - } |
482 | | - if (this.showItemNumber) { |
483 | | - var sCount = this.isIframe? this.strIframeCount : this.strImageCount; |
484 | | - sCount = sCount.replace('%1', this.currentItem + 1); |
485 | | - sCount = sCount.replace('%2', this.itemCount); |
486 | | - this.fbItemNumber.innerHTML = sCount; |
487 | | - if (sCount) this.fbItemNumber.style.display = ''; |
488 | | - } |
489 | | - if (this.isFirstItem) { |
490 | | - this.objTimeouts.firstLoad = setTimeout(function() { |
491 | | - fb.fbFloatbox.style.left = (fb.fbFloatbox.offsetLeft - fb.initialSize/2) + 'px'; |
492 | | - fb.fbFloatbox.style.top = (fb.fbFloatbox.offsetTop - fb.initialSize/3) + 'px'; |
493 | | - fb.fbFloatbox.style.width = fb.fbFloatbox.style.height = fb.initialSize + 'px'; |
494 | | - fb.fbFloatbox.style.borderWidth = fb.outerBorder + 'px'; |
495 | | - }, 500); |
496 | | - } else { |
497 | | - this.objTimeouts.loader = setTimeout(function() { fb.fbLoader.style.display = ''; }, 120); |
498 | | - } |
499 | | - if (this.isIframe) { |
500 | | - setTimeout(function() { fb.setSize(); }, 20); |
501 | | - } else { |
502 | | - var loader = new Image(); |
503 | | - loader.onload = function() { fb.setSize(this.width, this.height); }; |
504 | | - loader.onerror = function() { |
505 | | - fb.fbCaption.innerHTML = fb.currentHref.substring(fb.currentHref.lastIndexOf('/') + 1); |
506 | | - fb.fbCaption.style.display = ''; |
507 | | - if (fb.currentHref != fb.url404Image) { |
508 | | - this.src = fb.currentHref = fb.url404Image; |
509 | | - } else { |
510 | | - fb.setSize(); |
511 | | - } |
512 | | - }; |
513 | | - loader.src = this.currentHref; |
514 | | - } |
515 | | -}; |
516 | | -this.setSize = function(imageWidth, imageHeight) { |
517 | | - this.clearTimeout('firstLoad'); |
518 | | - if (typeof(this.panelHeight) == 'undefined') { |
519 | | - if (!this.fbCaption.style.display || !this.fbItemNumber.style.display || !this.fbControlPanel.style.display || this.lowerNav) { |
520 | | - this.panelHeight = 15 + 2*this.panelPadding; |
521 | | - if (!this.fbCaption.style.display && this.showItemNumber) this.panelHeight += 15; |
522 | | - } else { |
523 | | - this.panelHeight = this.padding; |
524 | | - } |
525 | | - } |
526 | | - var maxWidth = this.displayWidth - this.xFramework - 2*this.resizeSpace; |
527 | | - var maxHeight = this.displayHeight - this.yFramework - this.panelHeight - 2*this.resizeSpace; |
528 | | - var width = 0, height = 0; |
529 | | - this.itemScrolling = 'auto'; |
530 | | - var options = this.parseOptionString(this.arrItems[this.currentItem].rev); |
531 | | - if (options.width) width = (options.width == 'max')? maxWidth : parseInt(options.width); |
532 | | - if (options.height) height = (options.height == 'max')? maxHeight : parseInt(options.height); |
533 | | - if (options.scrolling) { |
534 | | - if (this.isIframe && /yes|no/i.test(options.scrolling)) this.itemScrolling = options.scrolling; |
535 | | - } |
536 | | - width = width || imageWidth || 500; |
537 | | - height = height || imageHeight || 300; |
538 | | - this.nativeWidth = width; |
539 | | - this.nativeHeight = height; |
540 | | - if (typeof(this.scaleItem) == 'undefined') this.scaleItem = this.autoResize; |
541 | | - if (this.scaleItem) { |
542 | | - var scale = Math.min(maxWidth / width, maxHeight / height); |
543 | | - if (scale < 1) { |
544 | | - width = Math.round(width * scale); |
545 | | - height = Math.round(height * scale); |
546 | | - } |
547 | | - } |
548 | | - if (this.isFirstItem) this.fbFloatbox.style.borderWidth = this.outerBorder + 'px'; |
549 | | - if (this.upperNav && this.showUpperNav) { |
550 | | - this.fbUpperPrev.style.top = this.fbUpperNext.style.top = |
551 | | - (height * this.upperNavPos/100 + this.padding + this.innerBorder) + 'px'; |
552 | | - } |
553 | | - this.newWidth = width + this.xFramework; |
554 | | - this.infoPanelHeight = 0; |
555 | | - this.fbInfoPanel.style.display = this.fbControlPanel.style.display = ''; |
556 | | - if (!this.fbCaption.style.display || !this.fbItemNumber.style.display) { |
557 | | - var ipWidth = this.newWidth - 2*(this.outerBorder + Math.max(this.padding, 8)) - this.lowerPanelSpace - this.fbControlPanel.offsetWidth; |
558 | | - if (ipWidth > 80) { |
559 | | - this.fbInfoPanel.style.width = ipWidth + 'px'; |
560 | | - this.fbInfoPanel.style.left = '-9999px'; |
561 | | - this.infoPanelHeight = this.fbInfoPanel.offsetHeight; |
562 | | - } |
563 | | - } |
564 | | - this.panelHeight = Math.max(this.infoPanelHeight, this.fbControlPanel.offsetHeight); |
565 | | - this.fbInfoPanel.style.display = this.fbControlPanel.style.display = 'none'; |
566 | | - if (this.panelHeight) this.panelHeight += 2*this.panelPadding; |
567 | | - this.panelHeight = Math.max(this.panelHeight, this.padding); |
568 | | - this.newHeight = this.yFramework + height + this.panelHeight; |
569 | | - if ((this.scaleItem || height == maxHeight) && this.newHeight > this.displayHeight) { |
570 | | - if (this.resizeCounter++ < 3) { |
571 | | - return this.loadItem(this.currentItem); |
572 | | - } |
573 | | - } |
574 | | - var freeSpace = this.displayWidth - this.newWidth; |
575 | | - var newLeft = (freeSpace <= 0)? 0 : Math.floor(freeSpace/2); |
576 | | - var freeSpace = this.displayHeight - this.newHeight; |
577 | | - var ratio = freeSpace / this.displayHeight; |
578 | | - if (ratio <= .15) { |
579 | | - var factor = 2; |
580 | | - } else if (ratio >= .3) { |
581 | | - var factor = 3; |
582 | | - } else { |
583 | | - var factor = 2 + (ratio - .15)/.15; |
584 | | - } |
585 | | - var newTop = (freeSpace <= 0)? 0 : Math.floor(freeSpace/factor); |
586 | | - if (this.getXScroll() || this.getYScroll()) { |
587 | | - this.fbFloatbox.style.display = 'none'; |
588 | | - if (this.ie6 || this.ieQuirks) this.stretchOverlay(); |
589 | | - newLeft += this.getXScroll(); |
590 | | - newTop += this.getYScroll(); |
591 | | - this.fbFloatbox.style.display = ''; |
592 | | - } |
593 | | - this.itemWidth = width; |
594 | | - this.itemHeight = height; |
595 | | - var oldLeft = this.fbFloatbox.offsetLeft, oldTop = this.fbFloatbox.offsetTop; |
596 | | - var oldWidth = this.fbFloatbox.offsetWidth, oldHeight = this.fbFloatbox.offsetHeight; |
597 | | - this.arrResize1.length = this.arrResize2.length = 0; |
598 | | - if (oldLeft != newLeft) |
599 | | - var resizeL = [this.fbFloatbox, 'left', oldLeft, newLeft]; |
600 | | - if (oldTop != newTop) |
601 | | - var resizeT = [this.fbFloatbox, 'top', oldTop, newTop]; |
602 | | - var borderAdjust = this.ieQuirks? 0 : 2*this.outerBorder; |
603 | | - if (oldWidth != this.newWidth) |
604 | | - var resizeW = [this.fbFloatbox, 'width', oldWidth - borderAdjust, this.newWidth - borderAdjust]; |
605 | | - if (oldHeight != this.newHeight) |
606 | | - var resizeH = [this.fbFloatbox, 'height', oldHeight - borderAdjust, this.newHeight - borderAdjust]; |
607 | | - switch ((this.resizeOrder == 'random')? Math.floor(Math.random()*3) : this.resizeOrder) { |
608 | | - case 'width': case 1: |
609 | | - if (resizeL) this.arrResize1.push(resizeL); |
610 | | - if (resizeW) this.arrResize1.push(resizeW); |
611 | | - if (resizeT) this.arrResize2.push(resizeT); |
612 | | - if (resizeH) this.arrResize2.push(resizeH); |
613 | | - break; |
614 | | - case 'height': case 2: |
615 | | - if (resizeL) this.arrResize2.push(resizeL); |
616 | | - if (resizeW) this.arrResize2.push(resizeW); |
617 | | - if (resizeT) this.arrResize1.push(resizeT); |
618 | | - if (resizeH) this.arrResize1.push(resizeH); |
619 | | - break; |
620 | | - default: |
621 | | - if (resizeL) this.arrResize1.push(resizeL); |
622 | | - if (resizeW) this.arrResize1.push(resizeW); |
623 | | - if (resizeT) this.arrResize1.push(resizeT); |
624 | | - if (resizeH) this.arrResize1.push(resizeH); |
625 | | - } |
626 | | - this.fbInfoPanel.style.left = Math.max(this.padding, 8) + 'px'; |
627 | | - this.resizeGroup(this.arrResize1, function() { |
628 | | - fb.resizeGroup(fb.arrResize2, function() { fb.showContent(); }) |
629 | | - }); |
630 | | -}; |
631 | | -this.showContent = function() { |
632 | | - this.clearTimeout('loader'); |
633 | | - var vscrollChanged = (this.displayWidth != (this.displayWidth = this.getDisplayWidth())); |
634 | | - var hscrollChanged = (this.displayHeight != (this.displayHeight = this.getDisplayHeight())); |
635 | | - if (this.resizeCounter++ < 4) { |
636 | | - var tolerance = 25 + 2*this.resizeSpace; |
637 | | - if ((vscrollChanged && Math.abs(this.newWidth - this.displayWidth) < tolerance) |
638 | | - || (hscrollChanged && Math.abs(this.newHeight - this.displayHeight) < tolerance)) |
639 | | - return this.loadItem(this.currentItem); |
640 | | - } |
641 | | - this.resizeCounter = 0; |
642 | | - if (this.ie6 || this.ieQuirks) this.stretchOverlay(); |
643 | | - if (this.disableScroll && !(this.ie6 || this.ieQuirks || this.operaQuirks)) { |
644 | | - if (this.newWidth <= this.displayWidth && this.newHeight <= this.displayHeight) { |
645 | | - this.fbFloatbox.style.position = 'fixed'; |
646 | | - this.fbFloatbox.style.left = (this.fbFloatbox.offsetLeft - this.getXScroll()) + 'px'; |
647 | | - this.fbFloatbox.style.top = (this.fbFloatbox.offsetTop - this.getYScroll()) + 'px'; |
648 | | - } |
649 | | - } |
650 | | - this.fbItem = this.setNode((this.isIframe? 'iframe' : 'img'), 'fbItem', this.fbContentPanel); |
651 | | - this.fbItem.width = this.itemWidth; |
652 | | - this.fbItem.height = this.itemHeight; |
653 | | - this.fbItem.src = this.currentHref; |
654 | | - this.fbItem.style.left = this.fbItem.style.top = this.padding + 'px'; |
655 | | - this.fbItem.style.borderWidth = this.innerBorder + 'px'; |
656 | | - if (this.upperNav) { |
657 | | - this.fbLeftNav.style.width = this.fbRightNav.style.width = Math.max(this.upperNavWidth/100 * this.itemWidth, this.fbUpperPrev.offsetWidth) + 'px'; |
658 | | - this.fbLeftNav.style.height = this.fbRightNav.style.height = this.itemHeight + 'px'; |
659 | | - } |
660 | | - var panelTop = this.itemHeight + 2*this.innerBorder + this.padding; |
661 | | - if (this.infoPanelHeight) { |
662 | | - this.fbInfoPanel.style.display = ''; |
663 | | - this.fbInfoPanel.style.top = (panelTop + (this.panelHeight - this.fbInfoPanel.offsetHeight) / 2) + 'px'; |
664 | | - } |
665 | | - if (this.showClose || this.showPlayPause || this.lowerNav) { |
666 | | - this.fbControlPanel.style.display = ''; |
667 | | - this.fbControlPanel.style.top = (panelTop + (this.panelHeight - this.fbControlPanel.offsetHeight) / 2) + 'px'; |
668 | | - } |
669 | | - if (this.isFirstItem && this.showPlayPause) { |
670 | | - this.fbPlay.style.display = this.isPaused? '' : 'none'; |
671 | | - this.fbPause.style.display = this.isPaused? 'none' : ''; |
672 | | - } |
673 | | - delete this.panelHeight; |
674 | | - delete this.scaleItem; |
675 | | - if (this.showResize) { |
676 | | - if (this.resizeActive) { |
677 | | - this.fbResize.scaleItem = !this.fbResize.scaleItem; |
678 | | - } else { |
679 | | - var xtra = this.outerBorder; |
680 | | - if (this.newWidth - xtra - this.padding > this.displayWidth |
681 | | - || this.newHeight - xtra - this.panelPadding > this.displayHeight) { |
682 | | - this.fbResize.scaleItem = true; |
683 | | - this.resizeActive = true; |
684 | | - } else { |
685 | | - xtra += this.resizeSpace; |
686 | | - if (this.itemWidth < this.nativeWidth - xtra - this.padding |
687 | | - || this.itemHeight < this.nativeHeight - xtra - this.panelPadding) { |
688 | | - this.fbResize.scaleItem = false; |
689 | | - this.resizeActive = true; |
690 | | - } |
691 | | - } |
692 | | - } |
693 | | - if (this.resizeActive) { |
694 | | - this.fbResize.style.backgroundPosition = this.fbResize.scaleItem? 'bottom' : 'top'; |
695 | | - this.fade(this.fbResize, this.upperOpacity); |
696 | | - } |
697 | | - } |
698 | | - this.fade(this.fbContentPanel, 10, 100); |
699 | | - this.fbLoader.style.display = 'none'; |
700 | | - this.fbItem.style.display = ''; |
701 | | - if (window.opera && this.isIframe) { |
702 | | - var src = this.fbItem.src; |
703 | | - this.fbItem.src = ''; |
704 | | - setTimeout(function() { fb.fbItem.src = src; }, 10); |
705 | | - } |
706 | | - if (!this.arrItems[this.currentItem].seen) { |
707 | | - this.arrItems[this.currentItem].seen = true; |
708 | | - this.itemsShown++; |
709 | | - } |
710 | | - this.nextItem = (this.currentItem < this.itemCount - 1)? this.currentItem + 1 : 0; |
711 | | - this.prevItem = this.currentItem? this.currentItem - 1 : this.itemCount - 1; |
712 | | - if (this.lowerNav) { |
713 | | - if (window.opera || this.ff3) { |
714 | | - this.fbLowerPrev.href = this.fbLowerNext.href = this.currentHref; |
715 | | - } else { |
716 | | - this.fbLowerPrev.href = this.arrItems[this.prevItem].href; |
717 | | - this.fbLowerNext.href = this.arrItems[this.nextItem].href; |
718 | | - } |
719 | | - } |
720 | | - if (this.upperNav) { |
721 | | - if (window.opera || this.ff3) { |
722 | | - this.fbLeftNav.href = this.fbUpperPrev.href = |
723 | | - this.fbRightNav.href = this.fbUpperNext.href = this.currentHref; |
724 | | - } else { |
725 | | - this.fbLeftNav.href = this.fbUpperPrev.href = this.arrItems[this.prevItem].href; |
726 | | - this.fbRightNav.href = this.fbUpperNext.href = this.arrItems[this.nextItem].href; |
727 | | - } |
728 | | - this.upperNavShown = true; |
729 | | - } |
730 | | - this.blockPreloadChain = false; |
731 | | - this.preloadNextImage(this.isIframe? '' : this.arrItems[this.nextItem].href); |
732 | | - if (this.isSlideshow && !this.isPaused) { |
733 | | - if (this.endTask == 'loop' || this.itemsShown < this.itemCount) { |
734 | | - this.objTimeouts.slideshow = setTimeout(function() { fb.loadItem(fb.nextItem); }, this.slideInterval*1000); |
735 | | - } else if (this.endTask == 'exit') { |
736 | | - this.objTimeouts.slideshow = setTimeout(function() { fb.end(); }, this.slideInterval*1000); |
737 | | - } else { |
738 | | - this.objTimeouts.slideshow = setTimeout(function() { fb.setPause(true); }, this.slideInterval*1000); |
739 | | - var i = this.itemCount; |
740 | | - while (i--) this.arrItems[i].seen = false; |
741 | | - this.itemsShown = 0; |
742 | | - } |
743 | | - } |
744 | | -}; |
745 | | -this.end = function() { |
746 | | - for (var key in this.objTimeouts) { |
747 | | - this.clearTimeout(key); |
748 | | - } |
749 | | - if (this.enableKeyboardNav) { |
750 | | - document.onkeydown = this.priorOnkeydown; |
751 | | - } |
752 | | - if (window.opera) document.onkeypress = this.priorOnkeypress; |
753 | | - this.fbOverlay.onclick = null; |
754 | | - this.fbFloatbox.style.display = 'none'; |
755 | | - if (this.ie6 || this.ieQuirks) { |
756 | | - top.detachEvent('onresize', fb.stretchOverlay); |
757 | | - top.detachEvent('onscroll', fb.stretchOverlay); |
758 | | - } |
759 | | - var callBack = function() { |
760 | | - fb.fbOverlay.style.display = 'none'; |
761 | | - if (fb.hideFlash) { |
762 | | - fb.setVisibility('object', ''); |
763 | | - fb.setVisibility('embed', ''); |
764 | | - } |
765 | | - if (fb.ie6 || fb.ieQuirks) fb.setVisibility('select', ''); |
766 | | - }; |
767 | | - this.fade(this.fbOverlay, this.overlayOpacity, 0, callBack); |
768 | | - function remove(el) { el.parentNode.removeChild(el); }; |
769 | | - if (this.upperNav) { |
770 | | - remove(this.fbUpperPrev); delete this.fbUpperPrev; |
771 | | - remove(this.fbUpperNext); delete this.fbUpperPrev; |
772 | | - remove(this.fbLeftNav); delete this.fbLeftNav; |
773 | | - remove(this.fbRightNav); delete this.fbRightNav; |
774 | | - } |
775 | | - if (this.fbItem) { remove(this.fbItem); delete this.fbItem; } |
776 | | - remove(this.fbCaption); delete this.fbCaption; |
777 | | - remove(this.fbItemNumber); delete this.fbItemNumber; |
778 | | - remove(this.fbInfoPanel); delete this.fbInfoPanel; |
779 | | - if (this.loadPageOnClose) { |
780 | | - if (this.loadPageOnClose == 'this') { |
781 | | - location.reload(true); |
782 | | - } else if (this.loadPageOnClose == 'back') { |
783 | | - history.back(); |
784 | | - } else { |
785 | | - location.replace(this.loadPageOnClose); |
786 | | - } |
787 | | - } |
788 | | -}; |
789 | | -this.keyboardAction = function(evt) { |
790 | | - var e = evt || window.event; |
791 | | - var keyCode = e.which || e.keyCode; |
792 | | - switch (keyCode) { |
793 | | - case 37: case 39: |
794 | | - if (fb.itemCount > 1) { |
795 | | - (keyCode == 37)? fb.fbLowerPrev.onclick() : fb.fbLowerNext.onclick(); |
796 | | - if (fb.showHints == 'once') { |
797 | | - fb.fbLowerPrev.title = fb.fbLowerNext.title = ''; |
798 | | - if (fb.upperNav) fb.fbUpperPrev.title = fb.fbUpperNext.title = ''; |
799 | | - } |
800 | | - } |
801 | | - return false; |
802 | | - case 32: |
803 | | - if (fb.isSlideshow) { |
804 | | - fb.setPause(!fb.isPaused); |
805 | | - if (fb.showHints == 'once') fb.fbPlay.title = fb.fbPause.title = ''; |
806 | | - } |
807 | | - return false; |
808 | | - case 9: |
809 | | - if (fb.resizeActive) { |
810 | | - fb.fbResize.onclick(); |
811 | | - if (fb.showHints == 'once') fb.fbResize.title = ''; |
812 | | - } |
813 | | - return false; |
814 | | - case 27: |
815 | | - if (fb.showHints == 'once') fb.fbClose.title = ''; |
816 | | - fb.end(); |
817 | | - return false; |
818 | | - case 13: |
819 | | - return false; |
820 | | - } |
821 | | -}; |
822 | | -this.setPause = function(bPause) { |
823 | | - this.isPaused = bPause; |
824 | | - if (bPause) { |
825 | | - this.clearTimeout('slideshow'); |
826 | | - } else { |
827 | | - this.loadItem(this.nextItem); |
828 | | - } |
829 | | - if (this.showPlayPause) { |
830 | | - this.fbPlay.style.display = bPause? '' : 'none'; |
831 | | - this.fbPause.style.display = bPause? 'none' : ''; |
832 | | - } |
833 | | -}; |
834 | | -this.fade = function(obj, startOp, finishOp, funcOnComplete) { |
835 | | - if (!funcOnComplete) var funcOnComplete = function() { return; }; |
836 | | - this.clearTimeout(obj.id); |
837 | | - if (typeof(finishOp) == 'undefined') finishOp = startOp; |
838 | | - var fadeIn = (startOp <= finishOp && finishOp > 0); |
839 | | - var duration = (obj.id == 'fbOverlay')? this.overlayFadeDuration : this.imageFadeDuration; |
840 | | - if (duration > 10) duration = 10; |
841 | | - if (duration < 0) duration = 0; |
842 | | - if (duration == 0) { |
843 | | - startOp = finishOp; |
844 | | - var incr = 100; |
845 | | - } else { |
846 | | - var root = Math.pow(100, .1); |
847 | | - var power = duration + ((10 - duration)/9) * (Math.log(2)/Math.log(root) - 1); |
848 | | - var incr = Math.round(100/Math.pow(root, power)); |
849 | | - } |
850 | | - if (!fadeIn) incr = -incr; |
851 | | - this.setOpacity(obj, startOp, finishOp, incr, fadeIn, funcOnComplete); |
852 | | - if (fadeIn) { |
853 | | - obj.style.display = ''; |
854 | | - obj.style.visibility = 'visible'; |
855 | | - } |
856 | | -}; |
857 | | -this.setOpacity = function(obj, thisOp, finishOp, incr, fadeIn, funcOnComplete) { |
858 | | - if (funcOnComplete) arguments.callee.oncomplete = funcOnComplete; |
859 | | - if ((fadeIn && thisOp >= finishOp) || (!fadeIn && thisOp <= finishOp)) thisOp = finishOp; |
860 | | - obj.style.opacity = obj.style.MozOpacity = obj.style.KhtmlOpacity = thisOp/100; |
861 | | - obj.style.filter = 'alpha(opacity=' + thisOp + ')'; |
862 | | - if (thisOp == finishOp) { |
863 | | - this.objTimeouts[obj.id] = null; |
864 | | - if (finishOp >= 100) { |
865 | | - try { obj.style.removeAttribute('filter'); } catch(e) {} |
866 | | - } |
867 | | - if (arguments.callee.oncomplete) arguments.callee.oncomplete(); |
868 | | - } else { |
869 | | - this.objTimeouts[obj.id] = setTimeout(function() { fb.setOpacity(fb[obj.id], thisOp + incr, finishOp, incr, fadeIn); }, 20); |
870 | | - } |
871 | | -}; |
872 | | -this.resizeGroup = function(arr, funcOnComplete) { |
873 | | - if (!funcOnComplete) var funcOnComplete = function() { return; }; |
874 | | - var i = arr.length; |
875 | | - if (!i) return funcOnComplete(); |
876 | | - this.clearTimeout('resizeGroup'); |
877 | | - var diff = 0; |
878 | | - while (i--) diff = Math.max(diff, Math.abs(arr[i][3] - arr[i][2])); |
879 | | - var rate = (diff && this.resizeDuration)? Math.pow(Math.max(1, 2.2 - this.resizeDuration/10), (Math.log(diff))) / diff : 1; |
880 | | - i = arr.length; |
881 | | - while (i--) { |
882 | | - arr[i][3] -= arr[i][2] |
883 | | - } |
884 | | - this.resize(rate, 1, arr, funcOnComplete); |
885 | | -}; |
886 | | -this.resize = function(rate, count, arr, funcOnComplete) { |
887 | | - if (arr) arguments.callee.arr = arr; |
888 | | - if (funcOnComplete) arguments.callee.oncomplete = funcOnComplete; |
889 | | - var arr = arguments.callee.arr; |
890 | | - var increment = rate * count; |
891 | | - if (increment > 1) increment = 1; |
892 | | - var i = arr.length; |
893 | | - while (i--) { |
894 | | - var obj = arr[i][0], prop = arr[i][1], startPx = arr[i][2], diff = arr[i][3]; |
895 | | - obj.style[prop] = (startPx + diff * increment) + 'px'; |
896 | | - } |
897 | | - if (increment >= 1) { |
898 | | - this.objTimeouts.resizeGroup = null; |
899 | | - if (arguments.callee.oncomplete) arguments.callee.oncomplete(); |
900 | | - } else { |
901 | | - this.objTimeouts.resizeGroup = setTimeout(function() { fb.resize(rate, count + 1); }, 20); |
902 | | - } |
903 | | -}; |
904 | | -this.getXScroll = function() { |
905 | | - return top.pageXOffset || this.body.scrollLeft || this.doc.documentElement.scrollLeft || 0; |
906 | | -}; |
907 | | -this.getYScroll = function() { |
908 | | - return top.pageYOffset || this.body.scrollTop || this.doc.documentElement.scrollTop || 0; |
909 | | -}; |
910 | | -this.getDisplayWidth = function() { |
911 | | - return (this.doc.documentElement && this.doc.documentElement.clientWidth) || this.body.clientWidth; |
912 | | -}; |
913 | | -this.getDisplayHeight = function() { |
914 | | - if (this.doc.childNodes && !this.doc.all && !navigator.taintEnabled && !this.doc.evaluate) { |
915 | | - return top.innerHeight; |
916 | | - } |
917 | | - if (window.opera) { |
918 | | - var h = this.body.clientHeight; |
919 | | - if (this.body.currentStyle) { |
920 | | - if (this.body.currentStyle.borderTopStyle != 'none') { |
921 | | - h += parseInt(this.body.currentStyle.borderTopWidth); |
922 | | - } |
923 | | - if (this.body.currentStyle.borderBottomStyle != 'none') { |
924 | | - h += parseInt(this.body.currentStyle.borderBottomWidth); |
925 | | - } |
926 | | - } |
927 | | - return h; |
928 | | - } |
929 | | - var elementHeight = (this.doc.documentElement && this.doc.documentElement.clientHeight) || 0; |
930 | | - if (!elementHeight || (this.doc.compatMode && this.doc.compatMode == 'BackCompat')) { |
931 | | - return this.body.clientHeight; |
932 | | - } |
933 | | - return elementHeight; |
934 | | -}; |
935 | | -this.setVisibility = function(tagName, state, thisWindow) { |
936 | | - if (!thisWindow) { |
937 | | - arguments.callee(tagName, state, top) |
938 | | - } else { |
939 | | - try { |
940 | | - var els = thisWindow.document.getElementsByTagName(tagName); |
941 | | - var i = els.length; while (i--) { |
942 | | - els[i].style.visibility = state; |
943 | | - } |
944 | | - } catch(e) {} |
945 | | - var frames = thisWindow.frames; |
946 | | - i = frames.length; while (i--) { |
947 | | - if (typeof(frames[i].window) == 'object') arguments.callee(tagName, state, frames[i].window); |
948 | | - } |
949 | | - } |
950 | | -}; |
951 | | -this.clearTimeout = function(key) { |
952 | | - if (this.objTimeouts[key]) { |
953 | | - clearTimeout(this.objTimeouts[key]); |
954 | | - this.objTimeouts[key] = null; |
955 | | - } |
956 | | -}; |
957 | | -this.stretchOverlay = function() { |
958 | | - if (arguments.length == 1) { |
959 | | - fb.clearTimeout('onresize'); |
960 | | - fb.objTimeouts.onresize = setTimeout(function() { fb.stretchOverlay(); }, 50); |
961 | | - } else { |
962 | | - fb.objTimeouts.onresize = null; |
963 | | - var width = fb.fbFloatbox.offsetLeft + fb.fbFloatbox.offsetWidth; |
964 | | - var height = fb.fbFloatbox.offsetTop + fb.fbFloatbox.offsetHeight; |
965 | | - var style = fb.fbOverlay.style; |
966 | | - style.width = style.height = '0'; |
967 | | - style.width = Math.max(width, fb.body.scrollWidth, fb.body.clientWidth, fb.doc.documentElement.clientWidth, fb.getDisplayWidth() + fb.getXScroll()) + 'px'; |
968 | | - style.height = Math.max(height, fb.body.scrollHeight, fb.body.clientHeight, fb.doc.documentElement.clientHeight, fb.getDisplayHeight() + fb.getYScroll()) + 'px'; |
969 | | - } |
970 | | -}; |
971 | | -}; |
972 | | -function initfb() { |
973 | | - if (arguments.callee.done) return; |
974 | | - arguments.callee.done = true; |
975 | | - if (!top.floatbox) top.floatbox = new Floatbox(); |
976 | | - fb = top.floatbox; |
977 | | - fb.tagAnchors(self.document); |
978 | | - if (fb.autoStart) fb.start(fb.autoStart); |
979 | | -}; |
980 | | -/*@cc_on |
981 | | -/*@if (@_win32 || @_win64) |
982 | | - intervalID = setInterval(function() { |
983 | | - try { |
984 | | - document.documentElement.doScroll('left'); |
985 | | - clearInterval(intervalID); |
986 | | - initfb(); |
987 | | - } catch (e) {} |
988 | | - }, 50); |
989 | | -@else @*/ |
990 | | - if (/Apple|KDE/i.test(navigator.vendor)) { |
991 | | - intervalID = setInterval(function() { |
992 | | - if (/loaded|complete/.test(document.readyState)) { |
993 | | - clearInterval(intervalID); |
994 | | - initfb(); |
995 | | - } |
996 | | - }, 50); |
997 | | - } else if (document.addEventListener) { |
998 | | - document.addEventListener('DOMContentLoaded', initfb, false); |
999 | | - } |
1000 | | -/*@end |
1001 | | -@*/ |
1002 | | -function onloadClosure(priorOnload, thisOnload) { |
1003 | | - return function() { |
1004 | | - if (priorOnload) priorOnload(); |
1005 | | - thisOnload(); |
1006 | | - }; |
1007 | | -}; |
1008 | | -window.onload = onloadClosure(window.onload, function() { |
1009 | | - if (typeof(intervalID) != 'undefined') clearInterval(intervalID); |
1010 | | - initfb(); |
1011 | | - if (!fb.itemCount) fb.preloadNextImage(); |
1012 | | -}); |