 function PresentationManager()
 {
	var presentations = new Array();
	
	this.GetPresentation = function(pId)
	{
		if (presentations.length == 0 || !pId)
		{
			return null;
		}
		for (var i = 0; i < presentations.length; i++)
		{
			if (presentations[i].GetId() == pId)
			{
				return presentations[i];
			}
		}
	}
	
	// Presentation Step Callback
	this.OnStepComplete = function(pId)
	{
		var presentation = this.GetPresentation(pId);
		if (presentation == null)
		{
			return false;
		}
		
		presentation.OnStepComplete();
		
		return true;		
	}	

	// Presentation Management
	this.Add = function(presentation)
	{
		if (!presentation || this.GetPresentation(presentation.GetId()))
		{
			return;
		}
		
		presentations.push(presentation);
	}
	
	this.Remove = function(presentation)
	{
		if (!presentation)
		{
			return;
		}
		
		for (var i = 0; i < presentations.length; i++)
		{
			if (presentations[i].GetId() == presentation.GetId())
			{
				presentations.splice(i, 1);
				return;
			}
		}
	}
	
	// Presentation Navigation	
	this.JumpToStart = function(pId, playStep)
	{
		var presentation = this.GetPresentation(pId);
		if (presentation == null)
		{
			return false;
		}
		
		presentation.JumpToStart(playStep);
		
		return true;
	}
	
	this.JumpToEnd = function(pId, playStep)
	{
		var presentation = this.GetPresentation(pId);
		if (presentation == null)
		{
			return false;
		}
		
		presentation.JumpToEnd(playStep);
		
		return true;
	}
	
	this.Previous = function(pId)
	{
		var presentation = this.GetPresentation(pId);
		if (presentation == null)
		{
			return false;
		}
		
		presentation.Previous();
		
		return true;
	}
	
	this.Next = function(pId)
	{
		var presentation = this.GetPresentation(pId);
		if (presentation == null)
		{
			return false;
		}
		
		presentation.Next();
		
		return true;
	}
	
	this.Play = function(pId, playFromStart)
	{
		var presentation = this.GetPresentation(pId);
		if (presentation == null)
		{
			return false;
		}

		presentation.Play(playFromStart);
		
		return true;
	}

	this.Stop = function(pId)
	{
		var presentation = this.GetPresentation(pId);
		if (presentation == null)
		{
			return false;
		}
		
		presentation.Stop();
		
		return true;
	}
	
	// Clean-up
	this.Dispose = function()
	{
		for (var i = 0; i < presentations.length; i++)
		{
			presentation[i].Dispose();
		}
		presentation = null;
	}	
 }
 
 PresentationManager.Instance = new PresentationManager();