HTML5 fractal visualization with recursive function