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