var sLquantity = new Class({ initialize:function(options){ this.setOptions(options); this.gather(options); }, setOptions:function(options){ this.options = Object.extend( { }, options || {} ); }, gather:function(options, el, op){ $$(options.plusClass).each(function(el){ $(el).addEvent('mousedown',this.plusHref.bind(this)); }.bind(this) ); $$(options.minusClass).each(function(el){ $(el).addEvent('mousedown', this.minusHref.pass([el], this)); }.bind(this) ); }, fX:function(options, stack){ introFx = new Fx.Style(stack, 'opacity', {duration: options.introDur, transition: Fx.Transitions.linear}); introFx.start(0 ,1); }, minusHref:function(el){ if( $$(this.options.minusClass).length > 1) $(el).parentNode.remove(); }, plusHref:function(){ var stack = this.cloneObj(this.options.conId).injectAfter(this.options.conId).setOpacity(0); stack.getChildren().each(function(el){ var minusClass = this.options.minusClass.split('.'); var plusClass = this.options.plusClass.split('.'); if( $(el).hasClass(minusClass[1])){ //$(el).removeEvents('mousedown', this.minusHref.bind(this)); if(window.ie) $(el).detachEvent('onmousedown', this.plusHref.bind(this)); $(el).addEvent('mousedown', function(){ alert('test'); }.bind(this)); } //$(el).addEvent('mousedown', this.minusHref.pass([el], this)); if( $(el).hasClass(plusClass[1])){ //$(el).removeEvents('mousedown', this.plusHref.bind(this)); if(window.ie) $(el).detachEvent('onmousedown', this.plusHref.bind(this)); $(el).addEvent('mousedown', function(){ alert('test'); }.bind(this)); } //$(el).addEvent('mousedown',this.plusHref.bind(this)); }.bind(this) ); this.fX(this.options, stack); }, cloneObj:function(el){ return $(el).clone(); } });