PopupGallery = Class.create(); PopupGallery.prototype = { controller: null, initialize: function(items) { this.items = items; if (this.items.length>0) { this.createPopup(); this.setDefaults(); this.setItemAttributes(); } }, createPopup: function() { this.closeBtn = Builder.node('a', {href:'#close', 'class':'close'}, 'Close'); Event.observe(this.closeBtn, 'click', this.close.bindAsEventListener(this), false); this.popupimg = Builder.node('img', {'class':'popupimg', border:0}); this.popupnav = Builder.node('div', {'class':'popupnav'}); this.popup = Builder.node('div', {'id':'popup', 'class':'popup'}, [ this.closeBtn, this.popupimg, this.popupnav ]); this.popupshadow = Builder.node('div', {id:'popupshadow', 'class':'popupshadow'}, [ Builder.node('img', {src:'/js/popup_shadow20070807.png', alt:'', border:0}) ]); document.body.appendChild(this.popupshadow); document.body.appendChild(this.popup); }, setDefaults: function() { this.defaultWidth = this.popup.offsetWidth; this.padleft = parseInt(Element.getStyle(this.popup, 'marginLeft').replace(/px/i,'')); this.padright = parseInt(Element.getStyle(this.popup, 'marginRight').replace(/px/i,'')); this.defaultHeight = this.popup.offsetHeight; this.padtop = parseInt(Element.getStyle(this.popup, 'marginTop').replace(/px/,'')); this.padbottom = parseInt(Element.getStyle(this.popup, 'marginBottom').replace(/px/,'')); }, setItemAttributes: function() { for (var i=0; i80) ? 80 : item.offsetWidth; this.height = item.offsetHeight; this.top = evt.pageY || evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); this.top -= this.height/2; if (AC.Detector.isiPhone()) { this.left = 3; this.top = 200; } // stop the default event Event.stop(evt); // track this click if (item.trackClick) item.trackClick(); // do the image this.prepPop(evt, item, i); }, getNav: function(item) { var wrapper = item.up('ul'); var siblings = wrapper.getElementsByClassName('popupthumb'); var items = []; for (var i=0; i