function UnitSelectorContextMenu(contentType)
{
	if (contentType == "EditDesign")
		return CONTROLCONTEXTMENU_ENABLEDISABLE | CONTROLCONTEXTMENU_EDIT | CONTROLCONTEXTMENU_PROPERTIES | CONTROLCONTEXTMENU_CUSTOMPROPERTIES | CONTROLCONTEXTMENU_DEPTHORDERING | CONTROLCONTEXTMENU_DELETERESTORE;
	if (contentType == "EditContent")
		return CONTROLCONTEXTMENU_EDIT | CONTROLCONTEXTMENU_DELETERESTORE;

	return 0;
}
function InitializeUnitSelectorControl(controlID, contentType)
{
	var control = eval("_" + controlID);

	if (contentType != "View")
	{
		control.OnContextMenu = UnitSelectorContextMenu;
		control.GetEditorControlID = function () { return "UnitSelectorEditor"; }
		control.GetCustomPropertyControlID = function () { return "UnitSelectorSettings"; };
		control.ContentUpdated = function () { doPostBack("", ""); };
		control.CustomPropertiesUpdated = function () { doPostBack("", ""); };
	}
	control.OnInitialized = function ()
	{
		$(".UnitSelectorAccordion").accordion(
		{
			  active: false
			, animated: false
			, autoHeight: false
			, collapsible: true
		}
		);
	};
}
function ToggleUnitList(unitListId)
{
	var unitList = document.getElementById(unitListId);
	if (unitList.style["display"] == "none")
		unitList.style["display"] = "block";
	else
		unitList.style["display"] = "none";
}

