/*
Copyright 2010, KISSY UI Library v1.1.5
MIT Licensed
build time: Sep 19 17:41
*/
KISSY.add("event",function(d,l){function k(a,c,e,g,j){if(d.isString(c))c=d.query(c);if(d.isArray(c)){d.each(c,function(h){r[a](h,e,g,j)});return true}if((e=d.trim(e))&&e.indexOf(y)>0){d.each(e.split(y),function(h){r[a](c,h,g,j)});return true}}function i(a,c){m(a)&&f.data(a,w,c)}function m(a){return a&&a.nodeType!==3&&a.nodeType!==8}var b=document,f=d.DOM,s=b.addEventListener?function(a,c,e,g){a.addEventListener&&a.addEventListener(c,e,!!g)}:function(a,c,e){a.attachEvent&&a.attachEvent("on"+c,e)},
t=b.removeEventListener?function(a,c,e,g){a.removeEventListener&&a.removeEventListener(c,e,!!g)}:function(a,c,e){a.detachEvent&&a.detachEvent("on"+c,e)},w="ksEventTargetId",y=" ",z=d.now(),x={},r={EVENT_GUID:w,special:{},add:function(a,c,e,g){if(!k("add",a,c,e,g)){var j=m(a)?f.data(a,w):-1,h,o,p,q,v;if(!(j===-1||!c||!d.isFunction(e))){if(!j){i(a,j=z++);x[j]={target:a,events:{}}}o=x[j].events;if(!o[c]){h=((j=!a.isCustomEventTarget)||a._supportSpecialEvent)&&r.special[c]||{};p=function(n,u){if(!n||
!n.fixed){n=new d.EventObject(a,n,c);d.isPlainObject(u)&&d.mix(n,u)}h.setup&&h.setup(n);return(h.handle||r._handle)(a,n,o[c].listeners)};o[c]={handle:p,listeners:[]};q=h.fix||c;v=h.capture;if(j)s(a,q,p,v);else a._addEvent&&a._addEvent(q,p,v)}o[c].listeners.push({fn:e,scope:g||a})}}},remove:function(a,c,e,g){if(!k("remove",a,c,e,g)){var j=m(a)?f.data(a,w):-1,h,o,p,q,v,n,u;if(j!==-1)if(j&&(h=x[j]))if(h.target===a){g=g||a;h=h.events||{};if(o=h[c]){p=o.listeners;n=p.length;if(d.isFunction(e)&&n){v=q=
0;for(u=[];q<n;++q)if(e!==p[q].fn||g!==p[q].scope)u[v++]=p[q];o.listeners=u;n=u.length}if(e===l||n===0){if(a.isCustomEventTarget)a._addEvent&&a._removeEvent(c,o.handle);else{e=r.special[c]||{};t(a,e.fix||c,o.handle)}delete h[c]}}if(c===l||d.isEmptyObject(h)){for(c in h)r.remove(a,c);delete x[j];f.removeData(a,w)}}}},_handle:function(a,c,e){e=e.slice(0);for(var g,j=0,h=e.length;j<h;++j){g=e[j];g=g.fn.call(g.scope||a,c);if(g===false&&a.isCustomEventTarget||c.isImmediatePropagationStopped)break}return g},
_getCache:function(a){return x[a]},_simpleAdd:s,_simpleRemove:t};r.on=r.add;d.Event=r});
KISSY.add("event-object",function(d,l){function k(b,f,s){this.currentTarget=b;this.originalEvent=f||{};if(f){this.type=f.type;this._fix()}else{this.type=s;this.target=b}this.currentTarget=b;this.fixed=true}var i=document,m="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" ");d.augment(k,
{_fix:function(){var b=this.originalEvent,f=m.length,s,t=this.currentTarget;for(t=t.nodeType===9?t:t.ownerDocument||i;f;){s=m[--f];this[s]=b[s]}if(!this.target)this.target=this.srcElement||i;if(this.target.nodeType===3)this.target=this.target.parentNode;if(!this.relatedTarget&&this.fromElement)this.relatedTarget=this.fromElement===this.target?this.toElement:this.fromElement;if(this.pageX===l&&this.clientX!==l){b=t.documentElement;f=t.body;this.pageX=this.clientX+(b&&b.scrollLeft||f&&f.scrollLeft||
0)-(b&&b.clientLeft||f&&f.clientLeft||0);this.pageY=this.clientY+(b&&b.scrollTop||f&&f.scrollTop||0)-(b&&b.clientTop||f&&f.clientTop||0)}if(this.which===l)this.which=this.charCode!==l?this.charCode:this.keyCode;if(this.metaKey===l)this.metaKey=this.ctrlKey;if(!this.which&&this.button!==l)this.which=this.button&1?1:this.button&2?3:this.button&4?2:0},preventDefault:function(){var b=this.originalEvent;if(b.preventDefault)b.preventDefault();else b.returnValue=false;this.isDefaultPrevented=true},stopPropagation:function(){var b=
this.originalEvent;if(b.stopPropagation)b.stopPropagation();else b.cancelBubble=true;this.isPropagationStopped=true},stopImmediatePropagation:function(){var b=this.originalEvent;b.stopImmediatePropagation?b.stopImmediatePropagation():this.stopPropagation();this.isImmediatePropagationStopped=true},halt:function(b){b?this.stopImmediatePropagation():this.stopPropagation();this.preventDefault()}});d.EventObject=k});
KISSY.add("event-target",function(d,l){var k=d.Event;d.EventTarget={isCustomEventTarget:true,fire:function(i,m){var b=d.DOM.data(this,k.EVENT_GUID)||-1;if((b=((k._getCache(b)||{}).events||{})[i])&&d.isFunction(b.handle))return b.handle(l,m);return this},on:function(i,m,b){k.add(this,i,m,b);return this},detach:function(i,m,b){k.remove(this,i,m,b);return this}}});
KISSY.add("event-mouseenter",function(d){var l=d.Event;d.UA.ie||d.each([{name:"mouseenter",fix:"mouseover"},{name:"mouseleave",fix:"mouseout"}],function(k){l.special[k.name]={fix:k.fix,setup:function(i){i.type=k.name},handle:function(i,m,b){if(d.DOM._isKSNode(i))i=i[0];var f=m.relatedTarget;try{for(;f&&f!==i;)f=f.parentNode;f!==i&&l._handle(i,m,b)}catch(s){}}}})});
KISSY.add("event-focusin",function(d){var l=d.Event;document.addEventListener&&d.each([{name:"focusin",fix:"focus"},{name:"focusout",fix:"blur"}],function(k){l.special[k.name]={fix:k.fix,capture:true,setup:function(i){i.type=k.name}}})});
