var EventUtil = new Object;
/**//*
This method is used to add the case to the specific object, oTarget is targeted, sEventType is the type of case, such as click, keydown, etc., fnHandler callback function is the case
/ *
EventUtil.addEventHandler = function (oTarget, sEventType, fnHandler) (
/ / firefox circumstances if (oTarget.addEventListener) (
oTarget.addEventListener (sEventType, fnHandler, false);
)
/ / IE under else if (oTarget.attachEvent) (
oTarget.attachEvent ( "on" + sEventType, fnHandler);
)
else (
oTarget [ "on" + sEventType] = fnHandler;
)
);
/ *
This method is used to remove a specific object of a specific case, oTarget is targeted, sEventType is the type of case, such as click, keydown, etc., fnHandler callback function is the case
/ *
EventUtil.removeEventHandler = function (oTarget, sEventType, fnHandler) (
if (oTarget.removeEventListener) (
oTarget.removeEventListener (sEventType, fnHandler, false);
) Else if (oTarget.detachEvent) (
oTarget.detachEvent ( "on" + sEventType, fnHandler);
) Else (
oTarget [ "on" + sEventType] = null;
)
);

/ *
Event format, and because IE under other browsers in different ways to obtain case and the case are not the same property, by this method provide a consistent case
* /
EventUtil.formatEvent = function (oEvent) (
/ / isIE and isWin to a js file reference to determine the type of browser and operating system if (isIE & & isWin) (
oEvent.charCode = (oEvent.type == "keypress")? oEvent.keyCode: 0;
/ / IE only supports the bubble, do not support the capture oEvent.eventPhase = 2;
oEvent.isChar = (oEvent.charCode> 0);
oEvent.pageX = oEvent.clientX + document.body.scrollLeft;
oEvent.pageY = oEvent.clientY + document.body.scrollTop;
/ / Prevent the default behavior of case oEvent.preventDefault = function () (
this.returnValue = false;
);

/ / Will toElement, fromElement standards into relatedTarget
if (oEvent.type == "mouseout") (
oEvent.relatedTarget = oEvent.toElement;
) Else if (oEvent.type == "mouseover") (
oEvent.relatedTarget = oEvent.fromElement;
)
/ / Cancel bubble
oEvent.stopPropagation = function () (
this.cancelBubble = true;
);

oEvent.target = oEvent.srcElement;
/ / Add property case occurred, IE does not oEvent.time = (new Date). GetTime ();
)
return oEvent;
);

EventUtil.getEvent = function () (
if (window.event) (
/ / Format of the IE case return this.formatEvent (window.event);
) Else (
return EventUtil.getEvent.caller.arguments [0];
)
);