/*
	Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

//>>built
define("dojo/touch",["./_base/kernel","./aspect","./dom","./_base/lang","./on","./has","./mouse","./domReady","./_base/window"],function(_1,_2,_3,_4,on,_5,_6,_7,_8){var _9=navigator.msPointerEnabled;var _a;function _b(_c,_d,_e){if(_9&&_e){return function(_f,_10){return on(_f,_e,_10);};}else{if(_5("touch")){return function(_11,_12){var _13=on(_11,_d,_12),_14=on(_11,_c,function(evt){if(!_a||(new Date()).getTime()>_a+1000){_12.call(this,evt);}});return {remove:function(){_13.remove();_14.remove();}};};}else{return function(_15,_16){return on(_15,_c,_16);};}}};var _17,_18,_19;if(_5("touch")&&!_9){_7(function(){_19=_8.body();_8.doc.addEventListener("touchstart",function(_1a){_a=(new Date()).getTime();var _1b=_19;_19=_1a.target;if(_19.dojoElementFromPoint){_19=_19.dojoElementFromPoint(_1a.changedTouches[0].clientX,_1a.changedTouches[0].clientY);}if(_1b){on.emit(_1b,"dojotouchout",{target:_1b,relatedTarget:_19,bubbles:true});}if(_19){on.emit(_19,"dojotouchover",{target:_19,relatedTarget:_1b,bubbles:true});}},true);on(_8.doc,"touchmove",function(_1c){_a=(new Date()).getTime();_18=_1c;var _1d=_8.doc.elementFromPoint(_1c.clientX,_1c.clientY);if(_1d){var _1e=_1d;if(_1d.dojoElementFromPoint){_1d=_1d.dojoElementFromPoint(_1c.clientX,_1c.clientY);}if(_19!==_1d){if(_19){on.emit(_1e,"dojotouchout",{target:_19,relatedTarget:_1d,bubbles:true});}if(_1d){on.emit(_1e,"dojotouchover",{target:_1d,relatedTarget:_19,bubbles:true});}_19=_1d;}on.emit(_1e,"dojotouchmove",{target:_1d,bubbles:true});}});on(_8.doc,"touchend",function(_1f){var _20=_8.doc.elementFromPoint(_1f.clientX,_1f.clientY);var _21=_20;if(_20.dojoElementFromPoint){_20=_20.dojoElementFromPoint(_1f.clientX,_1f.clientY);}if(_20){on.emit(_21,"dojotouchend",_4.delegate(_1f,{target:_20,bubbles:true}));}});});_17=function(_22,_23){return on(_22,"dojotouchmove",function(_24){_23(_4.delegate(_18,{target:_24.target,preventDefault:function(){_18.preventDefault();},stopPropagation:function(){_24.stopPropagation();}}));});};}var _25={press:_b("mousedown","touchstart","MSPointerDown"),move:_b("mousemove",_17,"MSPointerMove"),release:_b("mouseup","dojotouchend","MSPointerUp"),cancel:_b(_6.leave,"touchcancel",_5("touch")?"MSPointerCancel":null),over:_b("mouseover","dojotouchover","MSPointerOver"),out:_b("mouseout","dojotouchout","MSPointerOut"),enter:_6._eventHandler(_b("mouseover","dojotouchover","MSPointerOver")),leave:_6._eventHandler(_b("mouseout","dojotouchout","MSPointerOut"))};1&&(_1.touch=_25);return _25;});