(function(t){t.support.touch="ontouchend"in document;if(!t.support.touch){return}var e=t.ui.mouse.prototype,o=e._mouseInit,u=e._mouseDestroy,n;function r(e,t,o){if(e.originalEvent.touches.length>1){return}if(o!==false)e.preventDefault();var u=e.originalEvent.changedTouches[0],n=document.createEvent("MouseEvents");n.initMouseEvent(t,true,true,window,1,u.screenX,u.screenY,u.clientX,u.clientY,false,false,false,false,0,null);e.target.dispatchEvent(n)}e._touchStart=function(e){var t=this;if(n||!t._mouseCapture(e.originalEvent.changedTouches[0])){return}n=true;t._touchMoved=false;r(e,"mouseover",false);r(e,"mousemove",false);r(e,"mousedown",false)};e._touchMove=function(e){if(!n){return}this._touchMoved=true;r(e,"mousemove")};e._touchEnd=function(e){if(!n){return}r(e,"mouseup");r(e,"mouseout");if(!this._touchMoved){r(e,"click")}n=false};e._mouseInit=function(){var e=this;e.element.bind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")});o.call(e)};e._mouseDestroy=function(){var e=this;e.element.unbind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")});u.call(e)}})(jQuery);