var autociv_minimapExpand = {
	"toggle": function ()
	{
		if (!this.defaultSize)
		{
			this.defaultSize = this.GUI.size.toString();
			this.defaultSizeParent = this.GUIParent.size.toString();
		}

		if (this.expanded)
		{
			this.GUIParent.size = this.defaultSizeParent;
			this.GUI.size = this.defaultSize;
		}
		else
		{
			let sessionPanel = Engine.GetGUIObjectByName("session");
			let windowSize = sessionPanel.getComputedSize();

			// Get parent's absolute position on screen
			let parentSize = this.GUIParent.getComputedSize();
			let parentLeft = parentSize.left;
			let parentTop = parentSize.top;

			let screenWidth = windowSize.right - windowSize.left;
			let screenHeight = windowSize.bottom - windowSize.top;

			let halfHeight = (screenHeight / 2) - 70;

			// Height will be (2 * halfHeight - 150)
			let sizeValue = halfHeight - 75;

			let centerX = (windowSize.left + windowSize.right) / 2;
			let centerY = (windowSize.top + windowSize.bottom) / 2;

			// Convert screen coordinates to parent-relative coordinates
			this.GUI.size = {
				"left": centerX - sizeValue - parentLeft,
				"top": centerY - halfHeight - parentTop + 75,
				"right": centerX + sizeValue - parentLeft,
				"bottom": centerY + halfHeight - 75 - parentTop
			};
		}

		this.expanded = !this.expanded;
	},
	"expanded": false,
	get GUI()
	{
		return "_GUIObject" in this ? this._GUIObject :
			this._GUIObject = Engine.GetGUIObjectByName("minimapPanel");
	},
	get GUIParent() { return this.GUI.parent }
};
