LeftMenu = function(menuId)
{
	this.currentId = menuId;
	this.currentSubsetId = '';
	this.currentOverlayId = '';
	this.oCategoryContent = new CategoryContent();
	this.quickEdit = false;
}

LeftMenu.prototype.mouseOver = function()
{
	
}

LeftMenu.prototype.mouseOut = function()
{
	
}

LeftMenu.prototype.mouseClick = function()
{
	
}

LeftMenu.prototype.switchHorizontalArrow = function(overlayId)
{
	var imgId = 'arrow_'+overlayId;
	if(document.getElementById(imgId).className == 'menuarrow_left')
	{
		document.getElementById(imgId).className = 'menuarrow_right';
	}
	else
	{
		document.getElementById(imgId).className = 'menuarrow_left';
	}
}

LeftMenu.prototype.switchVerticalArrow = function(subsetId)
{
	var imgId = 'arrow_'+subsetId;
	if(document.getElementById(imgId).className == 'menuarrow_down')
	{
		document.getElementById(imgId).className = 'menuarrow_up';
	}
	else
	{
		document.getElementById(imgId).className = 'menuarrow_down';
	}
}

LeftMenu.prototype.expandCollapseSubset = function(subsetId)
{
	var overlayId = 'overlay_'+this.currentOverlayId;
	if(document.getElementById(overlayId))
	{
		document.getElementById(overlayId).style.display = 'none';
	}

	if (document.getElementById(subsetId).style.display == '')
	{
		document.getElementById(subsetId).style.display = 'none';
		this.currentSubsetId = '';
		this.switchVerticalArrow(subsetId);
	}
	else
	{
		if(document.getElementById(this.currentSubsetId))
		{
			document.getElementById(this.currentSubsetId).style.display = 'none';
			this.switchVerticalArrow(this.currentSubsetId);
		}
		document.getElementById(subsetId).style.display = '';
		this.switchVerticalArrow(subsetId);
		this.currentSubsetId = subsetId;
	}
}

LeftMenu.prototype.loadOverlay = function(id, category, mode, controller, view, screenName, andCategoryId, rootCategoryId, highlighted)
{
	var overlayId = 'overlay_'+id;

	if(document.getElementById(overlayId).style.display == '')
	{
		this.closeOverlay(id, highlighted);
	}
	else
	{
		if(document.getElementById("overlay_"+this.currentOverlayId))
		{
			this.closeOverlay(this.currentOverlayId, highlighted);
		}
		
		this.openOverlay(id, category, mode, controller, view, screenName, andCategoryId, rootCategoryId, highlighted);
	}
}

LeftMenu.prototype.openOverlay = function(id, category, mode, controller, view, screenName, andCategoryId, rootCategoryId, highlighted)
{
	var overlayId = 'overlay_'+id;
	if(document.oEmbeds != null)
	{
		for(var i = 0; i < document.oEmbeds.length; i++)
		{
			document.oEmbeds[i].style.display = "none";
		}
	}
	document.getElementById(overlayId).style.display = '';

	var pStr = new String(document.getElementById('content_'+id).innerHTML);
		
	if(pStr.length < 100)
	{
		this.oCategoryContent.quickEdit = this.quickEdit;
		this.oCategoryContent.runLoad(id, category, mode, controller, view, screenName, andCategoryId, rootCategoryId);
	}

	var imgId = 'arrow_'+id;

	if(highlighted)
	{
		imgId = 'arrow_highlighted_'+id;
	}
	document.getElementById(imgId).className = 'menuarrow_left';
	
	this.currentOverlayId = id;
}

LeftMenu.prototype.closeOverlay = function(id, highlighted)
{
	var overlayId = 'overlay_'+id;
	document.getElementById(overlayId).style.display = 'none';
	document.getElementById("content_"+id).innerHTML = "";
	if(document.oEmbeds != null)
	{
		for(var i = 0; i < document.oEmbeds.length; i++)
		{
			document.oEmbeds[i].style.display = "";
		}
	}
	
	var imgArrow = document.getElementById('arrow_'+id);
	var imgArrowHigh = document.getElementById('arrow_highlighted_'+id);
	
	if(imgArrowHigh)
	{
		imgArrowHigh.className = 'menuarrow_right';
	}
	else if(imgArrow)
	{
		imgArrow.className = 'menuarrow_right';
	}
}