/* Slimbox v1.3 - The ultimate lightweight Lightbox clone by Christophe Beyls (http://www.digitalia.be) - MIT-style license. Inspired by the original Lightbox v2 by Lokesh Dhakar. */ var Lightbox = { init: function(options){ this.options = Object.extend({ resizeDuration: 50, initialWidth: 720, resizeTransition: Fx.Transitions.elasticOut, initialHeight: 478, animateCaption: false }, options || {}); this.anchors = []; $each(document.links, function(el){ if (el.rel && el.rel.test(/^lightbox/i)){ el.onclick = this.click.pass(el, this); this.anchors.push(el); } }, this); this.eventKeyDown = this.keyboardListener.bindAsEventListener(this); this.eventPosition = this.position.bind(this); this.overlay = new Element('div').setProperty('id', 'lbOverlay').injectInside(document.body); this.center = new Element('div').setProperty('id', 'lbCenter').setStyles({width: this.options.initialWidth+'px', height: this.options.initialHeight+'px', marginLeft: '-'+(this.options.initialWidth/2)+'px', display: 'none'}).injectInside(document.body); this.image = new Element('div').setProperty('id', 'lbImage').injectInside(this.center); this.prevLink = new Element('a').setProperties({id: 'lbPrevLink', href: '#'}).setStyle('display', 'none').injectInside(this.image); this.nextLink = this.prevLink.clone().setProperty('id', 'lbNextLink').injectInside(this.image); this.prevLink.onclick = this.previous.bind(this); this.nextLink.onclick = this.next.bind(this); this.bottomContainer = new Element('div').setProperty('id', 'lbBottomContainer').setStyle('display', 'none').injectInside(document.body); this.bottom = new Element('div').setProperty('id', 'lbBottom').injectInside(this.bottomContainer); new Element('a').setProperties({id: 'lbCloseLink', href: '#'}).injectInside(this.bottom).onclick = this.overlay.onclick = this.close.bind(this); this.caption = new Element('div').setProperty('id', 'lbCaption').injectInside(this.bottom); this.number = new Element('div').setProperty('id', 'lbNumber').injectInside(this.bottom); new Element('div').setStyle('clear', 'both').injectInside(this.bottom); var nextEffect = this.nextEffect.bind(this); this.fx = { overlay: this.overlay.effect('opacity', {duration: 0}).hide(), resize: this.center.effects({duration: this.options.resizeDuration, transition: this.options.resizeTransition, onComplete: nextEffect}), image: this.image.effect('opacity', {duration: 0, onComplete: nextEffect}), bottom: this.bottom.effect('margin-top', {duration: 0, onComplete: nextEffect}) }; this.preloadPrev = new Image(); this.preloadNext = new Image(); }, click: function(link){ if (link.rel.length == 8) return this.show(link.href, link.title); var j, imageNum, images = []; this.anchors.each(function(el){ if (el.rel == link.rel){ for (j = 0; j < images.length; j++) if(images[j][0] == el.href) break; if (j == images.length){ text= el.getAttribute('href'); ptext=text.replace(/tn\//,""); ltext=ptext.replace(/\.med/,""); stext=text.replace(/\.med/,""); stext=stext + ".php"; var adtext = '
'; adtext += '