function pprStateChangeFunction(state) { var inputText = document.getElementById("it1"); if (inputText.value.length) { inputText.value += "\n"; } var stateStr = (state == TrRequestQueue.STATE_READY) ? "ready" : "busy"; inputText.value += "State has changed to "+stateStr; inputText.scrollTop = inputText.scrollHeight; } function pprDomReplacementFunction(oldDom, newDom) { var inputText = document.getElementById("it1"); if (inputText.value.length) { inputText.value += "\n"; } if (newDom === document.body) { inputText.value += "Document body was replaced"; } else { inputText.value += "DOM element with ID " + newDom.getAttribute("id") + " was replaced"; } inputText.scrollTop = inputText.scrollHeight; } function init() { TrPage.getInstance().getRequestQueue().addStateChangeListener(pprStateChangeFunction); TrPage.getInstance().addDomReplaceListener(pprDomReplacementFunction); } function setFocus(event) { event.target.focus(); }