Wrap Paley functionality in newPaley() function

Returns an object containing p, a reference to the canvas, and the draw() function
Correctly call clearRect()

I had forgotten to provide the coordinates of the upper-left corner
Fix stupid error in paley.js

The name of the iteration variable in the inner loop of draw() was residue, but
I had erroneously referred to it as j in the incrementation and conditional parts
of the for loop.