/*** Useage:* call inspect on an object to recursively inspect its nodes.* this requires a textarea to be present that has been assigned* to the variable debug_viewer such as:* <textarea id="debug_viewer"></textarea>* debug_viewer = getElementById("debug_viewer");* Must be global in scope.**********************************************/function print_atts(obj, indent){ if(!indent) indent = ""; if(!obj.attributes) return; var num = obj.attributes.length; print(indent + "It has " + num + " attributes and they are:", false); for(var x = 0; x < num; x++) { print(indent + obj.attributes[x].name + ": " + obj.attributes[x].value, false); }}function inspect(object, indent){ if(!indent) indent = ""; print(indent + "Inspecting " + object.tagName); print_atts(object, indent); if(object.hasChildNodes) { for(var x = 0; x < object.childNodes.length; x++) { inspect(object.childNodes[x], indent + " "); } }}function print(message, overwrite){ if(overwrite) debug_viewer.value = message + "\n"; else debug_viewer.value += message + "\n";}