small javascript functions