Oops, document.readyState is a string not a function.