Fixed javascript bug in poem.js

There was no bounds check on the array holding the poem. To prevent out-of-bounds accesses, the line that is passed in is taken modulo the length of the array.