if statement closed prematurely causing scope issue.

I'm hoping to fix the errors in the javascript console and investigate integrating aloha editor.