checking readyState to see if document has loaded already