move shakeEventDidOccur function outside of window.onload