(function(b){b.event.special.mousewheel={setup:function(){var a=b.event.special.mousewheel.handler;if(b.browser.mozilla)b(this).bind('mousemove.mousewheel',function(event){b.data(this,'mwcursorposdata',{pageX:event.pageX,pageY:event.pageY,clientX:event.clientX,clientY:event.clientY})});if(this.addEventListener)this.addEventListener((b.browser.mozilla?'DOMMouseScroll':'mousewheel'),a,false);else this.onmousewheel=a},teardown:function(){var a=b.event.special.mousewheel.handler;b(this).unbind('mousemove.mousewheel');if(this.removeEventListener)this.removeEventListener((b.browser.mozilla?'DOMMouseScroll':'mousewheel'),a,false);else this.onmousewheel=function(){};b.removeData(this,'mwcursorposdata')},handler:function(a){var d=Array.prototype.slice.call(arguments,1);a=b.event.fix(a||window.event);b.extend(a,b.data(this,'mwcursorposdata')||{});var c=0,e=true;if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;if(b.browser.opera)c=-a.wheelDelta;a.data=a.data||{};a.type="mousewheel";d.unshift(c);d.unshift(a);return b.event.handle.apply(this,d)}};b.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
