Adding javascript functions