There is generic code in the [nicely commented] xmlhttprequest.js file and code specific to this example ...
luke.breuer.com