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