/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ function QxEventManager(vClientWindow){QxObject.call(this);var o=this;this.__onmouseevent=function(e){return o._onmouseevent(e);};this.__onkeyevent=function(e){return o._onkeyevent(e);};this.__ondragevent=function(e){return o._ondragevent(e);};this.__onwindowblur=function(e){return o._onwindowblur(e);};this.__onwindowfocus=function(e){return o._onwindowfocus(e);};this.__onwindowresize=function(e){return o._onwindowresize(e);};if(isValid(vClientWindow)){this.attachEvents(vClientWindow);};this._commands={};};QxEventManager.extend(QxManager,"QxEventManager");QxEventManager.mouseEventTypes=["mouseover","mousemove","mouseout","mousedown","mouseup","click","dblclick","contextmenu",(new QxClient).isMshtml()?"mousewheel":"DOMMouseScroll"];QxEventManager.keyEventTypes=["keydown","keypress","keyup"];QxEventManager.dragEventTypes=(new QxClient).isGecko()?["dragdrop","dragenter","dragexit","draggesture","dragover"]:[];QxEventManager.addProperty({name:"allowClientContextMenu",type:Boolean,defaultValue:false});QxEventManager.addProperty({name:"captureWidget"});proto._attachedClientWindow=null;proto._lastMouseEventType=null;proto._lastMouseDown=false;proto._lastMouseEventDate=0;proto._modifyCaptureWidget=function(_b1,_b2,_b3,_b4){if(_b2){_b2.setCapture(false,_b4);};if(_b1){_b1.setCapture(true,_b4);};return true;};proto.addCommand=function(vCommand){this._commands[vCommand.toHash()]=vCommand;};proto.removeCommand=function(vCommand){delete this._commands[vCommand.toHash()];};proto._checkKeyEventMatch=function(e){var vCommand;for(var vHash in this._commands){vCommand=this._commands[vHash];if(vCommand.getEnabled()&&vCommand._matchesKeyEvent(e)){if(!vCommand.execute()){e.preventDefault();};};};};proto.attachEvents=function(clientWindow){if(this._attachedClientWindow){return false;};this._attachedClientWindow=clientWindow;this.attachEventTypes(QxEventManager.mouseEventTypes,this.__onmouseevent);this.attachEventTypes(QxEventManager.keyEventTypes,this.__onkeyevent);this.attachEventTypes(QxEventManager.dragEventTypes,this.__ondragevent);this.attachWindowEvents();};if((new QxClient).isMshtml()){proto.attachWindowEvents=function(){var winElem=this._attachedClientWindow.getElement();winElem.attachEvent("onblur",this.__onwindowblur);winElem.attachEvent("onfocus",this.__onwindowfocus);winElem.attachEvent("onresize",this.__onwindowresize);};}else {proto.attachWindowEvents=function(){var winElem=this._attachedClientWindow.getElement();winElem.addEventListener("blur",this.__onwindowblur,false);winElem.addEventListener("focus",this.__onwindowfocus,false);winElem.addEventListener("resize",this.__onwindowresize,false);};};proto.detachEvents=function(){if(!this._attachedClientWindow){return false;};this.detachWindowEvents();this.detachEventTypes(QxEventManager.mouseEventTypes,this.__onmouseevent);this.detachEventTypes(QxEventManager.keyEventTypes,this.__onkeyevent);this.detachEventTypes(QxEventManager.dragEventTypes,this.__ondragevent);this._attachedClientWindow=null;};if((new QxClient).isMshtml()){proto.detachWindowEvents=function(){try{var winElem=this._attachedClientWindow.getElement();winElem.detachEvent("onblur",this.__onwindowblur);winElem.detachEvent("onfocus",this.__onwindowfocus);winElem.detachEvent("onresize",this.__onwindowresize);}catch(ex){};};}else {proto.detachWindowEvents=function(){try{var winElem=this._attachedClientWindow.getElement();winElem.removeEventListener("blur",this.__onwindowblur,false);winElem.removeEventListener("focus",this.__onwindowfocus,false);winElem.removeEventListener("resize",this.__onwindowresize,false);}catch(ex){};};};proto.attachEventTypes=function(eventTypes,functionPointer){try{var d=this._attachedClientWindow.getClientDocument().getElement();if(d.attachEvent){for(var i=0;i