1//***********************************************************************************************************************************/ 2// LyteBox v3.22 3// 4// Author: Markus F. Hay 5// Website: http://www.dolem.com/lytebox 6// Date: October 2, 2007 7// License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/) 8// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES): 9// * Firefox: 2.0.0.7, 1.5.0.12 10// * Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2 11// * Opera: 9.23 12// 13// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62 14// * v3.22 (10/02/07) 15// * v3.21 (09/30/07) 16// * v3.20 (07/12/07) 17// * v3.10 (05/28/07) 18// * v3.00 (05/15/07) 19// * v2.02 (11/13/06) 20// 21// Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more 22// information please visit http://huddletogether.com/projects/lightbox2/ 23//***********************************************************************************************************************************/ 24 25// Task 138848, see line ~103 26/* 27Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { if( typeof this.splice == 'function' ) { this.splice(i,1); } } } }; 28Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { if( typeof this.shift == 'function' ) { this.shift(); } } }; 29*/ 30String.prototype.trim = function () { if( typeof this.replace == 'function' ) { return this.replace(/^\s+|\s+$/g, ''); } else { return '' } }; 31 32function LyteBox() { 33 /*** Start Global Configuration ***/ 34 this.theme = 'grey'; // themes: grey (default), red, green, blue, gold 35 this.hideFlash = true; // controls whether or not Flash objects should be hidden 36 this.outerBorder = true; // controls whether to show the outer grey (or theme) border 37 this.resizeSpeed = 8; // controls the speed of the image resizing (1=slowest and 10=fastest) 38 this.maxOpacity = 80; // higher opacity = darker overlay, lower opacity = lighter overlay 39 this.navType = 1; // 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number 40 this.autoResize = true; // controls whether or not images should be resized if larger than the browser window dimensions 41 this.doAnimations = true; // controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc. 42 43 this.borderSize = 12; // if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone... 44 /*** End Global Configuration ***/ 45 46 /*** Configure Slideshow Options ***/ 47 this.slideInterval = 4000; // Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds) 48 this.showNavigation = true; // true to display Next/Prev buttons/text during slideshow, false to hide 49 this.showClose = true; // true to display the Close button, false to hide
50 this.showDetails = true; // true to display image details (caption, count), false to hide 51 this.showPlayPause = true; // true to display pause/play buttons next to close button, false to hide 52 this.autoEnd = false; // true to automatically close Lytebox after the last image is reached, false to keep open 53 this.pauseOnNextClick = false; // true to pause the slideshow when the "Next" button is clicked 54 this.pauseOnPrevClick = true; // true to pause the slideshow when the "Prev" button is clicked 55 /*** End Slideshow Configuration ***/ 56 57 if(this.resizeSpeed > 10) { this.resizeSpeed = 10; } 58 if(this.resizeSpeed < 1) { resizeSpeed = 1; } 59 this.resizeDuration = (11 - this.resizeSpeed) * 0.15; 60 this.resizeWTimerArray = new Array(); 61 this.resizeWTimerCount = 0; 62 this.resizeHTimerArray = new Array(); 63 this.resizeHTimerCount = 0; 64 this.showContentTimerArray = new Array(); 65 this.showContentTimerCount = 0; 66 this.overlayTimerArray = new Array(); 67 this.overlayTimerCount = 0; 68 this.imageTimerArray = new Array(); 69 this.imageTimerCount = 0; 70 this.timerIDArray = new Array(); 71 this.timerIDCount = 0; 72 this.slideshowIDArray = new Array(); 73 this.slideshowIDCount = 0; 74 this.imageArray = new Array(); 75 this.activeImage = null; 76 this.slideArray = new Array(); 77 this.activeSlide = null; 78 this.frameArray = new Array(); 79 this.activeFrame = null; 80 this.checkFrame(); 81 this.isSlideshow = false; 82 this.isLyteframe = false; 83 /*@cc_on 84 /*@if (@_jscript) 85 this.ie = (document.all && !window.opera) ? true : false; 86 /*@else @*/ 87 this.ie = false;
88 /*@end 89 @*/ 90 this.ie7 = (this.ie && window.XMLHttpRequest); 91 92/* scroller */ 93 this.scrollerDisplay = false; 94 this.thumbsArray = new Array(); 95 this.scrollElement = 'undefined'; 96 this.scrollDirection = 1; 97 this.scrollerWidth = 500; 98 this.scrollerResized = false; 99/* scroller */ 100 101 this.initialize(); 102} 103 104//Task 138848 105LyteBox.prototype.removeDuplicates = function ( data ) { 106 for (var i = 1; i < data.length; i++) { 107 if (data[i][0] == data[i-1][0]) { 108 if( typeof data.splice == 'function' ) { 109 data.splice(i,1); 110 } 111 } 112 } 113 114 return data; 115}; 116// Array.prototype.empty is unused.. 117 118LyteBox.prototype.initialize = function() { 119 this.updateLyteboxItems(); 120 var objBody = this.doc.getElementsByTagName("body").item(0); 121 if (this.doc.getElementById('lbOverlay')) { 122 objBody.removeChild(this.doc.getElementById("lbOverlay")); 123 objBody.removeChild(this.doc.getElementById("lbMain")); 124 } 125 var objOverlay = this.doc.createElement("div"); 126 objOverlay.setAttribute('id','lbOverlay'); 127 objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme); 128 if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) { 129 objOverlay.style.position = 'absolute'; 130 } 131 objOverlay.style.display = 'none'; 132 objBody.appendChild(objOverlay); 133 var objLytebox = this.doc.createElement("div"); 134 objLytebox.setAttribute('id','lbMain'); 135 objLytebox.style.display = 'none'; 136 objBody.appendChild(objLytebox); 137 138/* scroller */ 139 var objScrollerOuter = this.doc.createElement("div"); 140 objScrollerOuter.setAttribute('id','objScrollerOuter'); 141 objLytebox.appendChild( objScrollerOuter ); 142 143 var objScroller = this.doc.createElement("div"); 144 objScroller.setAttribute('id','objScroller'); 145 objScrollerOuter.appendChild( objScroller ); 146 147 var objScrollerImages = this.doc.createElement("div"); 148 objScrollerImages.setAttribute('id','objScrollerImages'); 149 objScroller.appendChild( objScrollerImages ); 150 151 var objScrollerLeft = this.doc.createElement("div"); 152 objScrollerLeft.setAttribute('id','objScrollerLeft'); 153 objScrollerLeft.onmouseover = function () { myLytebox.gallery_slide_start( objScrollerImages, 1 ) }; 154 objScrollerLeft.onmouseout = function () { myLytebox.gallery_slide_stop() }; 155 objScrollerOuter.appendChild( objScrollerLeft ); 156 157 var objScrollerRight = this.doc.createElement("div"); 158 objScrollerRight.setAttribute('id','objScrollerRight'); 159 objScrollerRight.onmouseover = function () { myLytebox.gallery_slide_start( objScrollerImages, -1 ) }; 160 objScrollerRight.onmouseout = function () { myLytebox.gallery_slide_stop() }; 161 objScrollerOuter.appendChild( objScrollerRight ); 162/* scroller end */ 163 164 var objOuterContainer = this.doc.createElement("div"); 165 objOuterContainer.setAttribute('id','lbOuterContainer'); 166 objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme); 167 objLytebox.appendChild(objOuterContainer); 168 var objIframeContainer = this.doc.createElement("div"); 169 objIframeContainer.setAttribute('id','lbIframeContainer'); 170 objIframeContainer.style.display = 'none'; 171 objOuterContainer.appendChild(objIframeContainer); 172 var objIframe = this.doc.createElement("iframe"); 173 objIframe.setAttribute('id','lbIframe'); 174 objIframe.setAttribute('name','lbIframe'); 175 if ( window.location.toString().split( ':' )[0] == 'https' ) {
176 objIframe.setAttribute( 'src', 'javascript:false' ); 177 } 178 else { 179 objIframe.setAttribute( 'src', 'javascript:void(0)' ); 180 } 181 objIframe.style.display = 'none'; 182 objIframeContainer.appendChild(objIframe); 183 var objImageContainer = this.doc.createElement("div"); 184 objImageContainer.setAttribute('id','lbImageContainer'); 185 objOuterContainer.appendChild(objImageContainer); 186 var objLyteboxImage = this.doc.createElement("img"); 187 objLyteboxImage.setAttribute('id','lbImage'); 188 objImageContainer.appendChild(objLyteboxImage); 189 var objLoading = this.doc.createElement("div"); 190 objLoading.setAttribute('id','lbLoading'); 191 objOuterContainer.appendChild(objLoading); 192 var objDetailsContainer = this.doc.createElement("div"); 193 objDetailsContainer.setAttribute('id','lbDetailsContainer'); 194 objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme); 195 objLytebox.appendChild(objDetailsContainer); 196 var objDetailsData =this.doc.createElement("div"); 197 objDetailsData.setAttribute('id','lbDetailsData'); 198 objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme); 199 objDetailsContainer.appendChild(objDetailsData); 200 var objDetails = this.doc.createElement("div"); 201 objDetails.setAttribute('id','lbDetails'); 202 objDetailsData.appendChild(objDetails); 203 var objCaption = this.doc.createElement("span"); 204 objCaption.setAttribute('id','lbCaption'); 205 objDetails.appendChild(objCaption); 206 var objHoverNav = this.doc.createElement("div"); 207 objHoverNav.setAttribute('id','lbHoverNav'); 208 objImageContainer.appendChild(objHoverNav); 209 var objBottomNav = this.doc.createElement("div"); 210 objBottomNav.setAttribute('id','lbBottomNav'); 211 objDetailsData.appendChild(objBottomNav); 212 var objPrev = this.doc.createElement("a"); 213 objPrev.setAttribute('id','lbPrev'); 214 objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme); 215 objPrev.setAttribute('href','#'); 216 objHoverNav.appendChild(objPrev); 217 var objNext = this.doc.createElement("a"); 218 objNext.setAttribute('id','lbNext'); 219 objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme); 220 objNext.setAttribute('href','#'); 221 objHoverNav.appendChild(objNext);
222 var objNumberDisplay = this.doc.createElement("span"); 223 objNumberDisplay.setAttribute('id','lbNumberDisplay'); 224 objDetails.appendChild(objNumberDisplay); 225 var objNavDisplay = this.doc.createElement("span"); 226 objNavDisplay.setAttribute('id','lbNavDisplay'); 227 objNavDisplay.style.display = 'none'; 228 objDetails.appendChild(objNavDisplay); 229 var objClose = this.doc.createElement("a"); 230 objClose.setAttribute('id','lbClose'); 231 objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme); 232 objClose.setAttribute('href','#'); 233 objBottomNav.appendChild(objClose); 234 var objPause = this.doc.createElement("a"); 235 objPause.setAttribute('id','lbPause'); 236 objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme); 237 objPause.setAttribute('href','#'); 238 objPause.style.display = 'none'; 239 objBottomNav.appendChild(objPause); 240 var objPlay = this.doc.createElement("a"); 241 objPlay.setAttribute('id','lbPlay'); 242 objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme); 243 objPlay.setAttribute('href','#'); 244 objPlay.style.display = 'none'; 245 objBottomNav.appendChild(objPlay); 246}; 247/* scroller */ 248LyteBox.prototype.gallery_slide_start = function( el, direction ) { 249 this.scrollElement = el; 250 this.scrollDirection = direction; 251 if ( typeof this.scrollerOffsetLeft == 'undefined' ) { 252 this.scrollerOffsetLeft = parseInt( this.doc.getElementById('objScrollerImages').offsetLeft ); 253 } 254 this.scrollTimer = window.setInterval( 'myLytebox.gallery_repos()', 20 ); 255}; 256 257LyteBox.prototype.gallery_repos = function( ) { 258 if ( !this.scrollElement.style.left ) this.scrollElement.style.left = 0; 259 var scrollSpeed = 5; 260 261 var target_left = parseInt( this.scrollElement.style.left, 10 ) + ( this.scrollDirection * scrollSpeed ) - this.scrollElement.style.marginLeft; 262 263 // out of bounds check: left 264 if( target_left > 0 ) return; 265 266 if ( typeof scrollerImagesPadding == 'undefined' ) { 267 var objScrollerOuter = this.doc.getElementById('objScrollerOuter'); 268 var objScrollerImages = this.doc.getElementById('objScrollerImages'); 269 var scrollerImages = objScrollerImages.getElementsByTagName( 'img' ); 270 var scrollerImagesPadding = 0; 271 272 if ( this.ie ) { 273 scrollerImagesPadding += parseInt( objScrollerImages.currentStyle.marginLeft, 10 ); 274 scrollerImagesPadding += parseInt( objScrollerImages.currentStyle.marginRight, 10 ); 275 } 276 else { 277 scrollerImagesPadding += parseInt( window.getComputedStyle( objScrollerImages, null ).marginLeft, 10 ); 278 scrollerImagesPadding += parseInt( window.getComputedStyle( objScrollerImages, null ).marginRight, 10 ); 279 } 280 } 281 282 // out of bounds check: right 283 if( this.scrollDirection < 0 && parseInt( this.scrollElement.parentNode.offsetWidth ) + parseInt( this.scrollElement.offsetWidth ) >= ( scrollerImagesPadding + ( parseInt( this.scrollElement.offsetWidth ) + this.scrollElement.offsetWidth ) + parseInt( this.scrollElement.style.left ) - parseInt( this.scrollElement.parentNode.offsetWidth ) - parseInt( document.getElementById( 'objScrollerRight' ).offsetWidth ) ) ) { 284 return; 285 } 286 287 this.scrollElement.style.left = target_left + 'px'; 288}; 289 290LyteBox.prototype.gallery_slide_stop = function() { 291 window.clearInterval( this.scrollTimer ); 292}; 293/* scroller end */ 294 295LyteBox.prototype.updateLyteboxItems = function() { 296 297 var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a'); 298 for (var i = 0; i < anchors.length; i++) { 299 var anchor = anchors[i]; 300 var relAttribute = String(anchor.getAttribute('rel')); 301 if (anchor.getAttribute('href') && anchor.getAttribute('href').split( '?' )[0]) { 302 if (relAttribute.toLowerCase().match('lytebox')) { 303 anchor.onclick = function () { myLytebox.start(this, false, false); return false; } 304 } else if (relAttribute.toLowerCase().match('lyteshow')) { 305 anchor.onclick = function () { myLytebox.start(this, true, false); return false; } 306 } else if (relAttribute.toLowerCase().match('lyteframe')) { 307 anchor.onclick = function () { myLytebox.start(this, false, true); return false; } 308 } 309 } 310 } 311}; 312LyteBox.prototype.start = function(imageLink, doSlide, doFrame) { 313 if (this.ie && !this.ie7) { this.toggleSelects('hide'); } 314 if (this.hideFlash) { this.toggleFlash('hide'); } 315 this.isLyteframe = (doFrame ? true : false); 316 var pageSize = this.getPageSize(); 317 var objOverlay = this.doc.getElementById('lbOverlay'); 318 var objBody = this.doc.getElementsByTagName("body").item(0); 319 objOverlay.style.height = pageSize[1] + "px"; 320 objOverlay.style.display = ''; 321 this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity)); 322 var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a'); 323 if (this.isLyteframe) { 324 this.frameArray = []; 325 this.frameNum = 0; 326 if ((imageLink.getAttribute('rel') == 'lyteframe')) { 327 var rev = imageLink.getAttribute('rev'); 328 this.frameArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev))); 329 } else { 330 if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) { 331 for (var i = 0; i < anchors.length; i++) { 332 var anchor = anchors[i]; 333 if (anchor.getAttribute('href').split( '?' )[0] && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) { 334 var rev = anchor.getAttribute('rev'); 335 this.frameArray.push(new Array(anchor.getAttribute('href').split( '?' )[0], anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev))); 336 } 337 } 338 this.frameArray = this.removeDuplicates(this.frameArray); 339 while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('href').split( '?' )[0]) { this.frameNum++; } 340 } 341 } 342 } else { 343 this.imageArray = []; 344 this.slideArray = []; 345 this.slideNum = 0; 346 this.imageNum = 0; 347 this.scrollImages = []; 348 349 if ((imageLink.getAttribute('rel') == 'lytebox')) { 350 this.imageArray.push(new Array(imageLink.getAttribute('href').split( '?' )[0].split( '?' )[0], imageLink.getAttribute('title'))); 351 } else { 352 if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) { 353 for (var i = 0; i < anchors.length; i++) { 354 var anchor = anchors[i], 355 anchor_href = anchor.getAttribute('href'); 356 if ( anchor_href && anchor_href.split( '?' )[0] && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) { 357/* scroller */ 358 this.imageArray.push(new Array(anchor.getAttribute('href').split( '?' )[0].split( '?' )[0], anchor.getAttribute('title'), ( anchor.getAttribute('thumb') ? anchor.getAttribute('thumb') : '' ))); 359 this.scrollImages.push(new Array(( anchor.getAttribute('thumb') ? anchor.getAttribute('thumb') : '' ))); 360/* scroller end */ 361 } 362 } 363 this.imageArray = this.removeDuplicates(this.imageArray); 364 this.scrollImages = this.removeDuplicates(this.scrollImages); 365 while(this.imageNum < ( this.imageArray.length -1 ) && this.imageArray[this.imageNum][0] != imageLink.getAttribute('href').split( '?' )[0].split( '?' )[0]) { 366 this.imageNum++; 367 } 368 } 369 370 if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) { 371 for (var i = 0; i < anchors.length; i++) { 372 var anchor = anchors[i]; 373 if (anchor.getAttribute('href').split( '?' )[0] && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) { 374 this.slideArray.push(new Array(anchor.getAttribute('href').split( '?' )[0].split( '?' )[0], anchor.getAttribute('title'))); 375 } 376 } 377 this.slideArray = this.removeDuplicates(this.slideArray); 378 while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('href').split( '?' )[0]) { this.slideNum++; } 379 } 380 } 381/* scroller */ 382 if ( typeof this.imageArray == 'object' && typeof this.imageArray[0] != 'undefined' && typeof this.imageArray[0][2] == 'string' && this.imageArray[0][2].length > 0 && this.imageArray.length > 0 ) { 383 var objScrollerImages = this.doc.getElementById('objScrollerImages'); 384 var objScrollerImageChilds = objScrollerImages.childNodes; 385 if ( objScrollerImageChilds.length > 0 ) { 386 while( objScrollerImageChilds.length > 0 ) { 387 objScrollerImages.removeChild( objScrollerImageChilds[0] ); 388 } 389 } 390 391 var objScrollerOuter = this.doc.getElementById('objScrollerOuter'); 392 var objScroller = this.doc.getElementById('objScroller'); 393 objScrollerOuter.style.display = 'block'; 394 395 for (var i = 0; i < this.scrollImages.length; i++) { 396 var newThumbnail = this.doc.createElement("img"); 397 newThumbnail.setAttribute('src', this.scrollImages[i][0] ); 398 if ( i == 0 ) newThumbnail.setAttribute('class', 'first' ); 399 else if ( i == this.imageArray.length ) newThumbnail.setAttribute('class', 'last' );
400 newThumbnail.onclick = new Function('fx', "myLytebox.changeContent("+i+"); return false;"); 401 objScrollerImages.appendChild( newThumbnail ); 402 } 403 objScroller.style.top = objScroller.style.height * -1; 404 } 405/* scroller end */ 406 } 407 var object = this.doc.getElementById('lbMain'); 408 object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px"; 409 object.style.display = ''; 410 if (!this.outerBorder) { 411 this.doc.getElementById('lbOuterContainer').style.border = 'none'; 412 this.doc.getElementById('lbDetailsContainer').style.border = 'none'; 413 } else { 414 this.doc.getElementById('lbOuterContainer').style.borderBottom = ''; 415 this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme); 416 this.doc.getElementById('objScrollerOuter').setAttribute((this.ie ? 'className' : 'class'), this.theme); 417 } 418 this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; } 419 this.doc.getElementById('lbMain').onclick = function(e) { 420 var e = e; 421 if (!e) { 422 if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) { 423 e = window.parent.window.event; 424 } else { 425 e = window.event; 426 } 427 } 428 var id = (e.target ? e.target.id : e.srcElement.id); 429 if (id == 'lbMain') { myLytebox.end(); return false; } 430 } 431 this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; } 432 this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; } 433 this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; } 434 this.isSlideshow = doSlide; 435 this.isPaused = (this.slideNum != 0 ? true : false); 436 if (this.isSlideshow && this.showPlayPause && this.isPaused) { 437 this.doc.getElementById('lbPlay').style.display = ''; 438 this.doc.getElementById('lbPause').style.display = 'none'; 439 } 440 if (this.isLyteframe) { 441 this.changeContent(this.frameNum); 442 } else { 443 if (this.isSlideshow) { 444 this.changeContent(this.slideNum); 445 } else { 446 this.changeContent(this.imageNum); 447 } 448 } 449}; 450LyteBox.prototype.changeContent = function(imageNum) { 451 if (this.isSlideshow) { 452 for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } 453 } 454 455/* scroller */ 456 if ( !this.isLyteframe ) { 457 if ( typeof this.imageArray[imageNum] != 'undefined' && typeof this.imageArray[imageNum][2] == 'string' && this.imageArray[imageNum][2].length > 0) { 458 var objScrollerImages = this.doc.getElementById( 'objScrollerImages' ); 459 for (var i = 0; i < objScrollerImages.childNodes.length; i++ ) { 460 if ( i == 0 ) { 461 objScrollerImages.childNodes[i].className = 'first'; 462 objScrollerImages.childNodes[i].setAttribute('class', 'first' ); 463 } 464 else if ( i == ( objScrollerImages.childNodes.length - 1 ) ) { 465 objScrollerImages.childNodes[i].className = 'last'; 466 objScrollerImages.childNodes[i].setAttribute('class', 'last' ); 467 } 468 else { 469 objScrollerImages.childNodes[i].className = ''; 470 objScrollerImages.childNodes[i].setAttribute('class', '' ); 471 } 472 } 473 474 if ( typeof objScrollerImages.childNodes[imageNum] != 'undefined' ) { 475 objScrollerImages.childNodes[imageNum].setAttribute( 'class', objScrollerImages.childNodes[imageNum].getAttribute( 'class' )+' active' ); 476 objScrollerImages.childNodes[imageNum].className = objScrollerImages.childNodes[imageNum].className+' active'; 477 } 478 } 479 } 480/* scroller end */ 481 482 this.activeImage = this.activeSlide = this.activeFrame = imageNum; 483 if (!this.outerBorder) { 484 this.doc.getElementById('lbOuterContainer').style.border = 'none'; 485 this.doc.getElementById('lbDetailsContainer').style.border = 'none'; 486 } else { 487 this.doc.getElementById('lbOuterContainer').style.borderBottom = ''; 488 this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme); 489 } 490 this.doc.getElementById('lbLoading').style.display = ''; 491 this.doc.getElementById('lbImage').style.display = 'none'; 492 this.doc.getElementById('lbIframe').style.display = 'none'; 493 this.doc.getElementById('lbPrev').style.display = 'none'; 494 this.doc.getElementById('lbNext').style.display = 'none'; 495 this.doc.getElementById('lbIframeContainer').style.display = 'none'; 496 this.doc.getElementById('lbDetailsContainer').style.display = 'none';
497 this.doc.getElementById('lbNumberDisplay').style.display = 'none'; 498 if (this.navType == 2 || this.isLyteframe) { 499 object = this.doc.getElementById('lbNavDisplay'); 500 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>'; 501 object.style.display = 'none'; 502 } 503 if (this.isLyteframe) { 504 var iframe = myLytebox.doc.getElementById('lbIframe'); 505 var styles = this.frameArray[this.activeFrame][2]; 506 var aStyles = styles.split(';'); 507 for (var i = 0; i < aStyles.length; i++) { 508 if (aStyles[i].indexOf('width:') >= 0) { 509 var w = aStyles[i].replace('width:', ''); 510 iframe.width = w.trim(); 511 } else if (aStyles[i].indexOf('height:') >= 0) { 512 var h = aStyles[i].replace('height:', ''); 513 iframe.height = h.trim(); 514 } else if (aStyles[i].indexOf('scrolling:') >= 0) { 515 var s = aStyles[i].replace('scrolling:', ''); 516 iframe.scrolling = s.trim(); 517 } else if (aStyles[i].indexOf('border:') >= 0) { 518 // Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint) 519 //var b = aStyles[i].replace('border:', ''); 520 //iframe.style.border = b.trim(); 521 } 522 } 523 this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height)); 524 } else { 525/* lyteflv */ 526 if ( typeof lbFlashArray != 'undefined' && this.imageArray.length > 0 && typeof lbFlashArray[this.imageArray[imageNum][0]] == 'object' ) { 527 this.showNavigation = false; 528 this.navType = 0; 529 var lbImage = myLytebox.doc.getElementById('lbImage'); 530 lbImage.width = lbFlashArray[this.imageArray[imageNum][0]].w; 531 lbImage.height = lbFlashArray[this.imageArray[imageNum][0]].h; 532 myLytebox.resizeContainer( lbFlashArray[this.imageArray[imageNum][0]].w, lbFlashArray[this.imageArray[imageNum][0]].h ); 533 window.setTimeout( "lbFlashArray['"+this.imageArray[imageNum][0]+"'].callback()", 600 ); 534 } 535 else { 536/* lyteflv end */ 537 this.showNavigation = true; 538 this.navType = 1; 539 if( typeof myLytebox.imageArray[myLytebox.activeImage] != 'undefined' ) { 540 this.scrollerDisplay = ( typeof myLytebox.imageArray[myLytebox.activeImage][2] != 'undefined' && myLytebox.imageArray[myLytebox.activeImage][2].length > 0 ? true : false ); 541 } 542 imgPreloader = new Image(); 543 imgPreloader.onload = function() { 544 var imageWidth = imgPreloader.width; 545 var imageHeight = imgPreloader.height; 546 if (myLytebox.autoResize) { 547 var pagesize = myLytebox.getPageSize(); 548 var x = pagesize[2] - 150; 549 var y = pagesize[3] - 150; 550 if (imageWidth > x) { 551 imageHeight = Math.round(imageHeight * (x / imageWidth)); 552 imageWidth = x; 553 if (imageHeight > y) { 554 imageWidth = Math.round(imageWidth * (y / imageHeight)); 555 imageHeight = y; 556 } 557 } else if (imageHeight > y) { 558 imageWidth = Math.round(imageWidth * (y / imageHeight)); 559 imageHeight = y; 560 if (imageWidth > x) { 561 imageHeight = Math.round(imageHeight * (x / imageWidth)); 562 imageWidth = x; 563 } 564 } 565 } 566 var lbImage = myLytebox.doc.getElementById('lbImage') 567 lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]); 568 lbImage.width = imageWidth; 569 lbImage.height = imageHeight; 570 myLytebox.resizeContainer(imageWidth, imageHeight); 571 imgPreloader.onload = function() {}; 572 } 573 imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]); 574/* lyteflv */ 575 } 576/* lyteflv end */ 577 } 578}; 579LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) { 580 this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth; 581 this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight; 582 this.xScale = ((imgWidth + (this.borderSize * 2)) / this.wCur) * 100; 583 this.yScale = ((imgHeight + (this.borderSize * 2)) / this.hCur) * 100; 584 var wDiff = (this.wCur - this.borderSize * 2) - imgWidth; 585 var hDiff = (this.hCur - this.borderSize * 2) - imgHeight; 586 if (!(hDiff == 0)) { 587 this.hDone = false;
588 this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight)); 589 } else { 590 this.hDone = true; 591 } 592 if (!(wDiff == 0)) { 593 this.wDone = false; 594 this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth)); 595 } else { 596 this.wDone = true; 597 } 598 if ((hDiff == 0) && (wDiff == 0)) { 599 if (this.ie){ this.pause(250); } else { this.pause(100); } 600 } 601 this.doc.getElementById('lbPrev').style.height = imgHeight + "px"; 602 this.doc.getElementById('lbNext').style.height = imgHeight + "px"; 603 this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px"; 604 this.showContent(); 605}; 606LyteBox.prototype.showContent = function() { 607 if (this.wDone && this.hDone) { 608 for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); } 609 if (this.outerBorder) { 610 this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none'; 611 } 612 this.doc.getElementById('lbLoading').style.display = 'none'; 613 if (this.isLyteframe) { 614 this.doc.getElementById('lbIframe').style.display = ''; 615 this.appear('lbIframe', (this.doAnimations ? 0 : 100)); 616 } else { 617 this.doc.getElementById('lbImage').style.display = ''; 618 this.appear('lbImage', (this.doAnimations ? 0 : 100)); 619 this.preloadNeighborImages(); 620 } 621 if (this.isSlideshow) { 622 if(this.activeSlide == (this.slideArray.length - 1)) { 623 if (this.autoEnd) { 624 this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval); 625 } 626 } else { 627 if (!this.isPaused) { 628 this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval); 629 } 630 } 631 this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none'); 632 this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none'); 633 this.doc.getElementById('lbDetails').style.display = (this.showDetail
633s ? '' : 'none'); 634 this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none'); 635 this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : ''); 636 this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none'); 637 } else { 638 this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none'); 639 if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) { 640 this.doc.getElementById('lbNavDisplay').style.display = ''; 641 } else { 642 this.doc.getElementById('lbNavDisplay').style.display = 'none'; 643 } 644 this.doc.getElementById('lbClose').style.display = ''; 645 this.doc.getElementById('lbDetails').style.display = ''; 646 this.doc.getElementById('lbPause').style.display = 'none'; 647 this.doc.getElementById('lbPlay').style.display = 'none'; 648 } 649 this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : ''); 650 this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none'); 651 try { 652 this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0]; 653 } catch(e) { } 654 } else { 655 this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200); 656 } 657}; 658LyteBox.prototype.updateDetails = function() { 659 var object = this.doc.getElementById('lbCaption'); 660 var sTitle = (this.isSlideshow && this.slideArray.length > 0 ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1])); 661 if( sTitle != null && sTitle.indexOf( '|' ) != -1 ) { 662 sTitleParts = sTitle.split( '|' ); 663 sTitle = '<b>'+sTitleParts[0]+'</b><br>'+sTitleParts[1]; 664 } 665/* zeilenumbrueche in der description zulassen */ 666 if( typeof sTitle == 'string' ) { 667 sTitle = sTitle.replace(/\n/g,"<br>"); 668 object.style.display = ''; 669 object.innerHTML = (sTitle == null ? '' : sTitle); 670 } 671 object.style.display = ''; 672 object.innerHTML = (sTitle == null ? '' : sTitle); 673 this.updateNav(); 674 this.doc.getElementById('lbDetailsContainer').style.display = ''; 675 object = this.doc.getElementById('lbNumberDisplay'); 676 if (this.isSlideshow && this.slideArray.length > 1) { 677 object.style.display = ''; 678 object.innerHTML = "Image " + eval(this.activeSlide + 1) + " of " + this.slideArray.length; 679 this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none'); 680 } else if (this.imageArray.length > 1 && !this.isLyteframe) { 681 object.style.display = ''; 682 object.innerHTML = "Image " + eval(this.activeImage + 1) + " of " + this.imageArray.length; 683 this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none'); 684 } else if (this.frameArray.length > 1 && this.isLyteframe) { 685 object.style.display = ''; 686 object.innerHTML = "Page " + eval(this.activeFrame + 1) + " of " + this.frameArray.length; 687 this.doc.getElementById('lbNavDisplay').style.display = ''; 688 } else { 689 this.doc.getElementById('lbNavDisplay').style.display = 'none'; 690 } 691 this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100)); 692}; 693LyteBox.prototype.updateNav = function() { 694 if (this.isSlideshow) { 695 if (this.activeSlide != 0) { 696 var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev')); 697 object.style.display = ''; 698 object.onclick = function() { 699 if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); } 700 myLytebox.changeContent(myLytebox.activeSlide - 1); return false; 701 }; 702 } else { 703 if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; } 704 } 705 if (this.activeSlide != (this.slideArray.length - 1)) { 706 var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext')); 707 object.style.display = ''; 708 object.onclick = function() { 709 if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); } 710 myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
711 } 712 } else { 713 if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; } 714 } 715 } else if (this.isLyteframe) { 716 if(this.activeFrame != 0) { 717 var object = this.doc.getElementById('lbPrev2'); 718 object.style.display = ''; 719 object.onclick = function() { 720 myLytebox.changeContent(myLytebox.activeFrame - 1); return false; 721 } 722 } else { 723 this.doc.getElementById('lbPrev2_Off').style.display = ''; 724 } 725 if(this.activeFrame != (this.frameArray.length - 1)) { 726 var object = this.doc.getElementById('lbNext2'); 727 object.style.display = ''; 728 object.onclick = function() { 729 myLytebox.changeContent(myLytebox.activeFrame + 1); return false; 730 } 731 } else { 732 this.doc.getElementById('lbNext2_Off').style.display = ''; 733 } 734 } else { 735 if(this.activeImage != 0) { 736 var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev')); 737 object.style.display = ''; 738 object.onclick = function() { 739 myLytebox.changeContent(myLytebox.activeImage - 1); return false; 740 } 741 } else { 742 if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; } 743 } 744 if(this.activeImage != (this.imageArray.length - 1)) { 745 var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext')); 746 object.style.display = ''; 747 object.onclick = function() { 748 myLytebox.changeContent(myLytebox.activeImage + 1); return false; 749 } 750 } else { 751 if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; } 752 } 753 } 754 this.enableKeyboardNav(); 755}; 756LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; }; 757LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; }; 758LyteBox.prototype.keyboardAction = function(e) { 759 var keycode = key = escape = null; 760 keycode = (e == null) ? event.keyCode : e.which; 761 key = String.fromCharCode(keycode).toLowerCase(); 762 escape = (e == null) ? 27 : e.DOM_VK_ESCAPE; 763 if ((key == 'x') || (key == 'c') || (keycode == escape)) { 764 myLytebox.end(); 765 } else if ((key == 'p') || (keycode == 37)) { 766 if (myLytebox.isSlideshow) { 767 if(myLytebox.activeSlide != 0) { 768 myLytebox.disableKeyboardNav(); 769 myLytebox.changeContent(myLytebox.activeSlide - 1); 770 } 771 } else if (myLytebox.isLyteframe) { 772 if(myLytebox.activeFrame != 0) { 773 myLytebox.disableKeyboardNav(); 774 myLytebox.changeContent(myLytebox.activeFrame - 1); 775 } 776 } else { 777 if(myLytebox.activeImage != 0) { 778 myLytebox.disableKeyboardNav(); 779 myLytebox.changeContent(myLytebox.activeImage - 1); 780 } 781 } 782 } else if ((key == 'n') || (keycode == 39)) { 783 if (myLytebox.isSlideshow) { 784 if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) { 785 myLytebox.disableKeyboardNav(); 786 myLytebox.changeContent(myLytebox.activeSlide + 1); 787 } 788 } else if (myLytebox.isLyteframe) { 789 if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) { 790 myLytebox.disableKeyboardNav(); 791 myLytebox.changeContent(myLytebox.activeFrame + 1); 792 } 793 } else { 794 if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) { 795 myLytebox.disableKeyboardNav(); 796 myLytebox.changeContent(myLytebox.activeImage + 1); 797 } 798 } 799 } 800}; 801LyteBox.prototype.preloadNeighborImages = function() { 802 if (this.isSlideshow) { 803 if ((this.slideArray.length - 1) > this.activeSlide) { 804 preloadNextImage = new Image(); 805 preloadNextImage.src = this.slideArray[this.activeSlide + 1][0]; 806 } 807 if(this.activeSlide > 0) { 808 preloadPrevImage = new Image(); 809 preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0]; 810 } 811 } else { 812 if ((this.imageArray.length - 1) > this.activeImage) { 813 preloadNextImage = new Image(); 814 preloadNextImage.src = this.imageArray[this.activeImage + 1][0]; 815 } 816 if(this.activeImage > 0) { 817 preloadPrevImage = new Image(); 818 preloadPrevImage.src = this.imageArray[this.activeImage - 1][0]; 819 } 820 } 821}; 822LyteBox.prototype.togglePlayPause = function(hideID, showID) { 823 if (this.isSlideshow && hideID == "lbPause") { 824 for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } 825 } 826 this.doc.getElementById(hideID).style.display = 'none'; 827 this.doc.getElementById(showID).style.display = ''; 828 if (hideID == "lbPlay") { 829 this.isPaused = false;
830 if (this.activeSlide == (this.slideArray.length - 1)) { 831 this.end(); 832 } else { 833 this.changeContent(this.activeSlide + 1); 834 } 835 } else { 836 this.isPaused = true; 837 } 838}; 839LyteBox.prototype.end = function(caller) { 840 this.doc.getElementById('objScrollerOuter').style.display = 'none'; 841 var objScrollerImages = this.doc.getElementById('objScrollerImages'); 842 var objScrollerImageChilds = objScrollerImages.childNodes; 843 if ( objScrollerImageChilds.length > 0 ) { 844 while( objScrollerImageChilds.length > 0 ) { 845 objScrollerImages.removeChild( objScrollerImageChilds[0] ); 846 } 847 } 848 var closeClick = (caller == 'slideshow' ? false : true); 849 if (this.isSlideshow && this.isPaused && !closeClick) { return; } 850 this.disableKeyboardNav(); 851 this.doc.getElementById('lbMain').style.display = 'none'; 852 this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0)); 853 this.toggleSelects('visible'); 854 if (this.hideFlash) { this.toggleFlash('visible'); } 855 if (this.isSlideshow) { 856 for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } 857 } 858 if (this.isLyteframe) { 859 this.initialize(); 860 } 861/* lyteflv */ 862 if ( this.doc.getElementById( 'lbImage' ).tagName != 'IMG' ) { 863 var lbImage = this.doc.getElementById( 'lbImage' ); 864 if ( lbImage.length > 0 ) { 865 while( lbImage.length > 0 ) { 866 lbImage.removeChild( lbImage[0] ); 867 } 868 } 869 870 this.doc.getElementById( 'lbImageContainer' ).removeChild( this.doc.getElementById( 'lbImage' ) ); 871 var e = this.doc.createElement( 'img' ); 872 e.setAttribute( 'id', 'lbImage' ); 873 this.doc.getElementById( 'lbImageContainer' ).appendChild( e ); 874 } 875/* lyteflv end */ 876}; 877LyteBox.prototype.checkFrame = function() { 878 if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) { 879 this.isFrame = true; 880 this.lytebox = "window.parent." + window.name + ".myLytebox"; 881 this.doc = parent.document; 882 } else { 883 this.isFrame = false; 884 this.lytebox = "myLytebox"; 885 this.doc = document; 886 } 887}; 888LyteBox.prototype.getPixelRate = function(cur, img) { 889 var diff = (img > cur) ? img - cur : cur - img; 890 if (diff >= 0 && diff <= 100) { return 10; } 891 if (diff > 100 && diff <= 200) { return 15; } 892 if (diff > 200 && diff <= 300) { return 20; } 893 if (diff > 300 && diff <= 400) { return 25; } 894 if (diff > 400 && diff <= 500) { return 30; } 895 if (diff > 500 && diff <= 600) { return 35; } 896 if (diff > 600 && diff <= 700) { return 40; } 897 if (diff > 700) { return 45; } 898}; 899LyteBox.prototype.appear = function(id, opacity) { 900 var object = this.doc.getElementById(id).style; 901 object.opacity = (opacity / 100); 902 object.MozOpacity = (opacity / 100); 903 object.KhtmlOpacity = (opacity / 100); 904 object.filter = "alpha(opacity=" + (opacity + 10) + ")"; 905 if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) { 906 try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */ 907 this.updateDetails(); 908 } else if (opacity >= this.maxOpacity && id == 'lbOverlay') { 909 for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); } 910 return; 911 } else if (opacity >= 100 && id == 'lbDetailsContainer') { 912 try { object.removeAttribute("filter"); } catch(e) {} /* Fix added for IE Alpha Opacity Filter bug. */ 913 for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); } 914 this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px"; 915 } else { 916 if (id == 'lbOverlay') { 917 this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1); 918 } else { 919 this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1); 920 } 921 } 922}; 923LyteBox.prototype.fade = function(id, opacity) { 924 var object = this.doc.getElementById(id).style; 925 object.opacity = (opacity / 100); 926 object.MozOpacity = (opacity / 100); 927 object.KhtmlOpacity = (opacity / 100); 928 object.filter = "alpha(opacity=" + opacity + ")"; 929 if (opacity <= 0) { 930 try { 931 object.display = 'none'; 932 } catch(err) { } 933 } else if (id == 'lbOverlay') { 934 this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1); 935 } else { 936 this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1); 937 } 938}; 939LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) { 940 if (!this.hDone) { 941 this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100); 942 return; 943 } 944 945 var object = this.doc.getElementById(id); 946 var objScrollerImages = this.doc.getElementById('objScrollerImages'); 947 var timer = speed ? speed : (this.resizeDuration/2); 948 var newW = (this.doAnimations ? curW : maxW); 949 object.style.width = (newW) + "px"; 950 951 if (newW < maxW) { 952 newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate; 953 } else if (newW > maxW) { 954 newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate; 955 } 956 957 /* scroller */ 958 if ( this.scrollerDisplay ) { 959 var maxScrollerW = this.scrollerWidth; 960 var foo = maxScrollerW; 961 var objScrollerOuter = this.doc.getElementById('objScrollerOuter'); 962 var scrollerImages = this.doc.getElementById('objScrollerImages').getElementsByTagName( 'img' ); 963 964 if ( this.ie ) { 965 maxScrollerW += parseInt( objScrollerImages.currentStyle.marginLeft, 10 ); 966 maxScrollerW += parseInt( objScrollerImages.currentStyle.marginRight, 10 ); 967 } 968 else { 969 maxScrollerW += parseInt( window.getComputedStyle( objScrollerImages, null ).marginLeft, 10 ); 970 maxScrollerW += parseInt( window.getComputedStyle( objScrollerImages, null ).marginRight, 10 ); 971 } 972 973 if ( newW >= maxScrollerW ) { 974 objScrollerOuter.style.width = newW + "px"; 975 } 976 else { 977 objScrollerOuter.style.width = maxScrollerW + "px"; 978 } 979 } 980 /* scroller end */ 981 982 this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02); 983 if (parseInt(object.style.width) == maxW) { 984 this.wDone = true; 985 for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); } 986 } 987}; 988LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) { 989 var timer = speed ? speed : (this.resizeDuration/2); 990 var object = this.doc.getElementById(id); 991 var newH = (this.doAnimations ? curH : maxH); 992 object.style.height = (newH) + "px"; 993 if (newH < maxH) { 994 newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate; 995 } else if (newH > maxH) { 996 newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate; 997 } 998 this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02); 999 if (parseInt(object.style.height) == maxH) { 1000 this.hDone = true; 1001 for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); } 1002 } 1003}; 1004LyteBox.prototype.getPageScroll = function() { 1005 if (self.pageYOffset) { 1006 return this.isFrame ? parent.pageYOffset : self.pageYOffset; 1007 } else if (this.doc.documentElement && this.doc.documentElement.scrollTop){ 1008 return this.doc.documentElement.scrollTop; 1009 } else if (document.body) { 1010 return this.doc.body.scrollTop; 1011 } 1012}; 1013LyteBox.prototype.getPageSize = function() { 1014 var xScroll, yScroll, windowWidth, windowHeight; 1015 if (window.innerHeight && window.scrollMaxY) { 1016 xScroll = this.doc.scrollWidth;
1017 yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY); 1018 } else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){ 1019 xScroll = this.doc.body.scrollWidth; 1020 yScroll = this.doc.body.scrollHeight; 1021 } else { 1022 xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth; 1023 yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight; 1024 xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll; 1025 yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll; 1026 } 1027 if (self.innerHeight) { 1028 windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth; 1029 windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight; 1030 } else if (document.documentElement && document.documentElement.clientHeight) { 1031 windowWidth = this.doc.documentElement.clientWidth; 1032 windowHeight = this.doc.documentElement.clientHeight; 1033 } else if (document.body) { 1034 windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth; 1035 windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight; 1036 windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth; 1037 windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight; 1038 } 1039 if ( this.scrollerDisplay ) { 1040 if ( this.ie ) { 1041 windowHeight -= parseInt( this.doc.getElementById('objScroller').currentStyle.height, 10 ); 1042 } 1043 else { 1044 windowHeight -= parseInt( window.getComputedStyle( this.doc.getElementById('objScroller'), null ).height, 10 ); 1045 } 1046 } 1047 var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll; 1048 var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll; 1049 return new Array(pageWidth, pageHeight, windowWidth, windowHeight); 1050}; 1051LyteBox.prototype.toggleFlash = function(state) { 1052 var objects = this.doc.getElementsByTagName("object"); 1053 for (var i = 0; i < objects.length; i++) { 1054 objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible'; 1055 } 1056 var embeds = this.doc.getElementsByTagName("embed"); 1057 for (var i = 0; i < embeds.length; i++) { 1058 embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible'; 1059 } 1060 if (this.isFrame) { 1061 for (var i = 0; i < parent.frames.length; i++) { 1062 try { 1063 objects = parent.frames[i].window.document.getElementsByTagName("object"); 1064 for (var j = 0; j < objects.length; j++) { 1065 objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible'; 1066 } 1067 } catch(e) { } 1068 try { 1069 embeds = parent.frames[i].window.document.getElementsByTagName("embed"); 1070 for (var j = 0; j < embeds.length; j++) { 1071 embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible'; 1072 } 1073 } catch(e) { } 1074 } 1075 } 1076}; 1077LyteBox.prototype.toggleSelects = function(state) { 1078 var selects = this.doc.getElementsByTagName("select"); 1079 for (var i = 0; i < selects.length; i++ ) { 1080 selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible'; 1081 } 1082 if (this.isFrame) { 1083 for (var i = 0; i < parent.frames.length; i++) { 1084 try { 1085 selects = parent.frames[i].window.document.getElementsByTagName("select"); 1086 for (var j = 0; j < selects.length; j++) { 1087 selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible'; 1088 } 1089 } catch(e) { } 1090 } 1091 } 1092}; 1093LyteBox.prototype.pause = function(numberMillis) { 1094 var now = new Date(); 1095 var exitTime = now.getTime() + numberMillis; 1096 while (true) { 1097 now = new Date(); 1098 if (now.getTime() > exitTime) { return; } 1099 } 1100}; 1101if (window.addEventListener) { 1102 window.addEventListener("load",initLytebox,false); 1103} else if (window.attachEvent) { 1104 window.attachEvent("onload",initLytebox); 1105} else { 1106 window.onload = function() {initLytebox();} 1107} 1108function initLytebox() { myLytebox = new LyteBox(); }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.