What exactly is your question?
You've posted your code, but it's not clear to me exactly where you're stuck <s>.
>L<
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only