This looks more like it!
Copy the JS code and add in comments - how does it all work? Can you piece it together?