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