refactored jquery calls to be compatible with jquery 1.4.4. upgrading jquery looks to be too risky.
added feature's node_id to json output, cleaned up SQL moved into here-doc.
cleanup comments