﻿ACCResize = new function()
{
	this.divMap = null;

	var me = this;

	this.ResizeAll = function()
	{
		me.ResizeDiv();
		var arrInstances = CTopoliszMap.prototype.arrInstances;
		for(var i=0; i<arrInstances.length; i++)
		{
			if(arrInstances[i])
			{
				arrInstances[i].RedrawWithoutZooming();
			}
		}
	}

	this.ResizeDiv = function()
	{
		if (me.divMap == null)
			return;
			
		//var iWidth = GetLayerWidth(me.divMap);
		//me.divMap.style.height = parseInt(iWidth * 17 / 28) + "px";
		var iTop = GetAbsLayerTop(me.divMap);
		var iWindowHeight= window.innerHeight;
		if(!window.innerHeight && document.documentElement)
			iWindowHeight= document.documentElement.clientHeight;
		if(iTop < iWindowHeight/ 3)
			me.divMap.style.height = Math.max(300, iWindowHeight - iTop - 15) + "px";
		else
			me.divMap.style.height = Math.max(300, iWindowHeight - 15) + "px";
	}

	this.Init = function(idMap)
	{
		me.divMap = GetBlock(idMap);
		AddEvent(window, "resize", me.ResizeAll);
		me.ResizeDiv();
	}
}
