Some organisation and the javascript implementation

Hope you like it :)
Javascript is not done, I'll finish soon.