Script events and javascript functions
Example updated