On this page you can download the code: http://aws.amazon.com/code/Product-Advertising-API/2609
It's available under the free Apache License 2.0 and inside the package there's some JavaScript that you can reuse.
(I might update this with the most essential lines of that code.)