Instead of posting the entire javascript thing, you can either:
1) make a "bookmarklet" (bookmark whose address is a string of javascript) and select it each time you're done with your post (it adds the pic and submits your post)
2) paste just the img in before you push the submit button
You can't automaticly add it, but you can add the code as a bookmark and then just drag the book mark to the text box when you're finished typing your post.
if you use firefox: highlight the code and drag it up to the bookmark tool bard, and there you go, you have a bookmark.