1//**************************************************************************************************/ 2// Lytebox v5.5 3// 4// Author: Markus F. Hay 5// Website: http://lytebox.com (http://dolem.com/lytebox) 6// Date: January 26, 2012 7// License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/) 8//**************************************************************************************************/ 9function Lytebox(bInitialize, aHttp) { 10 /*** Language Configuration ***/ 11 12 // English - configure for your language or customize as needed. 13 // Note that these values will be seen by users when mousing over buttons. 14 this.label = new Object(); 15 this.label['close'] = 'Close (Esc)'; 16 this.label['prev'] = 'Previous (\u2190)'; // Previous (left arrow) 17 this.label['next'] = 'Next (\u2192)'; // Next (right arrow) 18 this.label['play'] = 'Play (spacebar)'; 19 this.label['pause'] = 'Pause (spacebar)'; 20 this.label['print'] = 'Print'; 21 this.label['image'] = 'Image %1 of %2'; // %1 = active image, %2 = total images 22 this.label['page'] = 'Page %1 of %2'; // %1 = active page, %2 = total pages 23 24 25 /*** Configure Lytebox ***/ 26 27 this.theme = (typeof lyteboxTheme !== 'undefined') && /^(black|grey|red|green|blue|gold|orange)$/i.test(lyteboxTheme) ? lyteboxTheme : 'black'; // themes: black (default), grey, red, green, blue, gold, orange 28 this.roundedBorder = false; // controls whether or not the viewer uses rounded corners (false = square corners) 29 this.innerBorder = true; // controls whether to show the inner border around image/html content 30 this.outerBorder = true; // controls whether to show the outer grey (or theme) border 31 this.resizeSpeed = 5; // controls the speed of the image resizing (1=slowest and 10=fastest) 32 this.maxOpacity = 80; // higher opacity = darker overlay, lower opacity = lighter overlay 33 this.borderSize = 12; // if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone... 34 this.appendQS = false; // if true, will append request_from=lytebox to the QS. Use this with caution as it may cause pages to not render 35 this.fixedPosition = this.isMobile() ? false : true; // if true, viewer will remain in a fixed position, otherwise page scrolling will be allowed 36 this.inherit = true; // controls whether or not data-lyte-options are inherited from the first link in a grouped set 37 38 this.__hideObjects = true; // controls whether or not objects (such as Flash, Java, etc.) should be hidden when the viewer opens 39 this.__autoResize = true; // controls whether or not images should be resized if larger than the browser window dimensions 40 this.__doAnimations = true; // controls ALL animation effects (i.e. overlay fade in/out, image resize transition, etc.) 41 this.__animateOverlay = false; // controls ONLY the overlay (background darkening) effects, and whether or not to fade in/out 42 this.__forceCloseClick = false; // if true, users are forced to click on the "Close" button when viewing content 43 this.__refreshPage = false; // force page refresh after closing Lytebox 44 this.__showPrint = false; // true to show print button, false to hide 45 this.__navType = 3; // 1 = "Prev/Next" buttons on top left and left 46 // 2 = "Prev/Next" buttons in navigation bar 47 // 3 = navType_1 + navType_2 (show both) 48 49 // These two options control the position of the title/counter and navigation buttons. Note that for mobile devices, 50 // the title is displayed on top and the navigation on the bottom. This is due to the view area being limited. 51 // You can customize this for non-mobile devices by changing the 2nd condition (: false) to true (: true) 52 this.__navTop = this.isMobile() ? false : false; // true to show the buttons on the top right, false to show them on bottom right (default) 53 this.__titleTop = this.isMobile() ? true : false; // true to show the title on the top left, false to show it on the bottom left (default) 54 55 56 /*** Configure HTML Content / Media Viewer Options ***/ 57 58 this.__width = '80%'; // default width of content viewer 59 this.__height = '80%'; // default height of content viewer 60 this.__scrolling = 'auto'; // controls whether or not scrolling is allowed in the content viewer -- options are auto|yes|no 61 this.__loopPlayback = false; // controls whether or not embedded media is looped (swf, avi, mov, etc.) 62 this.__autoPlay = true;
62 // controls whether or not to autoplay embedded media 63 this.__autoEmbed = true; // controls whether or not to automatically embed media in an object tag 64 65 66 /*** Configure Slideshow Options ***/ 67 68 this.__slideInterval = 4000; // change value (milliseconds) to increase/decrease the time between "slides" 69 this.__showNavigation = false; // true to display Next/Prev buttons/text during slideshow, false to hide 70 this.__showClose = true; // true to display the Close button, false to hide 71 this.__showDetails = true; // true to display image details (caption, count), false to hide 72 this.__showPlayPause = true; // true to display pause/play buttons next to close button, false to hide 73 this.__autoEnd = true; // true to automatically close Lytebox after the last image is reached, false to keep open 74 this.__pauseOnNextClick = false; // true to pause the slideshow when the "Next" button is clicked 75 this.__pauseOnPrevClick = true; // true to pause the slideshow when the "Prev" button is clicked 76 this.__loopSlideshow = false; // true to continuously loop through slides, false otherwise 77 78 79 /*** Configure Event Callbacks ***/ 80 81 this.__beforeStart = ''; // function to call before the viewer starts 82 this.__afterStart = ''; // function to call after the viewer starts 83 this.__beforeEnd = ''; // function to call before the viewer ends (after close click) 84 this.__afterEnd = ''; // function to call after the viewer ends 85 86 87 /*** Configure Lytetip (tooltips) Options ***/ 88 this.__changeTipCursor = true; // true to change the cursor to 'help', false to leave default (inhereted) 89 this.__tipDecoration = 'dotted'; // controls the text-decoration (underline) of the tip link (dotted|solid|none) 90 this.__tipStyle = 'classic'; // sets the default tip style if none is specified via data-lyte-options. Possible values are classic, info, help, warning, error 91 this.__tipRelative = true; // if true, tips will be positioned relative to the element. if false, tips will be absolutely positioned on the page. 92 // if you are having issues with tooltips not being properly positioned, then set this to false 93 94 95 this.navTypeHash = new Object(); 96 this.navTypeHash['Hover_by_type_1'] = true; 97 this.navTypeHash['Display_by_type_1'] = false; 98 this.navTypeHash['Hover_by_type_2'] = false; 99 this.navTypeHash['Display_by_type_2'] = true; 100 this.navTypeHash['Hover_by_type_3'] = true; 101 this.navTypeHash['Display_by_type_3'] = true; 102 this.resizeWTimerArray = new Array(); 103 this.resizeWTimerCount = 0; 104 this.resizeHTimerArray = new Array(); 105 this.resizeHTimerCount = 0; 106 this.changeContentTimerArray= new Array(); 107 this.changeContentTimerCount= 0; 108 this.overlayTimerArray = new Array(); 109 this.overlayTimerCount = 0; 110 this.imageTimerArray = new Array(); 111 this.imageTimerCount = 0; 112 this.timerIDArray = new Array(); 113 this.timerIDCount = 0; 114 this.slideshowIDArray = new Array(); 115 this.slideshowIDCount = 0; 116 this.imageArray = new Array(); 117 this.slideArray = new Array(); 118 this.frameArray = new Array(); 119 this.contentNum = null; 120 this.aPageSize = new Array(); 121 this.overlayLoaded = false; 122 this.checkFrame(); 123 this.isSlideshow = false; 124 this.isLyteframe = false; 125 this.tipSet = false; 126 this.ieVersion = this.ffVersion = this.chromeVersion = this.operaVersion = this.safariVersion = -1; 127 this.ie = this.ff = this.chrome = this.opera = this.safari = false; 128 this.setBrowserInfo(); 129 this.classAttribute = (((this.ie && this.doc.compatMode == 'BackCompat') || (this.ie && this.ieVersion <= 7)) ? 'className' : 'class'); 130 this.classAttribute = (this.ie && (document.documentMode == 8 || document.documentMode == 9)) ? 'class' : this.classAttribute; 131 this.isReady = false; 132 if (bInitialize) { 133 this.http = aHttp; 134 this.bodyOnscroll = document.body.onscroll; 135 if(this.resizeSpeed > 10) { this.resizeSpeed = 10; } 136 if(this.resizeSpeed < 1) { this.resizeSpeed = 1; } 137 var ie8Duration = 2; 138 var isWinXP = (navigator.userAgent.match(/windows nt 5.1/i) || navigator.userAgent.match(/windows nt 5.2/i) ? true : false); 139 this.resizeDuration = (11 - this.resizeSpeed) * (this.ie ? (this.ieVersion >= 9 ? 6 : (this.ieVersion == 8 ? (this.doc.compatMode == 'BackCompat' ? ie8Duration : ie8Duration - 1) : 3)) : 7); 140 this.resizeDuration = this.ff ? (11 - this.resizeSpeed) * (this.ffVersion < 6 ? 3 : (isWinXP ? 6 : 12)) : this.resizeDuration; 141 this.resizeDuration = this.chrome ? (11 - this.resizeSpeed) * 5 : this.resizeDuration; 142 this.resizeDuration = this.safari ? (11 - this.resizeSpeed) * 20 : this.resizeDuration; 143 this.resizeDuration = this.isMobile() ? (11 - this.resizeSpeed) * 2 : this.resizeDuration; 144 if (window.name != 'lbIframe') { 145 this.initialize(); 146 } 147 } else { 148 this.http = new Array(); 149 if (typeof $ == 'undefined') { 150 $ = function (id) { 151 if ($.cache[id] === undefined) {
152 $.cache[id] = document.getElementById(id) || false; 153 } 154 return $.cache[id]; 155 }; 156 $.cache = {}; 157 } 158 } 159} 160Lytebox.prototype.setBrowserInfo = function() { 161 var ua = navigator.userAgent.toLowerCase(); 162 this.chrome = ua.indexOf('chrome') > -1; 163 this.ff = ua.indexOf('firefox') > -1; 164 this.safari = !this.chrome && ua.indexOf('safari') > -1; 165 this.opera = ua.indexOf('opera') > -1; 166 this.ie = /*@cc_on!@*/false; 167 if (this.chrome) { 168 var re = new RegExp("chrome/([0-9]{1,}[\.0-9]{0,})"); 169 if (re.exec(ua) != null) { 170 this.chromeVersion = parseInt( RegExp.$1 ); 171 } 172 } 173 if (this.ff) { 174 var re = new RegExp("firefox/([0-9]{1,}[\.0-9]{0,})"); 175 if (re.exec(ua) != null) { 176 this.ffVersion = parseInt( RegExp.$1 ); 177 } 178 } 179 if (this.ie) { 180 var re = new RegExp("msie ([0-9]{1,}[\.0-9]{0,})"); 181 if (re.exec(ua) != null) { 182 this.ieVersion = parseInt( RegExp.$1 ); 183 } 184 } 185 if (this.opera) { 186 var re = new RegExp("opera/([0-9]{1,}[\.0-9]{0,})"); 187 if (re.exec(ua) != null) { 188 this.operaVersion = parseInt( RegExp.$1 ); 189 } 190 } 191 if (this.safari) { 192 var re = new RegExp("version/([0-9]{1,}[\.0-9]{0,})"); 193 if (re.exec(ua) != null) { 194 this.safariVersion = parseInt( RegExp.$1 ); 195 } 196 } 197}; 198Lytebox.prototype.initialize = function() { 199 this.updateLyteboxItems(); 200 var oBody = this.doc.getElementsByTagName('body').item(0); 201 if (this.doc.$('lbOverlay')) { oBody.removeChild(this.doc.$('lbOverlay')); } 202 if (this.doc.$('lbMain')) { oBody.removeChild(this.doc.$('lbMain')); } 203 if (this.doc.$('lbLauncher')) { oBody.removeChild(this.doc.$('lbLauncher')); } 204 var oLauncher = this.doc.createElement('a'); 205 oLauncher.setAttribute('id','lbLauncher'); 206 oLauncher.setAttribute(this.classAttribute, 'lytebox'); 207 oLauncher.style.display = 'none'; 208 oBody.appendChild(oLauncher); 209 var oOverlay = this.doc.createElement('div'); 210 oOverlay.setAttribute('id','lbOverlay'); 211 oOverlay.setAttribute(this.classAttribute, this.theme); 212 if (this.ie && (this.ieVersion <= 6 || (this.ieVersion <= 9 && this.doc.compatMode == 'BackCompat'))) { 213 oOverlay.style.position = 'absolute'; 214 } 215 oOverlay.style.display = 'none'; 216 oBody.appendChild(oOverlay); 217 var oLytebox = this.doc.createElement('div'); 218 oLytebox.setAttribute('id','lbMain'); 219 oLytebox.style.display = 'none'; 220 oBody.appendChild(oLytebox); 221 var oOuterContainer = this.doc.createElement('div'); 222 oOuterContainer.setAttribute('id','lbOuterContainer'); 223 oOuterContainer.setAttribute(this.classAttribute, this.theme); 224 if (this.roundedBorder) { 225 oOuterContainer.style.MozBorderRadius = '8px'; 226 oOuterContainer.style.borderRadius = '8px'; 227 } 228 oLytebox.appendChild(oOuterContainer); 229 var oTopContainer = this.doc.createElement('div'); 230 oTopContainer.setAttribute('id','lbTopContainer'); 231 oTopContainer.setAttribute(this.classAttribute, this.theme); 232 if (this.roundedBorder) { 233 oTopContainer.style.MozBorderRadius = '8px'; 234 oTopContainer.style.borderRadius = '8px'; 235 } 236 oOuterContainer.appendChild(oTopContainer); 237 var oTopData = this.doc.createElement('div'); 238 oTopData.setAttribute('id','lbTopData'); 239 oTopData.setAttribute(this.classAttribute, this.theme); 240 oTopContainer.appendChild(oTopData); 241 var oTitleTop = this.doc.createElement('span'); 242 oTitleTop.setAttribute('id','lbTitleTop'); 243 oTopData.appendChild(oTitleTop); 244 var oNumTop = this.doc.createElement('span'); 245 oNumTop.setAttribute('id','lbNumTop'); 246 oTopData.appendChild(oNumTop); 247 var oTopNav = this.doc.createElement('div'); 248 oTopNav.setAttribute('id','lbTopNav'); 249 oTopContainer.appendChild(oTopNav); 250 var oCloseTop = this.doc.createElement('a'); 251 oCloseTop.setAttribute('id','lbCloseTop'); 252 oCloseTop.setAttribute('title', this.label['close']); 253 oCloseTop.setAttribute(this.classAttribute, this.theme); 254 oCloseTop.setAttribute('href','javascript:void(0)'); 255 oTopNav.appendChild(oCloseTop); 256 var oPrintTop = this.doc.createElement('a'); 257 oPrintTop.setAttribute('id','lbPrintTop') 258 oPrintTop.setAttribute('title', this.label['print']); 259 oPrintTop.setAttribute(this.classAttribute, this.theme); 260 oPrintTop.setAttribute('href','javascript:void(0)'); 261 oTopNav.appendChild(oPrintTop); 262 var oNextTop = this.doc.createElement('a'); 263 oNextTop.setAttribute('id','lbNextTop'); 264 oNextTop.setAttribute('title', this.label['next']); 265 oNextTop.setAttribute(this.classAttribute, this.theme); 266 oNextTop.setAttribute('href','javascript:void(0)'); 267 oTopNav.appendChild(oNextTop); 268 var oPauseTop = this.doc.createElement('a'); 269 oPauseTop.setAttribute('id','lbPauseTop'); 270 oPauseTop.setAttribute('title', this.label['pause']); 271 oPauseTop.setAttribute(this.classAttribute, this.theme); 272 oPauseTop.setAttribute('href','javascript:void(0)'); 273 oPauseTop.style.display = 'none'; 274 oTopNav.appendChild(oPauseTop); 275 var oPlayTop = this.doc.createElement('a'); 276 oPlayTop.setAttribute('id','lbPlayTop'); 277 oPlayTop.setAttribute('title', this.label['play']); 278 oPlayTop.setAttribute(this.classAttribute, this.theme); 279 oPlayTop.setAttribute('href','javascript:void(0)'); 280 oPlayTop.style.display = 'none'; 281 oTopNav.appendChild(oPlayTop); 282 var oPrevTop = this.doc.createElement('a'); 283 oPrevTop.setAttribute('id','lbPrevTop'); 284 oPrevTop.setAttribute('title', this.label['prev']); 285 oPrevTop.setAttribute(this.classAttribute, this.theme); 286 oPrevTop.setAttribute('href','javascript:void(0)'); 287 oTopNav.appendChild(oPrevTop);
288 var oIframeContainer = this.doc.createElement('div'); 289 oIframeContainer.setAttribute('id','lbIframeContainer'); 290 oIframeContainer.style.display = 'none'; 291 oOuterContainer.appendChild(oIframeContainer); 292 var oIframe = this.doc.createElement('iframe'); 293 oIframe.setAttribute('id','lbIframe'); 294 oIframe.setAttribute('name','lbIframe') 295 oIframe.setAttribute('frameBorder','0'); 296 if (this.innerBorder) { 297 oIframe.setAttribute(this.classAttribute, this.theme); 298 } 299 oIframe.style.display = 'none'; 300 oIframeContainer.appendChild(oIframe); 301 var oImageContainer = this.doc.createElement('div'); 302 oImageContainer.setAttribute('id','lbImageContainer'); 303 oOuterContainer.appendChild(oImageContainer); 304 var oLyteboxImage = this.doc.createElement('img'); 305 oLyteboxImage.setAttribute('id','lbImage'); 306 if (this.innerBorder) { 307 oLyteboxImage.setAttribute(this.classAttribute, this.theme); 308 } 309 oImageContainer.appendChild(oLyteboxImage); 310 var oLoading = this.doc.createElement('div'); 311 oLoading.setAttribute('id','lbLoading'); 312 oLoading.setAttribute(this.classAttribute, this.theme); 313 oOuterContainer.appendChild(oLoading); 314 var oBottomContainer = this.doc.createElement('div'); 315 oBottomContainer.setAttribute('id','lbBottomContainer'); 316 oBottomContainer.setAttribute(this.classAttribute, this.theme); 317 if (this.roundedBorder) { 318 oBottomContainer.style.MozBorderRadius = '8px'; 319 oBottomContainer.style.borderRadius = '8px'; 320 } 321 oOuterContainer.appendChild(oBottomContainer); 322 var oDetailsBottom = this.doc.createElement('div'); 323 oDetailsBottom.setAttribute('id','lbBottomData'); 324 oDetailsBottom.setAttribute(this.classAttribute, this.theme); 325 oBottomContainer.appendChild(oDetailsBottom); 326 var oTitleBottom = this.doc.createElement('span'); 327 oTitleBottom.setAttribute('id','lbTitleBottom'); 328 oDetailsBottom.appendChild(oTitleBottom); 329 var oNumBottom = this.doc.createElement('span'); 330 oNumBottom.setAttribute('id','lbNumBottom'); 331 oDetailsBottom.appendChild(oNumBottom); 332 var oDescBottom = this.doc.createElement('span'); 333 oDescBottom.setAttribute('id','lbDescBottom'); 334 oDetailsBottom.appendChild(oDescBottom); 335 var oHoverNav = this.doc.createElement('div'); 336 oHoverNav.setAttribute('id','lbHoverNav'); 337 oImageContainer.appendChild(oHoverNav); 338 var oBottomNav = this.doc.createElement('div'); 339 oBottomNav.setAttribute('id','lbBottomNav'); 340 oBottomContainer.appendChild(oBottomNav); 341 var oPrevHov = this.doc.createElement('a'); 342 oPrevHov.setAttribute('id','lbPrevHov'); 343 oPrevHov.setAttribute('title', this.label['prev']); 344 oPrevHov.setAttribute(this.classAttribute, this.theme); 345 oPrevHov.setAttribute('href','javascript:void(0)'); 346 oHoverNav.appendChild(oPrevHov); 347 var oNextHov = this.doc.createElement('a'); 348 oNextHov.setAttribute('id','lbNextHov'); 349 oNextHov.setAttribute('title', this.label['next']); 350 oNextHov.setAttribute(this.classAttribute, this.theme); 351 oNextHov.setAttribute('href','javascript:void(0)'); 352 oHoverNav.appendChild(oNextHov); 353 var oClose = this.doc.createElement('a'); 354 oClose.setAttribute('id','lbClose'); 355 oClose.setAttribute('title', this.label['close']); 356 oClose.setAttribute(this.classAttribute, this.theme); 357 oClose.setAttribute('href','javascript:void(0)'); 358 oBottomNav.appendChild(oClose); 359 var oPrint = this.doc.createElement('a'); 360 oPrint.setAttribute('id','lbPrint'); 361 oPrint.setAttribute('title', this.label['print']); 362 oPrint.setAttribute(this.classAttribute, this.theme); 363 oPrint.setAttribute('href','javascript:void(0)'); 364 oPrint.style.display = 'none'; 365 oBottomNav.appendChild(oPrint); 366 var oNext = this.doc.createElement('a'); 367 oNext.setAttribute('id','lbNext'); 368 oNext.setAttribute('title', this.label['next']); 369 oNext.setAttribute(this.classAttribute, this.theme); 370 oNext.setAttribute('href','javascript:void(0)'); 371 oBottomNav.appendChild(oNext); 372 var oPause = this.doc.createElement('a'); 373 oPause.setAttribute('id','lbPause'); 374 oPause.setAttribute('title', this.label['pause']); 375 oPause.setAttribute(this.classAttribute, this.theme); 376 oPause.setAttribute('href','javascript:void(0)'); 377 oPause.style.display = 'none'; 378 oBottomNav.appendChild(oPause); 379 var oPlay = this.doc.createElement('a'); 380 oPlay.setAttribute('id','lbPlay'); 381 oPlay.setAttribute('title', this.label['play']); 382 oPlay.setAttribute(this.classAttribute, this.theme); 383 oPlay.setAttribute('href','javascript:void(0)'); 384 oPlay.style.display = 'none'; 385 oBottomNav.appendChild(oPlay); 386 var oPrev = this.doc.createElement('a'); 387 oPrev.setAttribute('id','lbPrev'); 388 oPrev.setAttribute('title', this.label['prev']); 389 oPrev.setAttribute(this.classAttribute, this.theme); 390 oPrev.setAttribute('href','javascript:void(0)'); 391 oBottomNav.appendChild(oPrev); 392 var iframes = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('iframe') : document.getElementsByTagName('iframe'); 393 for (var i = 0; i < iframes.length; i++) { 394 if (/youtube/i.test(iframes[i].src)) { 395 iframes[i].src += ((/\?/.test(iframes[i].src)) ? '&' : '?') + 'wmode=transparent'; 396 } 397 } 398 this.isReady = true; 399}; 400Lytebox.prototype.updateLyteboxItems = function() { 401 var anchors = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a'); 402 anchors = (this.isFrame) ? anchors : document.getElementsByTagName('a'); 403 var areas = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('area') : document.getElementsByTagName('area'); 404 var lyteLinks = this.combine(anchors, areas); 405 var myLink = relAttribute = revAttribute = classAttribute = dataOptions = dataTip = tipDecoration = tipStyle = tipImage = tipHtml = aSetting = sName = sValue = sExt = aUrl = null; 406 var bImage = bRelative = false;
407 for (var i = 0; i < lyteLinks.length; i++) { 408 myLink = lyteLinks[i]; 409 relAttribute = String(myLink.getAttribute('rel')); 410 classAttribute = String(myLink.getAttribute(this.classAttribute)); 411 if (myLink.getAttribute('href')) { 412 sType = classAttribute.match(/lytebox|lyteshow|lyteframe/i); 413 sType = this.isEmpty(sType) ? relAttribute.match(/lytebox|lyteshow|lyteframe/i) : sType; 414 dataOptions = String(myLink.getAttribute('data-lyte-options')); 415 dataOptions = this.isEmpty(dataOptions) ? String(myLink.getAttribute('rev')) : dataOptions; 416 aUrl = myLink.getAttribute('href').split('?'); 417 sExt = aUrl[0].split('.').pop().toLowerCase(); 418 bImage = (sExt == 'png' || sExt == 'jpg' || sExt == 'jpeg' || sExt == 'gif' || sExt == 'bmp'); 419 if (sType && sType.length >= 1) { 420 if (this.isMobile() && /youtube/i.test(myLink.getAttribute('href'))) { 421 myLink.target = '_blank'; 422 } else if (bImage && (dataOptions.match(/slide:true/i) || sType[0].toLowerCase() == 'lyteshow')) { 423 myLink.onclick = function () { $lb.start(this, true, false); return false; } 424 } else if (bImage) { 425 myLink.onclick = function () { $lb.start(this, false, false); return false; } 426 } else { 427 myLink.onclick = function () { $lb.start(this, false, true); return false; } 428 } 429 } 430 dataTip = String(myLink.getAttribute('data-tip')); 431 dataTip = this.isEmpty(dataTip) ? myLink.getAttribute('title') : dataTip; 432 if (classAttribute.toLowerCase().match('lytetip') && !this.isEmpty(dataTip) && !this.tipsSet) { 433 if (this.__changeTipCursor) { myLink.style.cursor = 'help'; } 434 tipDecoration = this.__tipDecoration; 435 tipStyle = this.__tipStyle; 436 bRelative = this.__tipRelative; 437 if (!this.isEmpty(dataOptions)) { 438 aOptions = dataOptions.split(' '); 439 for (var j = 0; j < aOptions.length; j++) { 440 aSetting = aOptions[j].split(':'); 441 sName = (aSetting.length > 1 ? this.trim(aSetting[0]).toLowerCase() : ''); 442 sValue = (aSetting.length > 1 ? this.trim(aSetting[1]) : ''); 443 switch(sName) { 444 case 'tipstyle': 445 tipStyle = (/classic|info|help|warning|error/.test(sValue) ? sValue : tipStyle); break; 446 case 'changetipcursor': 447 myLink.style.cursor = (/true|false/.test(sValue) ? (sValue == 'true' ? 'help' : '') : myLink.style.cursor); break; 448 case 'tiprelative': 449 bRelative = (/true|false/.test(sValue) ? (sValue == 'true') : bRelative); break; 450 case 'tipdecoration': 451 tipDecoration = (/dotted|solid|none/.test(sValue) ? sValue : tipDecoration); break; 452 } 453 } 454 } 455 if (tipDecoration != 'dotted') { 456 myLink.style.borderBottom = (tipDecoration == 'solid' ? '1px solid' : 'none'); 457 } 458 switch(tipStyle) { 459 case 'info': tipStyle = 'lbCustom lbInfo'; tipImage = 'lbTipImg lbInfoImg'; break; 460 case 'help': tipStyle = 'lbCustom lbHelp'; tipImage = 'lbTipImg lbHelpImg'; break; 461 case 'warning': tipStyle = 'lbCustom lbWarning'; tipImage = 'lbTipImg lbWarningImg'; break; 462 case 'error': tipStyle = 'lbCustom lbError'; tipImage = 'lbTipImg lbErrorImg'; break; 463 case 'classic': tipStyle = 'lbClassic'; tipImage = ''; break; 464 default: tipStyle = 'lbClassic'; tipImage = ''; 465 } 466 if ((this.ie && this.ieVersion <= 7) || (this.ieVersion == 8 && this.doc.compatMode == 'BackCompat')) { 467 tipImage = ''; 468 if (tipStyle != 'lbClassic' && !this.isEmpty(tipStyle)) { 469 tipStyle += ' lbIEFix'; 470 } 471 } 472 var aLinkPos = this.findPos(myLink); 473 if ((this.ie && (this.ieVersion <= 6 || this.doc.compatMode == 'BackCompat')) || bRelative) { 474 myLink.style.position = 'relative'; 475 } 476 tipHtml = myLink.innerHTML; 477 myLink.innerHTML = ''; 478 if ((this.ie && this.ieVersion <= 6 && this.doc.compatMode != 'BackCompat') || bRelative) { 479 myLink.innerHTML = tipHtml + '<span class="' + tipStyle + '">' + (tipImage ? '<div class="' + tipImage + '"></div>' : '') + dataTip + '</span>'; 480 } else { 481 myLink.innerHTML = tipHtml + '<span class="' + tipStyle + '" style="left:'+aLinkPos[0]+'px;top:'+(aLinkPos[1]+aLinkPos[2])+'px;">' + (tipImage ? '<div class="' + tipImage + '"></div>' : '') + dataTip + '</span>'; 482 } 483 if (classAttribute.match(/lytebox|lyteshow|lyteframe/i) == null) { 484 myLink.setAttribute('title',''); 485 } 486 } 487 } 488 } 489 this.tipsSet = true; 490}; 491Lytebox.prototype.launch = function(args) { 492 var sUrl = this.isEmpty(args.url) ? '' : String(args.url); 493 var sOptions = this.isEmpty(args.options) ? '' : String(args.options); 494 var sTitle = this.isEmpty(args.title) ? '' : args.title; 495 var sDesc = this.isEmpty(args.description) ? '' : args.description; 496 var bSlideshow = /slide:true/i.test(sOptions); 497 if (this.isEmpty(sUrl)) { 498 return false;
499 } 500 if (!this.isReady) { 501 this.timerIDArray[this.timerIDCount++] = setTimeout("$lb.launch({ url: '" + sUrl + "', options: '" + sOptions + "', title: '" + sTitle + "', description: '" + sDesc + "' })", 100); 502 return; 503 } else { 504 for (var i = 0; i < this.timerIDCount; i++) { window.clearTimeout(this.timerIDArray[i]); } 505 } 506 var aUrl = sUrl.split('?'); 507 var sExt = aUrl[0].split('.').pop().toLowerCase(); 508 var bImage = (sExt == 'png' || sExt == 'jpg' || sExt == 'jpeg' || sExt == 'gif' || sExt == 'bmp'); 509 var oLauncher = this.doc.$('lbLauncher'); 510 oLauncher.setAttribute('href', sUrl); 511 oLauncher.setAttribute('data-lyte-options', sOptions); 512 oLauncher.setAttribute('data-title', sTitle); 513 oLauncher.setAttribute('data-description', sDesc); 514 this.updateLyteboxItems(); 515 this.start(oLauncher, bSlideshow, (bImage ? false : true)); 516}; 517Lytebox.prototype.start = function(oLink, bSlideshow, bFrame) { 518 var dataOptions = String(oLink.getAttribute('data-lyte-options')); 519 dataOptions = this.isEmpty(dataOptions) ? String(oLink.getAttribute('rev')) : dataOptions; 520 this.setOptions(dataOptions); 521 this.isSlideshow = (bSlideshow ? true : false); 522 this.isLyteframe = (bFrame ? true : false); 523 if (!this.isEmpty(this.beforeStart)) { 524 var callback = window[this.beforeStart]; 525 if (typeof callback === 'function') { 526 if (!callback(this.args)) { return; } 527 } 528 } 529 if (this.ie && this.ieVersion <= 6) { this.toggleSelects('hide'); } 530 if (this.hideObjects) { this.toggleObjects('hide'); } 531 if (this.isFrame && window.parent.frames[window.name].document) { 532 window.parent.$lb.printId = (this.isLyteframe ? 'lbIframe' : 'lbImage'); 533 } else { 534 this.printId = (this.isLyteframe ? 'lbIframe' : 'lbImage'); 535 } 536 this.aPageSize = this.getPageSize(); 537 var objOverlay = this.doc.$('lbOverlay'); 538 var objBody = this.doc.getElementsByTagName("body").item(0); 539 objOverlay.style.height = this.aPageSize[1] + "px"; 540 objOverlay.style.display = ''; 541 this.fadeIn({ id: 'lbOverlay', opacity: (this.doAnimations && this.animateOverlay && (!this.ie || this.ieVersion >= 9) ? 0 : this.maxOpacity) }); 542 var anchors = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a'); 543 anchors = (this.isFrame) ? anchors : document.getElementsByTagName('a'); 544 var areas = (this.isFrame && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getElementsByTagName('area') : document.getElementsByTagName('area'); 545 var lyteLinks = this.combine(anchors, areas); 546 var sType = sExt = aUrl = null; 547 this.frameArray = []; 548 this.frameNum = 0; 549 this.imageArray = []; 550 this.imageNum = 0; 551 this.slideArray = []; 552 this.slideNum = 0; 553 if (this.isEmpty(this.group)) { 554 dataOptions = String(oLink.getAttribute('data-lyte-options')); 555 dataOptions = this.isEmpty(dataOptions) ? String(oLink.getAttribute('rev')) : dataOptions; 556 if (this.isLyteframe) { 557 this.frameArray.push(new Array(oLink.getAttribute('href'), (!this.isEmpty(oLink.getAttribute('data-title')) ? oLink.getAttribute('data-title') : oLink.getAttribute('title')), oLink.getAttribute('data-description'), dataOptions)); 558 } else { 559 this.imageArray.push(new Array(oLink.getAttribute('href'), (!this.isEmpty(oLink.getAttribute('data-title')) ? oLink.getAttribute('data-title') : oLink.getAttribute('title')), oLink.getAttribute('data-description'), dataOptions)); 560 } 561 } else { 562 for (var i = 0; i < lyteLinks.length; i++) { 563 var myLink = lyteLinks[i]; 564 dataOptions = String(myLink.getAttribute('data-lyte-options')); 565 dataOptions = this.isEmpty(dataOptions) ? String(myLink.getAttribute('rev')) : dataOptions; 566 if (myLink.getAttribute('href') && dataOptions.toLowerCase().match('group:' + this.group)) { 567 sType = String(myLink.getAttribute(this.classAttribute)).match(/lytebox|lyteshow|lyteframe/i); 568 sType = this.isEmpty(sType) ? myLink.getAttribute('rel').match(/lytebox|lyteshow|lyteframe/i) : sType; 569 aUrl = myLink.getAttribute('href').split('?'); 570 sExt = aUrl[0].split('.').pop().toLowerCase(); 571 bImage = (sExt == 'png' || sExt == 'jpg' || sExt == 'jpeg' || sExt == 'gif' || sExt == 'bmp'); 572 if (sType && sType.length >= 1) { 573 if (bImage && (dataOptions.match(/slide:true/i) || sType[0].toLowerCase() == 'lyteshow')) { 574 this.slideArray.push(new Array(myLink.getAttribute('href'), (!this.isEmpty(myLink.getAttribute('data-title')) ? myLink.getAttribute('data-title') : myLink.getAttribute('title')), myLink.getAttribute('data-description'), dataOptions)); 575 } else if (bImage) { 576 this.imageArray.push(new Array(myLink.getAttribute('href'), (!this.isEmpty(myLink.getAttribute('data-title')) ? myLink.getAttribute('data-title') : myLink.getAttribute('title')), myLink.getAttribute('data-description'), dataOptions)); 577 } else { 578 this.frameArray.push(new Array(myLink.getAttribute('href'), (!this.isEmpty(myLink.getAttribute('data-title')) ? myLink.getAttribute('data-title') : myLink.getAttribute('title')), myLink.getAttribute('data-description'), dataOptions)); 579 } 580 } 581 } 582 } 583 if (this.isLyteframe) { 584 this.frameArray = this.removeDuplicates(this.frameArray); 585 while(this.frameArray[this.frameNum][0] != oLink.getAttribute('href')) { this.frameNum++; } 586 } else if (bSlideshow) { 587 this.slideArray = this.removeDuplicates(this.slideArray); 588 try { 589 while(this.slideArray[this.slideNum][0] != oLink.getAttribute('href')) { this.slideNum++; } 590 } catch(e) { 591 } 592 } else { 593 this.imageArray = this.removeDuplicates(this.imageArray); 594 while(this.imageArray[this.imageNum][0] != oLink.getAttribute('href')) { this.imageNum++; } 595 } 596 } 597 this.changeContent(this.isLyteframe ? this.frameNum : (this.isSlideshow ? this.slideNum : this.imageNum)); 598}; 599Lytebox.prototype.changeContent = function(iContentNum) { 600 this.contentNum = iContentNum; 601 if (!this.overlayLoaded) { 602 this.changeContentTimerArray[this.changeContentTimerCount++] = setTimeout("$lb.changeContent(" + this.contentNum + ")", 250); 603 return; 604 } else { 605 for (var i = 0; i < this.changeContentTimerCount; i++) { window.clearTimeout(this.changeContentTimerArray[i]); } 606 } 607 var sDataLyteOptions = (this.isLyteframe) ? this.frameArray[this.contentNum][3] : (this.isSlideshow ? this.slideArray[this.contentNum][3] : this.imageArray[this.contentNum][3]); 608 if (!this.inherit || /inherit:false/i.test(sDataLyteOptions)) { 609 this.setOptions(String(sDataLyteOptions)); 610 } else { 611 var sDataLyteOptions1 = String((this.isLyteframe) ? this.frameArray[0][3] : (this.isSlideshow ? this.slideArray[0][3] : this.imageArray[0][3])); 612 if (this.isLyteframe) { 613 var sWidth = sHeight = null; 614 try { sWidth = sDataLyteOptions.match(/width:\d+(%|px|)/i)[0]; } catch(e) { } 615 try { sHeight = sDataLyteOptions.match(/height:\d+(%|px|)/i)[0]; } catch(e) { } 616 if (!this.isEmpty(sWidth)) { 617 sDataLyteOptions1 = sDataLyteOptions1.replace(/width:\d+(%|px|)/i, sWidth); 618 } 619 if (!this.isEmpty(sHeight)) { 620 sDataLyteOptions1 = sDataLyteOptions1.replace(/height:\d+(%|px|)/i, sHeight); 621 } 622 } 623 this.setOptions(sDataLyteOptions1); 624 } 625 var object = this.doc.$('lbMain'); 626 object.style.display = ''; 627 var iDivisor = 40; 628 if (this.autoResize && this.fixedPosition) { 629 if (this.ie && (this.ieVersion <= 7 || this.doc.compatMode == 'BackCompat')) { 630 object.style.top = (this.getPageScroll() + (this.aPageSize[3] / iDivisor)) + "px"; 631 var ps = (this.aPageSize[3] / iDivisor); 632 this.scrollHandler = function(){ 633 $lb.doc.$('lbMain').style.top = ($lb.getPageScroll() + ps) + 'px'; 634 } 635 this.bodyOnscroll = document.body.onscroll; 636 if (window.addEventListener) { 637 window.addEventListener('scroll', this.scrollHandler); 638 } else if (window.attachEvent) { 639 window.attachEvent('onscroll', this.scrollHandler); 640 } 641 object.style.position = "absolute"; 642 } else { 643 object.style.top = ((this.aPageSize[3] / iDivisor)) + "px"; 644 object.style.position = "fixed"; 645 } 646 } else { 647 object.style.position = "absolute"; 648 object.style.top = (this.getPageScroll() + (this.aPageSize[3] / iDivisor)) + "px"; 649 } 650 this.doc.$('lbOuterContainer').style.paddingBottom = '0'; 651 if (!this.outerBorder) { 652 this.doc.$('lbOuterContainer').style.border = 'none'; 653 } else { 654 this.doc.$('lbOuterContainer').setAttribute(this.classAttribute, this.theme); 655 } 656 if (this.forceCloseClick) { 657 this.doc.$('lbOverlay').onclick = ''; 658 } else { 659 this.doc.$('lbOverlay').onclick = function() { $lb.end(); return false; } 660 } 661 this.doc.$('lbMain').onclick = function(e) { 662 var e = e; 663 if (!e) { 664 if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) { 665 e = window.parent.window.event; 666 } else { 667 e = window.event; 668 } 669 } 670 var id = (e.target ? e.target.id : e.srcElement.id); 671 if ((id == 'lbMain') && (!$lb.forceCloseClick)) { $lb.end(); return false; } 672 } 673 this.doc.$('lbPrintTop').onclick = this.doc.$('lbPrint').onclick = function() { $lb.printWindow(); return false; } 674 this.doc.$('lbCloseTop').onclick = this.doc.$('lbClose').onclick = function() { $lb.end(); return false; } 675 this.doc.$('lbPauseTop').onclick = function() { $lb.togglePlayPause("lbPauseTop", "lbPlayTop"); return false; } 676 this.doc.$('lbPause').onclick = function() { $lb.togglePlayPause("lbPause", "lbPlay"); return false; } 677 this.doc.$('lbPlayTop').onclick = function() { $lb.togglePlayPause("lbPlayTop", "lbPauseTop"); return false; } 678 this.doc.$('lbPlay').onclick = function() { $lb.togglePlayPause("lbPlay", "lbPause"); return false; } 679 if (this.isSlideshow && this.showPlayPause && this.isPaused) { 680 this.doc.$('lbPlay').style.display = ''; 681 this.doc.$('lbPause').style.display = 'none'; 682 } 683 if (this.isSlideshow) { 684 for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } 685 } 686 if (!this.outerBorder) { 687 this.doc.$('lbOuterContainer').style.border = 'none'; 688 } else { 689 this.doc.$('lbOuterContainer').setAttribute(this.classAttribute, this.theme); 690 } 691 var iDecreaseMargin = 10; 692 if (this.titleTop || this.navTop) { 693 this.doc.$('lbTopContainer').style.visibility = 'hidden'; 694 iDecreaseMargin += this.doc.$('lbTopContainer').offsetHeight; 695 } else { 696 this.doc.$('lbTopContainer').style.display = 'none'; 697 } 698 this.doc.$('lbBottomContainer').style.display = 'none'; 699 this.doc.$('lbImage').style.display = 'none'; 700 this.doc.$('lbIframe').style.display = 'none'; 701 this.doc.$('lbPrevHov').style.display = 'none'; 702 this.doc.$('lbNextHov').style.display = 'none'; 703 this.doc.$('lbIframeContainer').style.display = 'none'; 704 this.doc.$('lbLoading').style.marginTop = '-' + iDecreaseMargin + 'px'; 705 this.doc.$('lbLoading').style.display = ''; 706 if (this.isLyteframe) { 707 var iframe = $lb.doc.$('lbIframe'); 708 iframe.src = 'about:blank'; 709 var w = this.trim(this.width);
710 var h = this.trim(this.height); 711 if (/\%/.test(w)) { 712 var percent = parseInt(w); 713 w = parseInt((this.aPageSize[2]-50)*percent/100); 714 w = w+'px'; 715 } 716 if (/\%/.test(h)) { 717 var percent = parseInt(h); 718 h = parseInt((this.aPageSize[3]-150)*percent/100); 719 h = h+'px'; 720 } 721 if (this.autoResize) { 722 var x = this.aPageSize[2] - 50; 723 var y = this.aPageSize[3] - 150; 724 w = (parseInt(w) > x ? x : w) + 'px'; 725 h = (parseInt(h) > y ? y : h) + 'px'; 726 } 727 iframe.height = this.height = h; 728 iframe.width = this.width = w; 729 iframe.scrolling = this.scrolling; 730 var oDoc = iframe.contentWindow || iframe.contentDocument; 731 try { 732 if (oDoc.document) { 733 oDoc = oDoc.document; 734 } 735 oDoc.body.style.margin = 0; 736 oDoc.body.style.padding = 0; 737 if (this.ie && this.ieVersion <= 8) { 738 oDoc.body.scroll = this.scrolling; 739 oDoc.body.overflow = this.scrolling = 'no' ? 'hidden' : 'auto'; 740 } 741 } catch(e) { } 742 this.resizeContainer(parseInt(this.width), parseInt(this.height)); 743 } else { 744 this.imgPreloader = new Image(); 745 this.imgPreloader.onload = function() { 746 var imageWidth = $lb.imgPreloader.width; 747 var imageHeight = $lb.imgPreloader.height; 748 if ($lb.autoResize) { 749 var x = $lb.aPageSize[2] - 50; 750 var y = $lb.aPageSize[3] - 150; 751 if (imageWidth > x) { 752 imageHeight = Math.round(imageHeight * (x / imageWidth)); 753 imageWidth = x; 754 if (imageHeight > y) { 755 imageWidth = Math.round(imageWidth * (y / imageHeight)); 756 imageHeight = y; 757 } 758 } else if (imageHeight > y) { 759 imageWidth = Math.round(imageWidth * (y / imageHeight)); 760 imageHeight = y; 761 if (imageWidth > x) { 762 imageHeight = Math.round(imageHeight * (x / imageWidth)); 763 imageWidth = x; 764 } 765 } 766 } 767 var lbImage = $lb.doc.$('lbImage'); 768 lbImage.src = $lb.imgPreloader.src; 769 lbImage.width = imageWidth; 770 lbImage.height = imageHeight; 771 $lb.resizeContainer(imageWidth, imageHeight); 772 $lb.imgPreloader.onload = function() {}; 773 } 774 this.imgPreloader.src = (this.isSlideshow ? this.slideArray[this.contentNum][0] : this.imageArray[this.contentNum][0]); 775 } 776}; 777Lytebox.prototype.resizeContainer = function(iWidth, iHeight) { 778 this.resizeWidth = iWidth; 779 this.resizeHeight = iHeight; 780 this.wCur = this.doc.$('lbOuterContainer').offsetWidth; 781 this.hCur = this.doc.$('lbOuterContainer').offsetHeight; 782 this.xScale = ((this.resizeWidth + (this.borderSize * 2)) / this.wCur) * 100; 783 this.yScale = ((this.resizeHeight + (this.borderSize * 2)) / this.hCur) * 100; 784 var wDiff = (this.wCur - this.borderSize * 2) - this.resizeWidth; 785 var hDiff = (this.hCur - this.borderSize * 2) - this.resizeHeight; 786 this.wDone = (wDiff == 0); 787 if (!(hDiff == 0)) { 788 this.hDone = false; 789 this.resizeH('lbOuterContainer', this.hCur, this.resizeHeight + this.borderSize * 2, this.getPixelRate(this.hCur, this.resizeHeight)); 790 } else { 791 this.hDone = true; 792 if (!this.wDone) { 793 this.resizeW('lbOuterContainer', this.wCur, this.resizeWidth + this.borderSize * 2, this.getPixelRate(this.wCur, this.resizeWidth)); 794 } 795 } 796 if ((hDiff == 0) && (wDiff == 0)) { 797 if (this.ie){ this.pause(250); } else { this.pause(100); } 798 } 799 this.doc.$('lbPrevHov').style.height = this.resizeHeight + "px"; 800 this.doc.$('lbNextHov').style.height = this.resizeHeight + "px"; 801 if (this.hDone && this.wDone) { 802 if (this.isLyteframe) { 803 this.loadContent(); 804 } else { 805 this.showContent(); 806 } 807 } 808}; 809Lytebox.prototype.loadContent = function() { 810 try { 811 var iframe = this.doc.$('lbIframe'); 812 var uri = this.frameArray[this.contentNum][0];
813 if (!this.inline && this.appendQS) { 814 uri += ((/\?/.test(uri)) ? '&' : '?') + 'request_from=lytebox'; 815 } 816 if (this.autoPlay && /youtube/i.test(uri)) { 817 uri += ((/\?/.test(uri)) ? '&' : '?') + 'autoplay=1'; 818 } 819 if (!this.autoEmbed || (this.ff && (uri.match(/.pdf|.mov|.wmv/i)))) { 820 this.frameSource = uri; 821 this.showContent(); 822 return; 823 } 824 if (this.ie) { 825 iframe.onreadystatechange = function() { 826 if ($lb.doc.$('lbIframe').readyState == "complete") { 827 $lb.showContent(); 828 $lb.doc.$('lbIframe').onreadystatechange = null; 829 } 830 }; 831 } else { 832 iframe.onload = function() { 833 $lb.showContent(); 834 $lb.doc.$('lbIframe').onload = null; 835 }; 836 } 837 if (this.inline || (uri.match(/.mov|.avi|.wmv|.mpg|.mpeg|.swf/i))) { 838 iframe.src = 'about:blank'; 839 this.frameSource = ''; 840 var sHtml = (this.inline) ? this.doc.$(uri.substr(uri.indexOf('#') + 1, uri.length)).innerHTML : this.buildObject(parseInt(this.width), parseInt(this.height), uri); 841 var oDoc = iframe.contentWindow || iframe.contentDocument; 842 if (oDoc.document) { 843 oDoc = oDoc.document; 844 } 845 oDoc.open(); 846 oDoc.write(sHtml); 847 oDoc.close(); 848 oDoc.body.style.margin = 0; 849 oDoc.body.style.padding = 0;
850 if (!this.inline) { 851 oDoc.body.style.backgroundColor = '#fff'; 852 oDoc.body.style.fontFamily = 'Verdana, Helvetica, sans-serif'; 853 oDoc.body.style.fontSize = '0.9em'; 854 } 855 this.frameSource = ''; 856 } else { 857 this.frameSource = uri; 858 iframe.src = uri; 859 } 860 } catch(e) { } 861}; 862Lytebox.prototype.showContent = function() { 863 if (this.isSlideshow) { 864 if(this.contentNum == (this.slideArray.length - 1)) { 865 if (this.loopSlideshow) { 866 this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("$lb.changeContent(0)", this.slideInterval); 867 } else if (this.autoEnd) { 868 this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("$lb.end('slideshow')", this.slideInterval); 869 } 870 } else { 871 if (!this.isPaused) { 872 this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("$lb.changeContent("+(this.contentNum+1)+")", this.slideInterval); 873 } 874 } 875 this.doc.$('lbHoverNav').style.display = (this.ieVersion != 6 && this.showNavigation && this.navTypeHash['Hover_by_type_' + this.navType] ? '' : 'none'); 876 this.doc.$('lbCloseTop').style.display = (this.showClose && this.navTop ? '' : 'none'); 877 this.doc.$('lbClose').style.display = (this.showClose && !this.navTop ? '' : 'none');
878 this.doc.$('lbBottomData').style.display = (this.showDetails ? '' : 'none'); 879 this.doc.$('lbPauseTop').style.display = (this.showPlayPause && this.navTop ? (!this.isPaused ? '' : 'none') : 'none'); 880 this.doc.$('lbPause').style.display = (this.showPlayPause && !this.navTop ? (!this.isPaused ? '' : 'none') : 'none'); 881 this.doc.$('lbPlayTop').style.display = (this.showPlayPause && this.navTop ? (!this.isPaused ? 'none' : '') : 'none'); 882 this.doc.$('lbPlay').style.display = (this.showPlayPause && !this.navTop ? (!this.isPaused ? 'none' : '') : 'none'); 883 this.doc.$('lbPrevTop').style.display = (this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none'); 884 this.doc.$('lbPrev').style.display = (!this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none'); 885 this.doc.$('lbNextTop').style.display = (this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none'); 886 this.doc.$('lbNext').style.display = (!this.navTop && this.showNavigation && this.navTypeHash['Display_by_type_' + this.navType] ? '' : 'none'); 887 } else { 888 this.doc.$('lbHoverNav').style.display = (this.ieVersion != 6 && this.navTypeHash['Hover_by_type_' + this.navType] && !this.isLyteframe ? '' : 'none'); 889 if ((this.navTypeHash['Display_by_type_' + this.navType] && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) { 890 this.doc.$('lbPrevTop').style.display = (this.navTop ? '' : 'none'); 891 this.doc.$('lbPrev').style.display = (!this.navTop ? '' : 'none'); 892 this.doc.$('lbNextTop').style.display = (this.navTop ? '' : 'none'); 893 this.doc.$('lbNext').style.display = (!this.navTop ? '' : 'none'); 894 } else { 895 this.doc.$('lbPrevTop').style.display = 'none'; 896 this.doc.$('lbPrev').style.display = 'none'; 897 this.doc.$('lbNextTop').style.display = 'none'; 898 this.doc.$('lbNext').style.display = 'none'; 899 } 900 this.doc.$('lbCloseTop').style.display = (this.navTop ? '' : 'none'); 901 this.doc.$('lbClose').style.display = (!this.navTop ? '' : 'none'); 902 this.doc.$('lbBottomData').style.display = ''; 903 this.doc.$('lbPauseTop').style.display = 'none'; 904 this.doc.$('lbPause').style.display = 'none'; 905 this.doc.$('lbPlayTop').style.display = 'none'; 906 this.doc.$('lbPlay').style.display = 'none'; 907 } 908 this.doc.$('lbPrintTop').style.display = (this.showPrint && this.navTop ? '' : 'none'); 909 this.doc.$('lbPrint').style.display = (this.showPrint && !this.navTop ? '' : 'none'); 910 this.updateDetails(); 911 this.doc.$('lbLoading').style.display = 'none'; 912 this.doc.$('lbImageContainer').style.display = (this.isLyteframe ? 'none' : ''); 913 this.doc.$('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none'); 914 if (this.isLyteframe) { 915 if (!this.isEmpty(this.frameSource)) { 916 this.doc.$('lbIframe').src = this.frameSource; 917 } 918 this.doc.$('lbIframe').style.display = ''; 919 this.fadeIn({ id: 'lbIframe', opacity: (this.doAnimations && (!this.ie || this.ieVersion >= 9) ? 0 : 100) }); 920 } else { 921 this.doc.$('lbImage').style.display = ''; 922 this.fadeIn({ id: 'lbImage', opacity: (this.doAnimations && (!this.ie || this.ieVersion >= 9) ? 0 : 100) }); 923 this.preloadNeighborImages(); 924 } 925 if (!this.isEmpty(this.afterStart)) { 926 var callback = window[this.afterStart]; 927 if (typeof callback === 'function') { 928 callback(this.args); 929 } 930 } 931}; 932Lytebox.prototype.updateDetails = function() { 933 var sTitle = (this.isSlideshow ? this.slideArray[this.contentNum][1] : (this.isLyteframe ? this.frameArray[this.contentNum][1] : this.imageArray[this.contentNum][1])); 934 var sDesc = (this.isSlideshow ? this.slideArray[this.contentNum][2] : (this.isLyteframe ? this.frameArray[this.contentNum][2] : this.imageArray[this.contentNum][2])); 935 if (this.ie && this.ieVersion <= 7 || (this.ieVersion >= 8 && this.doc.compatMode == 'BackCompat')) { 936 this.doc.$(this.titleTop ? 'lbTitleBottom' : 'lbTitleTop').style.display = 'none'; 937 this.doc.$(this.titleTop ? 'lbTitleTop' : 'lbTitleBottom').style.display = (this.isEmpty(sTitle) ? 'none' : 'block'); 938 } 939 this.doc.$('lbDescBottom').style.display = (this.isEmpty(sDesc) ? 'none' : ''); 940 this.doc.$(this.titleTop ? 'lbTitleTop' : 'lbTitleBottom').innerHTML = (this.isEmpty(sTitle) ? '' : sTitle); 941 this.doc.$(this.titleTop ? 'lbTitleBottom' : 'lbTitleTop').innerHTML = ''; 942 this.doc.$(this.titleTop ? 'lbNumBottom' : 'lbNumTop').innerHTML = ''; 943 this.updateNav(); 944 if (this.titleTop || this.navTop) { 945 this.doc.$('lbTopContainer').style.display = 'block'; 946 this.doc.$('lbTopContainer').style.visibility = 'visible'; 947 } else { 948 this.doc.$('lbTopContainer').style.display = 'none'; 949 } 950 var object = (this.titleTop ? this.doc.$('lbNumTop') : this.doc.$('lbNumBottom')); 951 if (this.isSlideshow && this.slideArray.length > 1) { 952 object.innerHTML = this.label['image'].replace('%1', this.contentNum + 1).replace('%2', this.slideArray.length); 953 } else if (this.imageArray.length > 1 && !this.isLyteframe) { 954 object.innerHTML = this.label['image'].replace('%1', this.contentNum + 1).replace('%2', this.imageArray.length); 955 } else if (this.frameArray.length > 1 && this.isLyteframe) { 956 object.innerHTML = this.label['page'].replace('%1', this.contentNum + 1).replace('%2', this.frameArray.length); 957 } else { 958 object.innerHTML = ''; 959 } 960 var bAddSpacer = !(this.titleTop || (this.isEmpty(sTitle) && this.isEmpty(object.innerHTML))); 961 this.doc.$('lbDescBottom').innerHTML = (this.isEmpty(sDesc) ? '' : (bAddSpacer ? '<br style="line-height:0.6em;" />' : '') + sDesc); 962 var iNavWidth = 0; 963 if (this.ie && this.ieVersion <= 7 || (this.ieVersion >= 8 && this.doc.compatMode == 'BackCompat')) {
964 iNavWidth = 39 + (this.showPrint ? 39 : 0) + (this.isSlideshow && this.showPlayPause ? 39 : 0); 965 if ((this.isSlideshow && this.slideArray.length > 1 && this.showNavigation && this.navType != 1) || 966 (this.frameArray.length > 1 && this.isLyteframe) || 967 (this.imageArray.length > 1 && !this.isLyteframe && this.navType != 1)) { 968 iNavWidth += 39*2; 969 } 970 } 971 this.doc.$('lbBottomContainer').style.display = (!(this.titleTop && this.navTop) || !this.isEmpty(sDesc) ? 'block' : 'none'); 972 if (this.titleTop && this.navTop) { 973 if (iNavWidth > 0) { 974 this.doc.$('lbTopNav').style.width = iNavWidth + 'px'; 975 } 976 this.doc.$('lbTopData').style.width = (this.doc.$('lbTopContainer').offsetWidth - this.doc.$('lbTopNav').offsetWidth - 15) + 'px'; 977 if (!this.isEmpty(sDesc)) { 978 this.doc.$('lbDescBottom').style.width = (this.doc.$('lbBottomContainer').offsetWidth - 15) + 'px'; 979 } 980 } else if ((!this.titleTop || !this.isEmpty(sDesc)) && !this.navTop) { 981 if (iNavWidth > 0) { 982 this.doc.$('lbBottomNav').style.width = iNavWidth + 'px'; 983 } 984 this.doc.$('lbBottomData').style.width = (this.doc.$('lbBottomContainer').offsetWidth - this.doc.$('lbBottomNav').offsetWidth - 15) + 'px'; 985 this.doc.$('lbDescBottom').style.width = this.doc.$('lbBottomData').style.width; 986 } 987 this.fixBottomPadding(); 988 this.aPageSize = this.getPageSize(); 989 var iMainTop = parseInt(this.doc.$('lbMain').style.top); 990 if ((this.ie && this.ieVersion <= 7) || (this.ieVersion >= 8 && this.doc.compatMode == 'BackCompat')) { 991 iMainTop = (this.ie ? parseInt(this.doc.$('lbMain').style.top) - this.getPageScroll() : parseInt(this.doc.$('lbMain').style.top)); 992 } 993 var iOverlap = (this.doc.$('lbOuterContainer').offsetHeight + iMainTop) - this.aPageSize[3]; 994 var iDivisor = 40; 995 if (iOverlap > 0 && this.autoResize && this.fixedPosition) { 996 if (this.ie && (this.ieVersion <= 7 || this.doc.compatMode == 'BackCompat')) { 997 document.body.onscroll = this.bodyOnscroll; 998 if (window.removeEventListener) { 999 window.removeEventListener('scroll', this.scrollHandler); 1000 } else if (window.detachEvent) { 1001 window.detachEvent('onscroll', this.scrollHandler); 1002 } 1003 } 1004 this.doc.$('lbMain').style.position = "absolute"; 1005 this.doc.$('lbMain').style.top = (this.getPageScroll() + (this.aPageSize[3] / iDivisor)) + "px"; 1006 } 1007}; 1008Lytebox.prototype.updateNav = function() { 1009 if (this.isSlideshow) { 1010 if (this.contentNum != 0) { 1011 if (this.navTypeHash['Display_by_type_' + this.navType] && this.showNavigation) { 1012 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').setAttribute(this.classAttribute, this.theme); 1013 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').style.display = ''; 1014 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').onclick = function() { 1015 if ($lb.pauseOnPrevClick) { $lb.togglePlayPause($lb.navTop ? 'lbPauseTop' : 'lbPause', $lb.navTop ? 'lbPlayTop' : 'lbPlay'); } 1016 $lb.changeContent($lb.contentNum - 1); return false; 1017 } 1018 } 1019 if (this.navTypeHash['Hover_by_type_' + this.navType]) { 1020 var object = this.doc.$('lbPrevHov'); 1021 object.style.display = ''; 1022 object.onclick = function() { 1023 if ($lb.pauseOnPrevClick) { $lb.togglePlayPause($lb.navTop ? 'lbPauseTop' : 'lbPause', $lb.navTop ? 'lbPlayTop' : 'lbPlay'); } 1024 $lb.changeContent($lb.contentNum - 1); return false; 1025 } 1026 } 1027 } else { 1028 if (this.navTypeHash['Display_by_type_' + this.navType]) { 1029 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').setAttribute(this.classAttribute, this.theme + 'Off'); 1030 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').onclick = function() { return false; } 1031 } 1032 } 1033 if (this.contentNum != (this.slideArray.length - 1) && this.showNavigation) { 1034 if (this.navTypeHash['Display_by_type_' + this.navType]) { 1035 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').setAttribute(this.classAttribute, this.theme); 1036 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').style.display = ''; 1037 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').onclick = function() { 1038 if ($lb.pauseOnNextClick) { $lb.togglePlayPause($lb.navTop ? 'lbPauseTop' : 'lbPause', $lb.navTop ? 'lbPlayTop' : 'lbPlay'); } 1039 $lb.changeContent($lb.contentNum + 1); return false;
1040 } 1041 } 1042 if (this.navTypeHash['Hover_by_type_' + this.navType]) { 1043 var object = this.doc.$('lbNextHov'); 1044 object.style.display = ''; 1045 object.onclick = function() { 1046 if ($lb.pauseOnNextClick) { $lb.togglePlayPause($lb.navTop ? 'lbPauseTop' : 'lbPause', $lb.navTop ? 'lbPlayTop' : 'lbPlay'); } 1047 $lb.changeContent($lb.contentNum + 1); return false; 1048 } 1049 } 1050 } else { 1051 if (this.navTypeHash['Display_by_type_' + this.navType]) { 1052 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').setAttribute(this.classAttribute, this.theme + 'Off'); 1053 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').onclick = function() { return false; } 1054 } 1055 } 1056 } else if (this.isLyteframe) { 1057 if(this.contentNum != 0) { 1058 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').setAttribute(this.classAttribute, this.theme); 1059 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').style.display = ''; 1060 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').onclick = function() { 1061 $lb.changeContent($lb.contentNum - 1); return false; 1062 } 1063 } else { 1064 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').setAttribute(this.classAttribute, this.theme + 'Off'); 1065 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').onclick = function() { return false; } 1066 } 1067 if(this.contentNum != (this.frameArray.length - 1)) { 1068 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').setAttribute(this.classAttribute, this.theme); 1069 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').style.display = ''; 1070 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').onclick = function() { 1071 $lb.changeContent($lb.contentNum + 1); return false; 1072 } 1073 } else { 1074 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').setAttribute(this.classAttribute, this.theme + 'Off'); 1075 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').onclick = function() { return false; } 1076 } 1077 } else { 1078 if(this.contentNum != 0) { 1079 if (this.navTypeHash['Display_by_type_' + this.navType]) { 1080 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').setAttribute(this.classAttribute, this.theme); 1081 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').style.display = ''; 1082 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').onclick = function() { 1083 $lb.changeContent($lb.contentNum - 1); return false; 1084 } 1085 } 1086 if (this.navTypeHash['Hover_by_type_' + this.navType]) { 1087 var object2 = this.doc.$('lbPrevHov'); 1088 object2.style.display = ''; 1089 object2.onclick = function() { 1090 $lb.changeContent($lb.contentNum - 1); return false; 1091 } 1092 } 1093 } else { 1094 if (this.navTypeHash['Display_by_type_' + this.navType]) { 1095 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').setAttribute(this.classAttribute, this.theme + 'Off'); 1096 this.doc.$(this.navTop ? 'lbPrevTop' : 'lbPrev').onclick = function() { return false; } 1097 } 1098 } 1099 if(this.contentNum != (this.imageArray.length - 1)) { 1100 if (this.navTypeHash['Display_by_type_' + this.navType]) { 1101 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').setAttribute(this.classAttribute, this.theme); 1102 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').style.display = ''; 1103 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').onclick = function() { 1104 $lb.changeContent($lb.contentNum + 1); return false; 1105 } 1106 } 1107 if (this.navTypeHash['Hover_by_type_' + this.navType]) { 1108 var object2 = this.doc.$('lbNextHov'); 1109 object2.style.display = ''; 1110 object2.onclick = function() { 1111 $lb.changeContent($lb.contentNum + 1); return false; 1112 } 1113 } 1114 } else { 1115 if (this.navTypeHash['Display_by_type_' + this.navType]) { 1116 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').setAttribute(this.classAttribute, this.theme + 'Off'); 1117 this.doc.$(this.navTop ? 'lbNextTop' : 'lbNext').onclick = function() { return false; } 1118 } 1119 } 1120 } 1121 this.enableKeyboardNav(); 1122}; 1123Lytebox.prototype.fixBottomPadding = function() { 1124 if (!((this.ieVersion == 7 || this.ieVersion == 8 || this.ieVersion == 9) && this.doc.compatMode == 'BackCompat') && this.ieVersion != 6) { 1125 var titleHeight = this.doc.$('lbTopContainer').offsetHeight + 5; 1126 var offsetHeight = (titleHeight == 5 ? 0 : titleHeight) + this.doc.$('lbBottomContainer').offsetHeight; 1127 this.doc.$('lbOuterContainer').style.paddingBottom = (offsetHeight + 5) + 'px'; 1128 } 1129}; 1130Lytebox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; }; 1131Lytebox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; }; 1132Lytebox.prototype.keyboardAction = function(e) { 1133 var keycode = key = escape = null; 1134 keycode = (e == null) ? event.keyCode : e.which; 1135 key = String.fromCharCode(keycode).toLowerCase(); 1136 escape = (e == null) ? 27 : e.DOM_VK_ESCAPE; 1137 if ((key == 'x') || (key == 'c') || (keycode == escape || keycode == 27)) { 1138 parent.$lb.end(); 1139 } else if (keycode == 32 && $lb.isSlideshow && $lb.showPlayPause) { 1140 if ($lb.isPaused) {
1141 $lb.togglePlayPause($lb.navTop ? 'lbPlayTop' : 'lbPlay', $lb.navTop ? 'lbPauseTop' : 'lbPause'); 1142 } else { 1143 $lb.togglePlayPause($lb.navTop ? 'lbPauseTop' : 'lbPause', $lb.navTop ? 'lbPlayTop' : 'lbPlay'); 1144 } 1145 return false; 1146 } else if (key == 'p' || keycode == 37) { 1147 if ($lb.isSlideshow) { 1148 if($lb.contentNum != 0) { 1149 $lb.disableKeyboardNav(); 1150 $lb.changeContent($lb.contentNum - 1); 1151 } 1152 } else if ($lb.isLyteframe) { 1153 if($lb.contentNum != 0) { 1154 $lb.disableKeyboardNav(); 1155 $lb.changeContent($lb.contentNum - 1); 1156 } 1157 } else { 1158 if($lb.contentNum != 0) { 1159 $lb.disableKeyboardNav(); 1160 $lb.changeContent($lb.contentNum - 1); 1161 } 1162 } 1163 } else if (key == 'n' || keycode == 39) { 1164 if ($lb.isSlideshow) { 1165 if($lb.contentNum != ($lb.slideArray.length - 1)) { 1166 $lb.disableKeyboardNav(); 1167 $lb.changeContent($lb.contentNum + 1); 1168 } 1169 } else if ($lb.isLyteframe) { 1170 if($lb.contentNum != ($lb.frameArray.length - 1)) { 1171 $lb.disableKeyboardNav(); 1172 $lb.changeContent($lb.contentNum + 1); 1173 } 1174 } else { 1175 if($lb.contentNum != ($lb.imageArray.length - 1)) { 1176 $lb.disableKeyboardNav(); 1177 $lb.changeContent($lb.contentNum + 1); 1178 } 1179 } 1180 } 1181}; 1182Lytebox.prototype.preloadNeighborImages = function() { 1183 if (this.isSlideshow) { 1184 if ((this.slideArray.length - 1) > this.contentNum) { 1185 var preloadNextImage = new Image(); 1186 preloadNextImage.src = this.slideArray[this.contentNum + 1][0]; 1187 } 1188 if (this.contentNum > 0) { 1189 var preloadPrevImage = new Image(); 1190 preloadPrevImage.src = this.slideArray[this.contentNum - 1][0]; 1191 } 1192 } else { 1193 if ((this.imageArray.length - 1) > this.contentNum) { 1194 var preloadNextImage = new Image(); 1195 preloadNextImage.src = this.imageArray[this.contentNum + 1][0]; 1196 } 1197 if (this.contentNum > 0) { 1198 var preloadPrevImage = new Image(); 1199 preloadPrevImage.src = this.imageArray[this.contentNum - 1][0]; 1200 } 1201 } 1202}; 1203Lytebox.prototype.togglePlayPause = function(sHideId, sShowId) { 1204 if (this.isSlideshow && (sHideId == 'lbPauseTop' || sHideId == 'lbPause')) { 1205 for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } 1206 } 1207 this.doc.$(sHideId).style.display = 'none'; 1208 this.doc.$(sShowId).style.display = ''; 1209 if (sHideId == 'lbPlayTop' || sHideId == 'lbPlay') { 1210 this.isPaused = false; 1211 if (this.contentNum == (this.slideArray.length - 1)) { 1212 if (this.loopSlideshow) { 1213 this.changeContent(0); 1214 } else if (this.autoEnd) { 1215 this.end(); 1216 } 1217 } else { 1218 this.changeContent(this.contentNum + 1); 1219 } 1220 } else { 1221 this.isPaused = true; 1222 } 1223}; 1224Lytebox.prototype.end = function(sCaller) { 1225 var closeClick = (sCaller == 'slideshow' ? false : true); 1226 if (this.isSlideshow && this.isPaused && !closeClick) { return; } 1227 if (!this.isEmpty(this.beforeEnd)) { 1228 var callback = window[this.beforeEnd]; 1229 if (typeof callback === 'function') { 1230 if (!callback(this.args)) { return; } 1231 } 1232 } 1233 this.disableKeyboardNav(); 1234 document.body.onscroll = this.bodyOnscroll; 1235 if (this.refreshPage) { 1236 var uri_href = top.location.href; 1237 var reg=/\#.*$/g; 1238 uri_href=uri_href.replace(reg, ""); 1239 top.location.href = uri_href; 1240 return; 1241 } 1242 this.doc.$('lbMain').style.display = 'none'; 1243 this.fadeOut({ id: 'lbOverlay', opacity: (this.doAnimations && this.animateOverlay && (!this.ie || this.ieVersion >= 9) ? this.maxOpacity : 0), speed: 5, display: 'none' }); 1244 this.toggleSelects('visible'); 1245 if (this.hideObjects) { this.toggleObjects('visible'); } 1246 this.doc.$('lbOuterContainer').style.width = '200px'; 1247 this.doc.$('lbOuterContainer').style.height = '200px'; 1248 if (this.inline && this.safari) { 1249 var iframe = this.doc.$('lbIframe'); 1250 var oDoc = iframe.contentWindow || iframe.contentDocument; 1251 if (oDoc.document) { 1252 oDoc = oDoc.document; 1253 } 1254 oDoc.open(); 1255 oDoc.write('<html><head></head><body></body></html>'); 1256 oDoc.close(); 1257 } 1258 if (this.isSlideshow) { 1259 for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); } 1260 this.isPaused = false; 1261 } 1262 if (!this.isEmpty(this.afterEnd)) { 1263 var callback = window[this.afterEnd]; 1264 if (typeof callback === 'function') { 1265 callback(this.args); 1266 } 1267 } 1268}; 1269Lytebox.prototype.checkFrame = function() { 1270 if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0) && window.name != 'lbIframe') { 1271 this.isFrame = true; 1272 this.doc = parent.document; 1273 } else { 1274 this.isFrame = false;
1275 this.doc = document; 1276 } 1277 this.doc.$ = this.doc.getElementById; 1278}; 1279Lytebox.prototype.getPixelRate = function(iCurrent, iDim) { 1280 var diff = (iDim > iCurrent) ? iDim - iCurrent : iCurrent - iDim; 1281 if (diff >= 0 && diff <= 100) { return (100 / this.resizeDuration); } 1282 if (diff > 100 && diff <= 200) { return (150 / this.resizeDuration); } 1283 if (diff > 200 && diff <= 300) { return (200 / this.resizeDuration); } 1284 if (diff > 300 && diff <= 400) { return (250 / this.resizeDuration); } 1285 if (diff > 400 && diff <= 500) { return (300 / this.resizeDuration); } 1286 if (diff > 500 && diff <= 600) { return (350 / this.resizeDuration); } 1287 if (diff > 600 && diff <= 700) { return (400 / this.resizeDuration); } 1288 if (diff > 700) { return (450 / this.resizeDuration); } 1289}; 1290Lytebox.prototype.fadeIn = function(args) { 1291 var sId = this.isEmpty(args.id) ? '' : args.id; 1292 var iSpeed = (this.isEmpty(args.speed) ? 5 : (parseInt(args.speed) > 5 ? 5 : parseInt(args.speed))); 1293 iSpeed = isNaN(iSpeed) ? 5 : iSpeed; 1294 var iOpacity = this.isEmpty(args.opacity) ? 0 : parseInt(args.opacity); 1295 iOpacity = isNaN(iOpacity) ? 0 : iOpacity; 1296 var sDisplay = this.isEmpty(args.display) ? '' : args.display; 1297 var sVisibility = this.isEmpty(args.visibility) ? '' : args.visibility; 1298 var oElement = this.doc.$(sId); 1299 var iIncrement = iSpeed; 1300 if (/lbImage|lbIframe|lbOverlay|lbBottomContainer|lbTopContainer/.test(sId)) { 1301 iIncrement = this.ff ? (this.ffVersion >= 6 ? 2 : 5) : (this.safari ? 3 : (this.ieVersion <= 8 ? 10 : 5)); 1302 iIncrement = this.isMobile() ? 20 : iIncrement; 1303 iIncrement = (sId == 'lbOverlay' ? iIncrement * 2 : iIncrement); 1304 iIncrement = (sId == 'lbIframe' ? 100 : iIncrement); 1305 } else if (this.ieVersion == 7 || this.ieVersion == 8) { 1306 iIncrement = 10; 1307 } 1308 oElement.style.opacity = (iOpacity / 100); 1309 oElement.style.filter = "alpha(opacity=" + (iOpacity) + ")"; 1310 if (iOpacity >= 100 && (sId == 'lbImage' || sId == 'lbIframe')) { 1311 try { oElement.style.removeAttribute("filter"); } catch(e) {} 1312 this.fixBottomPadding(); 1313 } else if (iOpacity >= this.maxOpacity && sId == 'lbOverlay') { 1314 for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); } 1315 this.overlayLoaded = true; 1316 return; 1317 } else if (iOpacity >= 100 && (sId == 'lbBottomContainer' || sId == 'lbTopContainer')) { 1318 try { oElement.style.removeAttribute("filter"); } catch(e) {} 1319 for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); } 1320 this.doc.$('lbOverlay').style.height = this.aPageSize[1] + "px"; 1321 } else if (iOpacity >= 100) { 1322 for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); } 1323 } else { 1324 if (sId == 'lbOverlay') { 1325 this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("$lb.fadeIn({ id: '" + sId + "', opacity: " + (iOpacity + iIncrement) + ", speed: " + iSpeed + " })", 1); 1326 } else { 1327 this.imageTimerArray[this.imageTimerCount++] = setTimeout("$lb.fadeIn({ id: '" + sId + "', opacity: " + (iOpacity + iIncrement) + ", speed: " + iSpeed + " })", 1); 1328 } 1329 } 1330}; 1331Lytebox.prototype.fadeOut = function(args) { 1332 var sId = this.isEmpty(args.id) ? '' : args.id; 1333 var iSpeed = (this.isEmpty(args.speed) ? 5 : (parseInt(args.speed) > 5 ? 5 : parseInt(args.speed))); 1334 iSpeed = isNaN(iSpeed) ? 5 : iSpeed; 1335 var iOpacity = this.isEmpty(args.opacity) ? 100 : parseInt(args.opacity); 1336 iOpacity = isNaN(iOpacity) ? 100 : iOpacity; 1337 var sDisplay = this.isEmpty(args.display) ? '' : args.display; 1338 var sVisibility = this.isEmpty(args.visibility) ? '' : args.visibility; 1339 var oElement = this.doc.$(sId); 1340 if (this.ieVersion == 7 || this.ieVersion == 8) { 1341 iSpeed *= 2; 1342 } 1343 oElement.style.opacity = (iOpacity / 100); 1344 oElement.style.filter = "alpha(opacity=" + iOpacity + ")"; 1345 if (iOpacity <= 0) { 1346 try { 1347 if (!this.isEmpty(sDisplay)) { 1348 oElement.style.display = sDisplay; 1349 } 1350 if (!this.isEmpty(sVisibility)) { 1351 oElement.style.visibility = sVisibility; 1352 } 1353 } catch(err) { } 1354 if (sId == 'lbOverlay') { 1355 this.overlayLoaded = false; 1356 if (this.isLyteframe) { 1357 this.doc.$('lbIframe').src = 'about:blank'; 1358 this.initialize(); 1359 } 1360 } else { 1361 for (var i = 0; i < this.timerIDCount; i++) { window.clearTimeout(this.timerIDArray[i]); } 1362 } 1363 } else if (sId == 'lbOverlay') { 1364 this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("$lb.fadeOut({ id: '" + sId + "', opacity: " + (iOpacity - (iSpeed * 2)) + ", speed: " + iSpeed + ", display: '" + sDisplay + "', visibility: '" + sVisibility + "' })", 1); 1365 } else { 1366 this.timerIDArray[this.timerIDCount++] = setTimeout("$lb.fadeOut({ id: '" + sId + "', opacity: " + (iOpacity - iSpeed) + ", speed: " + iSpeed + ", display: '" + sDisplay + "', visibility: '" + sVisibility + "' })", 1); 1367 } 1368}; 1369Lytebox.prototype.resizeW = function(sId, iCurrentW, iMaxW, iPixelRate, iSpeed) { 1370 var object = this.doc.$(sId); 1371 var newW = (this.doAnimations ? iCurrentW : iMaxW); 1372 object.style.width = (newW) + "px"; 1373 if (newW < iMaxW) { 1374 newW += (newW + iPixelRate >= iMaxW) ? (iMaxW - newW) : iPixelRate; 1375 } else if (newW > iMaxW) { 1376 newW -= (newW - iPixelRate <= iMaxW) ? (newW - iMaxW) : iPixelRate; 1377 } 1378 this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("$lb.resizeW('" + sId + "', " + newW + ", " + iMaxW + ", " + iPixelRate + ", " + (iSpeed) + ")", iSpeed); 1379 if (parseInt(object.style.width) == iMaxW) { 1380 this.wDone = true; 1381 for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); } 1382 if (this.isLyteframe) { 1383 this.loadContent(); 1384 } else { 1385 this.showContent(); 1386 } 1387 } 1388}; 1389Lytebox.prototype.resizeH = function(sId, iCurrentH, iMaxH, iPixelRate, iSpeed) { 1390 var object = this.doc.$(sId); 1391 var newH = (this.doAnimations ? iCurrentH : iMaxH); 1392 object.style.height = (newH) + "px"; 1393 if (newH < iMaxH) { 1394 newH += (newH + iPixelRate >= iMaxH) ? (iMaxH - newH) : iPixelRate; 1395 } else if (newH > iMaxH) { 1396 newH -= (newH - iPixelRate <= iMaxH) ? (newH - iMaxH) : iPixelRate; 1397 } 1398 this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("$lb.resizeH('" + sId + "', " + newH + ", " + iMaxH + ", " + iPixelRate + ", " + (iSpeed+.02) + ")", iSpeed+.02);
1399 if (parseInt(object.style.height) == iMaxH) { 1400 this.hDone = true; 1401 for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); } 1402 this.resizeW('lbOuterContainer', this.wCur, this.resizeWidth + this.borderSize * 2, this.getPixelRate(this.wCur, this.resizeWidth)); 1403 } 1404}; 1405Lytebox.prototype.getPageScroll = function() { 1406 if (self.pageYOffset) { 1407 return this.isFrame ? parent.pageYOffset : self.pageYOffset; 1408 } else if (this.doc.documentElement && this.doc.documentElement.scrollTop){ 1409 return this.doc.documentElement.scrollTop; 1410 } else if (document.body) { 1411 return this.doc.body.scrollTop; 1412 } 1413}; 1414Lytebox.prototype.getPageSize = function() { 1415 var xScroll, yScroll, windowWidth, windowHeight; 1416 if (window.innerHeight && window.scrollMaxY) { 1417 xScroll = this.doc.scrollWidth; 1418 yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY); 1419 } else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){ 1420 xScroll = this.doc.body.scrollWidth; 1421 yScroll = this.doc.body.scrollHeight; 1422 } else { 1423 xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth; 1424 yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight; 1425 xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll; 1426 yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll; 1427 } 1428 if (self.innerHeight) { 1429 windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth; 1430 windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight; 1431 } else if (document.documentElement && document.documentElement.clientHeight) { 1432 windowWidth = this.doc.documentElement.clientWidth; 1433 windowHeight = this.doc.documentElement.clientHeight; 1434 windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth; 1435 windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight; 1436 } else if (document.body) { 1437 windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth; 1438 windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight; 1439 windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth; 1440 windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight; 1441 } 1442 var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll; 1443 var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll; 1444 return new Array(pageWidth, pageHeight, windowWidth, windowHeight); 1445}; 1446Lytebox.prototype.toggleObjects = function(sState) { 1447 var objects = this.doc.getElementsByTagName("object"); 1448 for (var i = 0; i < objects.length; i++) { 1449 objects[i].style.visibility = (sState == "hide") ? 'hidden' : 'visible'; 1450 } 1451 var embeds = this.doc.getElementsByTagName("embed"); 1452 for (var i = 0; i < embeds.length; i++) { 1453 embeds[i].style.visibility = (sState == "hide") ? 'hidden' : 'visible'; 1454 } 1455 if (this.isFrame) { 1456 for (var i = 0; i < parent.frames.length; i++) { 1457 try { 1458 objects = parent.frames[i].window.document.getElementsByTagName("object"); 1459 for (var j = 0; j < objects.length; j++) { 1460 objects[j].style.visibility = (sState == "hide") ? 'hidden' : 'visible'; 1461 } 1462 } catch(e) {} 1463 1464 try { 1465 embeds = parent.frames[i].window.document.getElementsByTagName("embed"); 1466 for (var j = 0; j < embeds.length; j++) { 1467 embeds[j].style.visibility = (sState == "hide") ? 'hidden' : 'visible'; 1468 } 1469 } catch(e) {} 1470 } 1471 } 1472}; 1473Lytebox.prototype.toggleSelects = function(sState) { 1474 var selects = this.doc.getElementsByTagName("select"); 1475 for (var i = 0; i < selects.length; i++ ) { 1476 selects[i].style.visibility = (sState == "hide") ? 'hidden' : 'visible'; 1477 } 1478 if (this.isFrame) { 1479 for (var i = 0; i < parent.frames.length; i++) { 1480 try { 1481 selects = parent.frames[i].window.document.getElementsByTagName("select"); 1482 for (var j = 0; j < selects.length; j++) { 1483 selects[j].style.visibility = (sState == "hide") ? 'hidden' : 'visible'; 1484 } 1485 } catch(e) {} 1486 } 1487 } 1488}; 1489Lytebox.prototype.pause = function(iMillis) { 1490 var now = new Date(); 1491 var exitTime = now.getTime() + iMillis; 1492 while (true) { 1493 now = new Date(); 1494 if (now.getTime() > exitTime) { return; } 1495 } 1496}; 1497Lytebox.prototype.combine = function(aAnchors, aAreas) { 1498 var lyteLinks = []; 1499 for (var i = 0; i < aAnchors.length; i++) { 1500 lyteLinks.push(aAnchors[i]); 1501 } 1502 for (var i = 0; i < aAreas.length; i++) { 1503 lyteLinks.push(aAreas[i]); 1504 } 1505 return lyteLinks; 1506}; 1507Lytebox.prototype.removeDuplicates = function (aArray) { 1508 var aNew = new Array(); 1509 o:for(var i = 0, n = aArray.length; i < n; i++) { 1510 for(var x = 0, y = aNew.length; x < y; x++) { 1511 if (aNew[x][0].toLowerCase() == aArray[i][0].toLowerCase()) { continue o; } 1512 } 1513 aNew[aNew.length] = aArray[i]; 1514 } 1515 return aNew; 1516}; 1517Lytebox.prototype.printWindow = function () { 1518 var w = this.isLyteframe ? 800 : this.imgPreloader.width + 20; 1519 var h = this.isLyteframe ? 600 : this.imgPreloader.height + 20;
1520 var left = parseInt((screen.availWidth/2) - (w/2)); 1521 var top = parseInt((screen.availHeight/2) - (h/2)); 1522 var wOpts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top + "directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0"; 1523 var d = new Date(); 1524 var wName = 'Print' + d.getTime(); 1525 var wUrl = document.getElementById(this.printId).src; 1526 this.wContent = window.open(wUrl, wName, wOpts); 1527 this.wContent.focus(); 1528 var t = setTimeout("$lb.printContent()",1000); 1529}; 1530Lytebox.prototype.printContent = function() { 1531 try { 1532 if (this.wContent.document.readyState == 'complete') { 1533 this.wContent.print(); 1534 this.wContent.close(); 1535 this.wContent = null; 1536 } else { 1537 var t = setTimeout("$lb.printContent()",1000); 1538 } 1539 } catch(e) { } 1540}; 1541Lytebox.prototype.setOptions = function(sOptions) { 1542 this.args = ''; 1543 this.group = ''; 1544 this.inline = false; 1545 this.hideObjects = this.__hideObjects; 1546 this.autoResize = this.__autoResize; 1547 this.doAnimations = this.__doAnimations; 1548 this.animateOverlay = this.__animateOverlay; 1549 this.forceCloseClick = this.__forceCloseClick; 1550 this.refreshPage = this.__refreshPage; 1551 this.showPrint = this.__showPrint; 1552 this.navType = this.__navType; 1553 this.titleTop = this.__titleTop; 1554 this.navTop = this.__navTop; 1555 this.beforeStart = this.__beforeStart; 1556 this.afterStart = this.__afterStart 1557 this.beforeEnd = this.__beforeEnd; 1558 this.afterEnd = this.__afterEnd; 1559 this.scrolling = this.__scrolling; 1560 this.width = this.__width; 1561 this.height = this.__height; 1562 this.loopPlayback = this.__loopPlayback; 1563 this.autoPlay = this.__autoPlay; 1564 this.autoEmbed = this.__autoEmbed; 1565 this.slideInterval = this.__slideInterval; 1566 this.showNavigation = this.__showNavigation; 1567 this.showClose = this.__showClose;
1568 this.showDetails = this.__showDetails; 1569 this.showPlayPause = this.__showPlayPause; 1570 this.autoEnd = this.__autoEnd; 1571 this.pauseOnNextClick = this.__pauseOnNextClick; 1572 this.pauseOnPrevClick = this.__pauseOnPrevClick; 1573 this.loopSlideshow = this.__loopSlideshow; 1574 var sName = sValue = ''; 1575 var aSetting = null; 1576 var aOptions = sOptions.split(' '); 1577 for (var i = 0; i < aOptions.length; i++) { 1578 aSetting = aOptions[i].split(':'); 1579 sName = (aSetting.length > 1 ? this.trim(aSetting[0]).toLowerCase() : ''); 1580 sValue = (aSetting.length > 1 ? this.trim(aSetting[1]): ''); 1581 switch(sName) { 1582 case 'group': this.group = (sName == 'group' ? (!this.isEmpty(sValue) ? sValue.toLowerCase() : '') : ''); break; 1583 case 'hideobjects': this.hideObjects = (/true|false/.test(sValue) ? (sValue == 'true') : this.__hideObjects); break; 1584 case 'autoresize': this.autoResize = (/true|false/.test(sValue) ? (sValue == 'true') : this.__autoResize); break; 1585 case 'doanimations': this.doAnimations = (/true|false/.test(sValue) ? (sValue == 'true') : this.__doAnimations); break; 1586 case 'animateoverlay': this.animateOverlay = (/true|false/.test(sValue) ? (sValue == 'true') : this.__animateOverlay); break; 1587 case 'forcecloseclick': this.forceCloseClick = (/true|false/.test(sValue) ? (sValue == 'true') : this.__forceCloseClick); break; 1588 case 'refreshpage': this.refreshPage = (/true|false/.test(sValue) ? (sValue == 'true') : this.__refreshPage); break; 1589 case 'showprint': this.showPrint = (/true|false/.test(sValue) ? (sValue == 'true') : this.__showPrint); break; 1590 case 'navtype': this.navType = (/[1-3]{1}/.test(sValue) ? parseInt(sValue) : this.__navType); break; 1591 case 'titletop': this.titleTop = (/true|false/.test(sValue) ? (sValue == 'true') : this.__titleTop); break; 1592 case 'navtop': this.navTop = (/true|false/.test(sValue) ? (sValue == 'true') : this.__navTop); break; 1593 case 'beforestart': this.beforeStart = (!this.isEmpty(sValue) ? sValue : this.__beforeStart); break; 1594 case 'afterstart': this.afterStart = (!this.isEmpty(sValue) ? sValue : this.__afterStart); break; 1595 case 'beforeend': this.beforeEnd = (!this.isEmpty(sValue) ? sValue : this.__beforeEnd); break; 1596 case 'afterend': this.afterEnd = (!this.isEmpty(sValue) ? sValue : this.__afterEnd); break; 1597 case 'args': this.args = (!this.isEmpty(sValue) ? sValue : ''); break; 1598 case 'scrollbars': this.scrolling = (/auto|yes|no/.test(sValue) ? sValue : this.__scrolling); break; 1599 case 'scrolling': this.scrolling = (/auto|yes|no/.test(sValue) ? sValue : this.__scrolling); break; 1600 case 'width': this.width = (/\d(%|px|)/.test(sValue) ? sValue : this.__width); break; 1601 case 'height': this.height = (/\d(%|px|)/.test(sValue) ? sValue : this.__height); break; 1602 case 'loopplayback': this.loopPlayback = (/true|false/.test(sValue) ? (sValue == 'true') : this.__loopPlayback); break; 1603 case 'autoplay': this.autoPlay = (/true|false/.test(sValue) ? (sValue == 'true') : this.__autoPlay); break; 1604 case 'autoembed': this.autoEmbed = (/true|false/.test(sValue) ? (sValue == 'true') : this.__autoEmbed); break; 1605 case 'inline': this.inline = (/true|false/.test(sValue) ? (sValue == 'true') : false); 1606 case 'slideinterval': this.slideInterval = (/\d/.test(sValue) ? parseInt(sValue) : this.__slideInterval); break; 1607 case 'shownavigation': this.showNavigation = (/true|false/.test(sValue) ? (sValue == 'true') : this.__showNavigation); break; 1608 case 'showclose': this.showClose = (/true|false/.test(sValue) ? (sValue == 'true') : this.__showClose); break;
1609 case 'showdetails': this.showDetails = (/true|false/.test(sValue) ? (sValue == 'true') : this.__showDetails); break; 1610 case 'showplaypause': this.showPlayPause = (/true|false/.test(sValue) ? (sValue == 'true') : this.__showPlayPause); break; 1611 case 'autoend': this.autoEnd = (/true|false/.test(sValue) ? (sValue == 'true') : this.__autoEnd); break; 1612 case 'pauseonnextclick': this.pauseOnNextClick = (/true|false/.test(sValue) ? (sValue == 'true') : this.__pauseOnNextClick); break; 1613 case 'pauseonprevclick': this.pauseOnPrevClick = (/true|false/.test(sValue) ? (sValue == 'true') : this.__pauseOnPrevClick); break; 1614 case 'loopslideshow': this.loopSlideshow = (/true|false/.test(sValue) ? (sValue == 'true') : this.__loopSlideshow); break; 1615 } 1616 } 1617}; 1618 Lytebox.prototype.buildObject = function(w, h, url) { 1619 var object = ''; 1620 var classId = ''; 1621 var codebase = ''; 1622 var pluginsPage = ''; 1623 var auto = this.autoPlay ? 'true' : 'false'; 1624 var loop = this.loopPlayback ? 'true' : 'false'; 1625 var type = url.match(/.mov|.avi|.wmv|.mpg|.mpeg|.swf/i); 1626 switch(type[0]) { 1627 case '.mov': 1628 codebase = 'http://www.apple.com/qtactivex/qtplugin.cab'; 1629 pluginsPage = 'http://www.apple.com/quicktime/'; 1630 classId = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; 1631 object = '<object classid="' + classId + '" width="' + w + '" height="' + h + '" codebase="' + codebase + '">' 1632 + '<param name="src" value="' + url + '">' 1633 + '<param name="autoplay" value="' + auto + '">' 1634 + '<param name="loop" value="' + loop + '">' 1635 + '<param name="controller" value="true">' 1636 + '<embed src="' + url + '" width="' + w + '" height="' + h + '" autoplay="' + auto + '" loop="' + loop + '" controller="true" pluginspage="' + pluginsPage + '"></embed>' 1637 + '</object>'; 1638 if (this.getQuicktimeVersion() <= 0) { 1639 object = '<div style="padding:1em;">' 1640 + '<h2>QUICKTIME PLAYER</h2>' 1641 + '<p>Content on this page requires a newer version of QuickTime. Please click the image link below to download and install the latest version.</p>' 1642 + '<p><a href="http://www.apple.com/quicktime/" target="_blank"><img src="http://images.apple.com/about/webbadges/images/qt7badge_getQTfreeDownload.gif" alt="Get QuickTime" border="0" /></a></p>' 1643 + '</div>'; 1644 } 1645 break; 1646 case '.avi': 1647 case '.mpg': 1648 case '.mpeg': 1649 case '.wmv': 1650 classId = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; 1651 object = '<object classid="' + classId + '" width="' + w + '" height="' + h + '" codebase="' + codebase + '">' 1652 + '<param name="src" value="' + url + '">' 1653 + '<param name="autoplay" value="' + auto + '">' 1654 + '<param name="loop" value="' + loop + '">' 1655 + '<param name="controller" value="true">' 1656 + '<object type="video/quicktime" data="' + url + '" width="' + w + '" height="' + h + '">' 1657 + '<param name="controller" value="false">' 1658 + '<param name="autoplay" value="' + auto + '">' 1659 + '<param name="loop" value="' + loop + '">' 1660 + '</object>' 1661 + '</object>'; 1662 break; 1663 case '.swf': 1664 classId = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; 1665 object = '<object classid="' + classId + '" width="' + w + '" height="' + h + '" codebase="' + codebase + '">' 1666 + '<param name="movie" value="' + url + '">' 1667 + '<param name="quality" value="high">' 1668 + '<param name="wmode" value="opaque">' 1669 + '<!--[if !IE]>-->' 1670 + '<object type="application/x-shockwave-flash" data="' + url + '" width="' + w + '" height="' + h + '">' 1671 + '<!--<![endif]-->' 1672 + '<param name="quality" value="high">' 1673 + '<param name="wmode" value="opaque">' 1674 + '<div style="padding:1em;">' 1675 + '<h2>FLASH PLAYER</h2>' 1676 + '<p>Content on this page requires a newer version of Adobe Flash Player. Please click the image link below to download and install the latest version.</p>' 1677 + '<p><a href="http://www.adobe.com/go/getflashplayer" target="_blank"><img src="http://www.adobe.com/macromedia/style_guide/images/160x41_Get_Flash_Player.jpg" alt="Get Adobe Flash player" border="0" /></a></p>' 1678 + '</div>' 1679 + '<!--[if !IE]>-->' 1680 + '</object>' 1681 + '<!--<![endif]-->' 1682 + '</object>'; 1683 break; 1684 } 1685 return object; 1686}; 1687Lytebox.prototype.getQuicktimeVersion = function() { 1688 var agent = navigator.userAgent.toLowerCase(); 1689 var version = -1; 1690 if (navigator.plugins != null && navigator.plugins.length > 0) { 1691 for (i=0; i < navigator.plugins.length; i++ ) { 1692 var plugin = navigator.plugins[i]; 1693 if (plugin.name.indexOf('QuickTime') > -1) { 1694 version = parseFloat(plugin.name.substring(18)); 1695 } 1696 } 1697 } else if (this.autoEmbed && agent.indexOf('msie') != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf('win') != -1 && agent.indexOf('16bit') == -1) { 1698 var control = null; 1699 try { 1700 control = new ActiveXObject('QuickTime.QuickTime'); 1701 } catch (e) { } 1702 if (control) { 1703 isInstalled = true; 1704 } 1705 try { 1706 control = new ActiveXObject('QuickTimeCheckObject.QuickTimeCheck'); 1707 } catch (e) { return; } 1708 if (control) { 1709 isInstalled = true; 1710 version = control.QuickTimeVersion.toString(16); 1711 version = version.substring(0, 1) + '.' + version.substring(1, 3); 1712 version = parseInt(version); 1713 } 1714 } 1715 return version; 1716}; 1717Lytebox.prototype.findPos = function(el) { 1718 if (this.ie && this.doc.compatMode == 'BackCompat') { 1719 return [0, 16, 12]; 1720 } 1721 var left = 0; 1722 var top = 0; 1723 var height = 0; 1724 height = el.offsetHeight + 6; 1725 if (el.offsetParent) { 1726 do { 1727 left += el.offsetLeft; 1728 top += el.offsetTop; 1729 } while (el = el.offsetParent); 1730 } 1731 return [left, top, height]; 1732}; 1733Lytebox.prototype.isMobile = function() { 1734 var ua = navigator.userAgent; 1735 return (ua.match(/ipad/i) != null) 1736 || (ua.match(/ipod/i) != null) 1737 || (ua.match(/iphone/i) != null) 1738 || (ua.match(/android/i) != null) 1739 || (ua.match(/opera mini/i) != null) 1740 || (ua.match(/blackberry/i) != null) 1741 || (ua.match(/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i) != null) 1742 || (ua.match(/(iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i) != null) 1743 || (ua.match(/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo)/i) != null); 1744}; 1745Lytebox.prototype.validate = function(args) { 1746 var reTest = sName = ''; 1747 var bValid = false;
1748 var oElement = this.isEmpty(args.id) ? (this.isEmpty(args.element) ? null : args.element) : document.getElementById(args.id); 1749 var sInput = this.isEmpty(args.value) ? '' : String(args.value); 1750 var sType = this.isEmpty(args.type) ? '' : String(args.type).toLowerCase(); 1751 var sRegex = this.isEmpty(args.regex) ? '' : args.regex; 1752 var sCCType = (/visa|mc|amex|diners|discover|jcb/.test(args.ccType) ? args.ccType : ''); 1753 var sImageType = this.isEmpty(args.imageType) ? '' : String(args.imageType.toLowerCase()); 1754 var iMin = (/^\d+$/.test(args.min) ? parseInt(args.min) : 0); 1755 var iMax = (/^\d+$/.test(args.max) ? parseInt(args.max) : 0); 1756 var bInclusive = args.inclusive ? true : (/true|false/.test(args.inclusive) ? (args.inclusive == 'true') : true); 1757 var bAllowComma = args.allowComma ? true : (/true|false/.test(args.allowComma) ? (args.allowComma == 'true') : true); 1758 var bAllowWhitespace = args.allowWhiteSpace ? true : (/true|false/.test(args.allowWhiteSpace) ? (args.allowWhiteSpace == 'true') : true); 1759 if ((this.isEmpty(sInput) && this.isEmpty(oElement)) || (this.isEmpty(sType) && this.isEmpty(sRegex))) { 1760 return false; 1761 } 1762 var sInput = this.isEmpty(sInput) ? oElement.value : sInput; 1763 if (!this.isEmpty(sRegex)) { 1764 bValid = sRegex.test(sInput); 1765 } else { 1766 switch(sType) { 1767 case 'alnum': 1768 bValid = (bAllowWhitespace ? /^[a-z0-9\s]+$/i.test(sInput) : /^[a-z0-9]+$/i.test(sInput)); break; 1769 case 'alpha': 1770 bValid = (bAllowWhitespace ? /^[a-z\s]+$/i.test(sInput) : /^[a-z]+$/i.test(sInput)); break; 1771 case 'between': 1772 var iInput = bAllowComma ? parseInt(sInput.replace(/\,/g,'')) : parseInt(sInput); 1773 bValid = (bInclusive ? (iInput >
1773= iMin && iInput <= iMax) : (iInput > iMin && iInput < iMax)); break; 1774 case 'ccnum': 1775 if (this.isEmpty(sCCType)) { 1776 bValid = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/.test(sInput); break; 1777 } else { 1778 switch(sCCType) { 1779 case 'visa': 1780 bValid = /^4[0-9]{12}(?:[0-9]{3})?$/.test(sInput); break; 1781 case 'mc': 1782 bValid = /^5[1-5][0-9]{14}$/.test(sInput); break; 1783 case 'amex': 1784 bValid = /^3[47][0-9]{13}$/.test(sInput); break; 1785 case 'diners': 1786 bValid = /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/.test(sInput); break; 1787 case 'discover': 1788 bValid = /^6(?:011|5[0-9]{2})[0-9]{12}$/.test(sInput); break; 1789 case 'jcb': 1790 bValid = /^(?:2131|1800|35\d{3})\d{11}$/.test(sInput); break; 1791 default: 1792 bValid = false; 1793 } 1794 } 1795 case 'date': 1796 var date = new Date(sInput); 1797 bValid = !(date.toString() == 'NaN' || date.toString() == 'Invalid Date'); break; 1798 case 'digits': 1799 bValid = /^\d+$/.test(sInput); break; 1800 case 'email': 1801 bValid = /^([a-z0-9_\.\-])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+$/i.test(sInput); break; 1802 case 'float': 1803 bValid = /^[-+]?[0-9]*\.?[0-9]+$/.test(bAllowComma ? sInput.replace(/\,/g,'') : sInput); break; 1804 case 'image': 1805 if (this.isEmpty(sImageType)) { 1806 bValid = /^(png|jpg|jpeg|gif)$/i.test(sInput.split('.').pop()); break; 1807 } else { 1808 bValid = (sInput.split('.').pop().toLowerCase().match(sImageType) ? true : false); break; 1809 } 1810 case 'int': 1811 case 'integer': 1812 bValid = /^[-+]?\d+$/.test(sInput.replace(/\,/g,'')); break; 1813 case 'len': 1814 case 'length': 1815 bValid = (iMin == iMax) ? (sInput.length == iMin) : (sInput.length >= iMin && sInput.length <= iMax); break; 1816 case 'phone': 1817 bValid = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/.test(sInput); break; 1818 case 'notempty': 1819 bValid = !this.isEmpty(sInput); break; 1820 case 'ssn': 1821 bValid = /^[0-9]{3}\-?[0-9]{2}\-?[0-9]{4}$/.test(sInput); break; 1822 case 'url': 1823 bValid = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»""'']))/i.test(sInput); break; 1824 case 'zip': 1825 bValid = /^\d{5}$|^\d{5}-\d{4}$/.test(sInput); break; 1826 } 1827 } 1828 return bValid; 1829}; 1830Lytebox.prototype.ajax = function(args) { 1831 var iIndex = this.http.length; 1832 var oRequest = this.getRequestObject(); 1833 this.http[iIndex] = oRequest; 1834 var oHttpArgs = args; 1835 oHttpArgs.index = iIndex; 1836 oHttpArgs.method = !(/get|post/i.test(oHttpArgs.method)) ? 'get' : oHttpArgs.method; 1837 oHttpArgs.cache = !(/true|false/.test(oHttpArgs.cache)) ? true : (oHttpArgs.cache == 'true' || oHttpArgs.cache); 1838 if (!this.isEmpty(oHttpArgs.timeout) && (/^\d+$/.test(oHttpArgs.timeout))) { 1839 oHttpArgs.timerId = setTimeout("$lb.http["+iIndex+"].abort()", oHttpArgs.timeout); 1840 } 1841 oRequest.onreadystatechange = function() { 1842 return function() { 1843 if (oRequest.readyState == 4 && oRequest.status == 200) { 1844 if (document.getElementById(oHttpArgs.updateId)) { 1845 try { 1846 document.getElementById(oHttpArgs.updateId).innerHTML = oRequest.responseText; 1847 } catch(e) { alert(e.description ); }; 1848 } 1849 if (typeof oHttpArgs.success === 'function') { 1850 oHttpArgs.success(oRequest); 1851 } 1852 window.clearTimeout(oHttpArgs.timerId); 1853 $lb.http[oHttpArgs.index] = null; 1854 } else if (oRequest.readyState == 4 && oRequest.status != 200) { 1855 if (typeof oHttpArgs.fail === 'function') { 1856 oHttpArgs.fail(oRequest); 1857 } 1858 window.clearTimeout(oHttpArgs.timerId); 1859 $lb.http[oHttpArgs.index] = null; 1860 } 1861 } (oRequest, oHttpArgs); 1862 } 1863 if (oHttpArgs.method.toLowerCase() == 'post') { 1864 var oForm = document.getElementById(oHttpArgs.form); 1865 var bStripTags = !(/true|false/.test(args.stripTags)) ? false : (args.stripTags == 'true' || args.stripTags); 1866 var sParams = (oForm == null ? this.serialize({ name: oHttpArgs.form, stripTags: bStripTags }) : this.serialize({ element: oForm, stripTags: bStripTags })); 1867 var sTimestamp = (!oHttpArgs.cache ? ((/\&/.test(sParams)) ? '&' : '') + new Date().getTime() : ''); 1868 oRequest.open('post', oHttpArgs.url, true); 1869 oRequest.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 1870 oRequest.send(sParams + sTimestamp); 1871 } else { 1872 var sTimestamp = (!oHttpArgs.cache ? ((/\?/.test(oHttpArgs.url)) ? '&' : '?') + new Date().getTime() : ''); 1873 oRequest.open('get', oHttpArgs.url + sTimestamp, true); 1874 oRequest.send(); 1875 } 1876}; 1877Lytebox.prototype.serialize = function(args) { 1878 var sParams = sValue = '';
1879 var bStripTags = !(/true|false/.test(args.stripTags)) ? false : (args.stripTags == 'true' || args.stripTags); 1880 var oElements = this.isEmpty(args.id) ? (this.isEmpty(args.element) ? null : args.element) : document.getElementById(args.id); 1881 if (oElements == null) { 1882 for (var i = 0; i < document.forms.length; i++) { 1883 if (document.forms[i].name == args.name) { 1884 oElements = document.forms[i].elements; 1885 } 1886 } 1887 } 1888 for (var i = 0; i < oElements.length; i++) { 1889 if ((oElements[i].type == 'checkbox' && !oElements[i].checked) || 1890 (oElements[i].type == 'radio' && !oElements[i].checked) || 1891 (oElements[i].disabled) || (oElements[i].name == '') || (oElements[i].type == 'reset')) { 1892 continue; 1893 } 1894 if (oElements[i].type == 'select-multiple') { 1895 for (var j = 0; j < oElements[i].options.length; j++) { 1896 if (oElements[i].options[j].selected == true) { 1897 sParams += (sParams == '' ? '' : '&') + oElements[i].name + '=' + encodeURIComponent(oElements[i].options[j].value); 1898 } 1899 } 1900 } else { 1901 sValue = bStripTags ? this.stripTags({ value: oElements[i].value }) : oElements[i].value; 1902 sParams += (sParams == '' ? '' : '&') + oElements[i].name + '=' + encodeURIComponent(sValue); 1903 } 1904 } 1905 return sParams; 1906}; 1907Lytebox.prototype.getRequestObject = function () { 1908 var oReq = null; 1909 if (window.XMLHttpRequest) { 1910 try { oReq = new XMLHttpRequest(); } catch (e) { } 1911 } else if (typeof ActiveXObject != 'undefined') { 1912 try { 1913 oReq = new ActiveXObject("Msxml2.XMLHTTP"); 1914 } catch (e) { 1915 try { oReq = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } 1916 } 1917 } 1918 return oReq; 1919}; 1920Lytebox.prototype.isEmpty = function(args) { 1921 var sValue = ''; 1922 try { 1923 sValue = this.isEmpty(args.value) ? args : args.value; 1924 } catch(e) { 1925 sValue = args; 1926 } 1927 return (this.trim(sValue) == '' || sValue == 'null' || sValue == null || typeof(sValue) == 'undefined'); 1928}; 1929Lytebox.prototype.stripTags = function(args) { 1930 var oElement = this.isEmpty(args.id) ? (this.isEmpty(args.element) ? null : args.element) : document.getElementById(args.id); 1931 if (!this.isEmpty(oElement)) { 1932 oElement.value = String(oElement.value).replace(/(<([^>]+)>)/ig, ''); 1933 } else { 1934 var sValue = ''; 1935 try { 1936 sValue = this.isEmpty(args.value) ? args : args.value; 1937 } catch(e) { 1938 sValue = args; 1939 } 1940 return (this.trim(sValue) == '[object Object]') ? '' : String(sValue).replace(/(<([^>]+)>)/ig, ''); 1941 } 1942}; 1943Lytebox.prototype.trim = function(args) { 1944 var sValue = ''; 1945 try { 1946 sValue = this.isEmpty(args.value) ? args : args.value; 1947 } catch(e) { 1948 sValue = args; 1949 } 1950 return String(sValue).replace(/^\s+|\s+$/g, ''); 1951}; 1952Lytebox.prototype.capitalize = function (args) { 1953 return String(args.value ? args.value : args).replace( /(^|\s)([a-z])/g , function(m,p1,p2){return p1+p2.toUpperCase();}); 1954}; 1955Lytebox.prototype.hasClass = function (args) { 1956 var sClass = this.isEmpty(args.name) ? '' : args.name; 1957 var oElement = this.isEmpty(args.id) ? (this.isEmpty(args.element) ? null : args.element) : document.getElementById(args.id); 1958 return new RegExp('(\\s|^)' + sClass + '(\\s|$)').test(oElement.className); 1959}; 1960Lytebox.prototype.addClass = function (args) { 1961 var sClass = this.isEmpty(args.name) ? '' : args.name; 1962 var oElement = this.isEmpty(args.id) ? (this.isEmpty(args.element) ? null : args.element) : document.getElementById(args.id); 1963 var aClasses = sClass.split(' '); 1964 for (var i = 0; i < aClasses.length; i++) { 1965 if (!this.hasClass({ element: oElement, name: aClasses[i] })) { 1966 oElement.className += ' ' + aClasses[i]; 1967 } 1968 } 1969}; 1970Lytebox.prototype.removeClass = function (args) { 1971 var sClass = this.isEmpty(args.name) ? '' : args.name; 1972 var oElement = this.isEmpty(args.id) ? (this.isEmpty(args.element) ? null : args.element) : document.getElementById(args.id); 1973 var aClasses = sClass.split(' '); 1974 for (var i = 0; i < aClasses.length; i++) { 1975 if (this.hasClass({ element: oElement, name: aClasses[i] })) { 1976 oElement.className = oElement.className.replace(new RegExp('(\\s|^)' + aClasses[i] + '(\\s|$)'), ' ').replace(/\s+/g, ' ').replace(/^\s|\s$/, ''); 1977 } 1978 } 1979}; 1980if (window.addEventListener) { 1981 window.addEventListener("load", initLytebox, false); 1982} else if (window.attachEvent) { 1983 window.attachEvent("onload", initLytebox); 1984} else { 1985 window.onload = function() {initLytebox();} 1986} 1987function initLytebox() { myLytebox = $lb = new Lytebox(true, $lb.http); } 1988myLytebox = $lb = new Lytebox(false);
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.