(function(a){function b(b){var c=b||window.event,e=[].slice.call(arguments,1),f=0,g=0,h=0;b=a.event.fix(c);b.type="mousewheel";if(b.wheelDelta)f=b.wheelDelta/120;if(b.detail)f=-b.detail/3;h=f;if(c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS){h=0;g=-1*f}if(c.wheelDeltaY!==undefined)h=c.wheelDeltaY/120;if(c.wheelDeltaX!==undefined)g=-1*c.wheelDeltaX/120;e.unshift(b,f,g,h);return a.event.handle.apply(this,e)}var c=["DOMMouseScroll","mousewheel"];a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],b,false);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],b,false);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)
