Use a cleaner method to generate XML file
Allows to import the session from an XML file
Corrects, completes and simplifies catching of events
Adds a public function to start session recording

The function is automatically called upon page loading. We create
document.SESSION to allow external control of the program.
Allows to play an imported session