trying to add a register handling javascript code