/* Copyright 2009 Palm, Inc.  All rights reserved. */
/*global Mojo, Class, $L, Template, WordAssistant, ExcelAssistant, PowerPointAssistant */
/*jslint rhino:true, undef:true */

function AppAssistant(appController)
{
}

AppAssistant.prototype.handleLaunch = function(params) {
    try {
        var launchParams = {};
    
        if (Object.isString(params)) {
            if (params.isJSON()) {
                launchParams = params.evalJSON();
            }
        }
        else {
            launchParams = params;
        }

        if (Mojo.Controller.appInfo.noWindow) 
        {
            var f = function(stageController) {

                if (launchParams.target) {
                    // Sanitize the target property
                    launchParams.target = launchParams.target.stripScripts().stripTags();
                }

                var sceneParams = {
                    launchParams: launchParams
                };

                if (launchParams.target) 
				{
                    stageController.pushScene({name:'document', disableSceneScroller:true}, sceneParams);
                }
                else 
				{
                    stageController.pushScene({name:'recent'}, sceneParams);
                }
            };
            var stageName = "pdfviewer-" + Date.now();
            this.controller.createStageWithCallback({name: stageName, lightweight: true}, f);
        } else if(params.banner) {
            Mojo.Log.warn("Notifications not yet implemented.");
        }
    }
    catch (e) {
        Mojo.Log.logException(e, "AppAssistant#handleLaunch");
    }
};

AppAssistant.prototype.cleanup = function() {
};
