/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2004 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*
* $Id: //ols/research/cs2/ols.jsx#69 $
* $DateTime: 2005/03/10 21:10:14 $
* $Change: 7418 $
* $Author: gscott $
*
**************************************************************************/

onlineservices = { };

if ( BridgeTalk.appName == "bridge" && 	app.language != "Chinese" && app.language != "Korean" )
{
    
    $.level=0

    onlineservices.versionString = "3.0.29";

    onlineservices.logging     = 0;
    onlineservices.debugMenu   = false;
    onlineservices.newServices = false;
    
    onlineservices.longpath = "";
    
    onlineservices.isMac = (File.fs == "Macintosh");
    onlineservices.isWin = (File.fs == "Windows");

    /*****************************************************************************
     * Add menuitems
     *****************************************************************************/
     
    onlineservices.menubarLocation0    = "after submenu/VersionCue";    // Do not localize.
    onlineservices.menubarLocation     = "before FileInfo";             // Do not localize.
    onlineservices.contextmenuLocation = "before Thumbnail/FileInfo";   // Do not localize.

    onlineservices.menuitemLocation    = "at the end of Tools/PhotoshopServices"; // Do not localize.

	// Find localized files
	onlineservices.beginLocalize = function()
    {
    	var pathSpec = "{STARTUP}" + "/";
	    pathSpec += (File.fs == "Macintosh") ? "../" : "";
    	pathSpec += "Resources/";
	    if (app.language == "Chinese")
		    pathSpec += "{LOCALE}";
    	else
	    	pathSpec += "{LANGUAGE}";
    	pathSpec += (File.fs == "Macintosh") ? ".lproj/" : "/";
	    pathSpec += "{FILENAME}" + ".dat";
    	onlineservices.oldZStringPath = app.zStringPathSpecifier;
	    app.zStringPathSpecifier = pathSpec;
    }

    onlineservices.endLocalize = function()
    {
    	app.zStringPathSpecifier = onlineservices.oldZStringPath;
    }

    onlineservices.localize = function( str )
    {
        onlineservices.beginLocalize();
        var result = localize( str );
        onlineservices.endLocalize();
        return result;
    }
    

    // Photo Services

    onlineservices.menubar =
        new MenuElement
        (
            "menu"
        ,   onlineservices.localize("$$$/CS2/OLS/Menus/PhotoshopServices=Photoshop Services")
        ,   '-' + onlineservices.menubarLocation0
        ,   "Tools/PhotoshopServices"
        );

    onlineservices.menubar.photoPrints =
        new MenuElement
        (
            "command"
        ,   onlineservices.localize("$$$/CS2/OLS/Menus/PhotoPrints=Photo Prints...")
        ,   onlineservices.menuitemLocation
        );
    onlineservices.menubar.photoPrints.onSelect = function()
    {
        onlineservices.printOnline();
    };
    onlineservices.menubar.photoPrints.onDisplay = function()
    {
        this.enabled = onlineservices.isDocumentSelected();
    };

    if ( onlineservices.newServices )
    {
        onlineservices.menubar.photoBooks =
            new MenuElement
            (
                "command"
            ,   onlineservices.localize("$$$/CS2/OLS/Menus/PhotoBooks=Photo Books...")
            ,   onlineservices.menuitemLocation
            );
        onlineservices.menubar.photoBooks.onSelect = function()
        {
            onlineservices.printBooks();
        };
        onlineservices.menubar.photoBooks.onDisplay = function()
        {
            this.enabled = onlineservices.isDocumentSelected();
        };

        onlineservices.menubar.photoCalendars =
            new MenuElement
            (
                "command"
            ,   onlineservices.localize("$$$/CS2/OLS/Menus/PhotoCalendars=Photo Calendars...")
            ,   onlineservices.menuitemLocation
            );
        onlineservices.menubar.photoCalendars.onSelect = function()
        {
            onlineservices.printCalendars();
        };
        onlineservices.menubar.photoCalendars.onDisplay = function()
        {
            this.enabled = onlineservices.isDocumentSelected();
        };

        onlineservices.menubar.photoGreetingCards =
            new MenuElement
            (
                "command"
            ,   onlineservices.localize("$$$/CS2/OLS/Menus/PhotoGreetingCards=Photo Greeting Cards...")
            ,   onlineservices.menuitemLocation
            );
        onlineservices.menubar.photoGreetingCards.onSelect = function()
        {
            onlineservices.printCards();
        };
        onlineservices.menubar.photoGreetingCards.onDisplay = function()
        {
            this.enabled = onlineservices.isDocumentSelected();
        };
        
    } // endif ( onlineservices.newServices )

    onlineservices.menubar.photoSharing =
        new MenuElement
        (
            "command"
        ,   onlineservices.localize("$$$/CS2/OLS/Menus/PhotoSharing=Photo Sharing...")
        ,   onlineservices.menuitemLocation
        );
    onlineservices.menubar.photoSharing.onSelect = function()
    {
        onlineservices.shareOnline();
    };
    onlineservices.menubar.photoSharing.onDisplay = function()
    {
        this.enabled = onlineservices.isDocumentSelected();
    };

    onlineservices.menubar.chooseLocation =
        new MenuElement
        (
            "command"
        ,   onlineservices.localize("$$$/CS2/OLS/Menus/ChooseLocation=Choose Location...")
        ,   '-' + onlineservices.menuitemLocation
        );
    onlineservices.menubar.chooseLocation.onSelect = function()
    {
        onlineservices.chooseLocation();
    };
    onlineservices.menubar.chooseLocation.onDisplay = function()
    {
        this.enabled = true;
    };

    if ( onlineservices.debugMenu )
    {
        onlineservices.menubar.debugInfo =
            new MenuElement
            (
                "command"
            ,   onlineservices.localize("$$$/CS2/OLS/Menus/DebugInfo=Debug Info...")
            ,   onlineservices.menuitemLocation
            );
        onlineservices.menubar.debugInfo.onSelect = function()
        {
            onlineservices.showDebugInfo();
        };
    }
        

    /*****************************************************************************
     * Common code
     *****************************************************************************/

    onlineservices.printOnline = function(thumbs)
    {
    	if (thumbs == undefined)
    		thumbs = app.document.selections;
    		
        onlineservices.begin( "job" );
            onlineservices.begin( "service-spec" );
                onlineservices.set( "workflow", "print-photo" );
            onlineservices.end();
            onlineservices.includeDocuments( thumbs );
        onlineservices.end();
        onlineservices.startTask();
    }

    onlineservices.shareOnline = function()
    {
        onlineservices.begin( "job" );
            onlineservices.begin( "service-spec" );
                onlineservices.set( "workflow", "share-photo-upload" );
            onlineservices.end();
            onlineservices.includeDocuments( app.document.selections );
        onlineservices.end();
        onlineservices.startTask();
    }

    onlineservices.printBooks = function()
    {
        onlineservices.begin( "job" );
            onlineservices.begin( "service-spec" );
                onlineservices.set( "workflow", "print-creation" );
                onlineservices.begin( "creation-type-list" )
                    onlineservices.set( "creation-type", "album" );
                onlineservices.end();
            onlineservices.end();
            onlineservices.includeDocuments( app.document.selections );
        onlineservices.end();
        onlineservices.startTask();
    }

    onlineservices.printCards = function()
    {
        onlineservices.begin( "job" );
            onlineservices.begin( "service-spec" );
                onlineservices.set( "workflow", "print-creation" );
                onlineservices.begin( "creation-type-list" )
                    onlineservices.set( "creation-type", "postcard" );
                onlineservices.end();
            onlineservices.end();
            onlineservices.includeDocuments( app.document.selections );
        onlineservices.end();
        onlineservices.startTask();
    }

    onlineservices.printCalendars = function()
    {
        onlineservices.begin( "job" );
            onlineservices.begin( "service-spec" );
                onlineservices.set( "workflow", "print-creation" );
                onlineservices.begin( "creation-type-list" )
                    onlineservices.set( "creation-type", "calendar" );
                onlineservices.end();
            onlineservices.end();
            onlineservices.includeDocuments( app.document.selections );
        onlineservices.end();
        onlineservices.startTask();
    }

    onlineservices.chooseLocation = function()
    {
        onlineservices.begin( "job" );
            onlineservices.begin( "service-spec" );
                onlineservices.set( "workflow", "preferences" );
            onlineservices.end();
        onlineservices.end();
        onlineservices.startTask();
    }
    
    onlineservices.begin = function( name )
    {
		app.initializeOpera();   
        onlineservices.loadLib();
        onlineservices.lib.begin( name );
    }

    onlineservices.end = function()
    {
        onlineservices.loadLib();
        onlineservices.lib.end();
    }

    onlineservices.set = function( name, value )
    {
        onlineservices.loadLib();
        onlineservices.lib.set( name, value );
    }
    
    onlineservices.isDocumentSelected = function()
    {
        return app.document.selections.length > 0;
    }

    onlineservices.log = function(str)
    {
        app.console( "[OnlineServices] " + str + "\n" );
    };

    onlineservices.dumpObj = function( prefix, obj )
    {
        var e = "";
        for (i in obj)
        {
            if (e == "")
            {
                e += "{ ";
            }
            else
            {
                e += ", ";
            }
            e += i + ":" + obj[i];
        }
        e += " }";
        onlineservices.log(prefix + e);
    }

    onlineservices.createUpdateServicesView = function()
    {
        var v = new Window( 'palette' );
        v.orientation = 'column';
        v.alignChildren = 'center';

        v.description  = v.add( 'statictext' );
        v.description.text = onlineservices.localize( "$$$/CS2/OLS/ServiceListUpdate/ProgressMessage=Updating online service list..." );

        v.cancelButton = v.add( 'button' );
        v.cancelButton.alignment = 'right';
        v.cancelButton.text = onlineservices.localize( "$$$/CS2/OLS/SessionManager/CancelButton=Cancel" );

        v.layout.layout( true );
               
        v.cancelButton.onClick = function()
        {
            onlineservices.lib.terminateSession();
        }

        v.onClose = function()
        {
            onlineservices.lib.terminateSession();
        }
        
        return v;
    }

    onlineservices.showUpdateServicesView = function()
    {
        var v = onlineservices.updateServicesView;

        if ( v == undefined )
        {
            v = onlineservices.updateServicesView = onlineservices.createUpdateServicesView();
        }

        v.show();
    }

    onlineservices.hideUpdateServicesView = function()
    {
        var v = onlineservices.updateServicesView;
        if ( v != undefined )
        {
            v.hide();
        }
    }
    
    onlineservices.createProgressView = function( description, percent, detail )
    {
		if (onlineservices.progressView)
		{
			onlineservices.progressView.description.text = description;
			onlineservices.progressView.progress.value = percent;
			onlineservices.progressView.detail.text = detail;
			onlineservices.progressView.layout.layout(true);
			onlineservices.progressView.show();
		}
		else
		{
			var v = new Window( 'palette' );
			v.orientation            = 'column';
			v.alignChildren          = 'fill';
    
			v.description            = v.add( 'statictext' );
			v.description.text		 = onlineservices.longpath;
        
			v.progress               = v.add( 'progressbar' );
			v.progress.preferredSize = { width:300, height:20 };
			v.progress.value         = percent;

			v.detail                 = v.add( 'statictext' );
			v.detail.justify         = 'center';
			v.detail.text            = detail;
        
			v.cancelButton = v.add( 'button' );
			v.cancelButton.alignment = 'right';
			v.cancelButton.text = onlineservices.localize( "$$$/CS2/OLS/SessionManager/CancelButton=Cancel" );

			v.center();
			v.show();
        
			v.cancelButton.onClick = function()
			{
				onlineservices.lib.terminateSession();
			}

			v.onClose = function()
			{
				onlineservices.lib.terminateSession();
			}
			
			onlineservices.progressView = v;
			v.description.text       = description;
		}
    }

    onlineservices.updateProgressView = function( description, bytesCompleted, bytesTotal )
    {
        if ( bytesCompleted != bytesTotal )
        {
            var descriptionDecoded = unescape( description );
            var detail = bytesCompleted.toString() + " / " + bytesTotal.toString(); // FIXME: Zstring needed;
            var percent;
            
            if ( bytesCompleted == 0 )
            {
                percent = 0;
            }
            else if ( bytesCompleted >= bytesTotal )
            {
                percent = 100;
            }
            else
            {
                percent = Math.ceil( bytesCompleted / bytesTotal * 100 );
            }
           
            if ( onlineservices.progressView )
            {
                if ( onlineservices.progressView.description.text != descriptionDecoded )
                {
                    onlineservices.createProgressView( descriptionDecoded, percent, detail );
                }
                else
                {
                    onlineservices.progressView.progress.value = percent;
                    onlineservices.progressView.detail.text = detail;
                }
            }
            else
            {
                onlineservices.createProgressView( descriptionDecoded, percent, detail );
            }
        }
        else
        {
			if ( onlineservices.progressView )
			{
				onlineservices.progressView.hide();
			}
        }
    }

   onlineservices.hideProgressView = function()
    {
        if ( onlineservices.progressView )
        {
            onlineservices.progressView.hide();
        }
    }
    
    onlineservices.finishProgressView = function()
    {
        if ( onlineservices.progressView )
        {
            onlineservices.progressView.close();
            onlineservices.progressView = undefined;
        }
    }

    onlineservices.loadLocale = function()
    {
        if ( onlineservices.lib )
        {
     	   onlineservices.lib.set("app_locale", app.locale);
        }
    }

    onlineservices.bringAppToFront = function()
    {
		BridgeTalk.bringToFront("bridge");
    }

    onlineservices.getLibFilename = function()
    {
        var libFilename;
        if ( onlineservices.isWin )
        {
            libFilename = "ols.dll";
        }
        else // if ( onlineservices.isMac )
        {
            libFilename = "ols.bundle";
        }
        return libFilename;

    }
    
    onlineservices.getLibPath = function()
    {
        var libFilename = onlineservices.getLibFilename();
        var libPath;
        if ( onlineservices.isWin )
        {
            libPath = Folder.startup + "/" + libFilename;
        }
        else // if ( onlineservices.isMac )
        {
            libPath = Folder.startup.fsName + "/../../../Plug-ins/" + libFilename;
        }
        return libPath;
    }

    onlineservices.loadLib = function()
    {
        if ( onlineservices.lib == undefined )
        {
            var libPath = onlineservices.getLibPath();
            var libFileObj = new File( libPath );
            if ( libFileObj.exists )
            {
                onlineservices.lib = new ExternalObject( "lib:" + libPath );
                onlineservices.lib.setLogging( onlineservices.logging );
                onlineservices.restoreProperties();
                onlineservices.loadLocale();
            }
            else
            {
                Window.alert( "OLS library not found: " + libPath );
            }
        }
    }

    onlineservices.restoreProperties = function()
    {
        if ( app.preferences.onlineservicesPropertyKeysA  == undefined
          || app.preferences.onlineservicesPropertyKeysB  == undefined
          || app.preferences.onlineservicesPropertyValues == undefined )
        {
            return;
        }
        
        var keysA  = eval( app.preferences.onlineservicesPropertyKeysA );
        var keysB  = eval( app.preferences.onlineservicesPropertyKeysB );
        var values = eval( app.preferences.onlineservicesPropertyValues );

        if ( keysA.length != keysB.length || keysB.length != values.length )
        {
            return;
        }
        
        onlineservices.begin( "cs2-ols-properties" ); // Do not localize.
        
        for ( var i in keysA )
        {
            onlineservices.begin( "cs2-ols-property" ); // Do not localize.
                onlineservices.set( "key-a", unescape( keysA[i] ) ); // Do not localize.
                onlineservices.set( "key-b", unescape( keysB[i] ) ); // Do not localize.
                onlineservices.set( "value", unescape( values[i] ) ); // Do not localize.
            onlineservices.end();
        }

        onlineservices.end();
    }
   
    onlineservices.beginProperties = function()
    {
        onlineservices.propertyKeysA  = new Array;
        onlineservices.propertyKeysB  = new Array;
        onlineservices.propertyValues = new Array;
    }

    onlineservices.setProperty = function( keyA, keyB, value )
    {
        onlineservices.propertyKeysA.push(  escape( keyA ) );
        onlineservices.propertyKeysB.push(  escape( keyB ) );
        onlineservices.propertyValues.push( escape( value ) );
    }

    onlineservices.endProperties = function()
    {
        app.preferences.onlineservicesPropertyKeysA  = onlineservices.propertyKeysA.toSource();
        app.preferences.onlineservicesPropertyKeysB  = onlineservices.propertyKeysB.toSource();
        app.preferences.onlineservicesPropertyValues = onlineservices.propertyValues.toSource();
    }
    
    onlineservices.pumpOls = function()
    {
        if ( onlineservices.lib.pumpOLS() )
        {
            onlineservices.processMessages();
        }
    }

    onlineservices.processMessages = function()
    {
        while ( onlineservices.processMessage() )
        {
        }
    }
    
    onlineservices.processMessage = function()
    {
        var msg = onlineservices.lib.getMessage();
        if ( typeof( msg ) == "script" )
        {
            var delay  = 1; // In milliseconds.
            var repeat = false;
            app.scheduleTask( script, delay, repeat );
            return true;
        }
        else
        {
            return false;
        }
    }
    
    onlineservices.startTask = function()
    {
        if ( onlineservices.taskId == undefined )
        {
            var script = 'onlineservices.pumpOls();';
            var delay  = 100; // In milliseconds.
            var repeat = true;
            onlineservices.taskId  = app.scheduleTask( script, delay, repeat );
        }
    }

    onlineservices.stopTask = function()
    {
        if ( onlineservices.taskId != undefined )
        {
            var repeat = true;
            app.cancelTask( onlineservices.taskId, repeat );
            onlineservices.taskId = undefined;
        }
    }

    onlineservices.concat_paths = function( path1, path2 )
    {
        var separator;
        if ( onlineservices.isWin )
        {
            separator = '\\';
        }
        else // if ( onlineservices.isMac )
        {
            separator = '/';
        }
        // FIXME: Can't blindly insert a separator.
        return path1 + '\\' + path2;
    }

    onlineservices.includeDocuments = function( documents )
    {
		onlineservices.gotNonJPEG = false;
		onlineservices.longpath = "";
		
        onlineservices.lib.begin( "file-list" );

            var thePath = app.document.thumbnail.path;
            for (i=0; i<documents.length; i++)
            {
                var thumbnail = documents[i];
                if ( !thumbnail.container )
                {
                    app.preflightFiles( Array( thumbnail.path ) );
                    onlineservices.includeDocument( thumbnail );
                }
            }
            
        onlineservices.lib.end();
        
        if (onlineservices.gotNonJPEG)
        	Window.alert( onlineservices.localize("$$$/CS2/OLS/ErrorHandler/UseJPEG=Files selected for uploading must be in JPEG format.") );
    }

    onlineservices.twoDigits = function( n )
    {
        if ( n < 10 )
        {
            return '0'+n;
        }
        else
        {
            return n;
        }
    }
    
    onlineservices.formatDate = function( d )
    {
        return d.getUTCFullYear()
            + '-' + onlineservices.twoDigits( 1 + d.getUTCMonth() )
            + '-' + onlineservices.twoDigits( d.getUTCDate() )
            + '_' + onlineservices.twoDigits( d.getUTCHours() )
            + ':' + onlineservices.twoDigits( d.getUTCMinutes() )
            + ':' + onlineservices.twoDigits( d.getUTCSeconds() );
    }
    
    onlineservices.hashString = function( str )
    {
        var result = 1;
        for ( var i = 0; i < str.length; ++i )
        {
            result = ( 10*result + str.charCodeAt( i ) ) % 0xFFFFFFFF;
        }
        return result;
    }  

    /*
       Excerpted from OLSMessageExchangeConstants.h (internal):
       
        #define kOLSName_File                 "file"
        #define kOLSName_File_Id              "id"
        #define kOLSName_File_Type            "type"
        #define kOLSName_File_Name            "name"
        #define kOLSName_File_Caption         "caption"
        #define kOLSName_File_Url             "url"
        #define kOLSName_File_Size            "size"
        #define kOLSName_File_Created         "created"
        #define kOLSName_File_Modified        "modified"
        #define kOLSName_File_Version         "version"
        #define kOLSName_File_Xmp             "xmp"

        #define kOLSName_ImageInfo            "image-info"
        #define kOLSName_ImageInfo_Width      "width"
        #define kOLSName_ImageInfo_Height     "height"
        #define kOLSName_ImageInfo_Resolution "resolution"
        #define kOLSName_ImageInfo_Rotation   "rotation"

        #define kOLSName_Color                "color"
        #define kOLSName_Color_Space          "space"
        #define kOLSName_Color_BitsPerChannel "bits-per-channel"
        #define kOLSName_Color_Profile        "profile"
     */
    onlineservices.includeDocument = function( thumbnail )
    {
        var m = thumbnail.metadata;
        var spec = thumbnail.spec;
        var d;
        
		if ( thumbnail.mimeType == "image/jpeg")	// 	Do not localize
		{
        	onlineservices.lib.begin( "file" );
            
                var id = onlineservices.hashString( spec.fsName ).toString( 16 );
                if ( spec.modified != undefined )
                {
                    id = id + ':' + onlineservices.formatDate( spec.modified );
                }
                
            	onlineservices.lib.set( "id", id ); 
            	onlineservices.lib.set( "name", unescape(spec.name) );
            	onlineservices.lib.set( "fullpath", spec.fsName );
                onlineservices.lib.set( "escaped-name", escape( spec.fsName ) );
            	onlineservices.lib.set( "encoded-name", File.encode( spec.fsName ) );
            	onlineservices.lib.set( "size", spec.length.toString() ); 
            	onlineservices.lib.set( "type", thumbnail.mimeType );
            	d = spec.created;
            	if ( d != undefined )
            	{
                	onlineservices.lib.set( "created", onlineservices.formatDate( d ) );
            	}
            	d = spec.modified;
            	if ( d != undefined )
            	{
                	onlineservices.lib.set( "modified", onlineservices.formatDate( d ) );
            	}

            	onlineservices.lib.begin( "image-info" );

                	onlineservices.lib.set( "dimensions", m.FileDimensions );
                	onlineservices.lib.set( "resolution", m.FileResolution );
                	
           	    	onlineservices.lib.begin( "color" );
           	    
                    	onlineservices.lib.set( "space", m.FileColorMode );
                    	onlineservices.lib.set( "bits-per-channel", m.FileBitDepth );
              	    	onlineservices.lib.set( "profile", m.FileColorProfile );

               		onlineservices.lib.end();

            	onlineservices.lib.end();
            	
        	onlineservices.lib.end();
        	
        	if (onlineservices.longpath.length < spec.fsName.length)
        	{
        		onlineservices.longpath = spec.fsName;
        	}
        }
        else
        {
			onlineservices.gotNonJPEG = true;
        }
    }
   
    onlineservices.showDebugInfo = function()
    {
        var jsxVersion   = "ols.jsx version: " + onlineservices.versionString;
        var libFilename  = onlineservices.getLibFilename();
        var libVersion   = libFilename + " version: ";
        var libBuildDate = libFilename + " build date: ";
        
        onlineservices.loadLib();
        if ( onlineservices.lib )
        {
            libVersion   += onlineservices.lib.getOLSCS2Version();
            libBuildDate += onlineservices.lib.getOLSCS2BuildDate();
        }
        else
        {
            libVersion   += "lib not found";
            libBuildDate += "lib not found";
        }
        Window.alert( jsxVersion + '\n' + libVersion + '\n' + libBuildDate );
    }
    

    /*****************************************************************************
     * onlineservices.core
     *****************************************************************************/

    onlineservices.core = { };

    onlineservices.core.eventHandler = function( event )
    {
        var result = { handled: false };
        var target = event.object

    //	onlineservices.dumpObj("Event: ", event);

        if (target instanceof Thumbnail)
        {
    //		return onlineservices.core.doThumbEvent(event);
        }
        else if (target instanceof Document)
        {
    //		return onlineservices.core.doDocEvent(event)
        }
        else if (target instanceof App)
        {
    //		return onlineservices.core.doAppEvent(event);
        }

        return result;
    }


    onlineservices.initialize = function()
    {
    //    install_visiturl_callback_later();

        app.eventHandlers.push( { handler: onlineservices.core.eventHandler } );
    }


    /*****************************************************************************
     * Code to execute at the time this script is loaded.
     *****************************************************************************/

    onlineservices.initialize();

} // Endif ( BridgeTalk.appName == "bridge" )
else
{
	// ***************
	// Point App APIs
	// ***************

};

/*****************************************************************************
 * End
 *****************************************************************************/
