Firefox mobile browser fix

Firefox mobile browser doesn't use window.event. So changed the code to use the local event variable instead