Scripting conversion to instapaper format -- javascript help

I would like to convert web archives stored in Devonthink to a mobile-friendly format using the Instapaper Mobilizer text engine. I have a script that I have created (I’ll share it in the next posting – it’s clutzy but it gets the job done) for converting web archives to Readability format, and I can use this as a model.

Instapaper offers a browser bookmark that does this conversion in Safari, etc.: javascript:function%20iptxt(){var%20d=document;try{if(!d.body)throw(0);window.location='’+encodeURIComponent(d.location.href);}catch(e){alert(‘Please%20wait%20until%20the%20page%20has%20loaded.’);}}iptxt();void(0)

The question I have is how do I convert this javascript to be compatible with DevonThink – I don’t think I can just script it as

do javascript “function%20iptxt(){var%20d=document;

Any help on how to code this for a Devonthink script? Thanks.

Here’s a revised script replacing the URL encoding (%20):

tell application "DEVONthink Pro"
	do JavaScript "function iptxt(){var d=document;
}catch(e){alert('Please wait until the page has loaded.');
}}iptxt();void(0)" in think window 1
end tell

Would be interested in your Readability conversion script.

While I"m at it, I might as well put in my usual plug for Readability integration built into DT. See Reeder, Tweetmag and Echofon for how this makes life easier.