Fix javascript calls

We had some js problems. Prototype was just missing ?
Also some js function were rewritten but code has not been refactored everywhere