fixed #276 and fixed #582 by ensuring the _console object is pointing to the right window in both embed and full edit mode
fixed javascript exception when in debug mode
Merge pull request #649 from remy/fix/embed-console-276

Fix/embed console 276