This works great.. good job. I would recommend (as you pointed out in your header) to factor out your redundant code (i.e. you look up the OL object's parameters every few lines) to functions. You will not only be able to maintain and bug fix it ,but it will make it far easier on the eyes, in case someone else would like to contribute to your script.
I would suggest to do this right away while this is fresh in your mind, or you might end up like me, scratching my head wondering "why did I do that here?" :)
BTW THX for using code tags on this post.