put the javascript to handle marking todos complete in its own object with unique name

this should prevent concurrent running ajax calls to mess up the ui
move js genreated for ajax calls into their own object to prevent name clashes

I only modified the js that is most likely to be used in cocurrent calls. This because we
start the development of Tracks 3 that will change all js.
fix regression and refactor todos/update.js a bit
small refactorings of generated javascripts