SaveAs structure and ide.js OpenDocument Fix

Primary fix is error when calling drive.openDocument from ide.js; saveas functionality somewhat restructured but not functional yet.