JavaScript Solution

Figured I needed to weigh in with a JavaScript solution. Unfortunately, I don't know graffle and the XML looked daunting.