/* Copyright 2009 Palm, Inc.  All rights reserved. */


var AppManagerService = Class.create(
{
	initialize: function() {
	},

	launchPhotos: function(album_id, album_name, album_image_count, loader, controller) {
		var photorollFullscreen = Class.create(Photos.Model.LocalFullscreen, {
			initialize: function($super, albumID, albumName, index) {
				$super(albumID, albumName, index);
			},

			emptyScene: function() {
				return "capture";
			},

			headerTapped: function(stageController) {
				stageController.popScene();
				loader.push("thumbs", {
					model: new Photos.Model.LocalThumbs(
						album_id, album_name)
				}, stageController);
			}
		});
		
		// If there are no images in the album the photos app will show the thumbnail view 
		// rather than the fullscreen image view.
		if(album_image_count){
			loader.push(
				"fullscreen", 
				{model: new photorollFullscreen(album_id, album_name, 0)}, 
				controller.stageController
			);
		}else{
			loader.push(
				"thumbs", 
				{model: new Photos.Model.LocalThumbs(album_id, album_name)}, 
				controller.stageController
			);
		}
		return;	
	}, 
	
	launchVideos: function(videoUrl, posterUrl, title, count, duration, size, loader, controller){
		if (0 === count) {
			llog("Not pushing video player, there be no videos");
		}
		else {
			var params = {
				noAutoPlay: true,
				target: videoUrl,
				title: title,
				thumbUrl: posterUrl, 
				duration: duration,
				size: size 
			};

			loader.Push(controller.stageController, loader.Videoeditor, params);			
		}
	}
	

});

