var Quicklook = Class.create({ initialize: function (options){ this.options = Object.extend({ // options go here }, options || {}); }, attachAddItemHandlers: function(aElements) { aElements.invoke('observe', 'click', function(evt){ this.options.id = evt.element().id; this.openModal(evt.element(), this.options); Event.stop(evt); return false; }.bindAsEventListener(this)) }, attachAddItemPopinHandlers: function(aElements) { aElements.invoke('observe', 'click', function(evt){ this.options.id = evt.element().id; this.openModal(evt.element(), this.options); Event.stop(evt); return false; }.bindAsEventListener(this)) }, openModal: function (link, params) { url = this.options.url + "&" + this.options.param + "=" + link.up('.phone').id + "&handset_browse_page_id=" + this.options.handset_browse_page_id + "&without_header=true"; if (/MSIE|Safari/.test(navigator.userAgent)) { new ajaxModal(url, params || { containerClassName: 'quick-look-container' }); } else { new ajaxModal(url, params); } } }); Filter = Class.create({ initialize: function (container, options){ this.container = $(container); this.options = Object.extend({ afterFilter: Prototype.emptyFunction }, options || {}); }, attachHandlers: function(aElements){ aElements.invoke('observe', 'click', function(evt){ var eltURI = evt.element().href; if(eltURI.include('/shop/asp/')) { eltURI +='/ajax/yes'; } else { eltURI = eltURI + "&ajax=yes"; } this.doFilter(eltURI); Event.stop(evt); return false; }.bindAsEventListener(this)); }, attachFormHandler: function(formId){ this.formElement = $(formId); if(this.formElement) { var hidden = $(Builder.node('input', { type: 'hidden', name: 'ajax', value: 'yes' })); this.formElement.appendChild(hidden); this.formElement.getInputs('submit').invoke('remove') if (document.getElementById('sort')) { $('sort').observe('change', function() { this.doFormFilter(this.formElement.action); }.bind(this)) } } }, doFilter: function(url){ new Ajax.Updater(this.container, url, { evalScripts: true, method: 'get', onLoading: function () { $('sandglass').show(); }.bind(this), onComplete: function(){ this.container.hide(); Effect.Appear(this.container, {duration: 1.0}); this.notify('afterFilter'); $('sandglass').hide(); }.bindAsEventListener(this) }); // new Effect.Pulsate(this.results, {duration: 1.2}); }, doFormFilter: function(url){ new Ajax.Updater(this.container, url, { evalScripts: true, onLoading: function () { $('sandglass').show(); }.bind(this), method: 'get', parameters: this.formElement.serialize(true), onComplete: function(){ this.container.hide(); Effect.Appear(this.container, {duration: 1.0}); this.notify('afterFilter'); $('sandglass').hide(); }.bindAsEventListener(this) }); }, notify: function(event_name){ try{ if(this.options[event_name]) return [this.options[event_name].apply(this.options[event_name],$A(arguments).slice(1))]; }catch(e){ if(e != $break) throw e; else return false; } } });// END: Filter/phone search