Adding some great javascript functions

Signed-off-by: Nicke Forsberg <nickeforsberg@rockheart.se>