added a try statement to catch the errors in an alert box, and also surrounded the whole thing with a jquery document ready block as the code sometimes loaded before the markup.
took out the if statement because it was throwing an error, also took out the jquery document ready as need to expose the module to the global object without the function closure. This meant I had to move the call to the script down to the bottom of the markup so that it loaded after the DOM.
Cant make my mind up :) now I have put the if statement back in to check for collisions with other libraries
fixed some minor bugs, and reorganised the statements into a logical progression with 3 steps. Used a cool way of presenting the public methods in short form in the return object by using a pointer to the function reference. Still having problems with 'this' bug which does not properly reference the object but instead points to the global object, something to do with not finding the local parameter to reaching back up the chain.
found the global bug, it wsa just because the processlettre had not yet been defined in the script, I just needed to move the function to the top. And then initialise the setup process with an invokation at the bottom.
FINISHED well at least it runs and works. A few notes for future changes, the script does not accept spaces, it will fail if you use one in the word, it could also do with some time delay before ending the game to let you see what the word actually was. We could also add an easter egg that lets you access the word by entering some characters or something, and finally it needs a reset button to manually reset if anything goes wrong.