Add javascript functions