Javascript function to automate drawing register layout figures using SVG