/** Event handler for mouse wheel event.
 */
function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = -event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3 on Windows.
                 */
                if (navigator.userAgent.indexOf("Macintosh")>=0) delta = event.detail;
				else delta = event.detail/3;
        }
        /** If delta is nonzero, handle it.
         * Basically, delta is now positive if wheel was scrolled up,
         * and negative, if wheel was scrolled down.
         */
        dirProxy.call('jsMouseWheelEvent', delta);
        /** Prevent default actions caused by mouse wheel.
         * That might be ugly, but we handle scrolls somehow
         * anyway, so don't bother here..
         */
        if (event.preventDefault)
                event.preventDefault();
	event.returnValue = false;
}

/* Events handlers for window getting and loosing focus */

function windowBlur() {
        dirProxy.call('jsWindowEvent', 'blur');
        return(false);
}

function windowFocus() {
        dirProxy.call('jsWindowEvent', 'focus');
        return(false);
}
