Fixed event processing, added doc onclick event to front end script.