Implemented Snippet Edit

BIG CHANGE:
1) tidied up snippetBuilder. Is now ready for jQuery ACE
2) Found a lot of global vars that should have been local.
3) Created nice function closures to restore topic and snippet edit
forms.